}
}
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
getStringArray(wsdlFile)));
//output location
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
getStringArray(outputDirectory.getPath())));
//////////////////////////////////////////////////////////////////
// Databinding type
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
getStringArray(databindingName)));
if ("jibx".equals(databindingName)) {
String key = CommandLineOptionConstants.WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX
+ org.apache.axis2.wsdl.codegen.extension.JiBXExtension.BINDING_PATH_OPTION;
optionMap.put(key, new CommandLineOption(key, getStringArray(jibxBindingFile)));
}
if ("async".equals(syncMode)) {
// Async only option - forcing to generate async methods only
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
new String[0]));
} else if ("sync".equals(syncMode)) {
// Sync only option - forcing to generate Sync methods only
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
new String[0]));
} else if ("both".equals(syncMode)) {
// Do nothing
} else {
throw new MojoFailureException("Invalid syncMode: " + syncMode +
", expected either of 'sync', 'async' or 'both'.");
}
//Package
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
getStringArray(packageName)));
//stub language
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
getStringArray(language)));
//server side and generate services.xml options
if (generateServerSide) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
new String[0]));
//services XML generation - effective only when specified as the server side
if (generateServicesXml) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants
.GENERATE_SERVICE_DESCRIPTION_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants
.GENERATE_SERVICE_DESCRIPTION_OPTION,
new String[0]));
}
//generate all option - Only valid when generating serverside code
if (generateAllClasses) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
new String[0]));
}
}
//generate the test case
if (generateTestcase) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
new String[0]));
}
//Unwrap classes option - this determines whether the generated classes are inside the stub/MR
//or gets generates as seperate classes
if (unpackClasses) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION,
new String[0]));
}
//server side interface option
if (generateServerSideInterface) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION,
new String[0]));
}
if (unwrap) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.UNWRAP_PARAMETERS,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.UNWRAP_PARAMETERS,
new String[0]));
}
if (allPorts) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.All_PORTS_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.All_PORTS_OPTION,
new String[0]));
}
if (backwardCompatible) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION,
new String[0]));
}
if (flattenFiles) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.FLATTEN_FILES_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.FLATTEN_FILES_OPTION,
new String[0]));
}
if (skipMessageReceiver) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG,
new String[0]));
}
if (skipBuildXML) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG,
new String[0]));
}
if (skipWSDL) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.NO_WSDLS_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.NO_WSDLS_OPTION_LONG,
new String[0]));
}
if (overWrite) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.OVERRIDE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.OVERRIDE_OPTION,
new String[0]));
}
if (suppressPrefixes) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION,
new String[0]));
}
if (repositoryPath != null) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.REPOSITORY_PATH_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.REPOSITORY_PATH_OPTION,
new String[]{repositoryPath}));
}
if (externalMapping != null) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.EXTERNAL_MAPPING_OPTION,
new String[]{externalMapping}));
}
if (wsdlVersion != null) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION,
new String[]{wsdlVersion}));
}
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION,
new String[]{targetSourceFolderLocation}));
if (targetResourcesFolderLocation != null) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.RESOURCE_FOLDER_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.RESOURCE_FOLDER_OPTION,
new String[]{targetResourcesFolderLocation}));
}
if(options != null) {
for (Map.Entry<?,?> entry : options.entrySet()) {
String key = CommandLineOptionConstants.WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX + entry.getKey();
String value = (String) entry.getValue();
optionMap.put(
key,
new CommandLineOption(
key,
new String[]{value}));
}
}
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION,
new String[] { serviceName }));
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION,
new String[] { portName }));
// set the namespaces
if (!((namespaceToPackages == null) && (namespaceURIs == null))) {
optionMap.put(
CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION,
new String[] { getNamespaceToPackagesMap() }));
}
if (httpProxyHost != null) {
optionMap
.put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG,
new String[] { httpProxyHost }));
}
if (httpProxyPort != null) {
optionMap
.put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG,
new String[] { httpProxyPort }));
}
if (httpProxyUser != null) {
optionMap
.put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_USER_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_USER_OPTION_LONG,
new String[] { httpProxyUser }));
}
if (httpProxyPassword != null) {
optionMap
.put(CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PASSWORD_OPTION_LONG,
new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PASSWORD_OPTION_LONG,
new String[] { httpProxyPassword }));
}
return optionMap;