From: Robert L. <rle...@us...> - 2007-02-27 12:36:20
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21862/src/ccmtools/generator/java/templates Modified Files: ComponentDefAssemblyClassTemplate.java Added Files: AttributeDefAssemblyImplementationTemplate.java Log Message: now support "set attribute" after "configuration complete" Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ComponentDefAssemblyClassTemplate.java 27 Feb 2007 08:28:16 -0000 1.8 --- ComponentDefAssemblyClassTemplate.java 27 Feb 2007 12:36:16 -0000 1.9 *************** *** 31,35 **** protected final String TEXT_14 = " " + NL + "" + NL + " public "; protected final String TEXT_15 = "_Context ctx;" + NL + " " + NL + " private boolean ccm_activate_ok;" + NL + "" + NL + " " + NL + " public "; ! protected final String TEXT_16 = "Impl()" + NL + " throws CCMException" + NL + " {" + NL + " \ttry {" + NL + "\t\t\t// create inner components \t"; protected final String TEXT_17 = NL; protected final String TEXT_18 = " " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new CCMException(e.getMessage(), CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; --- 31,35 ---- protected final String TEXT_14 = " " + NL + "" + NL + " public "; protected final String TEXT_15 = "_Context ctx;" + NL + " " + NL + " private boolean ccm_activate_ok;" + NL + "" + NL + " " + NL + " public "; ! protected final String TEXT_16 = "Impl()" + NL + " throws CCMException" + NL + " {" + NL + " \ttry {"; protected final String TEXT_17 = NL; protected final String TEXT_18 = " " + NL + " \t} catch(Exception e) {" + NL + " \t\tthrow new CCMException(e.getMessage(), CCMExceptionReason.CREATE_ERROR);" + NL + " \t}" + NL + " }" + NL + "" + NL + "" + NL + " /* " + NL + " * Supported interface methods " + NL + " */" + NL + "" + NL + " /** Supported interface attributes */" + NL; *************** *** 157,161 **** stringBuffer.append(TEXT_23); ! stringBuffer.append(attr.generateApplicationImplementation()); } --- 157,161 ---- stringBuffer.append(TEXT_23); ! stringBuffer.append(attr.generateAssemblyImplementation(component.getAssemblyAttributeTarget(attr.getIdentifier()))); } --- NEW FILE: AttributeDefAssemblyImplementationTemplate.java --- package ccmtools.generator.java.templates; import ccmtools.generator.java.metamodel.*; public class AttributeDefAssemblyImplementationTemplate { protected static String nl; public static synchronized AttributeDefAssemblyImplementationTemplate create(String lineSeparator) { nl = lineSeparator; AttributeDefAssemblyImplementationTemplate result = new AttributeDefAssemblyImplementationTemplate(); 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 = " "; protected final String TEXT_3 = "()" + NL + " throws CCMException" + NL + " {" + NL + " return this."; protected final String TEXT_4 = "_;" + NL + " } " + NL + "" + NL + " public void "; protected final String TEXT_5 = "("; protected final String TEXT_6 = " value)" + NL + " throws CCMException" + NL + " {" + NL + " this."; protected final String TEXT_7 = "_ = value;"; protected final String TEXT_8 = NL; protected final String TEXT_9 = " " + NL + " }"; protected final String TEXT_10 = NL; public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); AttributeDef attr = (AttributeDef) argument; stringBuffer.append(TEXT_1); stringBuffer.append(attr.getType().generateJavaMapping()); stringBuffer.append(TEXT_2); stringBuffer.append(attr.getIdentifier()); stringBuffer.append(TEXT_3); stringBuffer.append(attr.getIdentifier()); stringBuffer.append(TEXT_4); stringBuffer.append(attr.getIdentifier()); stringBuffer.append(TEXT_5); stringBuffer.append(attr.getType().generateJavaMapping()); stringBuffer.append(TEXT_6); stringBuffer.append(attr.getIdentifier()); stringBuffer.append(TEXT_7); for(String code:attr.assembly_extra_code) { stringBuffer.append(TEXT_8); stringBuffer.append(code); } stringBuffer.append(TEXT_9); stringBuffer.append(TEXT_10); return stringBuffer.toString(); } } |