1 2 package SOFA.SOFAnode.Made.TIR.Impl; 3 import java.rmi.RemoteException ; 4 import java.rmi.server.UnicastRemoteObject ; 5 6 import SOFA.SOFAnode.Made.TIR.AbsoluteName; 7 import SOFA.SOFAnode.Made.TIR.Contained; 8 import SOFA.SOFAnode.Made.TIR.Container; 9 import SOFA.SOFAnode.Made.TIR.Identification; 10 import SOFA.SOFAnode.Made.TIR.Repository; 11 import SOFA.SOFAnode.Made.TIR.TIRExceptCreate; 12 import SOFA.SOFAnode.Made.TIR.TIRExceptLock; 13 14 public abstract class ContainedImpl extends UnicastRemoteObject implements Contained, TIRImplObject, SContained { 15 protected Identification id; 16 protected Container parent; 17 protected Repository rep; 18 19 public ContainedImpl(Identification ident, Container in, Repository inrep) throws RemoteException { 20 id = ident; 21 parent = in; 22 rep = inrep; 23 } 24 25 public ContainedImpl() throws RemoteException { 26 id = null; 27 parent = null; 28 rep = null; 29 } 30 31 public Identification get_identification() throws RemoteException { 32 return id; 33 } 34 35 public Container get_defined_in() throws RemoteException { 36 return parent; 37 } 38 39 public Container get_containing_repository() throws RemoteException { 40 return rep; 41 } 42 43 public AbsoluteName get_absolute_name() throws RemoteException { 44 AbsoluteNameImpl absName; 45 48 absName = new AbsoluteNameImpl(((SContained)parent).get_absolute_name().name()+"::"+id.name()); 49 50 return (AbsoluteName) absName; 51 } 52 53 public void tag(String t) throws RemoteException , TIRExceptCreate, TIRExceptLock { 54 String ebt = id.branchTag(); 55 if (t.compareTo(ebt)==0) 56 throw new TIRExceptCreate("This tag exists"); 57 String [] et = id.tag(); 58 int i,j; 59 for (i=0;i<et.length;i++) { 60 if (t.compareTo(et[i])==0) 61 throw new TIRExceptCreate("This tag exists"); 62 } 63 Contained[] sibl = parent.lookup_name(id); 64 for (j=0;j<sibl.length;j++) { 65 Identification idl = sibl[j].get_identification(); 66 67 ebt = idl.branchTag(); 68 if (t.compareTo(ebt)==0) 69 throw new TIRExceptCreate("This tag exists"); 70 et = idl.tag(); 71 for (i=0;i<et.length;i++) { 72 if (t.compareTo(et[i])==0) 73 throw new TIRExceptCreate("This tag exists"); 74 } 75 } 76 ((SIdentification) id).tag(t); 77 } 78 79 } 80 | Popular Tags |