/** * @param serviceName the service name * @param operationPackageName the operation classes package name * @return an operation corresponding to a Web Service operation. */ public static CixsOperation getOperation( final String serviceName, final String operationPackageName) { CixsOperation cixsOperation = new CixsOperation(); cixsOperation.setName("lsfileac"); cixsOperation.setCicsProgramName("LSFILEAC"); cixsOperation.setPackageName(operationPackageName); cixsOperation.setCicsChannel("LSFILEAC-CHANNEL"); cixsOperation.setFaultType("LsfileacException"); cixsOperation.addInput(createCixsStructure(serviceName, "QueryData", "QueryData", false)); cixsOperation.addInput(createCixsStructure(serviceName, "QueryLimit", "QueryLimit", false)); cixsOperation.addOutput(createCixsStructure(serviceName, "ReplyData", "ReplyData", false)); cixsOperation.addOutput(createCixsStructure(serviceName, "ReplyStatus", "ReplyStatus", false)); return cixsOperation; }
/** * Create a COBOl CICS HTTP Client program to use for testing. * * @param service the JBoss ESB service description * @param operation the operation for which a program is to be generated * @param parameters the set of parameters to pass to template engine * @param cobolFilesDir location where COBOL code should be generated * @param cobolHttpClientType the type of cobol http client to generate * @throws CodeGenMakeException if generation fails */ protected static void generateCobolSampleHttpClient( final CixsJbossEsbService service, final CixsOperation operation, final Map<String, Object> parameters, final File cobolFilesDir, final CobolHttpClientType cobolHttpClientType) throws CodeGenMakeException { String template; switch (cobolHttpClientType) { case DFHWBCLI: template = Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_DFHWBCLI_CLIENT_VLC_TEMPLATE; break; case WEBAPI: template = Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_WEBAPI_CLIENT_VLC_TEMPLATE; break; default: template = Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_LSHTTAPI_CLIENT_VLC_TEMPLATE; } generateFile( CIXS_JBOSSESB_GENERATOR_NAME, template, SERVICE_MODEL_NAME, service, parameters, cobolFilesDir, operation.getCicsProgramName() + ".cbl"); }
/** * Create host byte array to objects transformer for both request and response objects. * * @param operation the cixs operation * @param parameters miscellaneous help parameters * @param operationClassFilesDir where to store the generated file * @throws CodeGenMakeException if generation fails */ public static void generateHbaToObjectTransformers( final CixsOperation operation, final Map<String, Object> parameters, final File operationClassFilesDir) throws CodeGenMakeException { if (operation.getInput().size() > 0) { generateHbaToObjectTransformer( operation, parameters, operationClassFilesDir, operation.getRequestHolderType(), "Request"); } if (operation.getOutput().size() > 0) { generateHbaToObjectTransformer( operation, parameters, operationClassFilesDir, operation.getResponseHolderType(), "Response"); } }
/** * Create a COBOl CICS WMQ Client program to use for testing. * * @param service the JBoss ESB service description * @param operation the operation for which a program is to be generated * @param parameters the set of parameters to pass to template engine * @param cobolFilesDir location where COBOL code should be generated * @throws CodeGenMakeException if generation fails */ protected static void generateCobolSampleWmqClient( final CixsJbossEsbService service, final CixsOperation operation, final Map<String, Object> parameters, final File cobolFilesDir) throws CodeGenMakeException { generateFile( CIXS_JBOSSESB_GENERATOR_NAME, OPERATION_COBOL_CICS_WMQ_CLIENT_VLC_TEMPLATE, SERVICE_MODEL_NAME, service, parameters, cobolFilesDir, operation.getCicsProgramName() + ".cbl"); }
/** * Create a holder classes for channel/containers. * * @param operation the cixs operation * @param parameters miscellaneous help parameters * @param operationClassFilesDir where to store the generated file * @throws CodeGenMakeException if generation fails */ public static void generateHoldersXmlTransformers( final CixsOperation operation, final Map<String, Object> parameters, final File operationClassFilesDir) throws CodeGenMakeException { if (operation.getCicsChannel() == null || operation.getCicsChannel().length() == 0) { return; } if (operation.getInput().size() > 0) { generateHolderXmlToHostTransformer( operation, parameters, operationClassFilesDir, operation.getRequestHolderType()); } if (operation.getOutput().size() > 0) { generateHolderHostToXmlTransformer( operation, parameters, operationClassFilesDir, operation.getResponseHolderType()); } }
/** * Check input values that are common to all derived classes. Check that we are provided with * valid locations to generate in. * * @throws CodeGenMakeException if input is invalid */ public void checkExtendedInput() throws CodeGenMakeException { CodeGenUtil.checkDirectory(getTargetSrcDir(), true, "TargetSrcDir"); CodeGenUtil.checkDirectory(getTargetAntDir(), true, "TargetAntDir"); CodeGenUtil.checkDirectory(getTargetJbossEsbConfigDir(), true, "TargetJbossEsbConfigDir"); CodeGenUtil.checkDirectory( new File(getTargetJbossEsbConfigDir(), "META-INF"), true, "TargetJbossEsbConfigDir/META-INF"); CodeGenUtil.checkDirectory(getTargetDistDir(), true, "TargetDistDir"); /* Check that we are provided with valid locations to * reference.*/ if (getTargetBinDir() == null) { throw (new IllegalArgumentException("TargetBinDir: No directory name was specified")); } if (getTargetEsbDir() == null) { throw (new IllegalArgumentException("TargetEsbDir: No directory name was specified")); } /* Check that we have at least one operation. */ if (getCixsJbossEsbService().getCixsOperations().size() == 0) { throw new CodeGenMakeException("No operation was specified"); } /* Check that we have CICS program names mapped to operations */ for (CixsOperation operation : getCixsJbossEsbService().getCixsOperations()) { String cicsProgramName = operation.getCicsProgramName(); if (cicsProgramName == null || cicsProgramName.length() == 0) { throw new CodeGenMakeException("Operation must specify a CICS program name"); } } /* For HTTP transport check that the protocol is supported.*/ if (getSampleConfigurationTransport().equalsIgnoreCase("http")) { /* Check that we have a URI to expose to mainframe programs */ /* Set a sensible path using the service name. */ if (getHttpTransportParameters().getPath() == null || getHttpTransportParameters().getPath().length() == 0) { getHttpTransportParameters().setPath(getDefaultServicePath()); } /* Since we moved from JBR to Tomcat, there is a minor glitch where the * request URL needs to end with a slash otherwise an unhandled 302 * is returned. */ String path = getHttpTransportParameters().getPath(); if (path.charAt(path.length() - 1) != '/') { path += '/'; getHttpTransportParameters().setPath(path); } getHttpTransportParameters().check(); } /* For WMQ transport check parameters.*/ if (getSampleConfigurationTransport().equalsIgnoreCase("wmq")) { getWmqTransportParameters().check(); } /* For JBM transport check parameters.*/ if (getSampleConfigurationTransport().equalsIgnoreCase("jbm")) { getJbmTransportParameters().initialize(getCixsService().getName()); getJbmTransportParameters().check(); } checkExtendedExtendedInput(); }