KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > Connector > EEG > EEM > Elements > CRoleImplGen


1 /*
2  * CRoleImplGen.java
3  *
4  * Created on 13. duben 2002, 21:08
5  */

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 /**
15  *
16  * @author ghort
17  * @version
18  */

19 public class CRoleImplGen extends JImplWriterDirectorBase {
20
21     /** Creates new CRoleImplGen */
22     public CRoleImplGen(String JavaDoc provIfaceCDL, SOFA.Connector.Property[] params) {
23         super(provIfaceCDL,params);
24     }
25
26     public String JavaDoc[] getImplements() {
27         return new String JavaDoc[] {"SOFA.Connector.EEG.Types.CRole"};
28     }
29
30     public String JavaDoc getExtends() {
31         return "SOFA.Connector.EEG.ElementRoleBase";
32     }
33
34     public String JavaDoc getClassBody() {
35         String JavaDoc 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 JavaDoc 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