1 6 7 package SOFA.Connector.EEG.EEM.Elements; 8 9 import SOFA.Connector.EEG.CodeWriter.JWriterDirectorException; 10 import SOFA.Connector.EEG.EEM.Actions.JIfaceCN; 11 import SOFA.Connector.EEG.EEM.Actions.JImplWriterDirectorBase; 12 import SOFA.SOFAnode.Made.TIR.OperationDef; 13 14 19 public class CRoleImplGen extends JImplWriterDirectorBase { 20 21 22 public CRoleImplGen(String provIfaceCDL, SOFA.Connector.Property[] params) { 23 super(provIfaceCDL,params); 24 } 25 26 public String [] getImplements() { 27 return new String [] {"SOFA.Connector.EEG.Types.CRole"}; 28 } 29 30 public String getExtends() { 31 return "SOFA.Connector.EEG.ElementRoleBase"; 32 } 33 34 public String getClassBody() { 35 String reqIfaceMapped=SOFA.Connector.Property.findFirst(params,"reqIfaceMapped"); 36 return 37 "\tprotected "+reqIfaceMapped+" target;\n\n"+ 38 "\tpublic void link(Object target) throws SOFA.Connector.LinkException {\n"+ 39 "\t\tif (target instanceof SOFA.Connector.Reference) {\n"+ 40 "\t\t\tmanager.link(target);\n"+ 41 "\t\t} else {\n"+ 42 "\t\t\tthis.target=("+reqIfaceMapped+")target;\n"+ 43 "\t\t}\n"+ 44 "\t}\n\n"+ 45 "\tpublic org.objectweb.fractal.api.Type getFcItfType() { return new SOFA.Util.FcTypeImpl(); }\n\n"+ 46 "\tpublic boolean isFcInternalItf() { return false; }\n\n"+ 47 "\tpublic String getFcItfName() { return this.target.getFcItfName(); }\n\n"+ 48 "\tpublic org.objectweb.fractal.api.Component getFcItfOwner() { return this.target.getFcItfOwner(); }\n\n"; 49 } 50 51 public String getMethodBody(OperationDef method) throws JWriterDirectorException { 52 return 53 "\t\t"+declareRet(method,"ret")+"\n"+ 54 "\t\tSOFA.Component.ThreadIDRegistry thrReg=manager.getThrIDRegistry();\n"+ 55 "\t\tString thr_id=thrReg.threadOutCall();\n"+ 56 "\t\t"+assignRet(method,"ret")+targetCall(method,JIfaceCN.targetCallParams(method))+";\n"+ 57 "\t\tthrReg.threadInReturn(thr_id);\n"+ 58 "\t\t"+returnRet(method,"ret"); 59 } 60 61 } 62 | Popular Tags |