1 2 package SOFA.SOFAnode.Made.CDL; 3 import java.rmi.RemoteException ; 4 5 import SOFA.SOFAnode.Made.TIR.CDLRepository; 6 import SOFA.SOFAnode.Made.TIR.OperationDef; 7 import SOFA.SOFAnode.Made.TIR.ParamDescr; 8 import SOFA.SOFAnode.Made.TIR.TIRExceptCreate; 9 import SOFA.SOFAnode.Made.TIR.TIRExceptLock; 10 11 class CompOperation extends CompContainedIm { 12 public CompType type; 13 public List params; 14 public List raises; 15 16 public CompOperation(ID id, CompContainer parent, CompRepository rep, CompType type, List params, List raises) { 17 super(ObjectsKind.o_Operation, id, parent, rep); 18 id.version = ((CompContained)parent).getIdent().version; 19 this.type = type; 20 this.params = params; 21 this.raises = raises; 22 } 23 24 public void checkConsist(EnumList props, CompRepository rep) throws CDLExceptCheck, CDLExceptLock, CDLExceptRemote { 25 int i; 26 type.checkConsist(props, rep); 27 raises.toFirst(); 28 for (i=0;i<raises.size();i++) { 29 ((CompObject) raises.aktual()).checkConsist(props,rep); 30 raises.toNext(); 31 } 32 params.toFirst(); 33 for (i=0;i<params.size();i++) { 34 ((CompParam) params.aktual()).type.checkConsist(props,rep); 35 params.toNext(); 36 } 37 } 38 39 public void addToNormal(OperationDef obj, CDLRepository normRep) throws CDLExceptToNormal, CDLExceptRemote, CDLExceptLock { 40 params.toFirst(); 41 try { 42 for (int i=0;i<params.size(); i++) { 43 CompParam pp = (CompParam) params.aktual(); 44 try { 45 ParamDescr par = obj.create_parametr(pp.name, pp.type.toNormal(normRep), pp.mode); 46 if (par == null) 47 throw new CDLExceptToNormal("Can't create param in operation "+fullName()); 48 } catch (TIRExceptCreate ecr) { 49 throw new CDLExceptToNormal("Can't create param in operation "+fullName()); 50 } 51 params.toNext(); 52 } 53 } catch (RemoteException e) { 54 throw new CDLExceptRemote("Remote exception occured: "+e.getMessage()); 55 } catch (TIRExceptLock e) { 56 throw new CDLExceptLock("Repository is locked."); 57 } 58 } 59 } 60 | Popular Tags |