KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > TIR > Impl > ArchitectureDefImpl


1 /* $Id: ArchitectureDefImpl.java,v 1.2 2004/05/20 14:23:52 bures Exp $ */
2 package SOFA.SOFAnode.Made.TIR.Impl;
3 import java.io.DataInputStream JavaDoc;
4 import java.io.DataOutputStream JavaDoc;
5 import java.io.FileInputStream JavaDoc;
6 import java.io.FileOutputStream JavaDoc;
7 import java.io.IOException JavaDoc;
8 import java.rmi.RemoteException JavaDoc;
9
10 import SOFA.SOFAnode.Made.TIR.AbsoluteName;
11 import SOFA.SOFAnode.Made.TIR.ArchitectureDef;
12 import SOFA.SOFAnode.Made.TIR.BindDef;
13 import SOFA.SOFAnode.Made.TIR.BindOperDef;
14 import SOFA.SOFAnode.Made.TIR.BindOperProvReq;
15 import SOFA.SOFAnode.Made.TIR.BindOperSub;
16 import SOFA.SOFAnode.Made.TIR.CDLType;
17 import SOFA.SOFAnode.Made.TIR.Contained;
18 import SOFA.SOFAnode.Made.TIR.Container;
19 import SOFA.SOFAnode.Made.TIR.DefinitionKind;
20 import SOFA.SOFAnode.Made.TIR.FrameDef;
21 import SOFA.SOFAnode.Made.TIR.Identification;
22 import SOFA.SOFAnode.Made.TIR.InstDef;
23 import SOFA.SOFAnode.Made.TIR.PropertyDef;
24 import SOFA.SOFAnode.Made.TIR.Repository;
25 import SOFA.SOFAnode.Made.TIR.StateKind;
26 import SOFA.SOFAnode.Made.TIR.TIRExceptCommit;
27 import SOFA.SOFAnode.Made.TIR.TIRExceptCreate;
28 import SOFA.SOFAnode.Made.TIR.TIRExceptLock;
29 import SOFA.SOFAnode.Made.TIR.TIRObject;
30
31 public class ArchitectureDefImpl extends ContainerImpl implements ArchitectureDef, TIRImplObject, SContained {
32   protected Identification id;
33   protected Container parent;
34   protected Repository rep;
35   DefinitionKindImpl defKindImpl;
36   StateKindImpl stKindImpl;
37   FrameDef frm;
38   CDLType loadFrm;
39   boolean system;
40
41   ArchitectureDefImpl normal;
42   long workId;
43   
44   public ArchitectureDefImpl(Identification ident, Container in, Repository inrep, FrameDef frame, int state, boolean isSystem, long workId) throws RemoteException JavaDoc {
45     id = ident;
46     parent = in;
47     rep = inrep;
48     frm = frame;
49     system = isSystem;
50     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_Architecture);
51     stKindImpl = new StateKindImpl(state);
52     normal = null;
53     if (state == StateKind.sk_work)
54       this.workId = workId;
55     else
56       this.workId = -1L;
57   }
58
59   public ArchitectureDefImpl(Container in, Repository inrep) throws RemoteException JavaDoc {
60     id = null;
61     parent = in;
62     rep = inrep;
63     frm = null;
64     system = false;
65     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_Architecture);
66     stKindImpl = new StateKindImpl(StateKind.sk_normal);
67     normal = null;
68     this.workId = -1L;
69   }
70
71   public ArchitectureDefImpl(ArchitectureDefImpl a, Container in, Repository inrep, long workId) throws RemoteException JavaDoc {
72     parent = in;
73     rep = inrep;
74     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_Architecture);
75     stKindImpl = new StateKindImpl(StateKind.sk_work);
76     normal = a;
77     frm = normal.frm;
78     system = normal.system;
79     id = a.id;
80     this.workId = workId;
81   }
82
83   /* form interface Contained */
84   public Identification get_identification() throws RemoteException JavaDoc {
85     return id;
86   }
87
88   /* form interface Contained */
89   public Container get_defined_in() throws RemoteException JavaDoc {
90     return parent;
91   }
92
93   /* form interface Contained */
94   public Container get_containing_repository() throws RemoteException JavaDoc {
95     return rep;
96   }
97
98   /* form interface Contained */
99   public AbsoluteName get_absolute_name() throws RemoteException JavaDoc {
100     AbsoluteNameImpl absName;
101     if (rep == parent) { // object is contained in repository
102
absName = new AbsoluteNameImpl("::"+id.name());
103     } else {
104       absName = new AbsoluteNameImpl(((SContained)parent).get_absolute_name().name()+"::"+id.name());
105     }
106     return (AbsoluteName) absName;
107   }
108
109   public FrameDef frame() throws RemoteException JavaDoc {
110     return frm;
111   }
112
113   public boolean is_system() throws RemoteException JavaDoc {
114     return system;
115   }
116
117   public void tag(String JavaDoc t) throws RemoteException JavaDoc, TIRExceptCreate, TIRExceptLock {
118     if (stKindImpl.value()!=StateKind.sk_work)
119       throw new TIRExceptCreate("you can call create method on work object");
120     String JavaDoc ebt = id.branchTag();
121     if (t.compareTo(ebt)==0)
122       throw new TIRExceptCreate("This tag exists");
123     String JavaDoc[] et = id.tag();
124     int i,j;
125     for (i=0;i<et.length;i++) {
126       if (t.compareTo(et[i])==0)
127        throw new TIRExceptCreate("This tag exists");
128     }
129     Contained[] sibl = parent.lookup_name(id);
130     for (j=0;j<sibl.length;j++) {
131       Identification idl = sibl[j].get_identification();
132       
133       ebt = idl.branchTag();
134       if (t.compareTo(ebt)==0)
135         throw new TIRExceptCreate("This tag exists");
136       et = idl.tag();
137       for (i=0;i<et.length;i++) {
138         if (t.compareTo(et[i])==0)
139           throw new TIRExceptCreate("This tag exists");
140       }
141     }
142     ((SIdentification) id).tag(t);
143   }
144
145   /* from interface TIRObject */
146   public DefinitionKind get_def_kind() throws RemoteException JavaDoc {
147     return (DefinitionKind) defKindImpl;
148   }
149
150   /* from interface TIRObject */
151   public StateKind get_state() throws RemoteException JavaDoc {
152     return (StateKind) stKindImpl;
153   }
154
155   private void fromNormObj() throws RemoteException JavaDoc, TIRExceptLock {
156     if (normal==null)
157       return;
158     if (((WorkRepositoryImpl)rep).lock.isLocked())
159       throw new TIRExceptLock("Repository is locked");
160     int i;
161     LiItem akt;
162     akt = normal.firstChild;
163     for(i=0;i<normal.numOfItems;i++) {
164       addListItem(WorkRepositoryImpl.newWorkFromNormal(akt.obj,rep,this,workId));
165       akt = akt.next;
166     }
167     hasCont = true;
168   }
169
170   public Contained[] contents(DefinitionKind type) throws RemoteException JavaDoc, TIRExceptLock {
171     if (stKindImpl.value()==StateKind.sk_normal) {
172       if (((RepositoryImpl) rep).lock.isLocked())
173         throw new TIRExceptLock("Repository is locked");
174       else
175         return super.contents(type);
176     } else {
177       if (!hasCont)
178         fromNormObj();
179       if (((WorkRepositoryImpl) rep).lock.isLocked())
180         throw new TIRExceptLock("Repository is locked");
181       else
182         return super.contents(type);
183     }
184   }
185
186   public Contained lookup(Identification id) throws RemoteException JavaDoc, TIRExceptLock {
187     if (stKindImpl.value()==StateKind.sk_normal) {
188       if (((RepositoryImpl) rep).lock.isLocked())
189         throw new TIRExceptLock("Repository is locked");
190       else
191         return super.lookup(id);
192     } else {
193       if (!hasCont)
194         fromNormObj();
195       if (((WorkRepositoryImpl) rep).lock.isLocked())
196         throw new TIRExceptLock("Repository is locked");
197       else
198         return super.lookup(id);
199     }
200   }
201
202   public Contained lookup(String JavaDoc name, String JavaDoc ver) throws RemoteException JavaDoc, TIRExceptLock {
203     if (stKindImpl.value()==StateKind.sk_normal) {
204       if (((RepositoryImpl) rep).lock.isLocked())
205         throw new TIRExceptLock("Repository is locked");
206       else
207         return super.lookup(name, ver);
208     } else {
209       if (!hasCont)
210         fromNormObj();
211       if (((WorkRepositoryImpl) rep).lock.isLocked())
212         throw new TIRExceptLock("Repository is locked");
213       else
214         return super.lookup(name, ver);
215     }
216   }
217
218   public Contained[] lookup_name(Identification id) throws RemoteException JavaDoc, TIRExceptLock {
219     if (stKindImpl.value()==StateKind.sk_normal) {
220       if (((RepositoryImpl) rep).lock.isLocked())
221         throw new TIRExceptLock("Repository is locked");
222       else
223         return super.lookup_name(id);
224     } else {
225       if (!hasCont)
226         fromNormObj();
227       if (((WorkRepositoryImpl) rep).lock.isLocked())
228         throw new TIRExceptLock("Repository is locked");
229       else
230         return super.lookup_name(id);
231     }
232   }
233
234   public Contained[] lookup_name(String JavaDoc id) throws RemoteException JavaDoc, TIRExceptLock {
235     if (stKindImpl.value()==StateKind.sk_normal) {
236       if (((RepositoryImpl) rep).lock.isLocked())
237         throw new TIRExceptLock("Repository is locked");
238       else
239         return super.lookup_name(id);
240     } else {
241       if (!hasCont)
242         fromNormObj();
243       if (((WorkRepositoryImpl) rep).lock.isLocked())
244         throw new TIRExceptLock("Repository is locked");
245       else {
246         return super.lookup_name(id);
247       }
248     }
249   }
250
251   public Contained lookup_tag(String JavaDoc name, String JavaDoc tag) throws RemoteException JavaDoc, TIRExceptLock {
252     if (stKindImpl.value()==StateKind.sk_normal) {
253       if (((RepositoryImpl) rep).lock.isLocked())
254         throw new TIRExceptLock("Repository is locked");
255       else
256         return super.lookup_tag(name, tag);
257     } else {
258       if (!hasCont)
259         fromNormObj();
260       if (((WorkRepositoryImpl) rep).lock.isLocked())
261         throw new TIRExceptLock("Repository is locked");
262       else
263         return super.lookup_tag(name, tag);
264     }
265   }
266
267   public Contained[] lookup_branchtag(String JavaDoc name, String JavaDoc brtag) throws RemoteException JavaDoc, TIRExceptLock {
268     if (stKindImpl.value()==StateKind.sk_normal) {
269       if (((RepositoryImpl) rep).lock.isLocked())
270         throw new TIRExceptLock("Repository is locked");
271       else
272         return super.lookup_branchtag(name, brtag);
273     } else {
274       if (!hasCont)
275         fromNormObj();
276       if (((WorkRepositoryImpl) rep).lock.isLocked())
277         throw new TIRExceptLock("Repository is locked");
278       else
279         return super.lookup_branchtag(name, brtag);
280     }
281   }
282
283   public Contained lookup_lastinbranch(String JavaDoc name, String JavaDoc brtag) throws RemoteException JavaDoc, TIRExceptLock {
284     if (stKindImpl.value()==StateKind.sk_normal) {
285       if (((RepositoryImpl) rep).lock.isLocked())
286         throw new TIRExceptLock("Repository is locked");
287       else
288         return super.lookup_lastinbranch(name, brtag);
289     } else {
290       if (!hasCont)
291         fromNormObj();
292       if (((WorkRepositoryImpl) rep).lock.isLocked())
293         throw new TIRExceptLock("Repository is locked");
294       else
295         return super.lookup_lastinbranch(name, brtag);
296     }
297   }
298   
299   public Contained lookup_lastfromversion(String JavaDoc name, String JavaDoc version) throws RemoteException JavaDoc, TIRExceptLock {
300     if (stKindImpl.value()==StateKind.sk_normal) {
301       if (((RepositoryImpl) rep).lock.isLocked())
302         throw new TIRExceptLock("Repository is locked");
303       else
304         return super.lookup_lastfromversion(name, version);
305     } else {
306       if (!hasCont)
307         fromNormObj();
308       if (((WorkRepositoryImpl) rep).lock.isLocked())
309         throw new TIRExceptLock("Repository is locked");
310       else
311         return super.lookup_lastfromversion(name, version);
312     }
313   }
314
315   public Contained[] scontents(DefinitionKind type) throws RemoteException JavaDoc, TIRExceptLock {
316     if (stKindImpl.value()==StateKind.sk_normal) {
317       return super.scontents(type);
318     } else {
319       if (!hasCont)
320         fromNormObj();
321       return super.scontents(type);
322     }
323   }
324
325   public Contained slookup(Identification id) throws RemoteException JavaDoc, TIRExceptLock {
326     if (stKindImpl.value()==StateKind.sk_normal) {
327         return super.slookup(id);
328     } else {
329       if (!hasCont)
330         fromNormObj();
331       return super.slookup(id);
332     }
333   }
334
335   public Contained slookup(String JavaDoc name, String JavaDoc version) throws RemoteException JavaDoc, TIRExceptLock {
336     if (stKindImpl.value()==StateKind.sk_normal) {
337         return super.slookup(name, version);
338     } else {
339       if (!hasCont)
340         fromNormObj();
341       return super.slookup(name, version);
342     }
343   }
344
345   public Contained[] slookup_name(Identification id) throws RemoteException JavaDoc, TIRExceptLock {
346     if (stKindImpl.value()==StateKind.sk_normal) {
347         return super.slookup_name(id);
348     } else {
349       if (!hasCont)
350         fromNormObj();
351       return super.slookup_name(id);
352     }
353   }
354
355   public Contained[] slookup_name(String JavaDoc name) throws RemoteException JavaDoc, TIRExceptLock {
356     if (stKindImpl.value()==StateKind.sk_normal) {
357       return super.slookup_name(name);
358     } else {
359       if (!hasCont)
360         fromNormObj();
361       return super.slookup_name(name);
362     }
363   }
364
365   public InstDef create_inst(String JavaDoc name, CDLType type, int mode) throws RemoteException JavaDoc, TIRExceptCreate, TIRExceptLock {
366     if (!isNew())
367       throw new TIRExceptCreate("you can call create method on work object");
368     if (type==null)
369       return null;
370     else {
371       if (type.get_state().value()==StateKind.sk_work ) {
372         IdentificationImpl id = new IdentificationImpl(((SIdentification)this.id).language(), this.id.absolute_name().name()+"::"+name,this.id.version());
373         Contained[] a = lookup_name(id.name());
374         if (a.length != 0) {
375           if (a[0].get_def_kind().value() != DefinitionKind.dk_Inst)
376         throw new TIRExceptCreate("Name \""+id.name()+"\" exists in repository.");
377       boolean found = false;
378       for (int i=0;i<a.length;i++) {
379         if (((SIdentification) a[i].get_identification()).is_short_equal(id)) {
380           found = true;
381           break;
382         }
383       }
384       if (found)
385         throw new TIRExceptCreate("Object with same identification exists in repository.");
386         }
387         // creating new object
388
InstDef ret = new InstDefImpl(id, this, rep, type, new InstModeImpl(mode), workId);
389         addListItem(ret); // adding object to list
390
return ret; // return object
391
} else {
392         throw new TIRExceptCreate("Given object isn't work.");
393       }
394     }
395   }
396   
397   public BindDef create_bind(BindOperDef lhs, BindOperDef rhs, int mode) throws RemoteException JavaDoc, TIRExceptCreate, TIRExceptLock {
398     if (!isNew())
399       throw new TIRExceptCreate("you can call create method on work object");
400     if (rhs==null || lhs==null)
401       return null;
402     else {
403       if (rhs.get_state().value()==StateKind.sk_work &&
404           lhs.get_state().value()==StateKind.sk_work) {
405         IdentificationImpl id = new IdentificationImpl(((SIdentification)this.id).language(), this.id.absolute_name().name()+"::Bind"+numOfItems,this.id.version());
406         Contained[] a = lookup_name(id.name());
407         if (a.length != 0) {
408           if (a[0].get_def_kind().value() != DefinitionKind.dk_Bind)
409         throw new TIRExceptCreate("Name \""+id.name()+"\" exists in repository.");
410       boolean found = false;
411       for (int i=0;i<a.length;i++) {
412         if (((SIdentification) a[i].get_identification()).is_short_equal(id)) {
413           found = true;
414           break;
415         }
416       }
417       if (found)
418         throw new TIRExceptCreate("Object with same identification exists in repository.");
419         }
420         // creating new object
421
BindDef ret = new BindDefImpl(id, this, rep, lhs,rhs,new BindModeImpl(mode), "CSProcCall");
422         addListItem(ret); // adding object to list
423
return ret; // return object
424
} else {
425         throw new TIRExceptCreate("Given object isn't work.");
426       }
427     }
428   }
429
430   public BindDef create_bind(BindOperDef lhs, BindOperDef rhs, int mode, String JavaDoc using) throws RemoteException JavaDoc, TIRExceptCreate, TIRExceptLock {
431     if (!isNew())
432       throw new TIRExceptCreate("you can call create method on work object");
433     if (rhs==null || lhs==null || using == null)
434       return null;
435     else {
436       if (using.compareTo("CSProcCall")!=0 && using.compareTo("DataStream")!=0 && using.compareTo("EventPassing")!=0)
437         throw new TIRExceptCreate("Bad type of connector.");
438       if (rhs.get_state().value()==StateKind.sk_work &&
439           lhs.get_state().value()==StateKind.sk_work) {
440         IdentificationImpl id = new IdentificationImpl(((SIdentification)this.id).language(), this.id.absolute_name().name()+"::Bind"+numOfItems,this.id.version());
441         Contained[] a = lookup_name(id.name());
442         if (a.length != 0) {
443           if (a[0].get_def_kind().value() != DefinitionKind.dk_Bind)
444         throw new TIRExceptCreate("Name \""+id.name()+"\" exists in repository.");
445       boolean found = false;
446       for (int i=0;i<a.length;i++) {
447         if (((SIdentification) a[i].get_identification()).is_short_equal(id)) {
448           found = true;
449           break;
450         }
451       }
452       if (found)
453         throw new TIRExceptCreate("Object with same identification exists in repository.");
454         }
455         // creating new object
456
BindDef ret = new BindDefImpl(id, this, rep, lhs,rhs,new BindModeImpl(mode), new String JavaDoc(using));
457         addListItem(ret); // adding object to list
458
return ret; // return object
459
} else {
460         throw new TIRExceptCreate("Given object isn't work.");
461       }
462     }
463   }
464
465   public PropertyDef create_property(String JavaDoc name, CDLType type) throws RemoteException JavaDoc, TIRExceptCreate, TIRExceptLock {
466     if (!isNew())
467       throw new TIRExceptCreate("you can call create method on work object");
468     if (name==null || type==null)
469       return null;
470     int i;
471     if (type.get_state().value()!=StateKind.sk_work )
472       throw new TIRExceptCreate("Given objects aren't work.");
473     // set version of substructure same as this version
474
Identification id = new IdentificationImpl(((SIdentification)this.id).language(), this.id.absolute_name().name()+"::"+name,this.id.version());
475     Contained[] a = lookup_name(id.name());
476     if (a.length != 0) {
477       throw new TIRExceptCreate("Property with this name exists.");
478     }
479     // creating new object
480
PropertyDef ret = new PropertyDefImpl(id, this, rep, type, workId);
481     addListItem(ret); // adding object to list
482
return ret; // return object
483
}
484
485   public BindOperProvReq create_bindoperprovreq() throws RemoteException JavaDoc, TIRExceptCreate {
486     if (!isNew())
487       throw new TIRExceptCreate("you can call create method on work object");
488     return new BindOperProvReqImpl(StateKind.sk_work);
489   }
490
491   public BindOperSub create_bindopersub() throws RemoteException JavaDoc, TIRExceptCreate {
492     if (!isNew())
493       throw new TIRExceptCreate("you can call create method on work object");
494     return new BindOperSubImpl(StateKind.sk_work);
495   }
496
497   /*from interface TIRImplObject */
498   public void save(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
499     try {
500       st.curOutFile = new DataOutputStream JavaDoc(new FileOutputStream JavaDoc(st.currentFile));
501       ((IdentificationImpl)id).save(st.curOutFile);
502       // saving frame
503
if (frm == null) {
504         st.curOutFile.writeBoolean(false);
505       } else {
506         st.curOutFile.writeBoolean(true);
507         Identification idl = ((Contained)frm).get_identification();
508         Storage.writeString(st.curOutFile, idl.lang_absolute_name().name());
509         Storage.writeString(st.curOutFile, idl.name());
510         Storage.writeString(st.curOutFile, idl.version());
511       }
512       // end of saving frame
513
st.curOutFile.writeBoolean(system);
514       st.curOutFile.writeInt(numOfItems);
515       LiItem akt = firstChild;
516       for(int i=0;i<numOfItems;i++) { // saving all childs
517
st.curOutFile.writeInt(akt.obj.get_def_kind().value());
518         ((TIRImplObject)(akt.obj)).save(st);
519     akt = akt.next;
520       }
521       st.curOutFile.close();
522     } catch (IOException JavaDoc e) {
523       throw new TIRExceptStorage("Access error in "+st.current+".");
524     }
525   }
526
527   /*from interface TIRImplObject */
528   public void load(Storage st) throws RemoteException JavaDoc, TIRExceptStorage{
529     try {
530       st.curInFile = new DataInputStream JavaDoc(new FileInputStream JavaDoc(st.currentFile));
531       id = new IdentificationImpl();
532       ((IdentificationImpl)id).load(st.curInFile);
533       //loading frame
534
if (st.curInFile.readBoolean()) {
535         String JavaDoc absn = Storage.readString(st.curInFile);
536         String JavaDoc name = Storage.readString(st.curInFile);
537         String JavaDoc ver = Storage.readString(st.curInFile);
538         loadFrm = new NotYetInRep(absn,name,ver);
539       } else {
540         loadFrm = null;
541       }
542       // end of loading frame
543
system = st.curInFile.readBoolean();
544       int num = st.curInFile.readInt();
545       int dkind;
546       TIRImplObject obj;
547       for (int i=0;i<num;i++) {
548         dkind = st.curInFile.readInt();
549     switch (dkind) {
550       case DefinitionKind.dk_Inst:
551         obj = new InstDefImpl(this, rep);
552         obj.load(st);
553         addListItem((TIRObject)obj);
554         break;
555           case DefinitionKind.dk_Bind:
556         obj = new BindDefImpl(this, rep);
557         obj.load(st);
558         addListItem((TIRObject)obj);
559         break;
560           case DefinitionKind.dk_Property:
561         obj = new PropertyDefImpl(this, rep);
562         obj.load(st);
563         addListItem((TIRObject)obj);
564             break;
565       default:
566             throw new TIRExceptStorage("Unexpected kind of object in \""
567                                   +st.currentFile+"\".");
568     } // -- end of switch
569
}
570       st.curInFile.close();
571     } catch (IOException JavaDoc e) {
572       throw new TIRExceptStorage("Access error in "+st.current+".");
573     }
574   }
575
576   public void postLoad(RepositoryImpl r) throws RemoteException JavaDoc, TIRExceptStorage {
577     try {
578     
579       if ((loadFrm!=null) && (loadFrm.get_def_kind().value() == DefinitionKind.dk_none)) { // is tp NotYetInRep?
580
AbsoluteName nm = ((NotYetInRep) loadFrm).nm;
581         Container con = r;// begin search from repository
582
Contained[] rt;
583         Contained ret;
584         IdentificationImpl id;
585         for (int i=0;i<nm.size()-1;i++) { // last element is name of frame
586
id = new IdentificationImpl(nm.elementAt(0),"::"+nm.elementAt(i),"");
587           rt = ((SContainer)con).slookup_name(id);
588     if (rt.length==0) throw new TIRExceptStorage("Can't find frame " + nm.name());
589         if (rt.length==1) {
590           con = (Container) rt[0];
591     } else {
592       throw new TIRExceptStorage("Can't find frame " + nm.name());
593     }
594         }
595         if ((ret = ((SContainer)con).slookup(((NotYetInRep) loadFrm).id))==null)
596         throw new TIRExceptStorage("Can't find frame " + nm.name());
597         frm = (FrameDef) ret;
598         loadFrm = null;
599       }
600
601     } catch (TIRExceptLock e) {;}
602   
603     LiItem akt = firstChild;
604     for(int i=0;i<numOfItems;i++) {
605       ((TIRImplObject) akt.obj).postLoad(r);
606       akt = akt.next;
607     }
608   }
609
610   public boolean isNew() {
611     return ((stKindImpl.value()==StateKind.sk_work) && normal==null);
612   }
613
614   public void canCommit() throws RemoteException JavaDoc, TIRExceptCommit {
615     if (stKindImpl.value()==StateKind.sk_normal)
616       return;
617     LiItem akt;
618     int i;
619     akt = firstChild;
620     for (i=0;i<numOfItems;i++) {
621       ((TIRImplObject)akt.obj).canCommit();
622       akt = akt.next;
623     }
624   }
625
626   public void doCommit(Container in, Repository rep) throws RemoteException JavaDoc {
627     if (stKindImpl.value()==StateKind.sk_normal)
628       return;
629     if (isNew()) {
630       stKindImpl.toNormal();
631       if (frm!=null) {
632         Identification idl = frm.get_identification();
633         loadFrm = new NotYetInRep(idl.lang_absolute_name().name(), idl.name(), idl.version());
634         frm = null;
635       } else {
636         loadFrm = null;
637       }
638       LiItem akt = firstChild;
639       for (int i=0;i<numOfItems;i++) {
640         ((TIRImplObject)akt.obj).doCommit(this,rep);
641         akt = akt.next;
642       }
643       parent = in;
644       this.rep = rep;
645     } else {
646       normal = null;
647     }
648   }
649
650   public void doAbort(long workId) throws RemoteException JavaDoc {
651     LiItem akt = firstChild;
652     for(int i=0;i<numOfItems;i++) {
653       if (((TIRImplObject)akt.obj).isNew())
654         ((TIRImplObject)akt.obj).doAbort(workId);
655       akt = akt.next;
656     }
657   }
658 }
659
Popular Tags