You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(86) |
Dec
(163) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(114) |
Feb
(254) |
Mar
(166) |
Apr
(122) |
May
(131) |
Jun
(59) |
Jul
(201) |
Aug
(85) |
Sep
(80) |
Oct
(64) |
Nov
(103) |
Dec
(36) |
2005 |
Jan
(231) |
Feb
(204) |
Mar
(71) |
Apr
(54) |
May
(50) |
Jun
(120) |
Jul
(17) |
Aug
(124) |
Sep
(75) |
Oct
(154) |
Nov
(37) |
Dec
(143) |
2006 |
Jan
(346) |
Feb
(170) |
Mar
|
Apr
|
May
(273) |
Jun
(113) |
Jul
(427) |
Aug
(570) |
Sep
(212) |
Oct
(550) |
Nov
(348) |
Dec
(314) |
2007 |
Jan
(709) |
Feb
(223) |
Mar
(104) |
Apr
(24) |
May
(11) |
Jun
(3) |
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Robert L. <rle...@us...> - 2007-02-19 09:09:46
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30786/src/ccmtools/generator/java/templates/jet Modified Files: ComponentDefAssemblyClass.jet ProvidesDefGetMethodAssemplyImplementation.jet ProvidesDefAssemblyClass.jet Log Message: Java assemblies Index: ComponentDefAssemblyClass.jet =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet/ComponentDefAssemblyClass.jet,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ComponentDefAssemblyClass.jet 16 Feb 2007 13:34:21 -0000 1.4 --- ComponentDefAssemblyClass.jet 19 Feb 2007 09:09:42 -0000 1.5 *************** *** 23,28 **** * This class implements component equivalent and supported interfaces * as well as component attributes. - * Additionally, session component callback methods must be implemented. - * */ public class <%=component.getIdentifier()%>Impl --- 23,26 ---- *************** *** 72,76 **** public <%=component.getIdentifier()%>Impl() { - // OPTIONAL: IMPLEMENT ME HERE ! } --- 70,73 ---- *************** *** 134,138 **** ProvidesDef provides = (ProvidesDef)i.next(); %> ! <%=provides.generateGetMethodAssemblyImplementation(component.getInnerFacet(provides))%> <% } --- 131,135 ---- ProvidesDef provides = (ProvidesDef)i.next(); %> ! <%=provides.generateGetMethodAssemblyImplementation()%> <% } Index: ProvidesDefGetMethodAssemplyImplementation.jet =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet/ProvidesDefGetMethodAssemplyImplementation.jet,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProvidesDefGetMethodAssemplyImplementation.jet 16 Feb 2007 12:30:15 -0000 1.1 --- ProvidesDefGetMethodAssemplyImplementation.jet 19 Feb 2007 09:09:42 -0000 1.2 *************** *** 7,12 **** %> public <%=provides.getInterface().generateAbsoluteJavaCcmName()%> get_<%=provides.getIdentifier()%>() { ! return new <%=provides.generateJavaNamespace()%>.<%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl(this, <%=provides.getAssemblyFacet()%>); } --- 7,16 ---- %> + private <%=provides.generateJavaNamespace()%>.<%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl <%=provides.getIdentifier()%>_; + public <%=provides.getInterface().generateAbsoluteJavaCcmName()%> get_<%=provides.getIdentifier()%>() { ! if(<%=provides.getIdentifier()%>_==null) ! <%=provides.getIdentifier()%>_ = new <%=provides.generateJavaNamespace()%>.<%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl(this); ! return <%=provides.getIdentifier()%>_; } Index: ProvidesDefAssemblyClass.jet =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet/ProvidesDefAssemblyClass.jet,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProvidesDefAssemblyClass.jet 16 Feb 2007 12:30:16 -0000 1.1 --- ProvidesDefAssemblyClass.jet 19 Feb 2007 09:09:42 -0000 1.2 *************** *** 30,41 **** /** the facet of the inner component we delegate to */ ! private <%=iface.generateAbsoluteJavaName()%> target; public <%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl( ! <%=provides.getComponent().getIdentifier()%>Impl component, ! <%=iface.generateAbsoluteJavaName()%> target) { this.component = component; - this.target = target; } --- 30,39 ---- /** the facet of the inner component we delegate to */ ! <%=iface.generateAbsoluteJavaName()%> target; public <%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl( ! <%=provides.getComponent().getIdentifier()%>Impl component) { this.component = component; } |
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30786/src/ccmtools/generator/java/templates Modified Files: ProvidesDefGetMethodAssemblyImplementationTemplate.java ProvidesDefAssemblyClassTemplate.java ComponentDefAssemblyClassTemplate.java Log Message: Java assemblies Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ComponentDefAssemblyClassTemplate.java 16 Feb 2007 13:34:21 -0000 1.4 --- ComponentDefAssemblyClassTemplate.java 19 Feb 2007 09:09:42 -0000 1.5 *************** *** 21,25 **** protected final String TEXT_4 = ";" + NL + " " + NL + "import Components.CCMException; " + NL + "import Components.CCMExceptionReason;" + NL + "import Components.SessionContext; " + NL; protected final String TEXT_5 = NL; ! protected final String TEXT_6 = " " + NL + " " + NL + "/**" + NL + " * This class implements component equivalent and supported interfaces" + NL + " * as well as component attributes." + NL + " * Additionally, session component callback methods must be implemented." + NL + " *" + NL + " */ " + NL + "public class "; protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Supported interface attribute variables */" + NL; --- 21,25 ---- protected final String TEXT_4 = ";" + NL + " " + NL + "import Components.CCMException; " + NL + "import Components.CCMExceptionReason;" + NL + "import Components.SessionContext; " + NL; protected final String TEXT_5 = NL; ! protected final String TEXT_6 = " " + NL + " " + NL + "/**" + NL + " * This class implements component equivalent and supported interfaces" + NL + " * as well as component attributes." + NL + " */ " + NL + "public class "; protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Supported interface attribute variables */" + NL; *************** *** 31,35 **** protected final String TEXT_14 = " " + NL + "" + NL + " public "; protected final String TEXT_15 = "_Context ctx;" + NL + " " + NL + " " + NL + " public "; ! protected final String TEXT_16 = "Impl()" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; protected final String TEXT_17 = NL; protected final String TEXT_18 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; --- 31,35 ---- protected final String TEXT_14 = " " + NL + "" + NL + " public "; protected final String TEXT_15 = "_Context ctx;" + NL + " " + NL + " " + NL + " public "; ! protected final String TEXT_16 = "Impl()" + NL + " {" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; protected final String TEXT_17 = NL; protected final String TEXT_18 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; *************** *** 155,159 **** stringBuffer.append(TEXT_23); ! stringBuffer.append(provides.generateGetMethodAssemblyImplementation(component.getInnerFacet(provides))); } --- 155,159 ---- stringBuffer.append(TEXT_23); ! stringBuffer.append(provides.generateGetMethodAssemblyImplementation()); } Index: ProvidesDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ProvidesDefAssemblyClassTemplate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProvidesDefAssemblyClassTemplate.java 16 Feb 2007 12:33:43 -0000 1.1 --- ProvidesDefAssemblyClassTemplate.java 19 Feb 2007 09:09:42 -0000 1.2 *************** *** 24,32 **** protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Reference to the facet's component implementation */" + NL + " private "; ! protected final String TEXT_9 = "Impl component;" + NL + " " + NL + " /** the facet of the inner component we delegate to */" + NL + " private "; ! protected final String TEXT_10 = " target;" + NL + "" + NL + " public "; ! protected final String TEXT_11 = "Impl(" + NL + " \t"; ! protected final String TEXT_12 = "Impl component," + NL + " \t"; ! protected final String TEXT_13 = " target)" + NL + " {" + NL + " this.component = component;" + NL + " this.target = target;" + NL + " }" + NL; protected final String TEXT_14 = " " + NL + "// TODO: assembly implementation"; protected final String TEXT_15 = NL; --- 24,32 ---- protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Reference to the facet's component implementation */" + NL + " private "; ! protected final String TEXT_9 = "Impl component;" + NL + " " + NL + " /** the facet of the inner component we delegate to */"; ! protected final String TEXT_10 = NL + " "; ! protected final String TEXT_11 = " target;" + NL + "" + NL + " public "; ! protected final String TEXT_12 = "Impl(" + NL + " \t"; ! protected final String TEXT_13 = "Impl component)" + NL + " {" + NL + " this.component = component;" + NL + " }" + NL; protected final String TEXT_14 = " " + NL + "// TODO: assembly implementation"; protected final String TEXT_15 = NL; *************** *** 71,82 **** stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(TEXT_9); - stringBuffer.append(iface.generateAbsoluteJavaName()); stringBuffer.append(TEXT_10); ! stringBuffer.append(provides.getComponent().getIdentifier()); ! stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_11); stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(TEXT_12); ! stringBuffer.append(iface.generateAbsoluteJavaName()); stringBuffer.append(TEXT_13); --- 71,81 ---- stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(TEXT_9); stringBuffer.append(TEXT_10); ! stringBuffer.append(iface.generateAbsoluteJavaName()); stringBuffer.append(TEXT_11); stringBuffer.append(provides.getComponent().getIdentifier()); + stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_12); ! stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(TEXT_13); Index: ProvidesDefGetMethodAssemblyImplementationTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ProvidesDefGetMethodAssemblyImplementationTemplate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProvidesDefGetMethodAssemblyImplementationTemplate.java 16 Feb 2007 12:33:42 -0000 1.1 --- ProvidesDefGetMethodAssemblyImplementationTemplate.java 19 Feb 2007 09:09:42 -0000 1.2 *************** *** 15,25 **** protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; ! protected final String TEXT_1 = NL + " public "; ! protected final String TEXT_2 = " get_"; ! protected final String TEXT_3 = "()" + NL + " {" + NL + " return new "; ! protected final String TEXT_4 = "."; ! protected final String TEXT_5 = "Impl(this, "; ! protected final String TEXT_6 = ");" + NL + " }"; ! protected final String TEXT_7 = NL; public String generate(Object argument) --- 15,30 ---- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; ! protected final String TEXT_1 = NL + "\tprivate "; ! protected final String TEXT_2 = "."; ! protected final String TEXT_3 = "Impl "; ! protected final String TEXT_4 = "_;" + NL + "" + NL + " public "; ! protected final String TEXT_5 = " get_"; ! protected final String TEXT_6 = "()" + NL + " {" + NL + " \tif("; ! protected final String TEXT_7 = "_==null)" + NL + " \t\t"; ! protected final String TEXT_8 = "_ = new "; ! protected final String TEXT_9 = "."; ! protected final String TEXT_10 = "Impl(this);" + NL + " \treturn "; ! protected final String TEXT_11 = "_;" + NL + " }"; ! protected final String TEXT_12 = NL; public String generate(Object argument) *************** *** 30,45 **** stringBuffer.append(TEXT_1); ! stringBuffer.append(provides.getInterface().generateAbsoluteJavaCcmName()); stringBuffer.append(TEXT_2); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_3); - stringBuffer.append(provides.generateJavaNamespace()); - stringBuffer.append(TEXT_4); - stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_5); ! stringBuffer.append(provides.getAssemblyFacet()); stringBuffer.append(TEXT_6); stringBuffer.append(TEXT_7); return stringBuffer.toString(); } --- 35,61 ---- stringBuffer.append(TEXT_1); ! stringBuffer.append(provides.generateJavaNamespace()); stringBuffer.append(TEXT_2); + stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_3); stringBuffer.append(provides.getIdentifier()); + stringBuffer.append(TEXT_4); + stringBuffer.append(provides.getInterface().generateAbsoluteJavaCcmName()); stringBuffer.append(TEXT_5); ! stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_6); + stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_7); + stringBuffer.append(provides.getIdentifier()); + stringBuffer.append(TEXT_8); + stringBuffer.append(provides.generateJavaNamespace()); + stringBuffer.append(TEXT_9); + stringBuffer.append(provides.getComponent().getIdentifier()); + stringBuffer.append(provides.getIdentifier()); + stringBuffer.append(TEXT_10); + stringBuffer.append(provides.getIdentifier()); + stringBuffer.append(TEXT_11); + stringBuffer.append(TEXT_12); return stringBuffer.toString(); } |
From: Robert L. <rle...@us...> - 2007-02-19 09:09:45
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30786/src/ccmtools/generator/java/metamodel Modified Files: ComponentDef.java ProvidesDef.java Log Message: Java assemblies Index: ComponentDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ComponentDef.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ComponentDef.java 16 Feb 2007 13:34:20 -0000 1.21 --- ComponentDef.java 19 Feb 2007 09:09:42 -0000 1.22 *************** *** 332,360 **** { Connection c = (Connection) e; Port target = c.getReceptacle(); ! if (target.getComponent() != null) { ! StringBuffer code = new StringBuffer(); code.append(TAB3); code.append(target.getComponent()); code.append("_.connect_"); ! code.append(target.getConnector()); code.append("("); ! Port source = c.getFacet(); ! if (source.getComponent() == null) ! { ! // connect an outer receptacle to the receptacle of an inner component ! code.append("ctx.get_connection_"); ! } ! else ! { ! // connect facet and receptacle if inner components ! code.append(source.getComponent()); ! code.append("_.provide_"); ! } ! code.append(source.getConnector()); ! code.append("());"); ! list.add(code.toString()); } } else if (e instanceof Attribute) --- 332,375 ---- { Connection c = (Connection) e; + StringBuffer code = new StringBuffer(); + String code_tail; Port target = c.getReceptacle(); ! String target_name=target.getConnector(); ! if(target.getComponent()==null) { ! // connect to an outer facet ! String check=TAB3+"if("+target_name+"_!=null)"; ! list.add(check); ! code.append(TAB4); ! code.append(target_name); ! code.append("_.target = "); ! code_tail = ";"; ! } ! else ! { ! // connect to the receptacle of an inner component code.append(TAB3); code.append(target.getComponent()); code.append("_.connect_"); ! code.append(target_name); code.append("("); ! code_tail = ");"; ! } ! Port source = c.getFacet(); ! if (source.getComponent() == null) ! { ! // connect from an outer receptacle ! code.append("ctx.get_connection_"); ! } ! else ! { ! // connect from the facet of an inner component ! code.append(source.getComponent()); ! code.append("_.provide_"); } + code.append(source.getConnector()); + code.append("()"); + code.append(code_tail); + list.add(code.toString()); } else if (e instanceof Attribute) *************** *** 392,418 **** } - public String getInnerFacet( ProvidesDef facet ) - { - String name = facet.getIdentifier(); - for (AssemblyElement e : assembly_.getElements()) - { - if (e instanceof Connection) - { - Connection c = (Connection) e; - Port target = c.getReceptacle(); - if (target.getComponent() == null && target.getConnector().equals(name)) - { - Port source = c.getFacet(); - if (source.getComponent() == null) - { - // special case: connect an outer facet to an outer receptacle - return "ctx.get_connection_" + source.getConnector() + "()"; - } - return source.getComponent() + "_.provide_" + source.getConnector() + "()"; - } - } - } - throw new RuntimeException("facet \"" + name + "\" is not connected"); - } /*********************************************************************************************** --- 407,410 ---- Index: ProvidesDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ProvidesDef.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ProvidesDef.java 16 Feb 2007 12:34:31 -0000 1.20 --- ProvidesDef.java 19 Feb 2007 09:09:42 -0000 1.21 *************** *** 124,139 **** } ! public String generateGetMethodAssemblyImplementation(String inner_facet) { - inner_facet_ = inner_facet; return new ProvidesDefGetMethodAssemblyImplementationTemplate().generate(this); } - - private String inner_facet_; - - public String getAssemblyFacet() - { - return inner_facet_; - } // Generate SourceFile objects -------------------------------------------- --- 124,131 ---- } ! public String generateGetMethodAssemblyImplementation() { return new ProvidesDefGetMethodAssemblyImplementationTemplate().generate(this); } // Generate SourceFile objects -------------------------------------------- |
From: Robert L. <rle...@us...> - 2007-02-19 09:08:55
|
Update of /cvsroot/ccmtools/ccmtools/test/JavaAssembly/prototype/wamas In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30310/test/JavaAssembly/prototype/wamas Modified Files: C3i1Impl.java C3Impl.java Main.java Log Message: new facet adapter concept Index: C3i1Impl.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/test/JavaAssembly/prototype/wamas/C3i1Impl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** C3i1Impl.java 15 Feb 2007 12:21:19 -0000 1.3 --- C3i1Impl.java 19 Feb 2007 09:08:47 -0000 1.4 *************** *** 32,39 **** private C3Impl component; ! public C3i1Impl(C3Impl component, wamas.Test.I1 target) { this.component = component; - this.target = target; } --- 32,41 ---- private C3Impl component; ! // connect comp1.i1 to this.i1; ! wamas.Test.I1 target; ! ! public C3i1Impl(C3Impl component) { this.component = component; } *************** *** 43,49 **** - // connect comp1.i1 to this.i1; - private wamas.Test.I1 target; - public String value() throws CCMException --- 45,48 ---- Index: Main.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/test/JavaAssembly/prototype/wamas/Main.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Main.java 15 Feb 2007 12:21:20 -0000 1.2 --- Main.java 19 Feb 2007 09:08:48 -0000 1.3 *************** *** 9,21 **** H3 home = (H3)H3Deployment.create(); C3 component = home.create(); component.configuration_complete(); System.out.println("C3.b = "+component.b()); - wamas.Test.I1 c3i1 = component.provide_i1(); System.out.println("C3->I1.value() = "+c3i1.value()); wamas.Test.H1 h1 = (wamas.Test.H1)wamas.Test.H1Deployment.create(); wamas.Test.C1 c1 = h1.create(); - c1.configuration_complete(); wamas.Test.I1 c1i1 = c1.provide_i1(); System.out.println("C1->I1.value() = "+c1i1.value()); } --- 9,21 ---- H3 home = (H3)H3Deployment.create(); C3 component = home.create(); + wamas.Test.I1 c3i1 = component.provide_i1(); component.configuration_complete(); System.out.println("C3.b = "+component.b()); System.out.println("C3->I1.value() = "+c3i1.value()); wamas.Test.H1 h1 = (wamas.Test.H1)wamas.Test.H1Deployment.create(); wamas.Test.C1 c1 = h1.create(); wamas.Test.I1 c1i1 = c1.provide_i1(); + c1.configuration_complete(); System.out.println("C1->I1.value() = "+c1i1.value()); } Index: C3Impl.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/test/JavaAssembly/prototype/wamas/C3Impl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** C3Impl.java 15 Feb 2007 12:21:20 -0000 1.2 --- C3Impl.java 19 Feb 2007 09:08:48 -0000 1.3 *************** *** 88,95 **** public wamas.Test.CCM_I1 get_i1() { ! // connect comp1.i1 to this.i1; ! return new wamas.C3i1Impl(this, comp1_.provide_i1()); } --- 88,98 ---- + private wamas.C3i1Impl i1_; + public wamas.Test.CCM_I1 get_i1() { ! if(i1_==null) ! i1_ = new wamas.C3i1Impl(this); ! return i1_; } *************** *** 123,126 **** --- 126,133 ---- comp1_.connect_i2(comp2_.provide_i2()); + // connect comp1.i1 to this.i1; + if(i1_!=null) + i1_.target = comp1_.provide_i1(); + // connect this.i3 to comp2.i3; comp2_.connect_i3(ctx.get_connection_i3()); |
From: Robert L. <rle...@us...> - 2007-02-19 09:08:54
|
Update of /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30310/test/JavaAssembly/test1 Modified Files: Makefile Log Message: new facet adapter concept Index: Makefile =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 16 Feb 2007 12:34:32 -0000 1.2 --- Makefile 19 Feb 2007 09:08:48 -0000 1.3 *************** *** 2,5 **** --- 2,7 ---- ccmjava -app -iface -local test1.idl ccmjava -assembly test1.assembly test1.idl + cp ../prototype/wamas/Main.java wamas/ javac `find -name '*.java'` + java wamas.Main rm `find -name '*.class'` |
From: Robert L. <rle...@us...> - 2007-02-16 13:34:28
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27808/src/ccmtools/generator/java/templates/jet Modified Files: ComponentDefAssemblyClass.jet Log Message: Java assemblies Index: ComponentDefAssemblyClass.jet =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet/ComponentDefAssemblyClass.jet,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ComponentDefAssemblyClass.jet 16 Feb 2007 12:30:13 -0000 1.3 --- ComponentDefAssemblyClass.jet 16 Feb 2007 13:34:21 -0000 1.4 *************** *** 151,154 **** --- 151,155 ---- { try { + // create inner components <% for(Iterator i=component.getAssemblyAttributeInitialisation(); i.hasNext();) *************** *** 160,163 **** --- 161,165 ---- %> + // setup inner components <% for(Iterator i=component.getAssemblyAttributeSetup(); i.hasNext();) |
From: Robert L. <rle...@us...> - 2007-02-16 13:34:28
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27808/src/ccmtools/generator/java/metamodel Modified Files: ComponentDef.java Log Message: Java assemblies Index: ComponentDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ComponentDef.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ComponentDef.java 16 Feb 2007 12:34:31 -0000 1.20 --- ComponentDef.java 16 Feb 2007 13:34:20 -0000 1.21 *************** *** 332,343 **** --- 332,390 ---- { Connection c = (Connection) e; + Port target = c.getReceptacle(); + if (target.getComponent() != null) + { + StringBuffer code = new StringBuffer(); + code.append(TAB3); + code.append(target.getComponent()); + code.append("_.connect_"); + code.append(target.getConnector()); + code.append("("); + Port source = c.getFacet(); + if (source.getComponent() == null) + { + // connect an outer receptacle to the receptacle of an inner component + code.append("ctx.get_connection_"); + } + else + { + // connect facet and receptacle if inner components + code.append(source.getComponent()); + code.append("_.provide_"); + } + code.append(source.getConnector()); + code.append("());"); + list.add(code.toString()); + } } else if (e instanceof Attribute) { Attribute a = (Attribute) e; + Port target = a.getTarget(); + String source = a.getSource(); + StringBuffer code = new StringBuffer(); + code.append(TAB3); + code.append(target.getComponent()); + code.append("_."); + code.append(target.getConnector()); + code.append("(this."); + code.append(source); + code.append("_);"); + list.add(code.toString()); } else if (e instanceof Constant) { Constant c = (Constant) e; + Port target = c.getTarget(); + String value = c.getValue().toString(); + StringBuffer code = new StringBuffer(); + code.append(TAB3); + code.append(target.getComponent()); + code.append("_."); + code.append(target.getConnector()); + code.append("("); + code.append(value); + code.append(");"); + list.add(code.toString()); } } |
From: Robert L. <rle...@us...> - 2007-02-16 13:34:28
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27808/src/ccmtools/generator/java/templates Modified Files: ComponentDefAssemblyClassTemplate.java Log Message: Java assemblies Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ComponentDefAssemblyClassTemplate.java 16 Feb 2007 12:33:44 -0000 1.3 --- ComponentDefAssemblyClassTemplate.java 16 Feb 2007 13:34:21 -0000 1.4 *************** *** 40,46 **** protected final String TEXT_23 = NL; protected final String TEXT_24 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_25 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " \ttry {"; protected final String TEXT_26 = NL; ! protected final String TEXT_27 = " " + NL; protected final String TEXT_28 = NL; protected final String TEXT_29 = " " + NL + "" + NL + "\t\t\t// finish configuration \t"; --- 40,46 ---- protected final String TEXT_23 = NL; protected final String TEXT_24 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_25 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " \ttry {" + NL + "\t\t\t// create inner components \t"; protected final String TEXT_26 = NL; ! protected final String TEXT_27 = " " + NL + "" + NL + "\t\t\t// setup inner components \t"; protected final String TEXT_28 = NL; protected final String TEXT_29 = " " + NL + "" + NL + "\t\t\t// finish configuration \t"; |
From: Robert L. <rle...@us...> - 2007-02-16 13:34:28
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27808/src/ccmtools/parser/assembly/metamodel Modified Files: Constant.java Attribute.java Log Message: Java assemblies Index: Attribute.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Attribute.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Attribute.java 12 Feb 2007 16:01:12 -0000 1.4 --- Attribute.java 16 Feb 2007 13:34:21 -0000 1.5 *************** *** 26,29 **** --- 26,43 ---- target_ = target; source_ = source; + if(target.getComponent()==null) + throw new RuntimeException("target must be an inner component"); + if(source.getComponent()!=null) + throw new RuntimeException("source must not be an inner component"); + } + + public Port getTarget() + { + return target_; + } + + public String getSource() + { + return source_.getConnector(); } Index: Constant.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Constant.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Constant.java 12 Feb 2007 16:01:12 -0000 1.3 --- Constant.java 16 Feb 2007 13:34:21 -0000 1.4 *************** *** 26,29 **** --- 26,41 ---- target_ = target; value_ = value; + if(target.getComponent()==null) + throw new RuntimeException("target must be an inner component"); + } + + public Port getTarget() + { + return target_; + } + + public Value getValue() + { + return value_; } |
From: Robert L. <rle...@us...> - 2007-02-16 12:34:45
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3911/src/ccmtools/parser/assembly/metamodel Modified Files: Assembly.java Port.java Connection.java Log Message: Java assemblies Index: Connection.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Connection.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Connection.java 12 Feb 2007 16:01:13 -0000 1.3 --- Connection.java 16 Feb 2007 12:34:32 -0000 1.4 *************** *** 28,31 **** --- 28,41 ---- } + public Port getFacet() + { + return facet_; + } + + public Port getReceptacle() + { + return receptacle_; + } + void postProcessing( Assembly parent, Map<String, Component> components ) { *************** *** 34,41 **** receptacle_.postProcessing(components); } public void prettyPrint( PrintStream out, String offset ) { ! out.println(offset + "connect " + facet_ + " to " + receptacle_ + " ;"); } } --- 44,56 ---- receptacle_.postProcessing(components); } + + public String toString() + { + return "connect " + facet_ + " to " + receptacle_; + } public void prettyPrint( PrintStream out, String offset ) { ! out.println(offset + toString() + " ;"); } } Index: Port.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Port.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Port.java 12 Feb 2007 16:01:12 -0000 1.4 --- Port.java 16 Feb 2007 12:34:32 -0000 1.5 *************** *** 32,35 **** --- 32,51 ---- connector_ = connector; } + + /** + * returns the name of the inner component or null if this is a port of the outer component + */ + public String getComponent() + { + return component_; + } + + /** + * returns the name of this facet or receptacle + */ + public String getConnector() + { + return connector_; + } /** Index: Assembly.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Assembly.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Assembly.java 15 Feb 2007 16:46:41 -0000 1.6 --- Assembly.java 16 Feb 2007 12:34:32 -0000 1.7 *************** *** 12,15 **** --- 12,16 ---- import java.io.PrintStream; import java.util.HashMap; + import java.util.List; import java.util.Map; import java.util.Vector; *************** *** 31,37 **** elements_ = elements; } private HashMap<String, Component> components_; ! public Map<String, Component> getComponents() { --- 32,43 ---- elements_ = elements; } + + public List<AssemblyElement> getElements() + { + return elements_; + } private HashMap<String, Component> components_; ! public Map<String, Component> getComponents() { *************** *** 54,65 **** } } ! private MComponentDef ccmComponent_; ! ! void updateCcmModel(MComponentDef component) { ccmComponent_ = component; } ! public MComponentDef getCcmComponent() { --- 60,71 ---- } } ! private MComponentDef ccmComponent_; ! ! void updateCcmModel( MComponentDef component ) { ccmComponent_ = component; } ! public MComponentDef getCcmComponent() { |
From: Robert L. <rle...@us...> - 2007-02-16 12:34:39
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3911/src/ccmtools/generator/java/metamodel Modified Files: ComponentDef.java OperationDef.java HomeDef.java ProvidesDef.java Log Message: Java assemblies Index: ComponentDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ComponentDef.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ComponentDef.java 15 Feb 2007 16:46:41 -0000 1.19 --- ComponentDef.java 16 Feb 2007 12:34:31 -0000 1.20 *************** *** 19,26 **** --- 19,32 ---- import ccmtools.generator.java.templates.ComponentDefInterfaceTemplate; import ccmtools.parser.assembly.metamodel.Assembly; + import ccmtools.parser.assembly.metamodel.AssemblyElement; + import ccmtools.parser.assembly.metamodel.Attribute; import ccmtools.parser.assembly.metamodel.Component; + import ccmtools.parser.assembly.metamodel.Connection; + import ccmtools.parser.assembly.metamodel.Constant; import ccmtools.parser.assembly.metamodel.Model; + import ccmtools.parser.assembly.metamodel.Port; import ccmtools.parser.idl.metamodel.CcmModelHelper; import ccmtools.parser.idl.metamodel.ComponentIDL.MComponentDef; + import ccmtools.parser.idl.metamodel.ComponentIDL.MHomeDef; import ccmtools.utils.SourceFile; import ccmtools.utils.Text; *************** *** 257,261 **** private HashMap<String, MComponentDef> assembly_local_components_; ! Map<String, MComponentDef> getAssemblyLocalComponents() { if (assembly_local_components_ == null) --- 263,267 ---- private HashMap<String, MComponentDef> assembly_local_components_; ! public Map<String, MComponentDef> getAssemblyLocalComponents() { if (assembly_local_components_ == null) *************** *** 291,294 **** --- 297,372 ---- } + public Iterator getAssemblyAttributeInitialisation() + { + ArrayList<String> list = new ArrayList<String>(); + for (String key : getAssemblyLocalComponents().keySet()) + { + MComponentDef comp_def = assembly_local_components_.get(key); + List homes = comp_def.getHomes(); + if (homes.size() > 0) + { + // using first home + MHomeDef home = (MHomeDef) homes.get(0); + String hn = CcmModelHelper.getAbsoluteName(home, "."); + String code = TAB3 + key + "_ = ((" + hn + ")" + hn + + "Deployment.create()).create();"; + list.add(code); + } + else + { + // no home + String cn = CcmModelHelper.getAbsoluteName(comp_def, "."); + String code = TAB3 + key + "_ = new " + cn + "Adapter(new " + cn + "Impl());"; + list.add(code); + } + } + return list.iterator(); + } + + public Iterator getAssemblyAttributeSetup() + { + ArrayList<String> list = new ArrayList<String>(); + for (AssemblyElement e : assembly_.getElements()) + { + if (e instanceof Connection) + { + Connection c = (Connection) e; + } + else if (e instanceof Attribute) + { + Attribute a = (Attribute) e; + } + else if (e instanceof Constant) + { + Constant c = (Constant) e; + } + } + return list.iterator(); + } + + public String getInnerFacet( ProvidesDef facet ) + { + String name = facet.getIdentifier(); + for (AssemblyElement e : assembly_.getElements()) + { + if (e instanceof Connection) + { + Connection c = (Connection) e; + Port target = c.getReceptacle(); + if (target.getComponent() == null && target.getConnector().equals(name)) + { + Port source = c.getFacet(); + if (source.getComponent() == null) + { + // special case: connect an outer facet to an outer receptacle + return "ctx.get_connection_" + source.getConnector() + "()"; + } + return source.getComponent() + "_.provide_" + source.getConnector() + "()"; + } + } + } + throw new RuntimeException("facet \"" + name + "\" is not connected"); + } + /*********************************************************************************************** * Client Library Generator Methods Index: OperationDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/OperationDef.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** OperationDef.java 16 Jan 2007 09:25:22 -0000 1.14 --- OperationDef.java 16 Feb 2007 12:34:31 -0000 1.15 *************** *** 4,12 **** import java.util.List; import java.util.Set; - import ccmtools.generator.java.templates.OperationDefAdapterFromCorbaTemplate; import ccmtools.generator.java.templates.OperationDefAdapterLocalTemplate; import ccmtools.generator.java.templates.OperationDefAdapterToCorbaTemplate; import ccmtools.generator.java.templates.OperationDefApplicationImplementationTemplate; import ccmtools.generator.java.templates.OperationDefCatchStatementConverterFromCorbaTemplate; import ccmtools.generator.java.templates.OperationDefCatchStatementConverterToCorbaTemplate; --- 4,12 ---- import java.util.List; import java.util.Set; import ccmtools.generator.java.templates.OperationDefAdapterFromCorbaTemplate; import ccmtools.generator.java.templates.OperationDefAdapterLocalTemplate; import ccmtools.generator.java.templates.OperationDefAdapterToCorbaTemplate; import ccmtools.generator.java.templates.OperationDefApplicationImplementationTemplate; + import ccmtools.generator.java.templates.OperationDefAssemblyImplementationTemplate; import ccmtools.generator.java.templates.OperationDefCatchStatementConverterFromCorbaTemplate; import ccmtools.generator.java.templates.OperationDefCatchStatementConverterToCorbaTemplate; *************** *** 203,207 **** --- 203,224 ---- } } + + public String generateAssemblyImplementation() + { + return new OperationDefAssemblyImplementationTemplate().generate(this); + } + public String generateAssemblyReturnStatement() + { + StringBuffer code = new StringBuffer(); + if(!(getType() instanceof VoidType)) + code.append("return "); + code.append("target."); + code.append(getIdentifier()); + code.append("("); + code.append(generateParameterList()); + code.append(");"); + return code.toString(); + } Index: HomeDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/HomeDef.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** HomeDef.java 14 Feb 2007 12:27:05 -0000 1.12 --- HomeDef.java 16 Feb 2007 12:34:31 -0000 1.13 *************** *** 6,10 **** import java.util.Set; import java.util.TreeSet; - import ccmtools.generator.java.templates.HomeDefAdapterFromCorbaTemplate; import ccmtools.generator.java.templates.HomeDefAdapterLocalTemplate; --- 6,9 ---- *************** *** 25,288 **** import ccmtools.utils.Text; ! public class HomeDef ! extends ! ModelElement ! implements ! JavaLocalInterfaceGeneratorElement, ! JavaLocalAdapterGeneratorElement, ! JavaClientLibGeneratorElement, ! JavaCorbaAdapterGeneratorElement, ! JavaApplicationGeneratorElement { ! private ComponentDef component; ! ! public HomeDef(String identifier, List<String> namespace) ! { ! super(identifier, namespace); ! } ! public ComponentDef getComponent() ! { ! return component; ! } ! public void setComponent(ComponentDef component) ! { ! this.component = component; ! } ! ! public Set<String> getJavaImportStatements() ! { ! Set<String> importStatements = new TreeSet<String>(); ! // Some component management methods can throw this exception type ! importStatements.add(generateAbsoluteJavaName()); ! importStatements.add(generateAbsoluteJavaCcmName()); ! importStatements.add(getComponent().generateAbsoluteJavaName()); ! return importStatements; ! } ! ! ! /************************************************************************* ! * Local Interface Generator Methods ! *************************************************************************/ ! ! public String generateJavaImportStatements() ! { ! return generateJavaImportStatements(getJavaImportStatements()); ! } ! ! public String generateJavaImportStatements(String namespace) ! { ! return generateJavaImportStatements(namespace, getJavaImportStatements()); ! } ! ! public String generateInterface() ! { ! return new HomeDefInterfaceTemplate().generate(this); ! } ! ! public String generateImplicitInterface() ! { ! return new HomeDefImplicitInterfaceTemplate().generate(this); ! } ! ! public String generateExplicitInterface() ! { ! return new HomeDefExplicitInterfaceTemplate().generate(this); ! } ! ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateLocalInterfaceSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! ! SourceFile iface = new SourceFile(localPackageName, getIdentifier() + ".java", generateInterface()); ! sourceFileList.add(iface); ! ! SourceFile implicitInterface = new SourceFile(localPackageName, getIdentifier() + "Implicit.java", ! generateImplicitInterface()); ! sourceFileList.add(implicitInterface); ! ! SourceFile explicitInterface = new SourceFile(localPackageName, getIdentifier() + "Explicit.java", ! generateExplicitInterface()); ! sourceFileList.add(explicitInterface); ! ! return sourceFileList; ! } ! ! ! ! /************************************************************************* ! * Local Adapter Generator Methods ! *************************************************************************/ ! ! public String generateApplicationInterface() ! { ! return new HomeDefApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateImplicitApplicationInterface() ! { ! return new HomeDefImplicitApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateExplicitApplicationInterface() ! { ! return new HomeDefExplicitApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateAdapterLocal() ! { ! return new HomeDefAdapterLocalTemplate().generate(this); ! } ! ! public String generateDeploymentLocal() ! { ! return new HomeDefDeploymentLocalTemplate().generate(this); ! } ! ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateLocalAdapterSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! ! SourceFile applicationInterface = new SourceFile(localPackageName, ! generateCcmIdentifier() + ".java", generateApplicationInterface()); ! sourceFileList.add(applicationInterface); ! SourceFile implicitApplicationIface = new SourceFile(localPackageName, ! generateCcmIdentifier() + "Implicit.java", generateImplicitApplicationInterface()); ! sourceFileList.add(implicitApplicationIface); ! SourceFile explicitApplicationIface = new SourceFile(localPackageName, ! generateCcmIdentifier() + "Explicit.java", generateExplicitApplicationInterface()); ! sourceFileList.add(explicitApplicationIface); ! ! SourceFile adapterLocal = new SourceFile(localPackageName, ! getIdentifier() + "Adapter.java", generateAdapterLocal()); ! sourceFileList.add(adapterLocal); ! ! SourceFile deploymentLocal = new SourceFile(localPackageName, ! getIdentifier() + "Deployment.java", generateDeploymentLocal()); ! sourceFileList.add(deploymentLocal); ! ! return sourceFileList; ! } ! ! ! ! /************************************************************************* ! * Application Generator Methods ! *************************************************************************/ ! ! public String generateApplicationClass() ! { ! return new HomeDefApplicationClassTemplate().generate(this); ! } ! ! public String generateFactoryApplication() ! { ! return new HomeDefFactoryApplicationTemplate().generate(this); ! } ! ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateApplicationSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! ! SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() + ! "Impl.java", generateApplicationClass()); ! sourceFileList.add(applicationClass); ! ! SourceFile factoryApplication = new SourceFile(localPackageName, getIdentifier() + ! "Factory.java", generateFactoryApplication()); ! sourceFileList.add(factoryApplication); ! ! return sourceFileList; ! } ! ! public List<SourceFile> generateAssemblySourceFiles(Model assemblies) { ! // no special home implementation for assemblies ! return generateApplicationSourceFiles(); } - - - - /************************************************************************* - * Client Library Generator Methods - *************************************************************************/ - - public String generateAdapterToCorba() - { - return new HomeDefAdapterToCorbaTemplate().generate(this); - } - - public String generateClientLibDeployment() - { - return new HomeDefDeploymentClientLibTemplate().generate(this); - } ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateClientLibSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! ! SourceFile adapterToCorba = new SourceFile(localPackageName, getIdentifier() + ! "AdapterToCorba.java",generateAdapterToCorba()); ! sourceFileList.add(adapterToCorba); ! ! SourceFile deploymentClientLib = new SourceFile(localPackageName, getIdentifier() + ! "ClientLibDeployment.java",generateClientLibDeployment()); ! sourceFileList.add(deploymentClientLib); ! ! return sourceFileList; ! } ! ! /************************************************************************* ! * CORBA Adapter Generator Methods ! *************************************************************************/ ! ! public String generateAdapterFromCorba() ! { ! return new HomeDefAdapterFromCorbaTemplate().generate(this); ! } ! ! public String generateCorbaComponentDeployment() ! { ! return new HomeDefDeploymentCorbaComponentTemplate().generate(this); ! } ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateCorbaAdapterSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String remotePackageName = Text.joinList(File.separator, getJavaRemoteNamespaceList()); ! ! SourceFile adapterFromCorba = new SourceFile(remotePackageName, getIdentifier() + ! "AdapterFromCorba.java",generateAdapterFromCorba()); ! sourceFileList.add(adapterFromCorba); ! ! SourceFile deploymentCorbaComponent = new SourceFile(remotePackageName, getIdentifier() + ! "Deployment.java",generateCorbaComponentDeployment()); ! sourceFileList.add(deploymentCorbaComponent); ! ! return sourceFileList; ! } ! } --- 24,247 ---- import ccmtools.utils.Text; ! public class HomeDef extends ModelElement implements JavaLocalInterfaceGeneratorElement, ! JavaLocalAdapterGeneratorElement, JavaClientLibGeneratorElement, ! JavaCorbaAdapterGeneratorElement, JavaApplicationGeneratorElement { ! private ComponentDef component; + public HomeDef( String identifier, List<String> namespace ) + { + super(identifier, namespace); + } ! public ComponentDef getComponent() ! { ! return component; ! } ! public void setComponent( ComponentDef component ) ! { ! this.component = component; ! } ! public Set<String> getJavaImportStatements() ! { ! Set<String> importStatements = new TreeSet<String>(); ! // Some component management methods can throw this exception type ! importStatements.add(generateAbsoluteJavaName()); ! importStatements.add(generateAbsoluteJavaCcmName()); ! importStatements.add(getComponent().generateAbsoluteJavaName()); ! return importStatements; ! } ! /*********************************************************************************************** ! * Local Interface Generator Methods ! **********************************************************************************************/ ! public String generateJavaImportStatements() { ! return generateJavaImportStatements(getJavaImportStatements()); } ! public String generateJavaImportStatements( String namespace ) ! { ! return generateJavaImportStatements(namespace, getJavaImportStatements()); ! } ! public String generateInterface() ! { ! return new HomeDefInterfaceTemplate().generate(this); ! } ! public String generateImplicitInterface() ! { ! return new HomeDefImplicitInterfaceTemplate().generate(this); ! } ! ! public String generateExplicitInterface() ! { ! return new HomeDefExplicitInterfaceTemplate().generate(this); ! } ! ! // Generate SourceFile objects -------------------------------------------- ! public List<SourceFile> generateLocalInterfaceSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! SourceFile iface = new SourceFile(localPackageName, getIdentifier() + ".java", ! generateInterface()); ! sourceFileList.add(iface); ! SourceFile implicitInterface = new SourceFile(localPackageName, getIdentifier() ! + "Implicit.java", generateImplicitInterface()); ! sourceFileList.add(implicitInterface); ! SourceFile explicitInterface = new SourceFile(localPackageName, getIdentifier() ! + "Explicit.java", generateExplicitInterface()); ! sourceFileList.add(explicitInterface); ! return sourceFileList; ! } ! ! /*********************************************************************************************** ! * Local Adapter Generator Methods ! **********************************************************************************************/ ! public String generateApplicationInterface() ! { ! return new HomeDefApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateImplicitApplicationInterface() ! { ! return new HomeDefImplicitApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateExplicitApplicationInterface() ! { ! return new HomeDefExplicitApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateAdapterLocal() ! { ! return new HomeDefAdapterLocalTemplate().generate(this); ! } ! ! public String generateDeploymentLocal() ! { ! return new HomeDefDeploymentLocalTemplate().generate(this); ! } ! ! // Generate SourceFile objects -------------------------------------------- ! public List<SourceFile> generateLocalAdapterSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! SourceFile applicationInterface = new SourceFile(localPackageName, generateCcmIdentifier() ! + ".java", generateApplicationInterface()); ! sourceFileList.add(applicationInterface); ! SourceFile implicitApplicationIface = new SourceFile(localPackageName, ! generateCcmIdentifier() + "Implicit.java", generateImplicitApplicationInterface()); ! sourceFileList.add(implicitApplicationIface); ! SourceFile explicitApplicationIface = new SourceFile(localPackageName, ! generateCcmIdentifier() + "Explicit.java", generateExplicitApplicationInterface()); ! sourceFileList.add(explicitApplicationIface); ! SourceFile adapterLocal = new SourceFile(localPackageName, ! getIdentifier() + "Adapter.java", generateAdapterLocal()); ! sourceFileList.add(adapterLocal); ! SourceFile deploymentLocal = new SourceFile(localPackageName, getIdentifier() ! + "Deployment.java", generateDeploymentLocal()); ! sourceFileList.add(deploymentLocal); ! return sourceFileList; ! } ! ! /*********************************************************************************************** ! * Application Generator Methods ! **********************************************************************************************/ ! public String generateApplicationClass() ! { ! return new HomeDefApplicationClassTemplate().generate(this); ! } ! ! public String generateFactoryApplication() ! { ! return new HomeDefFactoryApplicationTemplate().generate(this); ! } + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateApplicationSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() + + "Impl.java", generateApplicationClass()); + sourceFileList.add(applicationClass); + SourceFile factoryApplication = new SourceFile(localPackageName, getIdentifier() + + "Factory.java", generateFactoryApplication()); + sourceFileList.add(factoryApplication); + return sourceFileList; + } + + public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) + { + if (getComponent().getAssemblyDescription(assemblies) != null) + { + // no special home implementation for assemblies + return generateApplicationSourceFiles(); + } + else + { + // no component impl. => no home impl. + return new ArrayList<SourceFile>(); + } + } + + /*********************************************************************************************** + * Client Library Generator Methods + **********************************************************************************************/ + public String generateAdapterToCorba() + { + return new HomeDefAdapterToCorbaTemplate().generate(this); + } + + public String generateClientLibDeployment() + { + return new HomeDefDeploymentClientLibTemplate().generate(this); + } + + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateClientLibSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile adapterToCorba = new SourceFile(localPackageName, getIdentifier() + + "AdapterToCorba.java", generateAdapterToCorba()); + sourceFileList.add(adapterToCorba); + SourceFile deploymentClientLib = new SourceFile(localPackageName, getIdentifier() + + "ClientLibDeployment.java", generateClientLibDeployment()); + sourceFileList.add(deploymentClientLib); + return sourceFileList; + } + + /*********************************************************************************************** + * CORBA Adapter Generator Methods + **********************************************************************************************/ + public String generateAdapterFromCorba() + { + return new HomeDefAdapterFromCorbaTemplate().generate(this); + } + + public String generateCorbaComponentDeployment() + { + return new HomeDefDeploymentCorbaComponentTemplate().generate(this); + } + + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateCorbaAdapterSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String remotePackageName = Text.joinList(File.separator, getJavaRemoteNamespaceList()); + SourceFile adapterFromCorba = new SourceFile(remotePackageName, getIdentifier() + + "AdapterFromCorba.java", generateAdapterFromCorba()); + sourceFileList.add(adapterFromCorba); + SourceFile deploymentCorbaComponent = new SourceFile(remotePackageName, getIdentifier() + + "Deployment.java", generateCorbaComponentDeployment()); + sourceFileList.add(deploymentCorbaComponent); + return sourceFileList; + } + } Index: ProvidesDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ProvidesDef.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ProvidesDef.java 15 Feb 2007 16:46:41 -0000 1.19 --- ProvidesDef.java 16 Feb 2007 12:34:31 -0000 1.20 *************** *** 6,12 **** --- 6,14 ---- import java.util.Set; import ccmtools.generator.java.templates.ProvidesDefApplicationClassTemplate; + import ccmtools.generator.java.templates.ProvidesDefAssemblyClassTemplate; import ccmtools.generator.java.templates.ProvidesDefEquivalentMethodAdapterFromCorbaTemplate; import ccmtools.generator.java.templates.ProvidesDefEquivalentMethodAdapterLocalTemplate; import ccmtools.generator.java.templates.ProvidesDefEquivalentMethodAdapterToCorbaTemplate; + import ccmtools.generator.java.templates.ProvidesDefGetMethodAssemblyImplementationTemplate; import ccmtools.generator.java.templates.ProvidesDefGetMethodImplementationTemplate; import ccmtools.generator.java.templates.ProvidesDefNavigationMethodAdapterFromCorbaTemplate; *************** *** 117,120 **** --- 119,140 ---- } + public String generateAssemblyClass() + { + return new ProvidesDefAssemblyClassTemplate().generate(this); + } + + public String generateGetMethodAssemblyImplementation(String inner_facet) + { + inner_facet_ = inner_facet; + return new ProvidesDefGetMethodAssemblyImplementationTemplate().generate(this); + } + + private String inner_facet_; + + public String getAssemblyFacet() + { + return inner_facet_; + } + // Generate SourceFile objects -------------------------------------------- public List<SourceFile> generateApplicationSourceFiles() *************** *** 135,139 **** if (assembly != null) { ! // TODO } return sourceFileList; --- 155,163 ---- if (assembly != null) { ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! String facetName = getComponent().getIdentifier() + getIdentifier(); ! SourceFile applicationClass = new SourceFile(localPackageName, facetName + "Impl.java", ! generateAssemblyClass()); ! sourceFileList.add(applicationClass); } return sourceFileList; |
From: Robert L. <rle...@us...> - 2007-02-16 12:34:38
|
Update of /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3911/test/JavaAssembly/test1 Modified Files: Makefile Log Message: Java assemblies Index: Makefile =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 15 Feb 2007 16:46:41 -0000 1.1 --- Makefile 16 Feb 2007 12:34:32 -0000 1.2 *************** *** 2,3 **** --- 2,5 ---- ccmjava -app -iface -local test1.idl ccmjava -assembly test1.assembly test1.idl + javac `find -name '*.java'` + rm `find -name '*.class'` |
From: Robert L. <rle...@us...> - 2007-02-16 12:33:49
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3511/src/ccmtools/generator/java/templates Modified Files: ComponentDefAssemblyClassTemplate.java Added Files: ProvidesDefGetMethodAssemblyImplementationTemplate.java ProvidesDefAssemblyClassTemplate.java OperationDefAssemblyImplementationTemplate.java Log Message: Java assemblies Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ComponentDefAssemblyClassTemplate.java 15 Feb 2007 16:46:41 -0000 1.2 --- ComponentDefAssemblyClassTemplate.java 16 Feb 2007 12:33:44 -0000 1.3 *************** *** 40,45 **** protected final String TEXT_23 = NL; protected final String TEXT_24 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_25 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "}"; protected final String TEXT_26 = NL; public String generate(Object argument) --- 40,52 ---- protected final String TEXT_23 = NL; protected final String TEXT_24 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_25 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " \ttry {"; protected final String TEXT_26 = NL; + protected final String TEXT_27 = " " + NL; + protected final String TEXT_28 = NL; + protected final String TEXT_29 = " " + NL + "" + NL + "\t\t\t// finish configuration \t"; + protected final String TEXT_30 = NL + "\t\t\t"; + protected final String TEXT_31 = "_.configuration_complete();"; + protected final String TEXT_32 = " " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new CCMException(e.getMessage(), CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "}"; + protected final String TEXT_33 = NL; public String generate(Object argument) *************** *** 148,152 **** stringBuffer.append(TEXT_23); ! stringBuffer.append(provides.generateGetMethodImplementation()); } --- 155,159 ---- stringBuffer.append(TEXT_23); ! stringBuffer.append(provides.generateGetMethodAssemblyImplementation(component.getInnerFacet(provides))); } *************** *** 155,159 **** --- 162,197 ---- stringBuffer.append(component.generateCcmIdentifier()); stringBuffer.append(TEXT_25); + + for(Iterator i=component.getAssemblyAttributeInitialisation(); i.hasNext();) + { + stringBuffer.append(TEXT_26); + stringBuffer.append(i.next().toString()); + + } + + stringBuffer.append(TEXT_27); + + for(Iterator i=component.getAssemblyAttributeSetup(); i.hasNext();) + { + + stringBuffer.append(TEXT_28); + stringBuffer.append(i.next().toString()); + + } + + stringBuffer.append(TEXT_29); + + for (String key : component.getAssemblyLocalComponents().keySet()) + { + + stringBuffer.append(TEXT_30); + stringBuffer.append(key); + stringBuffer.append(TEXT_31); + + } + + stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_33); return stringBuffer.toString(); } --- NEW FILE: OperationDefAssemblyImplementationTemplate.java --- package ccmtools.generator.java.templates; import ccmtools.generator.java.metamodel.*; public class OperationDefAssemblyImplementationTemplate { protected static String nl; public static synchronized OperationDefAssemblyImplementationTemplate create(String lineSeparator) { nl = lineSeparator; OperationDefAssemblyImplementationTemplate result = new OperationDefAssemblyImplementationTemplate(); nl = null; return result; } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = " public "; protected final String TEXT_2 = " "; protected final String TEXT_3 = "("; protected final String TEXT_4 = ")"; protected final String TEXT_5 = NL + " "; protected final String TEXT_6 = NL + " {" + NL + " \t"; protected final String TEXT_7 = NL + " } "; protected final String TEXT_8 = NL; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); OperationDef op = (OperationDef) argument; stringBuffer.append(TEXT_1); stringBuffer.append(op.generateReturnType()); stringBuffer.append(TEXT_2); stringBuffer.append(op.getIdentifier()); stringBuffer.append(TEXT_3); stringBuffer.append(op.generateParameterDeclarationList()); stringBuffer.append(TEXT_4); stringBuffer.append(TEXT_5); stringBuffer.append(op.generateThrowsStatementLocal()); stringBuffer.append(TEXT_6); stringBuffer.append(op.generateAssemblyReturnStatement()); stringBuffer.append(TEXT_7); stringBuffer.append(TEXT_8); return stringBuffer.toString(); } } --- NEW FILE: ProvidesDefAssemblyClassTemplate.java --- package ccmtools.generator.java.templates; import java.util.Iterator; import ccmtools.generator.java.metamodel.*; public class ProvidesDefAssemblyClassTemplate { protected static String nl; public static synchronized ProvidesDefAssemblyClassTemplate create(String lineSeparator) { nl = lineSeparator; ProvidesDefAssemblyClassTemplate result = new ProvidesDefAssemblyClassTemplate(); nl = null; return result; } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = "/**" + NL + " * This file was automatically generated by "; protected final String TEXT_2 = NL + " * <http://ccmtools.sourceforge.net>" + NL + " * " + NL + " * "; protected final String TEXT_3 = "Impl facet implementation." + NL + " *" + NL + " */" + NL + "" + NL + "package "; protected final String TEXT_4 = "; " + NL; protected final String TEXT_5 = NL; protected final String TEXT_6 = " " + NL + "" + NL + "/** " + NL + " * This class implements a component facet's methods." + NL + " *" + NL + " */" + NL + "public class "; protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Reference to the facet's component implementation */" + NL + " private "; protected final String TEXT_9 = "Impl component;" + NL + " " + NL + " /** the facet of the inner component we delegate to */" + NL + " private "; protected final String TEXT_10 = " target;" + NL + "" + NL + " public "; protected final String TEXT_11 = "Impl(" + NL + " \t"; protected final String TEXT_12 = "Impl component," + NL + " \t"; protected final String TEXT_13 = " target)" + NL + " {" + NL + " this.component = component;" + NL + " this.target = target;" + NL + " }" + NL; protected final String TEXT_14 = " " + NL + "// TODO: assembly implementation"; protected final String TEXT_15 = NL; protected final String TEXT_16 = NL + "// TODO: assembly implementation"; protected final String TEXT_17 = NL; protected final String TEXT_18 = " " + NL + "" + NL + "" + NL + " /** Business logic implementations */" + NL; protected final String TEXT_19 = " " + NL + "// TODO: assembly implementation"; protected final String TEXT_20 = NL; protected final String TEXT_21 = NL + " "; protected final String TEXT_22 = NL + "// TODO: assembly implementation"; protected final String TEXT_23 = NL; protected final String TEXT_24 = " " + NL + " " + NL + " "; protected final String TEXT_25 = " "; protected final String TEXT_26 = NL; protected final String TEXT_27 = " " + NL; protected final String TEXT_28 = NL; protected final String TEXT_29 = NL + "}"; protected final String TEXT_30 = NL; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); ProvidesDef provides = (ProvidesDef) argument; InterfaceDef iface = provides.getInterface(); stringBuffer.append(TEXT_1); stringBuffer.append(iface.generateCcmtoolsVersion()); stringBuffer.append(TEXT_2); stringBuffer.append(iface.generateCcmIdentifier()); stringBuffer.append(TEXT_3); stringBuffer.append(provides.generateJavaNamespace()); stringBuffer.append(TEXT_4); stringBuffer.append(TEXT_5); stringBuffer.append(provides.generateJavaImportStatements(provides.generateJavaNamespace())); stringBuffer.append(TEXT_6); stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_7); stringBuffer.append(iface.generateCcmIdentifier()); stringBuffer.append(TEXT_8); stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(TEXT_9); stringBuffer.append(iface.generateAbsoluteJavaName()); stringBuffer.append(TEXT_10); stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_11); stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(TEXT_12); stringBuffer.append(iface.generateAbsoluteJavaName()); stringBuffer.append(TEXT_13); for(Iterator i=iface.getBaseInterfaces().iterator(); i.hasNext();) { InterfaceDef baseIface = (InterfaceDef)i.next(); for(Iterator j=baseIface.getAttributes().iterator(); j.hasNext(); ) { AttributeDef attr = (AttributeDef)j.next(); stringBuffer.append(TEXT_14); stringBuffer.append(TEXT_15); stringBuffer.append(attr.generateApplicationDeclaration()); } } for(Iterator i=iface.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); stringBuffer.append(TEXT_16); stringBuffer.append(TEXT_17); stringBuffer.append(attr.generateApplicationDeclaration()); } stringBuffer.append(TEXT_18); for(Iterator i=iface.getBaseInterfaces().iterator(); i.hasNext();) { InterfaceDef baseIface = (InterfaceDef)i.next(); for(Iterator j=baseIface.getAttributes().iterator(); j.hasNext(); ) { AttributeDef attr = (AttributeDef)j.next(); stringBuffer.append(TEXT_19); stringBuffer.append(TEXT_20); stringBuffer.append(attr.generateApplicationImplementation()); } } stringBuffer.append(TEXT_21); for(Iterator i=iface.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); stringBuffer.append(TEXT_22); stringBuffer.append(TEXT_23); stringBuffer.append(attr.generateApplicationImplementation()); } stringBuffer.append(TEXT_24); for(Iterator i=iface.getBaseInterfaces().iterator(); i.hasNext();) { InterfaceDef baseIface = (InterfaceDef)i.next(); for(Iterator j=baseIface.getOperations().iterator(); j.hasNext(); ) { OperationDef op = (OperationDef)j.next(); stringBuffer.append(TEXT_25); stringBuffer.append(TEXT_26); stringBuffer.append(op.generateAssemblyImplementation()); } } stringBuffer.append(TEXT_27); for(Iterator i=iface.getOperations().iterator(); i.hasNext();) { OperationDef op = (OperationDef)i.next(); stringBuffer.append(TEXT_28); stringBuffer.append(op.generateAssemblyImplementation()); } stringBuffer.append(TEXT_29); stringBuffer.append(TEXT_30); return stringBuffer.toString(); } } --- NEW FILE: ProvidesDefGetMethodAssemblyImplementationTemplate.java --- package ccmtools.generator.java.templates; import ccmtools.generator.java.metamodel.*; public class ProvidesDefGetMethodAssemblyImplementationTemplate { protected static String nl; public static synchronized ProvidesDefGetMethodAssemblyImplementationTemplate create(String lineSeparator) { nl = lineSeparator; ProvidesDefGetMethodAssemblyImplementationTemplate result = new ProvidesDefGetMethodAssemblyImplementationTemplate(); nl = null; return result; } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = NL + " public "; protected final String TEXT_2 = " get_"; protected final String TEXT_3 = "()" + NL + " {" + NL + " return new "; protected final String TEXT_4 = "."; protected final String TEXT_5 = "Impl(this, "; protected final String TEXT_6 = ");" + NL + " }"; protected final String TEXT_7 = NL; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); ProvidesDef provides = (ProvidesDef) argument; stringBuffer.append(TEXT_1); stringBuffer.append(provides.getInterface().generateAbsoluteJavaCcmName()); stringBuffer.append(TEXT_2); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_3); stringBuffer.append(provides.generateJavaNamespace()); stringBuffer.append(TEXT_4); stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_5); stringBuffer.append(provides.getAssemblyFacet()); stringBuffer.append(TEXT_6); stringBuffer.append(TEXT_7); return stringBuffer.toString(); } } |
From: Robert L. <rle...@us...> - 2007-02-16 12:30:27
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1558/src/ccmtools/generator/java/templates/jet Modified Files: ComponentDefAssemblyClass.jet Added Files: OperationDefAssemblyImplementation.jet ProvidesDefGetMethodAssemplyImplementation.jet ProvidesDefAssemblyClass.jet Log Message: Java assemblies Index: ComponentDefAssemblyClass.jet =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet/ComponentDefAssemblyClass.jet,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ComponentDefAssemblyClass.jet 15 Feb 2007 16:46:42 -0000 1.2 --- ComponentDefAssemblyClass.jet 16 Feb 2007 12:30:13 -0000 1.3 *************** *** 134,138 **** ProvidesDef provides = (ProvidesDef)i.next(); %> ! <%=provides.generateGetMethodImplementation()%> <% } --- 134,138 ---- ProvidesDef provides = (ProvidesDef)i.next(); %> ! <%=provides.generateGetMethodAssemblyImplementation(component.getInnerFacet(provides))%> <% } *************** *** 150,154 **** throws CCMException { ! // OPTIONAL: IMPLEMENT ME HERE ! } --- 150,184 ---- throws CCMException { ! try { ! <% ! for(Iterator i=component.getAssemblyAttributeInitialisation(); i.hasNext();) ! { ! %> ! <%=i.next().toString()%> ! <% ! } ! %> ! ! <% ! for(Iterator i=component.getAssemblyAttributeSetup(); i.hasNext();) ! { ! %> ! <%=i.next().toString()%> ! <% ! } ! %> ! ! // finish configuration ! <% ! for (String key : component.getAssemblyLocalComponents().keySet()) ! { ! %> ! <%=key%>_.configuration_complete(); ! <% ! } ! %> ! } catch(Exception e) { ! throw new CCMException(e.getMessage(), CCMExceptionReason.CREATE_ERROR); ! } } --- NEW FILE: OperationDefAssemblyImplementation.jet --- <%@ jet package="ccmtools.generator.java.templates" class="OperationDefAssemblyImplementationTemplate" imports="ccmtools.generator.java.metamodel.* " %> <% OperationDef op = (OperationDef) argument; %> public <%=op.generateReturnType()%> <%=op.getIdentifier()%>(<%=op.generateParameterDeclarationList()%>) <%=op.generateThrowsStatementLocal()%> { <%=op.generateAssemblyReturnStatement()%> } --- NEW FILE: ProvidesDefGetMethodAssemplyImplementation.jet --- <%@ jet package="ccmtools.generator.java.templates" class="ProvidesDefGetMethodAssemblyImplementationTemplate" imports="ccmtools.generator.java.metamodel.* " %> <% ProvidesDef provides = (ProvidesDef) argument; %> public <%=provides.getInterface().generateAbsoluteJavaCcmName()%> get_<%=provides.getIdentifier()%>() { return new <%=provides.generateJavaNamespace()%>.<%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl(this, <%=provides.getAssemblyFacet()%>); } --- NEW FILE: ProvidesDefAssemblyClass.jet --- <%@ jet package="ccmtools.generator.java.templates" class="ProvidesDefAssemblyClassTemplate" imports="java.util.Iterator ccmtools.generator.java.metamodel.* " %> <% ProvidesDef provides = (ProvidesDef) argument; InterfaceDef iface = provides.getInterface(); %> /** * This file was automatically generated by <%=iface.generateCcmtoolsVersion()%> * <http://ccmtools.sourceforge.net> * * <%=iface.generateCcmIdentifier()%>Impl facet implementation. * */ package <%=provides.generateJavaNamespace()%>; <%=provides.generateJavaImportStatements(provides.generateJavaNamespace())%> /** * This class implements a component facet's methods. * */ public class <%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl implements <%=iface.generateCcmIdentifier()%> { /** Reference to the facet's component implementation */ private <%=provides.getComponent().getIdentifier()%>Impl component; /** the facet of the inner component we delegate to */ private <%=iface.generateAbsoluteJavaName()%> target; public <%=provides.getComponent().getIdentifier()%><%=provides.getIdentifier()%>Impl( <%=provides.getComponent().getIdentifier()%>Impl component, <%=iface.generateAbsoluteJavaName()%> target) { this.component = component; this.target = target; } <% for(Iterator i=iface.getBaseInterfaces().iterator(); i.hasNext();) { InterfaceDef baseIface = (InterfaceDef)i.next(); for(Iterator j=baseIface.getAttributes().iterator(); j.hasNext(); ) { AttributeDef attr = (AttributeDef)j.next(); %> // TODO: assembly implementation <%=attr.generateApplicationDeclaration()%> <% } } %> <% for(Iterator i=iface.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); %> // TODO: assembly implementation <%=attr.generateApplicationDeclaration()%> <% } %> /** Business logic implementations */ <% for(Iterator i=iface.getBaseInterfaces().iterator(); i.hasNext();) { InterfaceDef baseIface = (InterfaceDef)i.next(); for(Iterator j=baseIface.getAttributes().iterator(); j.hasNext(); ) { AttributeDef attr = (AttributeDef)j.next(); %> // TODO: assembly implementation <%=attr.generateApplicationImplementation()%> <% } } %> <% for(Iterator i=iface.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); %> // TODO: assembly implementation <%=attr.generateApplicationImplementation()%> <% } %> <% for(Iterator i=iface.getBaseInterfaces().iterator(); i.hasNext();) { InterfaceDef baseIface = (InterfaceDef)i.next(); for(Iterator j=baseIface.getOperations().iterator(); j.hasNext(); ) { OperationDef op = (OperationDef)j.next(); %> <%=op.generateAssemblyImplementation()%> <% } } %> <% for(Iterator i=iface.getOperations().iterator(); i.hasNext();) { OperationDef op = (OperationDef)i.next(); %> <%=op.generateAssemblyImplementation()%> <% } %> } |
From: Robert L. <rle...@us...> - 2007-02-15 16:47:35
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1748/src/ccmtools/generator/java/templates Modified Files: ComponentDefAssemblyClassTemplate.java Log Message: Java assemblies Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ComponentDefAssemblyClassTemplate.java 15 Feb 2007 13:18:37 -0000 1.1 --- ComponentDefAssemblyClassTemplate.java 15 Feb 2007 16:46:41 -0000 1.2 *************** *** 19,25 **** protected final String TEXT_2 = NL + " * <http://ccmtools.sourceforge.net>" + NL + " * " + NL + " * "; protected final String TEXT_3 = " component business logic." + NL + " *" + NL + " */" + NL + "" + NL + "package "; ! protected final String TEXT_4 = ";" + NL + " " + NL + "import Components.CCMException; " + NL + "import Components.SessionContext; " + NL; protected final String TEXT_5 = NL; ! protected final String TEXT_6 = " " + NL + " " + NL + "/**" + NL + " * This class implements component equivalent and supported interfaces" + NL + " * as well as component attributes." + NL + " * Additionally, session component callback methods must be implemented." + NL + " *" + NL + " * // TODO: WRITE YOUR DESCRIPTION HERE !" + NL + " *" + NL + " * @author" + NL + " * @version" + NL + " */ " + NL + "public class "; protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Supported interface attribute variables */" + NL; --- 19,25 ---- protected final String TEXT_2 = NL + " * <http://ccmtools.sourceforge.net>" + NL + " * " + NL + " * "; protected final String TEXT_3 = " component business logic." + NL + " *" + NL + " */" + NL + "" + NL + "package "; ! protected final String TEXT_4 = ";" + NL + " " + NL + "import Components.CCMException; " + NL + "import Components.CCMExceptionReason;" + NL + "import Components.SessionContext; " + NL; protected final String TEXT_5 = NL; ! protected final String TEXT_6 = " " + NL + " " + NL + "/**" + NL + " * This class implements component equivalent and supported interfaces" + NL + " * as well as component attributes." + NL + " * Additionally, session component callback methods must be implemented." + NL + " *" + NL + " */ " + NL + "public class "; protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Supported interface attribute variables */" + NL; *************** *** 27,43 **** protected final String TEXT_10 = " " + NL + " " + NL + "" + NL + " /** Component attribute variables */" + NL + " "; protected final String TEXT_11 = NL; ! protected final String TEXT_12 = " " + NL + "" + NL + " public "; ! protected final String TEXT_13 = "_Context ctx;" + NL + " " + NL + " " + NL + " public "; ! protected final String TEXT_14 = "Impl()" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; ! protected final String TEXT_15 = NL; ! protected final String TEXT_16 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; protected final String TEXT_17 = NL; ! protected final String TEXT_18 = " " + NL + "" + NL + "" + NL + " /** Component attribute accessor methods */" + NL; protected final String TEXT_19 = NL; ! protected final String TEXT_20 = " " + NL + "" + NL + "" + NL + " /** Facet implementation factory methods */" + NL + " "; protected final String TEXT_21 = NL; ! protected final String TEXT_22 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_23 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "}"; ! protected final String TEXT_24 = NL; public String generate(Object argument) --- 27,45 ---- protected final String TEXT_10 = " " + NL + " " + NL + "" + NL + " /** Component attribute variables */" + NL + " "; protected final String TEXT_11 = NL; ! protected final String TEXT_12 = " " + NL + " "; ! protected final String TEXT_13 = NL; ! protected final String TEXT_14 = " " + NL + "" + NL + " public "; ! protected final String TEXT_15 = "_Context ctx;" + NL + " " + NL + " " + NL + " public "; ! protected final String TEXT_16 = "Impl()" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; protected final String TEXT_17 = NL; ! protected final String TEXT_18 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; protected final String TEXT_19 = NL; ! protected final String TEXT_20 = " " + NL + "" + NL + "" + NL + " /** Component attribute accessor methods */" + NL; protected final String TEXT_21 = NL; ! protected final String TEXT_22 = " " + NL + "" + NL + "" + NL + " /** Facet implementation factory methods */" + NL + " "; ! protected final String TEXT_23 = NL; ! protected final String TEXT_24 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_25 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "}"; ! protected final String TEXT_26 = NL; public String generate(Object argument) *************** *** 85,92 **** stringBuffer.append(TEXT_12); ! stringBuffer.append(component.generateCcmIdentifier()); stringBuffer.append(TEXT_13); ! stringBuffer.append(component.getIdentifier()); stringBuffer.append(TEXT_14); for(Iterator i = component.getSupports().iterator(); i.hasNext();) --- 87,104 ---- stringBuffer.append(TEXT_12); ! ! for(Iterator i=component.getAssemblyAttributeDeclarations(); i.hasNext();) ! { ! stringBuffer.append(TEXT_13); ! stringBuffer.append(i.next().toString()); ! ! } ! stringBuffer.append(TEXT_14); + stringBuffer.append(component.generateCcmIdentifier()); + stringBuffer.append(TEXT_15); + stringBuffer.append(component.getIdentifier()); + stringBuffer.append(TEXT_16); for(Iterator i = component.getSupports().iterator(); i.hasNext();) *************** *** 97,101 **** AttributeDef attr = (AttributeDef)j.next(); ! stringBuffer.append(TEXT_15); stringBuffer.append(attr.generateApplicationImplementation()); --- 109,113 ---- AttributeDef attr = (AttributeDef)j.next(); ! stringBuffer.append(TEXT_17); stringBuffer.append(attr.generateApplicationImplementation()); *************** *** 103,107 **** } ! stringBuffer.append(TEXT_16); for(Iterator i = component.getSupports().iterator(); i.hasNext();) --- 115,119 ---- } ! stringBuffer.append(TEXT_18); for(Iterator i = component.getSupports().iterator(); i.hasNext();) *************** *** 112,116 **** OperationDef op = (OperationDef)j.next(); ! stringBuffer.append(TEXT_17); stringBuffer.append(op.generateApplicationImplementation()); --- 124,128 ---- OperationDef op = (OperationDef)j.next(); ! stringBuffer.append(TEXT_19); stringBuffer.append(op.generateApplicationImplementation()); *************** *** 118,122 **** } ! stringBuffer.append(TEXT_18); for(Iterator i = component.getAttributes().iterator(); i.hasNext();) --- 130,134 ---- } ! stringBuffer.append(TEXT_20); for(Iterator i = component.getAttributes().iterator(); i.hasNext();) *************** *** 124,133 **** AttributeDef attr = (AttributeDef)i.next(); ! stringBuffer.append(TEXT_19); stringBuffer.append(attr.generateApplicationImplementation()); } ! stringBuffer.append(TEXT_20); for(Iterator i = component.getFacet().iterator(); i.hasNext();) --- 136,145 ---- AttributeDef attr = (AttributeDef)i.next(); ! stringBuffer.append(TEXT_21); stringBuffer.append(attr.generateApplicationImplementation()); } ! stringBuffer.append(TEXT_22); for(Iterator i = component.getFacet().iterator(); i.hasNext();) *************** *** 135,147 **** ProvidesDef provides = (ProvidesDef)i.next(); ! stringBuffer.append(TEXT_21); stringBuffer.append(provides.generateGetMethodImplementation()); } - stringBuffer.append(TEXT_22); - stringBuffer.append(component.generateCcmIdentifier()); - stringBuffer.append(TEXT_23); stringBuffer.append(TEXT_24); return stringBuffer.toString(); } --- 147,159 ---- ProvidesDef provides = (ProvidesDef)i.next(); ! stringBuffer.append(TEXT_23); stringBuffer.append(provides.generateGetMethodImplementation()); } stringBuffer.append(TEXT_24); + stringBuffer.append(component.generateCcmIdentifier()); + stringBuffer.append(TEXT_25); + stringBuffer.append(TEXT_26); return stringBuffer.toString(); } |
From: Robert L. <rle...@us...> - 2007-02-15 16:47:34
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1748/src/ccmtools/generator/java Modified Files: Main.java Log Message: Java assemblies Index: Main.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/Main.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Main.java 14 Feb 2007 12:27:04 -0000 1.10 --- Main.java 15 Feb 2007 16:46:41 -0000 1.11 *************** *** 66,69 **** --- 66,70 ---- String idlFile = (String) i.next(); MContainer ccmModel = ParserManager.loadCcmModel(uiDriver, idlFile, parameters.getIncludePaths()); + assemblies.updateCcmModel(ccmModel); // Transform CCM Model to Java Implementation Model |
From: Robert L. <rle...@us...> - 2007-02-15 16:47:32
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1748/src/ccmtools/parser/assembly/metamodel Modified Files: Module.java Component.java Assembly.java QualifiedName.java ModelElement.java Model.java Log Message: Java assemblies Index: Component.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Component.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Component.java 12 Feb 2007 16:01:13 -0000 1.3 --- Component.java 15 Feb 2007 16:46:41 -0000 1.4 *************** *** 27,30 **** --- 27,35 ---- name_ = name; } + + public QualifiedName getCcmName() + { + return idl_name_; + } void postProcessing( Assembly parent, Map<String, Component> components ) Index: Assembly.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Assembly.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Assembly.java 14 Feb 2007 12:27:05 -0000 1.5 --- Assembly.java 15 Feb 2007 16:46:41 -0000 1.6 *************** *** 14,17 **** --- 14,18 ---- import java.util.Map; import java.util.Vector; + import ccmtools.parser.idl.metamodel.ComponentIDL.MComponentDef; /** *************** *** 32,35 **** --- 33,41 ---- private HashMap<String, Component> components_; + + public Map<String, Component> getComponents() + { + return components_; + } void postProcessing( Module parent, Map<String, Assembly> assemblies ) *************** *** 48,51 **** --- 54,69 ---- } } + + private MComponentDef ccmComponent_; + + void updateCcmModel(MComponentDef component) + { + ccmComponent_ = component; + } + + public MComponentDef getCcmComponent() + { + return ccmComponent_; + } public void prettyPrint( PrintStream out, String offset ) Index: Model.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Model.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Model.java 15 Feb 2007 13:18:37 -0000 1.6 --- Model.java 15 Feb 2007 16:46:41 -0000 1.7 *************** *** 12,16 **** --- 12,20 ---- import java.io.PrintStream; import java.util.HashMap; + import java.util.List; import java.util.Vector; + import ccmtools.parser.idl.metamodel.BaseIDL.MContainer; + import ccmtools.parser.idl.metamodel.BaseIDL.MModuleDef; + import ccmtools.parser.idl.metamodel.ComponentIDL.MComponentDef; /** *************** *** 79,82 **** --- 83,137 ---- /** + * the key is a qualified IDL name (starting with "::") + */ + static HashMap<String, MComponentDef> ccm_component_repository = new HashMap<String, MComponentDef>(); + + static void updateCcmModel( List ccm_elements, List<ModelElement> this_elements, + String parent_name ) + { + for (Object root : ccm_elements) + { + if (root instanceof MModuleDef) + { + MModuleDef module = (MModuleDef) root; + String name = module.getIdentifier(); + boolean found = false; + for (ModelElement e : this_elements) + { + if (e instanceof Module && e.name().equals(name)) + { + ((Module) e).updateCcmModel(module); + found = true; + } + } + if (!found) + { + String pn = parent_name + IDL_SCOPE + name; + final List<ModelElement> dummy = new Vector<ModelElement>(); + updateCcmModel(module.getContentss(), dummy, pn); + } + } + else if (root instanceof MComponentDef) + { + MComponentDef component = (MComponentDef) root; + String name = component.getIdentifier(); + ccm_component_repository.put(parent_name + IDL_SCOPE + name, component); + for (ModelElement e : this_elements) + { + if (e instanceof Assembly && e.name().equals(name)) + { + ((Assembly) e).updateCcmModel(component); + } + } + } + } + } + + public void updateCcmModel( MContainer ccmModel ) + { + updateCcmModel(ccmModel.getContentss(), elements_, ""); + } + + /** * searches for an assembly description * Index: ModelElement.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/ModelElement.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ModelElement.java 15 Feb 2007 13:18:37 -0000 1.5 --- ModelElement.java 15 Feb 2007 16:46:41 -0000 1.6 *************** *** 27,30 **** --- 27,35 ---- } + public String name() + { + return name_; + } + public abstract void prettyPrint( PrintStream out, String offset ); Index: QualifiedName.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/QualifiedName.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QualifiedName.java 13 Feb 2007 07:34:45 -0000 1.4 --- QualifiedName.java 15 Feb 2007 16:46:41 -0000 1.5 *************** *** 10,13 **** --- 10,15 ---- package ccmtools.parser.assembly.metamodel; + import ccmtools.parser.idl.metamodel.ComponentIDL.MComponentDef; + /** * a qualified name *************** *** 38,40 **** --- 40,63 ---- scope_ = scope; } + + /** + * returns the component (or null if we couldn't find it) + */ + public MComponentDef getCcmComponent() + { + if (qn_.startsWith(Model.IDL_SCOPE)) + { + return Model.ccm_component_repository.get(qn_); + } + ModelElement parent = scope_; + while (parent != null) + { + String key = parent.getGlobalName() + Model.IDL_SCOPE + qn_; + MComponentDef x = Model.ccm_component_repository.get(key); + if (x != null) + return x; + parent = parent.getParent(); + } + return Model.ccm_component_repository.get(Model.IDL_SCOPE + qn_); + } } Index: Module.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Module.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Module.java 14 Feb 2007 12:27:05 -0000 1.5 --- Module.java 15 Feb 2007 16:46:41 -0000 1.6 *************** *** 13,16 **** --- 13,17 ---- import java.util.Map; import java.util.Vector; + import ccmtools.parser.idl.metamodel.BaseIDL.MModuleDef; /** *************** *** 30,39 **** { parent_ = parent; ! for (int i = 0; i < children_.size(); ++i) { ! children_.get(i).postProcessing(this, assemblies); } } public void prettyPrint( PrintStream out, String offset ) { --- 31,45 ---- { parent_ = parent; ! for (ModelElement e : children_) { ! e.postProcessing(this, assemblies); } } + void updateCcmModel( MModuleDef module ) + { + Model.updateCcmModel(module.getContentss(), children_, getGlobalName()); + } + public void prettyPrint( PrintStream out, String offset ) { |
From: Robert L. <rle...@us...> - 2007-02-15 16:47:29
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1748/src/ccmtools/generator/java/metamodel Modified Files: ComponentDef.java ProvidesDef.java Log Message: Java assemblies Index: ComponentDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ComponentDef.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ComponentDef.java 15 Feb 2007 13:18:37 -0000 1.18 --- ComponentDef.java 15 Feb 2007 16:46:41 -0000 1.19 *************** *** 3,7 **** --- 3,10 ---- import java.io.File; import java.util.ArrayList; + import java.util.HashMap; + import java.util.Iterator; import java.util.List; + import java.util.Map; import java.util.Set; import java.util.TreeSet; *************** *** 11,19 **** --- 14,26 ---- import ccmtools.generator.java.templates.ComponentDefApplicationClassTemplate; import ccmtools.generator.java.templates.ComponentDefApplicationInterfaceTemplate; + import ccmtools.generator.java.templates.ComponentDefAssemblyClassTemplate; import ccmtools.generator.java.templates.ComponentDefContextClassTemplate; import ccmtools.generator.java.templates.ComponentDefContextInterfaceTemplate; import ccmtools.generator.java.templates.ComponentDefInterfaceTemplate; import ccmtools.parser.assembly.metamodel.Assembly; + import ccmtools.parser.assembly.metamodel.Component; import ccmtools.parser.assembly.metamodel.Model; + import ccmtools.parser.idl.metamodel.CcmModelHelper; + import ccmtools.parser.idl.metamodel.ComponentIDL.MComponentDef; import ccmtools.utils.SourceFile; import ccmtools.utils.Text; *************** *** 199,207 **** } ! public String generateAssemblyClass(Assembly assembly) { ! //return new ComponentDefAssemblyClassTemplate().generate(this); ! // TODO ! return new ComponentDefApplicationClassTemplate().generate(this); } --- 206,212 ---- } ! public String generateAssemblyClass() { ! return new ComponentDefAssemblyClassTemplate().generate(this); } *************** *** 217,229 **** } public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) { ! Assembly assembly = getAssemblyDescription(assemblies, true); List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! if (assembly != null) { String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() ! + "Impl.java", generateAssemblyClass(assembly)); sourceFileList.add(applicationClass); } --- 222,236 ---- } + private Assembly assembly_; + public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) { ! assembly_ = getAssemblyDescription(assemblies); List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! if (assembly_ != null) { String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() ! + "Impl.java", generateAssemblyClass()); sourceFileList.add(applicationClass); } *************** *** 231,251 **** } /** * searches for the assembly description * * @param assemblies the assembly model - * @param check true if we tell the user about unknown components * @return the assembly description (or null) */ ! Assembly getAssemblyDescription( Model assemblies, boolean check ) { ! String n = Text.joinList(Model.IDL_SCOPE, getIdlNamespaceList()); ! Assembly a = assemblies.getAssembly(n); ! if (a == null && check) { ! // TODO: how could we handle that? ! System.err.println("cannot find an assembly for component " + n); } ! return a; } --- 238,292 ---- } + private String getQualifiedCcmName() + { + return Text.joinList(Model.IDL_SCOPE, getJavaNamespaceList()) + Model.IDL_SCOPE + + getIdentifier(); + } + /** * searches for the assembly description * * @param assemblies the assembly model * @return the assembly description (or null) */ ! Assembly getAssemblyDescription( Model assemblies ) { ! return assemblies.getAssembly(getQualifiedCcmName()); ! } ! ! private HashMap<String, MComponentDef> assembly_local_components_; ! ! Map<String, MComponentDef> getAssemblyLocalComponents() ! { ! if (assembly_local_components_ == null) { ! assembly_local_components_ = new HashMap<String, MComponentDef>(); ! Map<String, Component> local_comps = assembly_.getComponents(); ! for (String key : local_comps.keySet()) ! { ! Component comp_decl = local_comps.get(key); ! MComponentDef comp_def = comp_decl.getCcmName().getCcmComponent(); ! if (comp_def == null) ! { ! throw new RuntimeException("cannot find component " + key + " of type " ! + comp_decl.getCcmName()); ! } ! assembly_local_components_.put(key, comp_def); ! } } ! return assembly_local_components_; ! } ! ! public Iterator getAssemblyAttributeDeclarations() ! { ! ArrayList<String> list = new ArrayList<String>(); ! for (String key : getAssemblyLocalComponents().keySet()) ! { ! MComponentDef comp_def = assembly_local_components_.get(key); ! String java_type = CcmModelHelper.getAbsoluteName(comp_def, "."); ! String code = TAB + "private " + java_type + " " + key + "_;"; ! list.add(code); ! } ! return list.iterator(); } Index: ProvidesDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ProvidesDef.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ProvidesDef.java 15 Feb 2007 13:18:37 -0000 1.18 --- ProvidesDef.java 15 Feb 2007 16:46:41 -0000 1.19 *************** *** 131,135 **** public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) { ! Assembly assembly = component.getAssemblyDescription(assemblies, false); List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); if (assembly != null) --- 131,135 ---- public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) { ! Assembly assembly = component.getAssemblyDescription(assemblies); List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); if (assembly != null) |
From: Robert L. <rle...@us...> - 2007-02-15 16:46:50
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1748/src/ccmtools/generator/java/templates/jet Modified Files: ComponentDefAssemblyClass.jet Log Message: Java assemblies Index: ComponentDefAssemblyClass.jet =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet/ComponentDefAssemblyClass.jet,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ComponentDefAssemblyClass.jet 15 Feb 2007 13:18:37 -0000 1.1 --- ComponentDefAssemblyClass.jet 15 Feb 2007 16:46:42 -0000 1.2 *************** *** 15,18 **** --- 15,19 ---- import Components.CCMException; + import Components.CCMExceptionReason; import Components.SessionContext; *************** *** 24,31 **** * Additionally, session component callback methods must be implemented. * - * // TODO: WRITE YOUR DESCRIPTION HERE ! - * - * @author - * @version */ public class <%=component.getIdentifier()%>Impl --- 25,28 ---- *************** *** 60,63 **** --- 57,69 ---- } %> + + <% + for(Iterator i=component.getAssemblyAttributeDeclarations(); i.hasNext();) + { + %> + <%=i.next().toString()%> + <% + } + %> public <%=component.generateCcmIdentifier()%>_Context ctx; |
From: Robert L. <rle...@us...> - 2007-02-15 16:46:46
|
Update of /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1748/test/JavaAssembly/test1 Added Files: test1.idl test1.assembly .cvsignore Makefile Log Message: Java assemblies --- NEW FILE: .cvsignore --- wamas --- NEW FILE: test1.idl --- module wamas { module Test { interface I1 { string value(); }; interface I2 { /* empty */ }; interface I3 { /* empty */ }; component C1 { attribute string a1; attribute long a2; provides I1 i1; uses I2 i2; }; home H1 manages C1 { }; component C2 { attribute long b; provides I2 i2; uses I3 i3; }; home H2 manages C2 { }; }; // /module Test component C3 { attribute long b; provides Test::I1 i1; uses Test::I3 i3; }; home H3 manages C3 { }; }; // /module wamas --- NEW FILE: Makefile --- all: ccmjava -app -iface -local test1.idl ccmjava -assembly test1.assembly test1.idl --- NEW FILE: test1.assembly --- module wamas { assembly A3 implements C3 { component Test::C1 comp1; component wamas::Test::C2 comp2; connect comp2.i2 to comp1.i2; connect comp1.i1 to this.i1; connect i3 to comp2.i3; constant comp1.a1 = "Hello World"; constant comp1.a2 = 642; attribute comp2.b = this.b; }; }; // /module wamas |
From: Robert L. <rle...@us...> - 2007-02-15 16:43:17
|
Update of /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv593/test/JavaAssembly/test1 Log Message: Directory /cvsroot/ccmtools/ccmtools/test/JavaAssembly/test1 added to the repository |
From: Robert L. <rle...@us...> - 2007-02-15 13:18:43
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15719/src/ccmtools/generator/java/templates Added Files: ComponentDefAssemblyClassTemplate.java Log Message: Java assemblies --- NEW FILE: ComponentDefAssemblyClassTemplate.java --- package ccmtools.generator.java.templates; import java.util.Iterator; import ccmtools.generator.java.metamodel.*; public class ComponentDefAssemblyClassTemplate { protected static String nl; public static synchronized ComponentDefAssemblyClassTemplate create(String lineSeparator) { nl = lineSeparator; ComponentDefAssemblyClassTemplate result = new ComponentDefAssemblyClassTemplate(); nl = null; return result; } protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = "/**" + NL + " * This file was automatically generated by "; protected final String TEXT_2 = NL + " * <http://ccmtools.sourceforge.net>" + NL + " * " + NL + " * "; protected final String TEXT_3 = " component business logic." + NL + " *" + NL + " */" + NL + "" + NL + "package "; protected final String TEXT_4 = ";" + NL + " " + NL + "import Components.CCMException; " + NL + "import Components.SessionContext; " + NL; protected final String TEXT_5 = NL; protected final String TEXT_6 = " " + NL + " " + NL + "/**" + NL + " * This class implements component equivalent and supported interfaces" + NL + " * as well as component attributes." + NL + " * Additionally, session component callback methods must be implemented." + NL + " *" + NL + " * // TODO: WRITE YOUR DESCRIPTION HERE !" + NL + " *" + NL + " * @author" + NL + " * @version" + NL + " */ " + NL + "public class "; protected final String TEXT_7 = "Impl " + NL + " implements "; protected final String TEXT_8 = NL + "{" + NL + " /** Supported interface attribute variables */" + NL; protected final String TEXT_9 = NL; protected final String TEXT_10 = " " + NL + " " + NL + "" + NL + " /** Component attribute variables */" + NL + " "; protected final String TEXT_11 = NL; protected final String TEXT_12 = " " + NL + "" + NL + " public "; protected final String TEXT_13 = "_Context ctx;" + NL + " " + NL + " " + NL + " public "; protected final String TEXT_14 = "Impl()" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; protected final String TEXT_15 = NL; protected final String TEXT_16 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; protected final String TEXT_17 = NL; protected final String TEXT_18 = " " + NL + "" + NL + "" + NL + " /** Component attribute accessor methods */" + NL; protected final String TEXT_19 = NL; protected final String TEXT_20 = " " + NL + "" + NL + "" + NL + " /** Facet implementation factory methods */" + NL + " "; protected final String TEXT_21 = NL; protected final String TEXT_22 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(SessionContext ctx) " + NL + " throws CCMException" + NL + " {" + NL + " this.ctx = ("; protected final String TEXT_23 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws CCMException" + NL + " {" + NL + " // OPTIONAL: IMPLEMENT ME HERE !" + NL + " }" + NL + "}"; protected final String TEXT_24 = NL; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); ComponentDef component = (ComponentDef) argument; stringBuffer.append(TEXT_1); stringBuffer.append(component.generateCcmtoolsVersion()); stringBuffer.append(TEXT_2); stringBuffer.append(component.generateCcmIdentifier()); stringBuffer.append(TEXT_3); stringBuffer.append(component.generateJavaNamespace()); stringBuffer.append(TEXT_4); stringBuffer.append(TEXT_5); stringBuffer.append(component.generateJavaImportStatements()); stringBuffer.append(TEXT_6); stringBuffer.append(component.getIdentifier()); stringBuffer.append(TEXT_7); stringBuffer.append(component.generateCcmIdentifier()); stringBuffer.append(TEXT_8); for(Iterator i = component.getSupports().iterator(); i.hasNext();) { SupportsDef supports = (SupportsDef)i.next(); for(Iterator j = supports.getInterface().getAllAttributes().iterator(); j.hasNext();) { AttributeDef attr = (AttributeDef)j.next(); stringBuffer.append(TEXT_9); stringBuffer.append(attr.generateApplicationDeclaration()); } } stringBuffer.append(TEXT_10); for(Iterator i=component.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); stringBuffer.append(TEXT_11); stringBuffer.append(attr.generateApplicationDeclaration()); } stringBuffer.append(TEXT_12); stringBuffer.append(component.generateCcmIdentifier()); stringBuffer.append(TEXT_13); stringBuffer.append(component.getIdentifier()); stringBuffer.append(TEXT_14); for(Iterator i = component.getSupports().iterator(); i.hasNext();) { SupportsDef supports = (SupportsDef)i.next(); for(Iterator j = supports.getInterface().getAllAttributes().iterator(); j.hasNext();) { AttributeDef attr = (AttributeDef)j.next(); stringBuffer.append(TEXT_15); stringBuffer.append(attr.generateApplicationImplementation()); } } stringBuffer.append(TEXT_16); for(Iterator i = component.getSupports().iterator(); i.hasNext();) { SupportsDef supports = (SupportsDef)i.next(); for(Iterator j = supports.getInterface().getAllOperations().iterator(); j.hasNext();) { OperationDef op = (OperationDef)j.next(); stringBuffer.append(TEXT_17); stringBuffer.append(op.generateApplicationImplementation()); } } stringBuffer.append(TEXT_18); for(Iterator i = component.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); stringBuffer.append(TEXT_19); stringBuffer.append(attr.generateApplicationImplementation()); } stringBuffer.append(TEXT_20); for(Iterator i = component.getFacet().iterator(); i.hasNext();) { ProvidesDef provides = (ProvidesDef)i.next(); stringBuffer.append(TEXT_21); stringBuffer.append(provides.generateGetMethodImplementation()); } stringBuffer.append(TEXT_22); stringBuffer.append(component.generateCcmIdentifier()); stringBuffer.append(TEXT_23); stringBuffer.append(TEXT_24); return stringBuffer.toString(); } } |
From: Robert L. <rle...@us...> - 2007-02-15 13:18:43
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15719/src/ccmtools/generator/java/metamodel Modified Files: ComponentDef.java ProvidesDef.java Log Message: Java assemblies Index: ComponentDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ComponentDef.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ComponentDef.java 14 Feb 2007 12:27:05 -0000 1.17 --- ComponentDef.java 15 Feb 2007 13:18:37 -0000 1.18 *************** *** 6,10 **** import java.util.Set; import java.util.TreeSet; - import ccmtools.generator.java.templates.ComponentDefAdapterFromCorbaTemplate; import ccmtools.generator.java.templates.ComponentDefAdapterLocalTemplate; --- 6,9 ---- *************** *** 15,295 **** import ccmtools.generator.java.templates.ComponentDefContextInterfaceTemplate; import ccmtools.generator.java.templates.ComponentDefInterfaceTemplate; import ccmtools.parser.assembly.metamodel.Model; import ccmtools.utils.SourceFile; import ccmtools.utils.Text; ! public class ComponentDef ! extends ! ModelElement ! implements ! JavaLocalInterfaceGeneratorElement, ! JavaLocalAdapterGeneratorElement, ! JavaClientLibGeneratorElement, ! JavaCorbaAdapterGeneratorElement, ! JavaApplicationGeneratorElement { ! private List<AttributeDef> attributes = new ArrayList<AttributeDef>(); ! private List<ProvidesDef> facet = new ArrayList<ProvidesDef>(); ! private List<UsesDef> receptacle = new ArrayList<UsesDef>(); ! private List<SupportsDef> supports = new ArrayList<SupportsDef>(); ! private JavaApplicationGeneratorElement home; ! ! ! public ComponentDef(String identifier, List<String> namespace) ! { ! super(identifier, namespace); ! } ! ! ! public List<AttributeDef> getAttributes() ! { ! return attributes; ! } ! ! public List<ProvidesDef> getFacet() ! { ! return facet; ! } ! ! public List<UsesDef> getReceptacle() ! { ! return receptacle; ! } ! ! public List<SupportsDef> getSupports() ! { ! return supports; ! } ! public JavaApplicationGeneratorElement getHome() ! { ! return home; ! } ! ! public void setHome(JavaApplicationGeneratorElement home) ! { ! this.home = home; ! } ! ! public Set<String> getJavaImportStatements() ! { ! Set<String> importStatements = new TreeSet<String>(); ! // Each component class refers to its context object ! importStatements.add(generateAbsoluteJavaCcmName() + "_Context"); ! for(AttributeDef a : getAttributes()) ! { ! importStatements.addAll(a.getType().getJavaImportStatements()); ! } ! for(SupportsDef s : getSupports()) ! { ! importStatements.addAll(s.getJavaImportStatements()); ! } ! importStatements.add(generateAbsoluteJavaName()); ! return importStatements; ! } ! ! /************************************************************************* ! * Local Interface Generator Methods ! *************************************************************************/ ! ! public String generateJavaImportStatements() ! { ! return generateJavaImportStatements(getJavaImportStatements()); ! } ! ! public String generateJavaImportStatements(String namespace) ! { ! return generateJavaImportStatements(namespace, getJavaImportStatements()); ! } ! ! public String generateInterface() ! { ! return new ComponentDefInterfaceTemplate().generate(this); ! } ! ! public String generateSupportsDeclarations() ! { ! List<String> supportsList = new ArrayList<String>(); ! for(SupportsDef s : getSupports()) ! { ! supportsList.add(s.getInterface().getIdentifier()); ! } ! if(supportsList.size() > 0) ! { ! return "," + NL + TAB + Text.joinList( "," + NL + TAB, supportsList); ! } ! else ! { ! return ""; // no supported interfaces ! } ! } ! ! ! public String generateSupportsCcmDeclarations() ! { ! List<String> supportsList = new ArrayList<String>(); ! for(SupportsDef s : getSupports()) ! { ! supportsList.add(s.getInterface().generateCcmIdentifier()); ! } ! if(supportsList.size() > 0) ! { ! return "," + NL + TAB + Text.joinList("," + NL + TAB, supportsList); ! } ! else ! { ! return ""; // no supported interfaces ! } ! } ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateLocalInterfaceSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! SourceFile iface = new SourceFile(localPackageName, getIdentifier() + ".java", generateInterface()); ! sourceFileList.add(iface); ! return sourceFileList; ! } ! ! ! ! ! /************************************************************************* ! * Local Adapter Generator Methods ! *************************************************************************/ ! ! public String generateApplicationInterface() ! { ! return new ComponentDefApplicationInterfaceTemplate().generate(this); ! } ! ! public String generateContextInterface() ! { ! return new ComponentDefContextInterfaceTemplate().generate(this); ! } ! ! public String generateContextClass() ! { ! return new ComponentDefContextClassTemplate().generate(this); ! } ! ! public String generateAdapterLocal() ! { ! return new ComponentDefAdapterLocalTemplate().generate(this); ! } ! ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateLocalAdapterSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! ! SourceFile applicationInterface = new SourceFile(localPackageName, ! generateCcmIdentifier() + ".java", generateApplicationInterface()); ! sourceFileList.add(applicationInterface); ! ! SourceFile contextInterface = new SourceFile(localPackageName, ! generateCcmIdentifier() + "_Context.java", generateContextInterface()); ! sourceFileList.add(contextInterface); ! SourceFile contextClass = new SourceFile(localPackageName, ! generateCcmIdentifier() + "_ContextImpl.java", generateContextClass()); ! sourceFileList.add(contextClass); ! ! SourceFile adapterLocal = new SourceFile(localPackageName, ! getIdentifier() + "Adapter.java", generateAdapterLocal()); ! sourceFileList.add(adapterLocal); ! ! return sourceFileList; ! } ! ! ! ! /************************************************************************* ! * Application Generator Methods ! *************************************************************************/ ! ! public String generateApplicationClass() ! { ! return new ComponentDefApplicationClassTemplate().generate(this); ! } ! ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateApplicationSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! ! SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() + ! "Impl.java", generateApplicationClass()); ! sourceFileList.add(applicationClass); ! ! return sourceFileList; ! } ! ! public List<SourceFile> generateAssemblySourceFiles(Model assemblies) { List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); // TODO return sourceFileList; } - - - - /************************************************************************* - * Client Library Generator Methods - *************************************************************************/ - - public String generateAdapterToCorba() - { - return new ComponentDefAdapterToCorbaTemplate().generate(this); - } - - - // Generate SourceFile objects -------------------------------------------- - - public List<SourceFile> generateClientLibSourceFiles() - { - List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); - String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); - - SourceFile adapterToCorba = new SourceFile(localPackageName, getIdentifier() + - "AdapterToCorba.java",generateAdapterToCorba()); - sourceFileList.add(adapterToCorba); - - return sourceFileList; - } - - - /************************************************************************* - * CORBA Adapter Generator Methods - *************************************************************************/ - - public String generateAdapterFromCorba() - { - return new ComponentDefAdapterFromCorbaTemplate().generate(this); - } - - - // Generate SourceFile objects -------------------------------------------- - - public List<SourceFile> generateCorbaAdapterSourceFiles() - { - List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); - String remotePackageName = Text.joinList(File.separator, getJavaRemoteNamespaceList()); - - SourceFile adapterToCorba = new SourceFile(remotePackageName, getIdentifier() + - "AdapterFromCorba.java",generateAdapterFromCorba()); - sourceFileList.add(adapterToCorba); - - return sourceFileList; - } } \ No newline at end of file --- 14,289 ---- import ccmtools.generator.java.templates.ComponentDefContextInterfaceTemplate; import ccmtools.generator.java.templates.ComponentDefInterfaceTemplate; + import ccmtools.parser.assembly.metamodel.Assembly; import ccmtools.parser.assembly.metamodel.Model; import ccmtools.utils.SourceFile; import ccmtools.utils.Text; ! public class ComponentDef extends ModelElement implements JavaLocalInterfaceGeneratorElement, ! JavaLocalAdapterGeneratorElement, JavaClientLibGeneratorElement, ! JavaCorbaAdapterGeneratorElement, JavaApplicationGeneratorElement { ! private List<AttributeDef> attributes = new ArrayList<AttributeDef>(); + private List<ProvidesDef> facet = new ArrayList<ProvidesDef>(); ! private List<UsesDef> receptacle = new ArrayList<UsesDef>(); ! private List<SupportsDef> supports = new ArrayList<SupportsDef>(); ! private JavaApplicationGeneratorElement home; ! public ComponentDef( String identifier, List<String> namespace ) ! { ! super(identifier, namespace); ! } ! ! public List<AttributeDef> getAttributes() ! { ! return attributes; ! } ! ! public List<ProvidesDef> getFacet() ! { ! return facet; ! } ! ! public List<UsesDef> getReceptacle() ! { ! return receptacle; ! } ! ! public List<SupportsDef> getSupports() ! { ! return supports; ! } ! ! public JavaApplicationGeneratorElement getHome() ! { ! return home; ! } ! ! public void setHome( JavaApplicationGeneratorElement home ) ! { ! this.home = home; ! } ! ! public Set<String> getJavaImportStatements() ! { ! Set<String> importStatements = new TreeSet<String>(); ! // Each component class refers to its context object ! importStatements.add(generateAbsoluteJavaCcmName() + "_Context"); ! for (AttributeDef a : getAttributes()) ! { ! importStatements.addAll(a.getType().getJavaImportStatements()); ! } ! for (SupportsDef s : getSupports()) ! { ! importStatements.addAll(s.getJavaImportStatements()); ! } ! importStatements.add(generateAbsoluteJavaName()); ! return importStatements; ! } ! ! /*********************************************************************************************** ! * Local Interface Generator Methods ! **********************************************************************************************/ ! public String generateJavaImportStatements() ! { ! return generateJavaImportStatements(getJavaImportStatements()); ! } ! ! public String generateJavaImportStatements( String namespace ) ! { ! return generateJavaImportStatements(namespace, getJavaImportStatements()); ! } ! ! public String generateInterface() ! { ! return new ComponentDefInterfaceTemplate().generate(this); ! } ! ! public String generateSupportsDeclarations() ! { ! List<String> supportsList = new ArrayList<String>(); ! for (SupportsDef s : getSupports()) ! { ! supportsList.add(s.getInterface().getIdentifier()); ! } ! if (supportsList.size() > 0) ! { ! return "," + NL + TAB + Text.joinList("," + NL + TAB, supportsList); ! } ! else ! { ! return ""; // no supported interfaces ! } ! } ! ! public String generateSupportsCcmDeclarations() ! { ! List<String> supportsList = new ArrayList<String>(); ! for (SupportsDef s : getSupports()) ! { ! supportsList.add(s.getInterface().generateCcmIdentifier()); ! } ! if (supportsList.size() > 0) ! { ! return "," + NL + TAB + Text.joinList("," + NL + TAB, supportsList); ! } ! else ! { ! return ""; // no supported interfaces ! } ! } ! ! // Generate SourceFile objects -------------------------------------------- ! public List<SourceFile> generateLocalInterfaceSourceFiles() { List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile iface = new SourceFile(localPackageName, getIdentifier() + ".java", + generateInterface()); + sourceFileList.add(iface); + return sourceFileList; + } + + /*********************************************************************************************** + * Local Adapter Generator Methods + **********************************************************************************************/ + public String generateApplicationInterface() + { + return new ComponentDefApplicationInterfaceTemplate().generate(this); + } + + public String generateContextInterface() + { + return new ComponentDefContextInterfaceTemplate().generate(this); + } + + public String generateContextClass() + { + return new ComponentDefContextClassTemplate().generate(this); + } + + public String generateAdapterLocal() + { + return new ComponentDefAdapterLocalTemplate().generate(this); + } + + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateLocalAdapterSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile applicationInterface = new SourceFile(localPackageName, generateCcmIdentifier() + + ".java", generateApplicationInterface()); + sourceFileList.add(applicationInterface); + SourceFile contextInterface = new SourceFile(localPackageName, generateCcmIdentifier() + + "_Context.java", generateContextInterface()); + sourceFileList.add(contextInterface); + SourceFile contextClass = new SourceFile(localPackageName, generateCcmIdentifier() + + "_ContextImpl.java", generateContextClass()); + sourceFileList.add(contextClass); + SourceFile adapterLocal = new SourceFile(localPackageName, + getIdentifier() + "Adapter.java", generateAdapterLocal()); + sourceFileList.add(adapterLocal); + return sourceFileList; + } + + /*********************************************************************************************** + * Application Generator Methods + **********************************************************************************************/ + public String generateApplicationClass() + { + return new ComponentDefApplicationClassTemplate().generate(this); + } + + public String generateAssemblyClass(Assembly assembly) + { + //return new ComponentDefAssemblyClassTemplate().generate(this); // TODO + return new ComponentDefApplicationClassTemplate().generate(this); + } + + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateApplicationSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() + + "Impl.java", generateApplicationClass()); + sourceFileList.add(applicationClass); + return sourceFileList; + } + + public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) + { + Assembly assembly = getAssemblyDescription(assemblies, true); + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + if (assembly != null) + { + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile applicationClass = new SourceFile(localPackageName, getIdentifier() + + "Impl.java", generateAssemblyClass(assembly)); + sourceFileList.add(applicationClass); + } + return sourceFileList; + } + + /** + * searches for the assembly description + * + * @param assemblies the assembly model + * @param check true if we tell the user about unknown components + * @return the assembly description (or null) + */ + Assembly getAssemblyDescription( Model assemblies, boolean check ) + { + String n = Text.joinList(Model.IDL_SCOPE, getIdlNamespaceList()); + Assembly a = assemblies.getAssembly(n); + if (a == null && check) + { + // TODO: how could we handle that? + System.err.println("cannot find an assembly for component " + n); + } + return a; + } + + /*********************************************************************************************** + * Client Library Generator Methods + **********************************************************************************************/ + public String generateAdapterToCorba() + { + return new ComponentDefAdapterToCorbaTemplate().generate(this); + } + + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateClientLibSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); + SourceFile adapterToCorba = new SourceFile(localPackageName, getIdentifier() + + "AdapterToCorba.java", generateAdapterToCorba()); + sourceFileList.add(adapterToCorba); + return sourceFileList; + } + + /*********************************************************************************************** + * CORBA Adapter Generator Methods + **********************************************************************************************/ + public String generateAdapterFromCorba() + { + return new ComponentDefAdapterFromCorbaTemplate().generate(this); + } + + // Generate SourceFile objects -------------------------------------------- + public List<SourceFile> generateCorbaAdapterSourceFiles() + { + List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); + String remotePackageName = Text.joinList(File.separator, getJavaRemoteNamespaceList()); + SourceFile adapterToCorba = new SourceFile(remotePackageName, getIdentifier() + + "AdapterFromCorba.java", generateAdapterFromCorba()); + sourceFileList.add(adapterToCorba); return sourceFileList; } } \ No newline at end of file Index: ProvidesDef.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/metamodel/ProvidesDef.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ProvidesDef.java 14 Feb 2007 12:27:05 -0000 1.17 --- ProvidesDef.java 15 Feb 2007 13:18:37 -0000 1.18 *************** *** 5,9 **** import java.util.List; import java.util.Set; - import ccmtools.generator.java.templates.ProvidesDefApplicationClassTemplate; import ccmtools.generator.java.templates.ProvidesDefEquivalentMethodAdapterFromCorbaTemplate; --- 5,8 ---- *************** *** 14,196 **** import ccmtools.generator.java.templates.ProvidesDefNavigationMethodAdapterLocalTemplate; import ccmtools.generator.java.templates.ProvidesDefNavigationMethodAdapterToCorbaTemplate; import ccmtools.parser.assembly.metamodel.Model; import ccmtools.utils.SourceFile; import ccmtools.utils.Text; ! public class ProvidesDef ! extends ModelElement ! implements JavaApplicationGeneratorElement { ! private ComponentDef component; ! private InterfaceDef iface; ! ! public ProvidesDef(String identifier, List<String> namespace) ! { ! super(identifier, namespace); ! } ! ! public ComponentDef getComponent() ! { ! return component; ! } ! public void setComponent(ComponentDef component) ! { ! this.component = component; ! } ! public InterfaceDef getInterface() ! { ! return iface; ! } ! public void setInterface(InterfaceDef provides) ! { ! this.iface = provides; ! } ! ! public Set<String> getJavaImportStatements() ! { ! Set<String> importStatements = getInterface().getJavaImportStatements(); ! importStatements.add(getInterface().generateAbsoluteJavaCcmName()); ! importStatements.add(getInterface().generateAbsoluteJavaName()); ! importStatements.add(getComponent().generateAbsoluteJavaName() + "Impl"); ! importStatements.add("Components.CCMException"); ! return importStatements; ! } ! ! ! ! /************************************************************************* ! * Local Interface Generator ! *************************************************************************/ ! ! public String generateJavaImportStatements() ! { ! return generateJavaImportStatements(getJavaImportStatements()); ! } ! ! public String generateJavaImportStatements(String namespace) ! { ! return generateJavaImportStatements(namespace, getJavaImportStatements()); ! } ! ! public String generateEquivalentMethodDeclaration() ! { ! return TAB + getInterface().generateAbsoluteJavaName() + " provide_" + getIdentifier() + "();\n"; ! } ! ! ! ! /************************************************************************* ! * Local Adapter Generator ! *************************************************************************/ ! ! public String generateFacetAdapterReference() ! { ! return TAB + "private " + getInterface().generateAbsoluteJavaName() + ! " " + getIdentifier() + "FacetAdapter;"; ! } ! ! public String generateEquivalentMethodAdapterLocal() ! { ! return new ProvidesDefEquivalentMethodAdapterLocalTemplate().generate(this); ! } ! ! public String generateNavigationMethodAdapterLocal() ! { ! return new ProvidesDefNavigationMethodAdapterLocalTemplate().generate(this); ! } ! ! ! ! ! /************************************************************************* ! * Application Generator Methods ! *************************************************************************/ ! ! // Code generator methods ------------------------------------------------- ! public String generateEquivalentApplicationMethodDeclaration() ! { ! return TAB + getInterface().generateAbsoluteJavaCcmName() + " get_" + getIdentifier() + "();\n"; ! } ! ! public String generateGetMethodImplementation() ! { ! return new ProvidesDefGetMethodImplementationTemplate().generate(this); ! } ! ! public String generateApplicationClass() ! { ! return new ProvidesDefApplicationClassTemplate().generate(this); ! } ! ! ! // Generate SourceFile objects -------------------------------------------- ! ! public List<SourceFile> generateApplicationSourceFiles() ! { ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! String facetName = getComponent().getIdentifier() + getIdentifier(); ! ! SourceFile applicationClass = ! new SourceFile(localPackageName, facetName + "Impl.java", generateApplicationClass()); ! sourceFileList.add(applicationClass); ! ! return sourceFileList; ! } ! ! public List<SourceFile> generateAssemblySourceFiles(Model assemblies) { List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! // TODO return sourceFileList; } ! ! ! /************************************************************************* ! * CORBA Adapter Generator Methods ! *************************************************************************/ ! ! public String generateEquivalentMethodAdapterToCorba() ! { ! return new ProvidesDefEquivalentMethodAdapterToCorbaTemplate().generate(this); ! } ! ! public String generateEquivalentMethodAdapterFromCorba() ! { ! return new ProvidesDefEquivalentMethodAdapterFromCorbaTemplate().generate(this); ! } ! ! ! public String generateNavigationMethodAdapterToCorba() ! { ! return new ProvidesDefNavigationMethodAdapterToCorbaTemplate().generate(this); ! } ! public String generateNavigationMethodAdapterFromCorba() ! { ! return new ProvidesDefNavigationMethodAdapterFromCorbaTemplate().generate(this); ! } ! ! public String generateFacetAdapterDeclaration() ! { ! return TAB + "private " + getInterface().generateAbsoluteJavaName() + " " + getIdentifier() + ";\n"; ! } ! ! public String generateCorbaFacetReferenceDeclaration() ! { ! return TAB + "private " + getInterface().generateAbsoluteIdlName() + " " + getIdentifier() + "Facet;\n"; ! } ! ! public String generateCorbaFacetReferenceInit() ! { ! return TAB2 + getIdentifier() + "Facet = null;\n"; ! } } --- 13,181 ---- import ccmtools.generator.java.templates.ProvidesDefNavigationMethodAdapterLocalTemplate; import ccmtools.generator.java.templates.ProvidesDefNavigationMethodAdapterToCorbaTemplate; + import ccmtools.parser.assembly.metamodel.Assembly; import ccmtools.parser.assembly.metamodel.Model; import ccmtools.utils.SourceFile; import ccmtools.utils.Text; ! public class ProvidesDef extends ModelElement implements JavaApplicationGeneratorElement { ! private ComponentDef component; ! private InterfaceDef iface; ! public ProvidesDef( String identifier, List<String> namespace ) ! { ! super(identifier, namespace); ! } + public ComponentDef getComponent() + { + return component; + } ! public void setComponent( ComponentDef component ) ! { ! this.component = component; ! } ! public InterfaceDef getInterface() ! { ! return iface; ! } ! public void setInterface( InterfaceDef provides ) ! { ! this.iface = provides; ! } ! ! public Set<String> getJavaImportStatements() ! { ! Set<String> importStatements = getInterface().getJavaImportStatements(); ! importStatements.add(getInterface().generateAbsoluteJavaCcmName()); ! importStatements.add(getInterface().generateAbsoluteJavaName()); ! importStatements.add(getComponent().generateAbsoluteJavaName() + "Impl"); ! importStatements.add("Components.CCMException"); ! return importStatements; ! } ! ! /*********************************************************************************************** ! * Local Interface Generator ! **********************************************************************************************/ ! public String generateJavaImportStatements() ! { ! return generateJavaImportStatements(getJavaImportStatements()); ! } ! ! public String generateJavaImportStatements( String namespace ) ! { ! return generateJavaImportStatements(namespace, getJavaImportStatements()); ! } ! ! public String generateEquivalentMethodDeclaration() ! { ! return TAB + getInterface().generateAbsoluteJavaName() + " provide_" + getIdentifier() ! + "();\n"; ! } ! ! /*********************************************************************************************** ! * Local Adapter Generator ! **********************************************************************************************/ ! public String generateFacetAdapterReference() ! { ! return TAB + "private " + getInterface().generateAbsoluteJavaName() + " " + getIdentifier() ! + "FacetAdapter;"; ! } ! ! public String generateEquivalentMethodAdapterLocal() ! { ! return new ProvidesDefEquivalentMethodAdapterLocalTemplate().generate(this); ! } ! ! public String generateNavigationMethodAdapterLocal() ! { ! return new ProvidesDefNavigationMethodAdapterLocalTemplate().generate(this); ! } ! ! /*********************************************************************************************** ! * Application Generator Methods ! **********************************************************************************************/ ! // Code generator methods ------------------------------------------------- ! public String generateEquivalentApplicationMethodDeclaration() ! { ! return TAB + getInterface().generateAbsoluteJavaCcmName() + " get_" + getIdentifier() ! + "();\n"; ! } ! ! public String generateGetMethodImplementation() ! { ! return new ProvidesDefGetMethodImplementationTemplate().generate(this); ! } ! ! public String generateApplicationClass() ! { ! return new ProvidesDefApplicationClassTemplate().generate(this); ! } ! ! // Generate SourceFile objects -------------------------------------------- ! public List<SourceFile> generateApplicationSourceFiles() { List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! String localPackageName = Text.joinList(File.separator, getJavaNamespaceList()); ! String facetName = getComponent().getIdentifier() + getIdentifier(); ! SourceFile applicationClass = new SourceFile(localPackageName, facetName + "Impl.java", ! generateApplicationClass()); ! sourceFileList.add(applicationClass); return sourceFileList; } ! public List<SourceFile> generateAssemblySourceFiles( Model assemblies ) ! { ! Assembly assembly = component.getAssemblyDescription(assemblies, false); ! List<SourceFile> sourceFileList = new ArrayList<SourceFile>(); ! if (assembly != null) ! { ! // TODO ! } ! return sourceFileList; ! } ! /*********************************************************************************************** ! * CORBA Adapter Generator Methods ! **********************************************************************************************/ ! public String generateEquivalentMethodAdapterToCorba() ! { ! return new ProvidesDefEquivalentMethodAdapterToCorbaTemplate().generate(this); ! } ! public String generateEquivalentMethodAdapterFromCorba() ! { ! return new ProvidesDefEquivalentMethodAdapterFromCorbaTemplate().generate(this); ! } ! ! public String generateNavigationMethodAdapterToCorba() ! { ! return new ProvidesDefNavigationMethodAdapterToCorbaTemplate().generate(this); ! } ! ! public String generateNavigationMethodAdapterFromCorba() ! { ! return new ProvidesDefNavigationMethodAdapterFromCorbaTemplate().generate(this); ! } ! ! public String generateFacetAdapterDeclaration() ! { ! return TAB + "private " + getInterface().generateAbsoluteJavaName() + " " + getIdentifier() ! + ";\n"; ! } ! ! public String generateCorbaFacetReferenceDeclaration() ! { ! return TAB + "private " + getInterface().generateAbsoluteIdlName() + " " + getIdentifier() ! + "Facet;\n"; ! } ! ! public String generateCorbaFacetReferenceInit() ! { ! return TAB2 + getIdentifier() + "Facet = null;\n"; ! } } |
From: Robert L. <rle...@us...> - 2007-02-15 13:18:42
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/jet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15719/src/ccmtools/generator/java/templates/jet Added Files: ComponentDefAssemblyClass.jet Log Message: Java assemblies --- NEW FILE: ComponentDefAssemblyClass.jet --- <%@ jet package="ccmtools.generator.java.templates" class="ComponentDefAssemblyClassTemplate" imports="java.util.Iterator ccmtools.generator.java.metamodel.* " %> <% ComponentDef component = (ComponentDef) argument; %> /** * This file was automatically generated by <%=component.generateCcmtoolsVersion()%> * <http://ccmtools.sourceforge.net> * * <%=component.generateCcmIdentifier()%> component business logic. * */ package <%=component.generateJavaNamespace()%>; import Components.CCMException; import Components.SessionContext; <%=component.generateJavaImportStatements()%> /** * This class implements component equivalent and supported interfaces * as well as component attributes. * Additionally, session component callback methods must be implemented. * * // TODO: WRITE YOUR DESCRIPTION HERE ! * * @author * @version */ public class <%=component.getIdentifier()%>Impl implements <%=component.generateCcmIdentifier()%> { /** Supported interface attribute variables */ <% for(Iterator i = component.getSupports().iterator(); i.hasNext();) { SupportsDef supports = (SupportsDef)i.next(); for(Iterator j = supports.getInterface().getAllAttributes().iterator(); j.hasNext();) { AttributeDef attr = (AttributeDef)j.next(); %> <%=attr.generateApplicationDeclaration()%> <% } } %> /** Component attribute variables */ <% for(Iterator i=component.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); %> <%=attr.generateApplicationDeclaration()%> <% } %> public <%=component.generateCcmIdentifier()%>_Context ctx; public <%=component.getIdentifier()%>Impl() { // OPTIONAL: IMPLEMENT ME HERE ! } /* * Supported interface methods */ /** Supported interface attributes */ <% for(Iterator i = component.getSupports().iterator(); i.hasNext();) { SupportsDef supports = (SupportsDef)i.next(); for(Iterator j = supports.getInterface().getAllAttributes().iterator(); j.hasNext();) { AttributeDef attr = (AttributeDef)j.next(); %> <%=attr.generateApplicationImplementation()%> <% } } %> /** Supported interface methods */ <% for(Iterator i = component.getSupports().iterator(); i.hasNext();) { SupportsDef supports = (SupportsDef)i.next(); for(Iterator j = supports.getInterface().getAllOperations().iterator(); j.hasNext();) { OperationDef op = (OperationDef)j.next(); %> <%=op.generateApplicationImplementation()%> <% } } %> /** Component attribute accessor methods */ <% for(Iterator i = component.getAttributes().iterator(); i.hasNext();) { AttributeDef attr = (AttributeDef)i.next(); %> <%=attr.generateApplicationImplementation()%> <% } %> /** Facet implementation factory methods */ <% for(Iterator i = component.getFacet().iterator(); i.hasNext();) { ProvidesDef provides = (ProvidesDef)i.next(); %> <%=provides.generateGetMethodImplementation()%> <% } %> /** Component callback methods */ public void set_session_context(SessionContext ctx) throws CCMException { this.ctx = (<%=component.generateCcmIdentifier()%>_Context)ctx; } public void ccm_activate() throws CCMException { // OPTIONAL: IMPLEMENT ME HERE ! } public void ccm_passivate() throws CCMException { // OPTIONAL: IMPLEMENT ME HERE ! } public void ccm_remove() throws CCMException { // OPTIONAL: IMPLEMENT ME HERE ! } } |
From: Robert L. <rle...@us...> - 2007-02-15 13:18:42
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15719/src/ccmtools/parser/assembly/metamodel Modified Files: ModelElement.java Model.java Log Message: Java assemblies Index: ModelElement.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/ModelElement.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ModelElement.java 14 Feb 2007 12:27:05 -0000 1.4 --- ModelElement.java 15 Feb 2007 13:18:37 -0000 1.5 *************** *** 18,23 **** public abstract class ModelElement { - public static final String IDL_SCOPE = "::"; - protected String name_; --- 18,21 ---- *************** *** 25,29 **** { name_ = name; ! if (name.indexOf(IDL_SCOPE) >= 0) throw new RuntimeException("scoped name!"); } --- 23,27 ---- { name_ = name; ! if (name.indexOf(Model.IDL_SCOPE) >= 0) throw new RuntimeException("scoped name!"); } *************** *** 45,53 **** if (parent_ != null) { ! return parent_.getGlobalName() + IDL_SCOPE + name_; } else { ! return IDL_SCOPE + name_; } } --- 43,51 ---- if (parent_ != null) { ! return parent_.getGlobalName() + Model.IDL_SCOPE + name_; } else { ! return Model.IDL_SCOPE + name_; } } Index: Model.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Model.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Model.java 14 Feb 2007 12:27:05 -0000 1.5 --- Model.java 15 Feb 2007 13:18:37 -0000 1.6 *************** *** 19,22 **** --- 19,24 ---- public class Model { + public static final String IDL_SCOPE = "::"; + private Vector<ModelElement> elements_ = new Vector<ModelElement>(); *************** *** 75,77 **** --- 77,92 ---- } } + + /** + * searches for an assembly description + * + * @param key qualified IDL name of the component + * @return the assembly description (or null) + */ + public Assembly getAssembly( String key ) + { + if (!key.startsWith(IDL_SCOPE)) + key = IDL_SCOPE + key; + return assemblies_.get(key); + } } |