1
15
16 package gate.creole;
17
18 import gate.DataStore;
19 import gate.LanguageResource;
20 import gate.persist.PersistenceException;
21 import gate.security.SecurityException;
22
23
24
26 abstract public class AbstractLanguageResource
27 extends AbstractResource implements LanguageResource
28 {
29 static final long serialVersionUID = 3320133313194786685L;
30
31
32 public DataStore getDataStore() { return dataStore; }
33
34
35 public void setDataStore(DataStore dataStore) throws PersistenceException {
36 this.dataStore = dataStore;
37 }
39
42 public Object getLRPersistenceId(){
43 return lrPersistentId;
44 }
45
46
49 public void setLRPersistenceId(Object lrID){
50 this.lrPersistentId = lrID;
51 }
52
53
54
55 transient protected DataStore dataStore;
56
57
58 transient protected Object lrPersistentId = null;
59
60
61
64 public void sync()
65 throws PersistenceException,SecurityException {
66 if(dataStore == null)
67 throw new PersistenceException("LR has no DataStore");
68
69 dataStore.sync(this);
70 }
72
74 public void cleanup() {
75 }
77
81 public boolean isModified() {return false;}
82
83
87 public LanguageResource getParent()
88 throws PersistenceException,SecurityException {
89 if(dataStore == null)
90 throw new PersistenceException("LR has no DataStore");
91 throw new UnsupportedOperationException("getParent method not " +
92 "supported by this LR");
93 }
95
99 public void setParent(LanguageResource parentLR)
100 throws PersistenceException,SecurityException {
101 if(dataStore == null)
102 throw new PersistenceException("LR has no DataStore");
103 throw new UnsupportedOperationException("setParent method not " +
104 "supported by this LR");
105 }
107
108
109 }