Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12972/src/ccmtools/generator/java/templates Modified Files: ProvidesDefGetMethodAssemblyImplementationTemplate.java ComponentDefAssemblyClassTemplate.java ProvidesDefEquivalentMethodAdapterLocalTemplate.java Log Message: Java Assemblies: new design Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ComponentDefAssemblyClassTemplate.java 20 Mar 2007 10:56:00 -0000 1.10 --- ComponentDefAssemblyClassTemplate.java 21 Mar 2007 12:29:52 -0000 1.11 *************** *** 23,27 **** 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; protected final String TEXT_9 = NL; protected final String TEXT_10 = " " + NL + " " + NL + "" + NL + " /** Component attribute variables */" + NL + " "; --- 23,27 ---- 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 = ", Components.ComponentDelegator" + 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 + " "; *************** *** 33,55 **** protected final String TEXT_16 = "Impl()" + NL + " throws Components.CCMException" + NL + " {" + NL + " \ttry {"; protected final String TEXT_17 = NL; ! protected final String TEXT_18 = " " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new Components.CCMException(e.getMessage(), Components.CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; protected final String TEXT_19 = NL; ! protected final String TEXT_20 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; protected final String TEXT_21 = NL; ! protected final String TEXT_22 = " " + NL + "" + NL + "" + NL + " /** Component attribute accessor methods */" + NL; protected final String TEXT_23 = NL; ! protected final String TEXT_24 = " " + NL + "" + NL + "" + NL + " /** Facet implementation factory methods */" + NL + " "; protected final String TEXT_25 = NL; ! protected final String TEXT_26 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(Components.SessionContext ctx) " + NL + " throws Components.CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_27 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws Components.CCMException" + NL + " {" + NL + " \ttry {" + 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"; ! protected final String TEXT_30 = NL + "\t\t\t"; ! protected final String TEXT_31 = "_.configuration_complete();"; ! protected final String TEXT_32 = NL + NL + "\t\t\tccm_activate_ok = true; " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new Components.CCMException(e.getMessage(), Components.CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws Components.CCMException" + NL + " {" + NL + " // Who calls this method?" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws Components.CCMException" + NL + " {" + NL + " \ttry {"; ! protected final String TEXT_33 = NL + "\t\t\t"; ! protected final String TEXT_34 = "_.remove();"; ! protected final String TEXT_35 = NL + "\t\t} catch(Exception e) {" + NL + " \t\tthrow new Components.CCMException(e.getMessage(), Components.CCMExceptionReason.REMOVE_ERROR);" + NL + "\t\t} " + NL + " }" + NL + "}"; ! protected final String TEXT_36 = NL; public String generate(Object argument) --- 33,61 ---- protected final String TEXT_16 = "Impl()" + NL + " throws Components.CCMException" + NL + " {" + NL + " \ttry {"; protected final String TEXT_17 = NL; ! protected final String TEXT_18 = " " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new Components.CCMException(e.getMessage(), Components.CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + " " + NL + " " + NL + " /*" + NL + " * Components.ComponentDelegator implementation" + NL + " */" + NL + "\t" + NL + "\tpublic Object provide( String name ) throws Components.InvalidName" + NL + "\t{"; protected final String TEXT_19 = NL; ! protected final String TEXT_20 = " " + NL + "\t\tthrow new Components.InvalidName(\"unknown facet: \"+name);" + NL + "\t}" + NL + "" + NL + " public Components.Cookie connect( String name, Object connection )" + NL + "\t\tthrows Components.InvalidName, Components.InvalidConnection," + NL + " Components.AlreadyConnected, Components.ExceededConnectionLimit" + NL + " {"; protected final String TEXT_21 = NL; ! protected final String TEXT_22 = " " + NL + "\t\tthrow new Components.InvalidName(\"unknown receptacle: \"+name);" + NL + " }" + NL + " " + NL + " public void disconnect( String name, Components.Cookie ck )" + NL + " \tthrows Components.InvalidName, Components.InvalidConnection," + NL + " Components.CookieRequired, Components.NoConnection" + NL + " {"; protected final String TEXT_23 = NL; ! protected final String TEXT_24 = " " + NL + "\t\tthrow new Components.InvalidName(\"unknown receptacle: \"+name);" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; protected final String TEXT_25 = NL; ! protected final String TEXT_26 = " " + NL + " " + NL + " " + NL + " /** Supported interface methods */" + NL + " "; ! protected final String TEXT_27 = NL; ! protected final String TEXT_28 = " " + NL + "" + NL + "" + NL + " /** Component attribute accessor methods */" + NL; ! protected final String TEXT_29 = NL; ! protected final String TEXT_30 = " " + NL + "" + NL + "" + NL + " /** Facet implementation factory methods */" + NL + " "; ! protected final String TEXT_31 = NL; ! protected final String TEXT_32 = " " + NL + "" + NL + " /** Component callback methods */" + NL + " " + NL + " public void set_session_context(Components.SessionContext ctx) " + NL + " throws Components.CCMException" + NL + " {" + NL + " this.ctx = ("; ! protected final String TEXT_33 = "_Context)ctx; " + NL + " }" + NL + "" + NL + " public void ccm_activate() " + NL + " throws Components.CCMException" + NL + " {" + NL + " \ttry {" + NL + "\t\t\t// setup inner components \t"; ! protected final String TEXT_34 = NL; ! protected final String TEXT_35 = " " + NL + "" + NL + "\t\t\t// finish configuration \t"; ! protected final String TEXT_36 = NL + "\t\t\t"; ! protected final String TEXT_37 = "_.configuration_complete();"; ! protected final String TEXT_38 = NL + NL + "\t\t\tccm_activate_ok = true; " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new Components.CCMException(e.getMessage()," + NL + " \t\t\tComponents.CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + "" + NL + " public void ccm_passivate() " + NL + " throws Components.CCMException" + NL + " {" + NL + " // Who calls this method?" + NL + " }" + NL + "" + NL + " public void ccm_remove() " + NL + " throws Components.CCMException" + NL + " {" + NL + " \ttry {"; ! protected final String TEXT_39 = NL + "\t\t\t"; ! protected final String TEXT_40 = "_.remove();"; ! protected final String TEXT_41 = NL + "\t\t} catch(Exception e) {" + NL + " \t\tthrow new Components.CCMException(e.getMessage()," + NL + " \t\t\tComponents.CCMExceptionReason.REMOVE_ERROR);" + NL + "\t\t} " + NL + " }" + NL + "}"; ! protected final String TEXT_42 = NL; public String generate(Object argument) *************** *** 122,125 **** --- 128,161 ---- stringBuffer.append(TEXT_18); + for(Iterator i=component.getAssemblyDynamicProvide(); i.hasNext();) + { + + stringBuffer.append(TEXT_19); + stringBuffer.append(i.next().toString()); + + } + + stringBuffer.append(TEXT_20); + + for(Iterator i=component.getAssemblyDynamicConnect(); i.hasNext();) + { + + stringBuffer.append(TEXT_21); + stringBuffer.append(i.next().toString()); + + } + + stringBuffer.append(TEXT_22); + + for(Iterator i=component.getAssemblyDynamicDisconnect(); i.hasNext();) + { + + stringBuffer.append(TEXT_23); + stringBuffer.append(i.next().toString()); + + } + + stringBuffer.append(TEXT_24); + for(Iterator i = component.getSupports().iterator(); i.hasNext();) { *************** *** 129,133 **** AttributeDef attr = (AttributeDef)j.next(); ! stringBuffer.append(TEXT_19); stringBuffer.append(attr.generateApplicationImplementation()); --- 165,169 ---- AttributeDef attr = (AttributeDef)j.next(); ! stringBuffer.append(TEXT_25); stringBuffer.append(attr.generateApplicationImplementation()); *************** *** 135,139 **** } ! stringBuffer.append(TEXT_20); for(Iterator i = component.getSupports().iterator(); i.hasNext();) --- 171,175 ---- } ! stringBuffer.append(TEXT_26); for(Iterator i = component.getSupports().iterator(); i.hasNext();) *************** *** 144,148 **** OperationDef op = (OperationDef)j.next(); ! stringBuffer.append(TEXT_21); stringBuffer.append(op.generateApplicationImplementation()); --- 180,184 ---- OperationDef op = (OperationDef)j.next(); ! stringBuffer.append(TEXT_27); stringBuffer.append(op.generateApplicationImplementation()); *************** *** 150,154 **** } ! stringBuffer.append(TEXT_22); for(Iterator i = component.getAttributes().iterator(); i.hasNext();) --- 186,190 ---- } ! stringBuffer.append(TEXT_28); for(Iterator i = component.getAttributes().iterator(); i.hasNext();) *************** *** 156,165 **** AttributeDef attr = (AttributeDef)i.next(); ! stringBuffer.append(TEXT_23); stringBuffer.append(attr.generateAssemblyImplementation(component.getAssemblyAttributeTarget(attr.getIdentifier()))); } ! stringBuffer.append(TEXT_24); for(Iterator i = component.getFacet().iterator(); i.hasNext();) --- 192,201 ---- AttributeDef attr = (AttributeDef)i.next(); ! stringBuffer.append(TEXT_29); stringBuffer.append(attr.generateAssemblyImplementation(component.getAssemblyAttributeTarget(attr.getIdentifier()))); } ! stringBuffer.append(TEXT_30); for(Iterator i = component.getFacet().iterator(); i.hasNext();) *************** *** 167,211 **** ProvidesDef provides = (ProvidesDef)i.next(); ! stringBuffer.append(TEXT_25); stringBuffer.append(provides.generateGetMethodAssemblyImplementation()); } ! stringBuffer.append(TEXT_26); stringBuffer.append(component.generateCcmIdentifier()); ! 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); for (String key : component.getAssemblyLocalComponents().keySet()) { ! stringBuffer.append(TEXT_33); stringBuffer.append(key); ! stringBuffer.append(TEXT_34); } ! stringBuffer.append(TEXT_35); ! stringBuffer.append(TEXT_36); return stringBuffer.toString(); } --- 203,247 ---- ProvidesDef provides = (ProvidesDef)i.next(); ! stringBuffer.append(TEXT_31); stringBuffer.append(provides.generateGetMethodAssemblyImplementation()); } ! stringBuffer.append(TEXT_32); stringBuffer.append(component.generateCcmIdentifier()); ! stringBuffer.append(TEXT_33); ! for(Iterator i=component.getAssemblyActivate(); i.hasNext();) { ! stringBuffer.append(TEXT_34); stringBuffer.append(i.next().toString()); } ! stringBuffer.append(TEXT_35); for (String key : component.getAssemblyLocalComponents().keySet()) { ! stringBuffer.append(TEXT_36); stringBuffer.append(key); ! stringBuffer.append(TEXT_37); } ! stringBuffer.append(TEXT_38); for (String key : component.getAssemblyLocalComponents().keySet()) { ! stringBuffer.append(TEXT_39); stringBuffer.append(key); ! stringBuffer.append(TEXT_40); } ! stringBuffer.append(TEXT_41); ! stringBuffer.append(TEXT_42); return stringBuffer.toString(); } Index: ProvidesDefGetMethodAssemblyImplementationTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ProvidesDefGetMethodAssemblyImplementationTemplate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ProvidesDefGetMethodAssemblyImplementationTemplate.java 27 Feb 2007 08:28:15 -0000 1.4 --- ProvidesDefGetMethodAssemblyImplementationTemplate.java 21 Mar 2007 12:29:51 -0000 1.5 *************** *** 20,31 **** protected final String TEXT_4 = "_;" + NL + "" + NL + " public "; protected final String TEXT_5 = " get_"; ! protected final String TEXT_6 = "()" + NL + " {" + NL + " \t"; ! protected final String TEXT_7 = "_ = new "; ! protected final String TEXT_8 = "."; ! protected final String TEXT_9 = "Impl(this);" + NL + " \tif(ccm_activate_ok) {" + NL + " \t\t"; ! protected final String TEXT_10 = "_.target = "; ! protected final String TEXT_11 = ";" + NL + " \t}" + NL + " \treturn "; ! protected final String TEXT_12 = "_;" + NL + " }"; ! protected final String TEXT_13 = NL; public String generate(Object argument) --- 20,30 ---- 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) *************** *** 49,64 **** stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_7); - stringBuffer.append(provides.generateJavaNamespace()); - stringBuffer.append(TEXT_8); - stringBuffer.append(provides.getComponent().getIdentifier()); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_9); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_10); - stringBuffer.append(provides.getComponent().getAssemblyInitFacetTargetValue(provides)); - stringBuffer.append(TEXT_11); stringBuffer.append(provides.getIdentifier()); stringBuffer.append(TEXT_12); - stringBuffer.append(TEXT_13); return stringBuffer.toString(); } --- 48,61 ---- 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(); } Index: ProvidesDefEquivalentMethodAdapterLocalTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ProvidesDefEquivalentMethodAdapterLocalTemplate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ProvidesDefEquivalentMethodAdapterLocalTemplate.java 20 Mar 2007 14:05:21 -0000 1.4 --- ProvidesDefEquivalentMethodAdapterLocalTemplate.java 21 Mar 2007 12:29:52 -0000 1.5 *************** *** 18,23 **** protected final String TEXT_2 = " provide_"; protected final String TEXT_3 = "()" + NL + " {" + NL + " logger.fine(\"\");" + NL + " if("; ! protected final String TEXT_4 = "FacetAdapter == null)" + NL + " {" + NL + " \tif(delegator!=null)" + NL + " \t{" + NL + " \t\tObject o = delegator.provide(\""; ! protected final String TEXT_5 = "\");" + NL + " \t\tif(o!=null)" + NL + " \t\t{" + NL + " \t\t\t"; protected final String TEXT_6 = "FacetAdapter =" + NL + " \t\t\t\t("; protected final String TEXT_7 = ")o;" + NL + " \t\t\treturn "; --- 18,23 ---- protected final String TEXT_2 = " provide_"; protected final String TEXT_3 = "()" + NL + " {" + NL + " logger.fine(\"\");" + NL + " if("; ! protected final String TEXT_4 = "FacetAdapter == null)" + NL + " {" + NL + " \tif(delegator!=null)" + NL + " \t{" + NL + " \t\tObject o;" + NL + " \t\ttry {" + NL + " \t\t\to = delegator.provide(\""; ! protected final String TEXT_5 = "\");" + NL + " \t\t} catch(Components.InvalidName e) {" + NL + " \t\t\tthrow new RuntimeException(\"internal error: \"+e.getMessage());" + NL + " \t\t}" + NL + " \t\tif(o!=null)" + NL + " \t\t{" + NL + " \t\t\t"; protected final String TEXT_6 = "FacetAdapter =" + NL + " \t\t\t\t("; protected final String TEXT_7 = ")o;" + NL + " \t\t\treturn "; |