From: Robert L. <rle...@us...> - 2007-04-12 15:24:20
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv5682/src/ccmtools/generator/java/templates Modified Files: ComponentDefAssemblyClassTemplate.java ExceptionDefReasonConstructorTemplate.java ExceptionDefImplementationTemplate.java ExceptionDefConstructorTemplate.java ExceptionDefDefaultConstructorTemplate.java Log Message: *) UserException now calculates the repo-id *) all CCM-exceptions copy the message text to java.lang.Exception *) some small updates Index: ExceptionDefDefaultConstructorTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ExceptionDefDefaultConstructorTemplate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExceptionDefDefaultConstructorTemplate.java 27 Jul 2006 14:19:53 -0000 1.4 --- ExceptionDefDefaultConstructorTemplate.java 12 Apr 2007 15:24:15 -0000 1.5 *************** *** 17,21 **** protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = " public "; ! protected final String TEXT_2 = "() " + NL + " {" + NL + " super(REPOSITORY_ID);"; protected final String TEXT_3 = NL + " "; protected final String TEXT_4 = "("; --- 17,21 ---- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = " public "; ! protected final String TEXT_2 = "() " + NL + " {" + NL + " super();"; protected final String TEXT_3 = NL + " "; protected final String TEXT_4 = "("; Index: ComponentDefAssemblyClassTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ComponentDefAssemblyClassTemplate.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ComponentDefAssemblyClassTemplate.java 21 Mar 2007 12:29:52 -0000 1.11 --- ComponentDefAssemblyClassTemplate.java 12 Apr 2007 15:24:14 -0000 1.12 *************** *** 33,37 **** 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 + " {"; --- 33,37 ---- 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(" + NL + " \t\t\t\"assembly creation failed: \"+e.getMessage()," + NL + " \t\t\tComponents.CCMExceptionReason.CREATE_ERROR, e);" + 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 + " {"; *************** *** 53,57 **** 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();"; --- 53,57 ---- 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(" + NL + " \t\t\t\"assembly configuration failed: \"+e.getMessage()," + NL + " \t\t\tComponents.CCMExceptionReason.CREATE_ERROR, e);" + 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();"; Index: ExceptionDefConstructorTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ExceptionDefConstructorTemplate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExceptionDefConstructorTemplate.java 27 Jul 2006 14:19:53 -0000 1.3 --- ExceptionDefConstructorTemplate.java 12 Apr 2007 15:24:14 -0000 1.4 *************** *** 18,28 **** protected final String TEXT_1 = " public "; protected final String TEXT_2 = "("; ! protected final String TEXT_3 = ") " + NL + " {" + NL + " super(REPOSITORY_ID);"; protected final String TEXT_4 = NL + " "; protected final String TEXT_5 = "("; protected final String TEXT_6 = ");"; protected final String TEXT_7 = NL + " }" + NL + " " + NL + " public "; ! protected final String TEXT_8 = "(String reason, "; ! protected final String TEXT_9 = ") " + NL + " {" + NL + " super(REPOSITORY_ID + \" \" + reason);"; protected final String TEXT_10 = NL + " "; protected final String TEXT_11 = "("; --- 18,28 ---- protected final String TEXT_1 = " public "; protected final String TEXT_2 = "("; ! protected final String TEXT_3 = ") " + NL + " {" + NL + " super();"; protected final String TEXT_4 = NL + " "; protected final String TEXT_5 = "("; protected final String TEXT_6 = ");"; protected final String TEXT_7 = NL + " }" + NL + " " + NL + " public "; ! protected final String TEXT_8 = "(String _reason, "; ! protected final String TEXT_9 = ") " + NL + " {" + NL + " super(_reason);"; protected final String TEXT_10 = NL + " "; protected final String TEXT_11 = "("; Index: ExceptionDefImplementationTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ExceptionDefImplementationTemplate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExceptionDefImplementationTemplate.java 10 Jan 2007 16:19:14 -0000 1.6 --- ExceptionDefImplementationTemplate.java 12 Apr 2007 15:24:14 -0000 1.7 *************** *** 21,27 **** protected final String TEXT_4 = NL; protected final String TEXT_5 = NL + " " + NL + "public class "; ! protected final String TEXT_6 = " " + NL + " extends Components.UserException" + NL + "{" + NL + " private static final String REPOSITORY_ID = \""; ! protected final String TEXT_7 = "\";" + NL + " "; ! protected final String TEXT_8 = NL + " "; protected final String TEXT_9 = NL; protected final String TEXT_10 = NL; --- 21,27 ---- protected final String TEXT_4 = NL; protected final String TEXT_5 = NL + " " + NL + "public class "; ! protected final String TEXT_6 = " " + NL + " extends Components.UserException" + NL + "{"; ! protected final String TEXT_7 = NL + " "; ! protected final String TEXT_8 = NL; protected final String TEXT_9 = NL; protected final String TEXT_10 = NL; *************** *** 29,35 **** protected final String TEXT_12 = NL; protected final String TEXT_13 = NL; ! protected final String TEXT_14 = NL; ! protected final String TEXT_15 = NL + NL + "}"; ! protected final String TEXT_16 = NL; public String generate(Object argument) --- 29,34 ---- protected final String TEXT_12 = NL; protected final String TEXT_13 = NL; ! protected final String TEXT_14 = NL + NL + "}"; ! protected final String TEXT_15 = NL; public String generate(Object argument) *************** *** 47,52 **** stringBuffer.append( exception.getIdentifier() ); stringBuffer.append(TEXT_6); - stringBuffer.append(exception.generateRepositoryId()); - stringBuffer.append(TEXT_7); for(Iterator i=exception.getFields().iterator(); i.hasNext();) --- 46,49 ---- *************** *** 54,69 **** FieldDef field = (FieldDef)i.next(); ! stringBuffer.append(TEXT_8); stringBuffer.append(field.generateDeclaration()); } stringBuffer.append(TEXT_9); - stringBuffer.append(TEXT_10); stringBuffer.append(exception.generateDefaultConstructor()); stringBuffer.append(TEXT_11); - stringBuffer.append(TEXT_12); stringBuffer.append(exception.generateConstructor()); ! stringBuffer.append(TEXT_13); for(Iterator i=exception.getFields().iterator(); i.hasNext();) --- 51,66 ---- FieldDef field = (FieldDef)i.next(); ! stringBuffer.append(TEXT_7); stringBuffer.append(field.generateDeclaration()); } + stringBuffer.append(TEXT_8); stringBuffer.append(TEXT_9); stringBuffer.append(exception.generateDefaultConstructor()); + stringBuffer.append(TEXT_10); stringBuffer.append(TEXT_11); stringBuffer.append(exception.generateConstructor()); ! stringBuffer.append(TEXT_12); for(Iterator i=exception.getFields().iterator(); i.hasNext();) *************** *** 71,81 **** FieldDef field = (FieldDef)i.next(); ! stringBuffer.append(TEXT_14); stringBuffer.append(field.generateAccessors()); } stringBuffer.append(TEXT_15); - stringBuffer.append(TEXT_16); return stringBuffer.toString(); } --- 68,78 ---- FieldDef field = (FieldDef)i.next(); ! stringBuffer.append(TEXT_13); stringBuffer.append(field.generateAccessors()); } + stringBuffer.append(TEXT_14); stringBuffer.append(TEXT_15); return stringBuffer.toString(); } Index: ExceptionDefReasonConstructorTemplate.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/generator/java/templates/ExceptionDefReasonConstructorTemplate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExceptionDefReasonConstructorTemplate.java 27 Jul 2006 14:19:53 -0000 1.4 --- ExceptionDefReasonConstructorTemplate.java 12 Apr 2007 15:24:14 -0000 1.5 *************** *** 16,20 **** protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = " public "; ! protected final String TEXT_2 = "(String reason) " + NL + " {" + NL + " super(REPOSITORY_ID + \" \" + reason);" + NL + " }"; protected final String TEXT_3 = NL; --- 16,20 ---- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; protected final String TEXT_1 = " public "; ! protected final String TEXT_2 = "(String _reason) " + NL + " {" + NL + " super(_reason);" + NL + " }"; protected final String TEXT_3 = NL; |