« Return to Thread: [legstar-transport-dev] [39] trunk: Chaged cjheckstyle rules to those defined at http://www.muleforge.org/download/checkstyle.xml?version=1.
by fady-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View in Thread
Chaged cjheckstyle rules to those defined at http://www.muleforge.org/download/checkstyle.xml?version=1. Had to tweak it though because I devlop on a windows machine but keep properties files with UNIX style LF. Checkstyle does not like that so I removed the rule concerning end of files.
--- trunk/codecheck/checkstyle.xml (rev 0) +++ trunk/codecheck/checkstyle.xml 2008-07-24 07:37:16 UTC (rev 39) @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + This configuration file was written by the eclipse-cs plugin configuration editor +--> +<!-- + Checkstyle-Configuration: MuleForge checkstyle + Description: none +--> +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> +<module name="Checker"> + <property name="severity" value="warning"/> + <module name="TreeWalker"> + <property name="tabWidth" value="4"/> + <module name="JavadocMethod"/> + <module name="JavadocType"/> + <module name="JavadocVariable"/> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MethodName"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + <module name="MemberName"/> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="FileLength"/> + <module name="ParameterNumber"/> + <module name="EmptyForIteratorPad"/> + <module name="NoWhitespaceAfter"/> + <module name="NoWhitespaceBefore"/> + <module name="OperatorWrap"/> + <module name="TabCharacter"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"/> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"/> + <module name="NeedBraces"/> + <module name="LeftCurly"> + <property name="option" value="nl"/> + </module> + <module name="RightCurly"> + <property name="option" value="alone"/> + </module> + <module name="AvoidInlineConditionals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + <module name="EqualsHashCode"/> + <module name="HiddenField"/> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <module name="MagicNumber"/> + <module name="MissingSwitchDefault"/> + <module name="RedundantThrows"/> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + <module name="DesignForExtension"/> + <module name="FinalClass"/> + <module name="HideUtilityClassConstructor"/> + <module name="InterfaceIsType"/> + <module name="VisibilityModifier"/> + <module name="TodoComment"/> + <module name="UpperEll"/> + </module> + <module name="NewlineAtEndOfFile"> + <property name="severity" value="ignore"/> + </module> + <module name="Translation"/> +</module>
--- trunk/pom.xml 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/pom.xml 2008-07-24 07:37:16 UTC (rev 39) @@ -54,6 +54,7 @@ <url>dav:https://dav.muleforge.org/legstar-transport/maven</url> </site> </distributionManagement> + <repositories> <repository> <id>LegStar distribution</id> @@ -87,6 +88,7 @@ <url>http://download.java.net/maven/2</url> </repository> </repositories> + <build> <extensions> <extension> @@ -121,4 +123,24 @@ <module>tools</module> </modules> + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <links> + <link>http://java.sun.com/j2ee/1.4/docs/api</link> + <link>http://java.sun.com/j2se/1.4.2/docs/api</link> + <link>http://java.sun.com/j2se/1.5.0/docs/api</link> + </links> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> + </project> \ No newline at end of file
--- trunk/tools/pom.xml 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/pom.xml 2008-07-24 07:37:16 UTC (rev 39) @@ -54,6 +54,7 @@ <url>dav:https://dav.muleforge.org/legstar-transport/maven</url> </site> </distributionManagement> + <repositories> <repository> <id>LegStar distribution</id> @@ -87,6 +88,7 @@ <url>http://download.java.net/maven/2</url> </repository> </repositories> + <build> <extensions> <extension> @@ -115,6 +117,70 @@ </plugin> </plugins> </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <configuration> + <configLocation>../codecheck/checkstyle.xml</configLocation> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <targetJdk>1.5</targetJdk> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>taglist-maven-plugin</artifactId> + <configuration> + <tags> + <tag>TODO</tag> + <tag>@todo</tag> + <tag>FIXME</tag> + <tag>@fixme</tag> + <tag>@deprecated</tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jxr-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <links> + <link>http://java.sun.com/j2ee/1.4/docs/api</link> + <link>http://java.sun.com/j2se/1.4.2/docs/api</link> + <link>http://java.sun.com/j2se/1.5.0/docs/api</link> + </links> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> + <dependencies> <dependency> <groupId>org.apache.velocity</groupId>
--- trunk/tools/src/main/java/org/mule/providers/legstar/gen/AbstractCixsMuleGenerator.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/gen/AbstractCixsMuleGenerator.java 2008-07-24 07:37:16 UTC (rev 39) @@ -23,7 +23,8 @@ /** * This class groups methods that are common to all generators. */ -public abstract class AbstractCixsMuleGenerator extends AbstractCixsGenerator { +public abstract class AbstractCixsMuleGenerator extends AbstractCixsGenerator +{ /** This generator name. */ public static final String CIXS_MULE_GENERATOR_NAME = @@ -92,10 +93,11 @@ * Constructor. * @param model an instance of a generation model */ - public AbstractCixsMuleGenerator(final AbstractAntBuildCixsMuleModel model) { + public AbstractCixsMuleGenerator(final AbstractAntBuildCixsMuleModel model) + { super(model); } - + /** * Create the Mule Interface class file. * @param component the Mule component description @@ -107,7 +109,8 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_INTERFACE_VLC_TEMPLATE, COMPONENT_MODEL_NAME, @@ -128,7 +131,8 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_IMPLEMENTATION_VLC_TEMPLATE, COMPONENT_MODEL_NAME, @@ -149,7 +153,8 @@ final CixsOperation operation, final Map < String, Object > parameters, final File componentPropertiesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(Jaxws2CixsGenerator.JAXWS_TO_CIXS_GENERATOR_NAME, Jaxws2CixsGenerator.OPERATION_PROGRAM_VLC_TEMPLATE, "cixsOperation", @@ -170,7 +175,8 @@ final CixsOperation operation, final Map < String, Object > parameters, final File operationClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, OPERATION_FAULT_VLC_TEMPLATE, "cixsOperation", @@ -191,14 +197,17 @@ final CixsOperation operation, final Map < String, Object > parameters, final File operationClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { if (operation.getCicsChannel() == null - || operation.getCicsChannel().length() == 0) { + || operation.getCicsChannel().length() == 0) + { return; } - if (operation.getInput().size() > 0) { + if (operation.getInput().size() > 0) + { parameters.put("propertyName", "Request"); generateFile(CIXS_MULE_GENERATOR_NAME, OPERATION_HOLDER_VLC_TEMPLATE, @@ -208,7 +217,8 @@ operationClassFilesDir, operation.getRequestHolderType() + ".java"); } - if (operation.getOutput().size() > 0) { + if (operation.getOutput().size() > 0) + { parameters.put("propertyName", "Response"); generateFile(CIXS_MULE_GENERATOR_NAME, OPERATION_HOLDER_VLC_TEMPLATE, @@ -231,14 +241,15 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentAntFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_ANT_BUILD_JAR_VLC_TEMPLATE, COMPONENT_MODEL_NAME, component, parameters, componentAntFilesDir, - "build.xml"); + "build.xml"); } /** @@ -255,7 +266,8 @@ final Map < String, Object > parameters, final File componentAntFilesDir, final String configFileName) - throws CodeGenMakeException { + throws CodeGenMakeException + { parameters.put("configFileName", configFileName); generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_ANT_START_MULE_VLC_TEMPLATE, @@ -277,7 +289,8 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentConfFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_STANDALONE_CONFIG_XML_VLC_TEMPLATE, COMPONENT_MODEL_NAME, @@ -298,7 +311,8 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentAntFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateAntStartMule(component, parameters, componentAntFilesDir, @@ -317,15 +331,18 @@ final CixsOperation operation, final Map < String, Object > parameters, final File operationClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { - if (operation.getInput().size() > 0) { + if (operation.getInput().size() > 0) + { generateObjectToHbaTransformer(operation, parameters, operationClassFilesDir, operation.getRequestHolderType(), "Request"); } - if (operation.getOutput().size() > 0) { + if (operation.getOutput().size() > 0) + { generateObjectToHbaTransformer(operation, parameters, operationClassFilesDir, operation.getResponseHolderType(), @@ -348,7 +365,8 @@ final File operationClassFilesDir, final String holderType, final String propertyName) - throws CodeGenMakeException { + throws CodeGenMakeException + { parameters.put("propertyName", propertyName); generateFile(CIXS_MULE_GENERATOR_NAME, @@ -372,15 +390,18 @@ final CixsOperation operation, final Map < String, Object > parameters, final File operationClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { - if (operation.getInput().size() > 0) { + if (operation.getInput().size() > 0) + { generateHbaToObjectTransformer(operation, parameters, operationClassFilesDir, operation.getRequestHolderType(), "Request"); } - if (operation.getOutput().size() > 0) { + if (operation.getOutput().size() > 0) + { generateHbaToObjectTransformer(operation, parameters, operationClassFilesDir, operation.getResponseHolderType(), @@ -403,7 +424,8 @@ final File operationClassFilesDir, final String holderType, final String propertyName) - throws CodeGenMakeException { + throws CodeGenMakeException + { parameters.put("propertyName", propertyName); generateFile(CIXS_MULE_GENERATOR_NAME, @@ -427,15 +449,18 @@ final CixsOperation operation, final Map < String, Object > parameters, final File operationClassFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { - if (operation.getInput().size() > 0) { + if (operation.getInput().size() > 0) + { generateObjectToHttpResponseTransformer(operation, parameters, operationClassFilesDir, operation.getRequestHolderType(), "Request"); } - if (operation.getOutput().size() > 0) { + if (operation.getOutput().size() > 0) + { generateObjectToHttpResponseTransformer(operation, parameters, operationClassFilesDir, operation.getResponseHolderType(), @@ -458,11 +483,12 @@ final File operationClassFilesDir, final String holderType, final String propertyName) - throws CodeGenMakeException { + throws CodeGenMakeException + { - parameters.put("propertyName", propertyName); - generateFile(CIXS_MULE_GENERATOR_NAME, - OPERATION_OBJECT_TO_HTTP_RESPONSE_VLC_TEMPLATE, + parameters.put("propertyName", propertyName); + generateFile(CIXS_MULE_GENERATOR_NAME, + OPERATION_OBJECT_TO_HTTP_RESPONSE_VLC_TEMPLATE, "cixsOperation", operation, parameters, @@ -481,14 +507,15 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentConfFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_BRIDGE_CONFIG_XML_VLC_TEMPLATE, - COMPONENT_MODEL_NAME, - component, - parameters, - componentConfFilesDir, - "mule-bridge-config-" + component.getName() + ".xml"); + COMPONENT_MODEL_NAME, + component, + parameters, + componentConfFilesDir, + "mule-bridge-config-" + component.getName() + ".xml"); } /** @@ -502,7 +529,8 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentAntFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateAntStartMule(component, parameters, componentAntFilesDir, @@ -520,14 +548,15 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentConfFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, COMPONENT_LOCAL_CONFIG_XML_VLC_TEMPLATE, - COMPONENT_MODEL_NAME, - component, - parameters, - componentConfFilesDir, - "mule-local-config-" + component.getName() + ".xml"); + COMPONENT_MODEL_NAME, + component, + parameters, + componentConfFilesDir, + "mule-local-config-" + component.getName() + ".xml"); } /** @@ -541,7 +570,8 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentAntFilesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateAntStartMule(component, parameters, componentAntFilesDir, @@ -559,20 +589,22 @@ final CixsMuleComponent component, final Map < String, Object > parameters, final File componentPropertiesDir) - throws CodeGenMakeException { + throws CodeGenMakeException + { generateFile(CIXS_MULE_GENERATOR_NAME, - COMPONENT_LOG4J_PROP_VLC_TEMPLATE, - COMPONENT_MODEL_NAME, - component, - parameters, - componentPropertiesDir, - "log4j" + ".properties"); + COMPONENT_LOG4J_PROP_VLC_TEMPLATE, + COMPONENT_MODEL_NAME, + component, + parameters, + componentPropertiesDir, + "log4j" + ".properties"); } /** * @return the Mule component */ - public final CixsMuleComponent getCixsMuleComponent() { + public final CixsMuleComponent getCixsMuleComponent() + { return (CixsMuleComponent) getCixsService(); } @@ -580,14 +612,16 @@ * @param cixsMuleComponent the Mule component to set */ public final void setCixsMuleComponent( - final CixsMuleComponent cixsMuleComponent) { + final CixsMuleComponent cixsMuleComponent) + { setCixsService(cixsMuleComponent); } /** * @param cixsMuleComponent the Mule component to set */ - public final void add(final CixsMuleComponent cixsMuleComponent) { + public final void add(final CixsMuleComponent cixsMuleComponent) + { setCixsMuleComponent(cixsMuleComponent); } @@ -595,57 +629,68 @@ * @param cixsMuleComponent the Mule component to set */ public final void addCixsMuleComponent( - final CixsMuleComponent cixsMuleComponent) { + final CixsMuleComponent cixsMuleComponent) + { setCixsMuleComponent(cixsMuleComponent); } /** * @return the target mule jar files location */ - public final File getTargetJarDir() { + public final File getTargetJarDir() + { return getModel().getTargetJarDir(); } /** * @param targetJarDir the target mule jar files location to set */ - public final void setTargetJarDir(final File targetJarDir) { + public final void setTargetJarDir(final File targetJarDir) + { getModel().setTargetJarDir(targetJarDir); } /** * @return the target configuration files location */ - public final File getTargetMuleConfigDir() { + public final File getTargetMuleConfigDir() + { return getModel().getTargetMuleConfigDir(); } /** * @param targetMuleConfigDir the target configuration files location to set */ - public final void setTargetMuleConfigDir(final File targetMuleConfigDir) { + public final void setTargetMuleConfigDir(final File targetMuleConfigDir) + { getModel().setTargetMuleConfigDir(targetMuleConfigDir); } - + /** * @return the model representing all generation parameters */ - public AbstractAntBuildCixsMuleModel getModel() { + public final AbstractAntBuildCixsMuleModel getModel() + { return (AbstractAntBuildCixsMuleModel) super.getModel(); } /** {@inheritDoc} */ - public String getGeneratorName() { + public final String getGeneratorName() + { return CIXS_MULE_GENERATOR_NAME; } - + /** * @return the directory from which this ant script is start */ - public String getGenerateBuildDir() { - if (getProject() == null) { + public final String getGenerateBuildDir() + { + if (getProject() == null) + { return "."; - } else { + } + else + { return getProject().getBaseDir().getAbsolutePath(); } }
--- trunk/tools/src/main/java/org/mule/providers/legstar/gen/Cixs2MuleGenerator.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/gen/Cixs2MuleGenerator.java 2008-07-24 07:37:16 UTC (rev 39) @@ -30,12 +30,14 @@ * POJO within Mule. * */ -public class Cixs2MuleGenerator extends AbstractCixsMuleGenerator { +public class Cixs2MuleGenerator extends AbstractCixsMuleGenerator +{ /** * Constructor. */ - public Cixs2MuleGenerator() { + public Cixs2MuleGenerator() + { super(new AntBuildCixs2MuleModel()); } @@ -43,8 +45,10 @@ * Check that input values are valid. * @throws CodeGenMakeException if input is invalid */ - public void checkExtendedInput() throws CodeGenMakeException { - try { + public final void checkExtendedInput() throws CodeGenMakeException + { + try + { CodeGenUtil.checkDirectory( getTargetAntDir(), true, "TargetAntDir"); CodeGenUtil.checkDirectory( @@ -57,14 +61,18 @@ /* Check that we have CICS program names mapped to operations */ for (CixsOperation operation - : getCixsMuleComponent().getCixsOperations()) { + : getCixsMuleComponent().getCixsOperations()) + { String cicsProgramName = operation.getCicsProgramName(); - if (cicsProgramName == null || cicsProgramName.length() == 0) { + if (cicsProgramName == null || cicsProgramName.length() == 0) + { throw new CodeGenMakeException( "Operation must specify a CICS program name"); } } - } catch (IllegalArgumentException e) { + } + catch (IllegalArgumentException e) + { throw new CodeGenMakeException(e); } } @@ -73,8 +81,9 @@ * @param parameters a predefined set of parameters useful for generation * @throws CodeGenMakeException if generation fails */ - public void generate( - final Map < String, Object > parameters) throws CodeGenMakeException { + public final void generate( + final Map < String, Object > parameters) throws CodeGenMakeException + { parameters.put("targetJarDir", getTargetJarDir()); parameters.put("targetMuleConfigDir", getTargetMuleConfigDir()); @@ -105,7 +114,8 @@ generateLog4jProperties( getCixsMuleComponent(), parameters, operationPropertiesFilesDir); - for (CixsOperation operation : getCixsOperations()) { + for (CixsOperation operation : getCixsOperations()) + { /* Determine target files locations */ File operationClassFilesDir = CodeGenUtil.classFilesLocation( getTargetSrcDir(), operation.getPackageName(), true); @@ -138,7 +148,8 @@ final CixsMuleComponent component, final CixsOperation operation, final Map < String, Object > parameters, - final File cobolFilesDir) throws CodeGenMakeException { + final File cobolFilesDir) throws CodeGenMakeException + { generateFile(Cixs2JaxwsGenerator.CIXS_TO_JAXWS_GENERATOR_NAME, Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_CLIENT_VLC_TEMPLATE, Cixs2JaxwsGenerator.SERVICE_MODEL_NAME, @@ -151,27 +162,25 @@ /** * @return the directory where COBOL files will be created */ - public final File getTargetCobolDir() { - return getModel().getTargetCobolDir(); + public final File getTargetCobolDir() + { + return ((AntBuildCixs2MuleModel) getModel()).getTargetCobolDir(); } /** * @param targetCobolDir the directory where COBOL files will be created to set */ - public final void setTargetCobolDir(final File targetCobolDir) { - getModel().setTargetCobolDir(targetCobolDir); + public final void setTargetCobolDir(final File targetCobolDir) + { + ((AntBuildCixs2MuleModel) getModel()).setTargetCobolDir(targetCobolDir); } - /** {@inheritDoc} */ - public AntBuildCixs2MuleModel getModel() { - return (AntBuildCixs2MuleModel) super.getModel(); - } - /** * Convenience method to get the inner mapped operations. * @return the operations list */ - public List < CixsOperation > getCixsOperations() { + public final List < CixsOperation > getCixsOperations() + { return getCixsMuleComponent().getCixsOperations(); }
--- trunk/tools/src/main/java/org/mule/providers/legstar/gen/Mule2CixsGenerator.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/gen/Mule2CixsGenerator.java 2008-07-24 07:37:16 UTC (rev 39) @@ -25,12 +25,14 @@ * but internally the adapter use the LegStar transport to call a * a mainframe program. */ -public class Mule2CixsGenerator extends AbstractCixsMuleGenerator { +public class Mule2CixsGenerator extends AbstractCixsMuleGenerator +{ /** * Constructor. */ - public Mule2CixsGenerator() { + public Mule2CixsGenerator() + { super(new AntBuildMule2CixsModel()); } @@ -38,8 +40,10 @@ * Check that input values are valid. * @throws CodeGenMakeException if input is invalid */ - public void checkExtendedInput() throws CodeGenMakeException { - try { + public final void checkExtendedInput() throws CodeGenMakeException + { + try + { /* Check that we are provided with valid locations to * generate in.*/ CodeGenUtil.checkDirectory( @@ -53,17 +57,21 @@ /* Check that we are provided with valid locations to * reference.*/ - if (getTargetBinDir() == null) { + if (getTargetBinDir() == null) + { throw (new IllegalArgumentException( "TargetBinDir: No directory name was specified")); } - if (getTargetJarDir() == null) { + if (getTargetJarDir() == null) + { throw (new IllegalArgumentException( "TargetJarDir: No directory name was specified")); } CodeGenUtil.checkHttpURI(getHostURI()); - } catch (IllegalArgumentException e) { + } + catch (IllegalArgumentException e) + { throw new CodeGenMakeException(e); } } @@ -73,8 +81,8 @@ * @param parameters a predefined set of parameters useful for generation * @throws CodeGenMakeException if generation fails */ - public void generate( - final Map < String, Object > parameters) throws CodeGenMakeException { + public final void generate(final Map < String, Object > parameters) throws CodeGenMakeException + { parameters.put("targetJarDir", getTargetJarDir()); parameters.put("targetMuleConfigDir", getTargetMuleConfigDir()); @@ -107,7 +115,8 @@ generateLog4jProperties( getCixsMuleComponent(), parameters, operationPropertiesFilesDir); - for (CixsOperation operation : getCixsMuleComponent().getCixsOperations()) { + for (CixsOperation operation : getCixsMuleComponent().getCixsOperations()) + { /* Determine target files locations */ File operationClassFilesDir = CodeGenUtil.classFilesLocation( @@ -127,7 +136,8 @@ getCixsMuleComponent(), parameters, componentConfFilesDir); generateAntStartMuleBridgeConfigXml( getCixsMuleComponent(), parameters, componentAntFilesDir); - for (CixsOperation operation : getCixsMuleComponent().getCixsOperations()) { + for (CixsOperation operation : getCixsMuleComponent().getCixsOperations()) + { /* Determine target files locations */ File operationClassFilesDir = CodeGenUtil.classFilesLocation( getTargetSrcDir(), operation.getPackageName(), true); @@ -141,23 +151,20 @@ } - /** {@inheritDoc} */ - public AntBuildMule2CixsModel getModel() { - return (AntBuildMule2CixsModel) super.getModel(); - } - /** * @return the URI that the host exposes to consumers */ - public final String getHostURI() { - return getModel().getHostURI(); + public final String getHostURI() + { + return ((AntBuildMule2CixsModel) getModel()).getHostURI(); } /** * @param hostURI the URI that the host exposes to consumers to set */ - public final void setHostURI(final String hostURI) { - getModel().setHostURI(hostURI); + public final void setHostURI(final String hostURI) + { + ((AntBuildMule2CixsModel) getModel()).setHostURI(hostURI); } }
--- trunk/tools/src/main/java/org/mule/providers/legstar/model/AbstractAntBuildCixsMuleModel.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/model/AbstractAntBuildCixsMuleModel.java 2008-07-24 07:37:16 UTC (rev 39) @@ -18,7 +18,8 @@ * This can be used by Eclipse plugins to generate ant files. * This model is common to all Mule generation types. */ -public abstract class AbstractAntBuildCixsMuleModel extends AbstractAntBuildCixsModel { +public abstract class AbstractAntBuildCixsMuleModel extends AbstractAntBuildCixsModel +{ /** Mule product location on file system.*/ private String mMuleHome; @@ -39,21 +40,24 @@ * @param vlcTemplate a velocity template that accecpts this model */ public AbstractAntBuildCixsMuleModel( - final String generatorName, final String vlcTemplate) { + final String generatorName, final String vlcTemplate) + { super(generatorName, vlcTemplate); } /** * @return the Mule product location on file system */ - public final String getMuleHome() { + public final String getMuleHome() + { return mMuleHome; } /** * @param muleHome the Mule product location on file system to set */ - public final void setMuleHome(final String muleHome) { + public final void setMuleHome(final String muleHome) + { mMuleHome = muleHome; } @@ -61,7 +65,8 @@ * @return the target directory where Mule configuration files will be * created */ - public final File getTargetMuleConfigDir() { + public final File getTargetMuleConfigDir() + { return mTargetMuleConfigDir; } @@ -70,28 +75,32 @@ * files will be created to set */ public final void setTargetMuleConfigDir( - final File targetMuleConfigDir) { + final File targetMuleConfigDir) + { mTargetMuleConfigDir = targetMuleConfigDir; } /** * @return the target location for mule jar files */ - public final File getTargetJarDir() { + public final File getTargetJarDir() + { return mTargetJarDir; } /** * @param targetJarDir the target location for mule jar files to set */ - public final void setTargetJarDir(final File targetJarDir) { + public final void setTargetJarDir(final File targetJarDir) + { mTargetJarDir = targetJarDir; } /** * @return the the Mule-Legstar component being generated */ - public final CixsMuleComponent getCixsMuleComponent() { + public final CixsMuleComponent getCixsMuleComponent() + { return (CixsMuleComponent) getCixsService(); } @@ -100,7 +109,8 @@ * to set */ public final void setCixsMuleComponent( - final CixsMuleComponent cixsMuleComponent) { + final CixsMuleComponent cixsMuleComponent) + { setCixsService(cixsMuleComponent); } @@ -109,7 +119,8 @@ * The Mule generator might reside somewhere else than the LegStar core product. * This is needed for ant scripts classpaths. */ - public final String getMulegenProductLocation() { + public final String getMulegenProductLocation() + { return mMulegenProductLocation; } @@ -118,7 +129,8 @@ * is installed */ public final void setMulegenProductLocation( - final String mulegenProductLocation) { + final String mulegenProductLocation) + { mMulegenProductLocation = mulegenProductLocation; }
--- trunk/tools/src/main/java/org/mule/providers/legstar/model/AntBuildCixs2MuleModel.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/model/AntBuildCixs2MuleModel.java 2008-07-24 07:37:16 UTC (rev 39) @@ -16,7 +16,8 @@ * artifacts allow a CICS transaction to call a Mule component. * */ -public class AntBuildCixs2MuleModel extends AbstractAntBuildCixsMuleModel { +public class AntBuildCixs2MuleModel extends AbstractAntBuildCixsMuleModel +{ /** This generator name. */ public static final String CIXS2MULE_GENERATOR_NAME = @@ -33,21 +34,24 @@ /** * Construct the model. */ - public AntBuildCixs2MuleModel() { + public AntBuildCixs2MuleModel() + { super(CIXS2MULE_GENERATOR_NAME, CIXS2MULE_VELOCITY_MACRO_NAME); } /** * @return the directory where COBOL files will be created */ - public final File getTargetCobolDir() { + public final File getTargetCobolDir() + { return mTargetCobolDir; } /** * @param targetCobolDir the directory where COBOL files will be created to set */ - public final void setTargetCobolDir(final File targetCobolDir) { + public final void setTargetCobolDir(final File targetCobolDir) + { mTargetCobolDir = targetCobolDir; }
--- trunk/tools/src/main/java/org/mule/providers/legstar/model/AntBuildMule2CixsModel.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/model/AntBuildMule2CixsModel.java 2008-07-24 07:37:16 UTC (rev 39) @@ -14,7 +14,8 @@ * component runs under Mule and wraps a CICS transaction. * */ -public class AntBuildMule2CixsModel extends AbstractAntBuildCixsMuleModel { +public class AntBuildMule2CixsModel extends AbstractAntBuildCixsMuleModel +{ /** This generator name. */ public static final String MULE2CIXS_GENERATOR_NAME = @@ -33,15 +34,18 @@ private static final String DEFAULT_HOST_URI = "http://hosturi"; /** Construct the model. */ - public AntBuildMule2CixsModel() { + public AntBuildMule2CixsModel() + { super(MULE2CIXS_GENERATOR_NAME, MULE2CIXS_VELOCITY_MACRO_NAME); } /** * @return the URI that the host exposes to consumers */ - public final String getHostURI() { - if (mHostURI == null || mHostURI.length() == 0) { + public final String getHostURI() + { + if (mHostURI == null || mHostURI.length() == 0) + { return DEFAULT_HOST_URI; } return mHostURI; @@ -50,7 +54,8 @@ /** * @param hostURI the URI that the host exposes to consumers to set */ - public final void setHostURI(final String hostURI) { + public final void setHostURI(final String hostURI) + { mHostURI = hostURI; }
--- trunk/tools/src/main/java/org/mule/providers/legstar/model/CixsMuleComponent.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/tools/src/main/java/org/mule/providers/legstar/model/CixsMuleComponent.java 2008-07-24 07:37:16 UTC (rev 39) @@ -23,17 +23,19 @@ /** * Describes a Mule-LegStar Component with Mainframe access capabilities. */ -public class CixsMuleComponent extends AbstractCixsService { - +public class CixsMuleComponent extends AbstractCixsService +{ + /** List of additional classpath elements that might be needed to by * generated Mule startup procedure. */ - private List < Path > mMuleStartupClassPaths = new ArrayList < Path >(); + private List < Path > mMuleStartupClassPaths = new ArrayList < Path > (); /** * @param path an additional classpath element that might be needed * by generated Mule startup procedure */ - public final void addMuleStartupClassPath(final Path path) { + public final void addMuleStartupClassPath(final Path path) + { mMuleStartupClassPaths.add(path); } @@ -41,10 +43,13 @@ * @return the list of additional classpath elements that might be needed * by generated Mule startup procedure */ - public List < String > getMuleStartupPathElements() { - List < String > pathElements = new ArrayList < String >(); - for (Path path : mMuleStartupClassPaths) { - for (String pathElement : path.list()) { + public final List < String > getMuleStartupPathElements() + { + List < String > pathElements = new ArrayList < String > (); + for (Path path : mMuleStartupClassPaths) + { + for (String pathElement : path.list()) + { pathElements.add(pathElement); } } @@ -56,13 +61,16 @@ * path elements ant style. * @param pathElements a list of files to add on classpath */ - public void setMuleStartupPathElements(final List < String > pathElements) { - if (pathElements.size() == 0) { + public final void setMuleStartupPathElements(final List < String > pathElements) + { + if (pathElements.size() == 0) + { return; } Project antProject = new Project(); Path path = new Path(antProject); - for (String element : pathElements) { + for (String element : pathElements) + { PathElement pathElement = path.createPathElement(); pathElement.setLocation(new File(element)); }
--- trunk/transport/pom.xml 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/pom.xml 2008-07-24 07:37:16 UTC (rev 39) @@ -54,6 +54,7 @@ <url>dav:https://dav.muleforge.org/legstar-transport/maven</url> </site> </distributionManagement> + <repositories> <repository> <id>LegStar distribution</id> @@ -87,6 +88,7 @@ <url>http://download.java.net/maven/2</url> </repository> </repositories> + <build> <extensions> <extension> @@ -115,6 +117,70 @@ </plugin> </plugins> </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <configuration> + <configLocation>../codecheck/checkstyle.xml</configLocation> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <targetJdk>1.5</targetJdk> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>taglist-maven-plugin</artifactId> + <configuration> + <tags> + <tag>TODO</tag> + <tag>@todo</tag> + <tag>FIXME</tag> + <tag>@fixme</tag> + <tag>@deprecated</tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jxr-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <links> + <link>http://java.sun.com/j2ee/1.4/docs/api</link> + <link>http://java.sun.com/j2se/1.4.2/docs/api</link> + <link>http://java.sun.com/j2se/1.5.0/docs/api</link> + </links> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> + <dependencies> <dependency> <groupId>org.mule.transports</groupId>
--- trunk/transport/src/main/java/org/mule/providers/legstar/cixs/LegStarPoolAgent.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/cixs/LegStarPoolAgent.java 2008-07-24 07:37:16 UTC (rev 39) @@ -28,105 +28,124 @@ * and will result in all LegStar connections to be pooled. * */ -public class LegStarPoolAgent implements UMOAgent { - - /** Describes the Agent. */ +public class LegStarPoolAgent implements UMOAgent +{ + + /** Describes the Agent. */ private static final String DESCRIPTION = "Agent used to drive the legStar pooling engine"; - + /** A unique name for this agent. */ - private static final String AGENT_NAME = "LegStarPoolAgent"; - - /** This agent instance name. */ - private String mName = AGENT_NAME; + private static final String AGENT_NAME = "LegStarPoolAgent"; - /** Engine handler implementation. */ - private EngineHandler mServerHandler; - - /** TODO Should not be hardcoded. See how to get it from agent properties. */ - private static final String CONFIG_FILE_NAME = "legstar-engine-config.xml"; + /** This agent instance name. */ + private String mName = AGENT_NAME; - /** Logger. */ - private static final Log LOG = LogFactory.getLog(LegStarPoolAgent.class); - - /** {@inheritDoc} */ - public String getDescription() { - return DESCRIPTION; - } + /** Engine handler implementation. */ + private EngineHandler mServerHandler = null; + /** TODO Should not be hardcoded. See how to get it from agent properties. */ + private static final String CONFIG_FILE_NAME = "legstar-engine-config.xml"; + + /** Logger. */ + private static final Log LOG = LogFactory.getLog(LegStarPoolAgent.class); + /** {@inheritDoc} */ - public String getName() { - return mName; - } + public final String getDescription() + { + return DESCRIPTION; + } /** {@inheritDoc} */ - public void registered() { - LOG.info("registered"); - } + public final String getName() + { + return mName; + } /** {@inheritDoc} */ - public void setName(final String name) { - mName = name; - } + public final void registered() + { + LOG.info("registered"); + } /** {@inheritDoc} */ - public void unregistered() { - LOG.info("unregistered"); - } + public final void setName(final String name) + { + mName = name; + } /** {@inheritDoc} */ - public void start() throws UMOException { - LOG.info("Pool engine started"); - } + public final void unregistered() + { + LOG.info("unregistered"); + } /** {@inheritDoc} */ - public void stop() throws UMOException { - LOG.info("Pool engine stopped"); - mServerHandler.stop(); - } + public final void start() throws UMOException + { + LOG.info("Pool engine started"); + } /** {@inheritDoc} */ - public void dispose() { - mServerHandler = null; - LOG.info("Pool engine destroyed"); - } + public final void stop() throws UMOException + { + LOG.info("Pool engine stopped"); + if (mServerHandler != null) + { + mServerHandler.stop(); + } + } /** {@inheritDoc} */ - public void initialise() throws InitialisationException { - LOG.info("Initializing with " + CONFIG_FILE_NAME - + " configuration file."); - - try { - mServerHandler = new EngineHandler(loadConfigFile(CONFIG_FILE_NAME)); - mServerHandler.init(); - } catch (ConfigurationException e) { - LOG.error("Failed to initialize.", e); - throw new InitialisationException(e, this); - } catch (EngineStartupException e) { - LOG.error("Failed to start engine.", e); - throw new InitialisationException(e, this); - } - } + public final void dispose() + { + mServerHandler = null; + LOG.info("Pool engine destroyed"); + } - /** - * Use the Apache configuration API to retrieve the configuration file. - * This gives a lot of flexibility to locate the file. - * - * @param configFileName name of the configuration file - * @return the configuration retrieved - * @throws ConfigurationException if configuration cannot be retrieved - */ - private HierarchicalConfiguration loadConfigFile( - final String configFileName) throws ConfigurationException { - LOG.debug("Attempting to load " + configFileName); - DefaultConfigurationBuilder dcb = new DefaultConfigurationBuilder(); - dcb.setFileName(configFileName); - CombinedConfiguration config = (CombinedConfiguration) - dcb.getConfiguration(true).getConfiguration( - DefaultConfigurationBuilder.ADDITIONAL_NAME); - config.setExpressionEngine(new XPathExpressionEngine()); - LOG.debug("Load success for " + configFileName); - return config; - } + /** {@inheritDoc} */ + public final void initialise() throws InitialisationException + { + LOG.info("Initializing with " + CONFIG_FILE_NAME + + " configuration file."); + try + { + mServerHandler = new EngineHandler(loadConfigFile(CONFIG_FILE_NAME)); + mServerHandler.init(); + } + catch (ConfigurationException e) + { + LOG.error("Failed to initialize.", e); + throw new InitialisationException(e, this); + } + catch (EngineStartupException e) + { + LOG.error("Failed to start engine.", e); + throw new InitialisationException(e, this); + } + } + + /** + * Use the Apache configuration API to retrieve the configuration file. + * This gives a lot of flexibility to locate the file. + * + * @param configFileName name of the configuration file + * @return the configuration retrieved + * @throws ConfigurationException if configuration cannot be retrieved + */ + private HierarchicalConfiguration loadConfigFile(final String configFileName) throws ConfigurationException + { + LOG.debug("Attempting to load " + configFileName); + DefaultConfigurationBuilder dcb = new DefaultConfigurationBuilder(); + dcb.setFileName(configFileName); + CombinedConfiguration config = (CombinedConfiguration) + dcb.getConfiguration(true).getConfiguration( + DefaultConfigurationBuilder.ADDITIONAL_NAME); + config.setExpressionEngine(new XPathExpressionEngine()); + LOG.debug("Load success for " + configFileName); + return config; + + } + }
--- trunk/transport/src/main/java/org/mule/providers/legstar/cixs/MuleCixsException.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/cixs/MuleCixsException.java 2008-07-24 07:37:16 UTC (rev 39) @@ -12,7 +12,8 @@ /** * Exception related to a Mule-LegStar error. */ -public class MuleCixsException extends Exception { +public class MuleCixsException extends Exception +{ /** Unique serial ID. */ private static final long serialVersionUID = 2330171403837091360L; @@ -21,16 +22,18 @@ * Construct an exception from an error message. * @param message error message text */ - public MuleCixsException(final String message) { - super(message); - } - - /** - * Construct an exception from an exception. - * @param e the root exception - */ - public MuleCixsException(final Exception e) { - super(e); - } + public MuleCixsException(final String message) + { + super(message); + } + /** + * Construct an exception from an exception. + * @param e the root exception + */ + public MuleCixsException(final Exception e) + { + super(e); + } + }
--- trunk/transport/src/main/java/org/mule/providers/legstar/cixs/MuleHostHeader.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/cixs/MuleHostHeader.java 2008-07-24 07:37:16 UTC (rev 39) @@ -17,10 +17,11 @@ * Configuration parameters that a client can send as a header element. */ -public class MuleHostHeader implements Serializable { - +public class MuleHostHeader implements Serializable +{ + /** Unique serial ID. */ - private static final long serialVersionUID = 2175774875242240562L; + private static final long serialVersionUID = 2175774875242240562L; /** The host endpoint identifier. */ private String mHostEndPoint; @@ -28,7 +29,7 @@ /** The host character set. */ private String mHostCharset; - /** User ID used for host authentication/impersonation. */ + /** User ID used for host authentication/impersonation. */ private String mHostUserID; /** Password used for authentication. */ @@ -39,120 +40,134 @@ /** An identifier for this request (used for tracability). */ private String mHostRequestID; - + /** * Create a messaging Address from this host header data. * If no endpoint is explicitly specified, no address can be created. * All defaults from default configuration will apply. * @return the new host Address */ - public LegStarAddress getAddress() { - if (mHostEndPoint == null) { - return null; - } - LegStarAddress address = new LegStarAddress(mHostEndPoint); - address.setHostCharset(mHostCharset); - address.setHostUserID(mHostUserID); - address.setHostPassword(mHostPassword); - address.setHostTraceMode(mHostTraceMode); - return address; - } + public final LegStarAddress getAddress() + { + if (mHostEndPoint == null) + { + return null; + } + LegStarAddress address = new LegStarAddress(mHostEndPoint); + address.setHostCharset(mHostCharset); + address.setHostUserID(mHostUserID); + address.setHostPassword(mHostPassword); + address.setHostTraceMode(mHostTraceMode); + return address; + } - /** Gets the user ID used for host authentication/impersonation. - * @return host user ID - */ - public final String getHostUserID() { - return mHostUserID; - } + /** Gets the user ID used for host authentication/impersonation. + * @return host user ID + */ + public final String getHostUserID() + { + return mHostUserID; + } - /** - * Sets the user ID used for host authentication/impersonation. - * @param userID host user ID to set - */ - public final void setHostUserID(final String userID) { - this.mHostUserID = userID; - } + /** + * Sets the user ID used for host authentication/impersonation. + * @param userID host user ID to set + */ + public final void setHostUserID(final String userID) + { + this.mHostUserID = userID; + } - /** - * Gets the password used for authentication. - * @return host user ID - */ - public final String getHostPassword() { - return mHostPassword; - } + /** + * Gets the password used for authentication. + * @return host user ID + */ + public final String getHostPassword() + { + return mHostPassword; + } - /** - * Sets the password used for authentication. - * @param password host user ID to set - */ - public final void setHostPassword(final String password) { - this.mHostPassword = password; - } + /** + * Sets the password used for authentication. + * @param password host user ID to set + */ + public final void setHostPassword(final String password) + { + this.mHostPassword = password; + } - /** - * Gets the target host identifier. - * @return the target host identifier - */ - public final String getHostEndPoint() { - return mHostEndPoint; - } + /** + * Gets the target host identifier. + * @return the target host identifier + */ + public final String getHostEndPoint() + { + return mHostEndPoint; + } - /** - * Sets the target host identifier. - * @param endPoint target host identifier - */ - public final void setHostEndPoint(final String endPoint) { - this.mHostEndPoint = endPoint; - } + /** + * Sets the target host identifier. + * @param endPoint target host identifier + */ + public final void setHostEndPoint(final String endPoint) + { + this.mHostEndPoint = endPoint; + } - /** - * Gets the target host character set. - * @return the target host character set - */ - public final String getHostCharset() { - return mHostCharset; - } + /** + * Gets the target host character set. + * @return the target host character set + */ + public final String getHostCharset() + { + return mHostCharset; + } - /** - * Sets the target host character set. - * @param charset target host character set - */ - public final void setHostCharset(final String charset) { - this.mHostCharset = charset; - } + /** + * Sets the target host character set. + * @param charset target host character set + */ + public final void setHostCharset(final String charset) + { + this.mHostCharset = charset; + } - /** - * Gets the host trace mode. - * @return the host trace mode - */ - public final boolean getHostTraceMode() { - return mHostTraceMode; - } + /** + * Gets the host trace mode. + * @return the host trace mode + */ + public final boolean getHostTraceMode() + { + return mHostTraceMode; + } - /** - * Sets the host trace mode. - * @param traceMode the host trace mode - */ - public final void setTraceMode(final boolean traceMode) { - this.mHostTraceMode = traceMode; - } + /** + * Sets the host trace mode. + * @param traceMode the host trace mode + */ + public final void setTraceMode(final boolean traceMode) + { + this.mHostTraceMode = traceMode; + } - /** - * Gets the identifier for this request. - * @return the request identifier - */ - public final String getHostRequestID() { - return mHostRequestID; - } + /** + * Gets the identifier for this request. + * @return the request identifier + */ + public final String getHostRequestID() + { + return mHostRequestID; + } - /** - * Sets the identifier for this request. - * @param requestID the identifier for this request - */ - public final void setHostRequestID(final String requestID) { - this.mHostRequestID = requestID; - } + /** + * Sets the identifier for this request. + * @param requestID the identifier for this request + */ + public final void setHostRequestID(final String requestID) + { + this.mHostRequestID = requestID; + } }
--- trunk/transport/src/main/java/org/mule/providers/legstar/cixs/MuleHostHeaderFactory.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/cixs/MuleHostHeaderFactory.java 2008-07-24 07:37:16 UTC (rev 39) @@ -16,51 +16,54 @@ * runtime parameters needed to access a host from being shipped as * regular UMO message properties. */ -public final class MuleHostHeaderFactory { +public final class MuleHostHeaderFactory +{ /** Host request identifier. */ public static final String L4M_KEY_HOSTREQUESTID = "LegStarRequestID"; - + /** Host endpoint name property key. */ public static final String L4M_KEY_HOSTENDPOINT = "LegStarEndPoint"; - + /** Host character set property key. */ public static final String L4M_KEY_HOSTCHARSET = "LegStarCharset"; - + /** Host user ID property key. */ public static final String L4M_KEY_HOSTUSERID = "LegStarUserID"; - + /** Host password property key. */ public static final String L4M_KEY_HOSTPASSWORD = "LegStarPassword"; - + /** Host trace mode property key. */ public static final String L4M_KEY_HOSTTRACEMODE = "LegStarTraceMode"; - - + + /** Defeats instanciation since this is a utility class.*/ - private MuleHostHeaderFactory() { - + private MuleHostHeaderFactory() + { + } - /** - * Extracts header data from a Mule message properties and create an - * Host header. - * @param umoMessage the Mule message - * @return the new host header - */ - public static MuleHostHeader createHostHeader(final UMOMessage umoMessage) { - MuleHostHeader hostHeader = new MuleHostHeader(); - hostHeader.setHostEndPoint( - (String) umoMessage.getProperty(L4M_KEY_HOSTENDPOINT)); - hostHeader.setHostCharset( - (String) umoMessage.getProperty(L4M_KEY_HOSTCHARSET)); - hostHeader.setHostUserID( - (String) umoMessage.getProperty(L4M_KEY_HOSTUSERID)); - hostHeader.setHostPassword( - (String) umoMessage.getProperty(L4M_KEY_HOSTPASSWORD)); - hostHeader.setTraceMode( - umoMessage.getBooleanProperty(L4M_KEY_HOSTTRACEMODE, false)); - hostHeader.setHostRequestID( - (String) umoMessage.getProperty(L4M_KEY_HOSTREQUESTID)); - return hostHeader; - } + /** + * Extracts header data from a Mule message properties and create an + * Host header. + * @param umoMessage the Mule message + * @return the new host header + */ + public static MuleHostHeader createHostHeader(final UMOMessage umoMessage) + { + MuleHostHeader hostHeader = new MuleHostHeader(); + hostHeader.setHostEndPoint( + (String) umoMessage.getProperty(L4M_KEY_HOSTENDPOINT)); + hostHeader.setHostCharset( + (String) umoMessage.getProperty(L4M_KEY_HOSTCHARSET)); + hostHeader.setHostUserID( + (String) umoMessage.getProperty(L4M_KEY_HOSTUSERID)); + hostHeader.setHostPassword( + (String) umoMessage.getProperty(L4M_KEY_HOSTPASSWORD)); + hostHeader.setTraceMode( + umoMessage.getBooleanProperty(L4M_KEY_HOSTTRACEMODE, false)); + hostHeader.setHostRequestID( + (String) umoMessage.getProperty(L4M_KEY_HOSTREQUESTID)); + return hostHeader; + } }
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpConnector.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpConnector.java 2008-07-24 07:37:16 UTC (rev 39) @@ -28,32 +28,35 @@ * TODO in this form, LegstarConnector does not have the capability to * support any other transports than HTTP. */ -public class LegstarHttpConnector extends HttpConnector { - +public class LegstarHttpConnector extends HttpConnector +{ + /** Name of property holding the mainframe character set. */ public static final String HOST_CHARSET_PROPERTY = "hostCharset"; - + /** Name of Property holding jaxb qualified class name. */ public static final String JAXB_QUAL_CLASS_NAME = "jaxbClassName"; - + /** Name of Property holding cobol binding qualified class name. */ public static final String COXB_QUAL_CLASS_NAME = "coxbClassName"; - + /** Name of Property holding target Mainframe program properties file name. */ public static final String PROGRAM_PROP_FILE_NAME = "programPropFileName"; - - /** + + /** * No-Args constructor. */ - public LegstarHttpConnector() { + public LegstarHttpConnector() + { registerProtocols(); } /** logger used by this class. */ private final Log logger = LogFactory.getLog(getClass()); - + /** {@inheritDoc} */ - public void doInitialise() throws InitialisationException { + public final void doInitialise() throws InitialisationException + { super.doInitialise(); logger.debug("doInitialise"); } @@ -63,12 +66,14 @@ * as a valid protocol combination. "legstar" is the scheme * meta info and http is the protocol. */ - protected void registerProtocols() { - List < String > schemes = new ArrayList < String >(); + public final void registerProtocols() + { + List < String > schemes = new ArrayList < String > (); schemes.add("http"); schemes.add("https"); - for (Iterator< String > iterator = schemes.iterator(); iterator.hasNext();) { + for (Iterator < String > iterator = schemes.iterator(); iterator.hasNext();) + { String s = (String) iterator.next(); registerSupportedProtocol(s); } @@ -77,7 +82,8 @@ } /** {@inheritDoc} */ - public String getProtocol() { + public final String getProtocol() + { return "legstar"; } @@ -87,15 +93,20 @@ * we override the standard method. * {@inheritDoc} * */ - public UMOMessageReceiver lookupReceiver(final String key) { - if (key != null) { + public final UMOMessageReceiver lookupReceiver(final String key) + { + if (key != null) + { UMOMessageReceiver receiver = (UMOMessageReceiver) receivers.get(key); - if (receiver == null) { + if (receiver == null) + { return (UMOMessageReceiver) receivers.get( key.replace(getProtocol(), "http")); } return receiver; - } else { + } + else + { throw new IllegalArgumentException("Receiver key must not be null"); } }
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageAdapter.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageAdapter.java 2008-07-24 07:37:16 UTC (rev 39) @@ -17,8 +17,9 @@ * <code>LegstarMessageAdapter</code> delegates processing to * <code>HttpMessageAdapter</code>. */ -public class LegstarHttpMessageAdapter extends HttpMessageAdapter { - +public class LegstarHttpMessageAdapter extends HttpMessageAdapter +{ + /** Serial ID. */ private static final long serialVersionUID = 5737156381082603182L; @@ -27,8 +28,8 @@ * @param message the inner message * @throws MessagingException if construction fails */ - public LegstarHttpMessageAdapter( - final Object message) throws MessagingException { + public LegstarHttpMessageAdapter(final Object message) throws MessagingException + { super(message); }
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageDispatcher.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageDispatcher.java 2008-07-24 07:37:16 UTC (rev 39) @@ -21,44 +21,47 @@ * <code>LegstarMessageDispatcher</code> delegates most of its behavior * to <code>HttpClientMessageDispatcher</code>. */ -public class LegstarHttpMessageDispatcher extends HttpClientMessageDispatcher { +public class LegstarHttpMessageDispatcher extends HttpClientMessageDispatcher +{ /** * Constructor for a given endpoint. * @param endpoint the Mule endpoint */ - public LegstarHttpMessageDispatcher(final UMOImmutableEndpoint endpoint) { + public LegstarHttpMessageDispatcher(final UMOImmutableEndpoint endpoint) + { super(endpoint); } - + /** * We override this method because there is no way we can force the * http headers that we need. * {@inheritDoc} * */ - protected HttpMethod getMethod(final UMOEvent event) throws TransformerException { + public final HttpMethod getMethod(final UMOEvent event) throws TransformerException + { HttpMethod method = super.getMethod(event); - + /* Force the content type expected by the Mainframe */ method.addRequestHeader(HttpConstants.HEADER_CONTENT_TYPE, - "binary/octet-stream"); - + "binary/octet-stream"); + /* TODO these parameters should actually be obtained from an * equivalent to legstar-invoker-config using some host endpoint*/ /* For debugging purposes, this forces the Mainframe to log this * request */ method.addRequestHeader("CICSTraceMode", "true"); - + /* Forces the path assuming it is a Cics Web Services listening. * TODO again this should be externalized in a configuration file * */ - method.setPath("/CICS/CWBA/LSWEBBIN"); - + method.setPath("/CICS/CWBA/LSWEBBIN"); + /* This is not propagated by UMOMessageToHttpResponse * TODO open an issue with Mule. */ -// method.addRequestHeader(HttpConstants.HEADER_CONTENT_LENGTH, -// Integer.toString(bytesLength)); - +// method.addRequestHeader(HttpConstants.HEADER_CONTENT_LENGTH, +// Integer.toString(bytesLength)); + return method; }
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageDispatcherFactory.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageDispatcherFactory.java 2008-07-24 07:37:16 UTC (rev 39) @@ -21,11 +21,12 @@ */ public class LegstarHttpMessageDispatcherFactory - extends AbstractMessageDispatcherFactory { +extends AbstractMessageDispatcherFactory +{ /** {@inheritDoc} */ - public UMOMessageDispatcher create( - final UMOImmutableEndpoint endpoint) throws UMOException { + public final UMOMessageDispatcher create(final UMOImmutableEndpoint endpoint) throws UMOException + { return new LegstarHttpMessageDispatcher(endpoint); }
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageReceiver.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/LegstarHttpMessageReceiver.java 2008-07-24 07:37:16 UTC (rev 39) @@ -20,7 +20,8 @@ * <code>LegstarMessageReceiver</code> delegates all processing * to <code>HttpMessageReceiver</code>. */ -public class LegstarHttpMessageReceiver extends HttpMessageReceiver { +public class LegstarHttpMessageReceiver extends HttpMessageReceiver +{ /** * Constructs a message receiver for a component. @@ -33,7 +34,8 @@ final UMOConnector connector, final UMOComponent component, final UMOEndpoint endpoint) - throws InitialisationException { + throws InitialisationException + { super(connector, component, endpoint); }
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/transformers/AbstractObjectToHttpResponseTransformer.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/transformers/AbstractObjectToHttpResponseTransformer.java 2008-07-24 07:37:16 UTC (rev 39) @@ -26,7 +26,8 @@ * Such responses are targeted at the mainframe which has special requirements * for http headers such as content type and content length. */ -public class AbstractObjectToHttpResponseTransformer extends UMOMessageToHttpResponse { +public class AbstractObjectToHttpResponseTransformer extends UMOMessageToHttpResponse +{ /** When channeled over http, the legstar payload must be binary. */ private static final String LEGSTAR_HTTP_CONTENT_TYPE = @@ -37,11 +38,12 @@ * Overriding this method because <code>UMOMessageToHttpResponse</code> does * not allow the content length to be set directly. * {@inheritDoc} */ - protected HttpResponse createResponse( + public final HttpResponse createResponse( final Object src, final String encoding, final UMOEventContext context) - throws IOException, TransformerException { + throws IOException, TransformerException + { UMOMessage msg = context.getMessage(); /* Force the content type and content length */ @@ -49,12 +51,13 @@ LEGSTAR_HTTP_CONTENT_TYPE); HttpResponse response = super.createResponse(src, encoding, context); - + /* We make the assumption that the source has already been * transformed into a byte array. * TODO consider case where the Mule component raises an exception * what should we send to the host? */ - if (src != null && src instanceof byte[]) { + if (src != null && src instanceof byte[]) + { Header header = new Header( HttpConstants.HEADER_CONTENT_LENGTH, Integer.toString(((byte[]) src).length));
--- trunk/transport/src/main/java/org/mule/providers/legstar/http/transformers/LegStarMessageToHttpResponse.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/http/transformers/LegStarMessageToHttpResponse.java 2008-07-24 07:37:16 UTC (rev 39) @@ -13,67 +13,64 @@ import java.io.IOException; import java.io.InputStream; -import org.apache.commons.httpclient.Header; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mule.providers.NullPayload; -import org.mule.providers.http.HttpConstants; import org.mule.providers.http.HttpResponse; -import org.mule.providers.http.transformers.UMOMessageToHttpResponse; import org.mule.providers.legstar.i18n.LegstarMessages; import org.mule.umo.transformer.TransformerException; import org.mule.umo.UMOEventContext; -import org.mule.umo.UMOMessage; import com.legstar.messaging.LegStarMessage; /** - * <code>LegStarMessageToByteArray</code> will turn a an architected - * LegStar message into an http response which payloads is binary. + * <code>LegStarMessageToHttpResponse</code> will turn a an architected + * LegStar message into an http response which payload is binary. */ -public class LegStarMessageToHttpResponse extends UMOMessageToHttpResponse { +public class LegStarMessageToHttpResponse +extends AbstractObjectToHttpResponseTransformer +{ /** logger used by this class. */ private final Log logger = LogFactory.getLog(getClass()); - - /** When channeled over http, the legstar payload must be binary. */ - private static final String LEGSTAR_HTTP_CONTENT_TYPE = - "binary/octet-stream"; /** * Construct the transformer. Specify source and return types. */ - public LegStarMessageToHttpResponse() { + public LegStarMessageToHttpResponse() + { super(); registerSourceType(LegStarMessage.class); logger.debug("instantiation"); } /** {@inheritDoc} */ - public Object transform( - final Object src, - final String encoding, - final UMOEventContext context) throws TransformerException { - - /* This situation arises if the client starts by an HTTP HEAD method. */ - if (src instanceof HttpResponse) { - return src; - } - - /* This situation happens when an exception happened. There is normally - * a 500 http status set by the standard Mule exception mapping - * mechanism */ - if (src instanceof NullPayload) { + public final Object transform(final Object src, final String encoding, final UMOEventContext context) throws TransformerException + { + + /* This situation arises if the client starts by an HTTP HEAD method. */ + if (src instanceof HttpResponse) + { + return src; + } + + /* This situation happens when an exception happened. There is normally + * a 500 http status set by the standard Mule exception mapping + * mechanism */ + if (src instanceof NullPayload) + { return super.transform(null, encoding, context); - } - - /* Since the only source type registered is LegStarMessage, it is safe - * to cast the 'src' object directly to that type. */ - LegStarMessage requestMessage = (LegStarMessage) src; - - try { + } + + /* Since the only source type registered is LegStarMessage, it is safe + * to cast the 'src' object directly to that type. */ + LegStarMessage requestMessage = (LegStarMessage) src; + + try + { int bytesLength = requestMessage.getHostSize(); - if (bytesLength == 0) { + if (bytesLength == 0) + { throw new TransformerException( LegstarMessages.invalidHostDataSize(), this); } @@ -81,47 +78,19 @@ InputStream hostStream = requestMessage.sendToHost(); int rc; int pos = 0; - while ((rc = hostStream.read(result, pos, bytesLength - pos)) > 0) { + while ((rc = hostStream.read(result, pos, bytesLength - pos)) > 0) + { pos += rc; } - + return super.transform(result, encoding, context); - } catch (IOException e) { + } + catch (IOException e) + { throw new TransformerException( LegstarMessages.errorFormattingHostData(), this, e); } - } - - /** - * Overriding this method because <code>UMOMessageToHttpResponse</code> does - * not allow the content length to be set directly. - * {@inheritDoc} */ - protected HttpResponse createResponse( - final Object src, - final String encoding, - final UMOEventContext context) - throws IOException, TransformerException { + } - UMOMessage msg = context.getMessage(); - /* Force the content type and content length */ - msg.setStringProperty(HttpConstants.HEADER_CONTENT_TYPE, - LEGSTAR_HTTP_CONTENT_TYPE); - - HttpResponse response = super.createResponse(src, encoding, context); - - /* We make the assumption that the source has already been - * transformed into a byte array. - * TODO consider case where the Mule component raises an exception - * what should we send to the host? */ - if (src != null && src instanceof byte[]) { - Header header = new Header( - HttpConstants.HEADER_CONTENT_LENGTH, - Integer.toString(((byte[]) src).length)); - response.addHeader(header); - } - - return response; - } - }
--- trunk/transport/src/main/java/org/mule/providers/legstar/i18n/LegstarMessages.java 2008-07-23 13:25:41 UTC (rev 38) +++ trunk/transport/src/main/java/org/mule/providers/legstar/i18n/LegstarMessages.java 2008-07-24 07:37:16 UTC (rev 39) @@ -15,102 +15,152 @@ /** * Indirect references to messages from a bundle. */ -public class LegstarMessages extends MessageFactory { +public class LegstarMessages extends MessageFactory +{ /** Bundle is found under org.mule.i18n legstar-messages.properties. */ private static final String BUNDLE_PATH = getBundlePath("legstar"); + + /** Invalid legstar header in incoming message message number.*/ + private static final int MSG_NUM_1 = 1; /** * @return invalid legstar header in incoming message. */ - public static Message invalidLegstarHeader() { - return createMessage(BUNDLE_PATH, 1); + public static Message invalidLegstarHeader() + { + return createMessage(BUNDLE_PATH, MSG_NUM_1); } - /** + /** Something went wrong while receiving the host data message number.*/ + private static final int MSG_NUM_2 = 2; + + /** * @return something went wrong while receiving the host data. */ - public st