1
14 package gate.util.persistence;
15
16 import gate.Corpus;
17 import gate.creole.ResourceInstantiationException;
18 import gate.creole.SerialAnalyserController;
19 import gate.persist.PersistenceException;
20
25
26 public class SerialAnalyserControllerPersistence extends ControllerPersistence {
27
31 public void extractDataFromSource(Object source)throws PersistenceException{
32 if(! (source instanceof SerialAnalyserController)){
33 throw new UnsupportedOperationException(
34 getClass().getName() + " can only be used for " +
35 SerialAnalyserController.class.getName() +
36 " objects!\n" + source.getClass().getName() +
37 " is not a " + SerialAnalyserController.class.getName());
38 }
39
40 super.extractDataFromSource(source);
41
42 SerialAnalyserController sac = (SerialAnalyserController)source;
43 corpus = PersistenceManager.getPersistentRepresentation(sac.getCorpus());
44 }
45
46
50 public Object createObject()throws PersistenceException,
51 ResourceInstantiationException{
52 SerialAnalyserController sac = (SerialAnalyserController)
53 super.createObject();
54 sac.setCorpus((Corpus)PersistenceManager.getTransientRepresentation(corpus));
55 return sac;
56 }
57 protected Object corpus;
58 static final long serialVersionUID = -4116973147963269225L;
59 }