You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by ae...@apache.org on 2007/02/19 00:42:32 UTC
svn commit: r509031 - in
/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator:
Messages.properties Wsdl2Java.java Wsdl2JavaConstants.java
Author: aeberbac
Date: Sun Feb 18 15:42:31 2007
New Revision: 509031
URL: http://svn.apache.org/viewvc?view=rev&rev=509031
Log:
MUSE-174: added support for an output directory flag
Modified:
webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties
webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java
webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties?view=diff&rev=509031&r1=509030&r2=509031
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties Sun Feb 18 15:42:31 2007
@@ -11,6 +11,7 @@
\ \ XXX FILE\t\tThe WSDL definition file to analyze\n\n\
\
The following arguments are optional:\n\
+\ \ XXX DIR\t\tSpecify an output direcgtory\n\
\ \ XXX\t\tOverwrite files that exist\n\
\ \ XXX\t\t\tDisplay this message\n\
\ \ XXX\t\tDisplay more advanced help message\n
@@ -22,12 +23,13 @@
\ \ XXX FILE\tThe Muse descriptor to use\n\n\
\
The following arguments are optional:\n\
+\ \ XXX DIR\t\tSpecify an output direcgtory\n\
\ \ XXX\t\tOverwrite files that exist\n\
\ \ XXX CLASS\tThe Analyzer component\n\
\ \ XXX CLASS\tThe Synthesizer component\n\
\ \ XXX CLASS\tThe Projectizer component\n\
\ \ XXX FILE\t\tDump the built-in descriptor to a file\n\
-\ \ XXX\t\t\tGenerate an Axis2 project\n\
+\ \ XXX\t\tGenerate an Axis2 project\n\
\ \ XXX\t\t\tGenerate an OSGi project\n\
\ \ XXX\t\t\tGenerate a Mini SOAP Engine project\n\
\ \ XXX\t\tGenerate a proxy project\n\
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java?view=diff&rev=509031&r1=509030&r2=509031
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java Sun Feb 18 15:42:31 2007
@@ -68,7 +68,7 @@
* @throws Exception
*/
public Wsdl2Java(File wsdlFile) throws Exception {
- this(wsdlFile, null, false, false);
+ this(wsdlFile, null, false, false, null);
}
/**
@@ -81,7 +81,7 @@
* @throws Exception
*/
public Wsdl2Java(File wsdlFile, boolean overwrite) throws Exception {
- this(wsdlFile, null, overwrite, false);
+ this(wsdlFile, null, overwrite, false, null);
}
/**
@@ -92,9 +92,10 @@
* @param descriptorFile The Muse descriptor (can be null).
* @param overwrite Whether or not to overwrite existing files.
* @param generateCustomHeaders
+ * @param outputDirectory
* @throws Exception
*/
- public Wsdl2Java(File wsdlFile, File descriptorFile, boolean overwrite, boolean generateCustomHeaders) throws Exception {
+ public Wsdl2Java(File wsdlFile, File descriptorFile, boolean overwrite, boolean generateCustomHeaders, File targetDirectory) throws Exception {
Document descriptorDocument = getDescriptorDocument(descriptorFile);
Document[] wsdlDocuments = getWSDLDocuments(wsdlFile, descriptorFile, descriptorDocument);
@@ -104,6 +105,7 @@
_configuration.addParameter(ConfigurationData.DESCRIPTOR_DOCUMENT, descriptorDocument);
_configuration.addParameter(ConfigurationData.OVERWRITE, Boolean.valueOf(overwrite));
_configuration.addParameter(ConfigurationData.GENERATE_CUSTOM_HEADERS, Boolean.valueOf(generateCustomHeaders));
+ _configuration.addParameter(ConfigurationData.TARGET_DIRECTORY, targetDirectory);
}
private Document getDescriptorDocument(File file) {
@@ -243,6 +245,7 @@
boolean overwrite = checkOverwriteArg(arguments);
boolean generateCustomHeaders = checkHeadersFlag(arguments);
+ File outputDirectory = checkOutputArg(arguments);
File wsdl = checkWsdlArg(arguments);
File descriptorFile = checkDescriptorArg(arguments);
@@ -252,7 +255,7 @@
Wsdl2Java app = null;
try {
- app = new Wsdl2Java(wsdl, descriptorFile, overwrite, generateCustomHeaders);
+ app = new Wsdl2Java(wsdl, descriptorFile, overwrite, generateCustomHeaders, outputDirectory);
app.setAnalyzer(analyzer);
app.setSynthesizer(synthesizer);
app.setProjectizer(projectizer);
@@ -270,6 +273,29 @@
}
/**
+ * Get the output directory argument if it is present.
+ *
+ * @param arguments Command line arguments
+ * @return The output directory
+ */
+ private static File checkOutputArg(CommandLine arguments) {
+ String outputArg = arguments.getFlagValue(OUTPUT_FLAG);
+
+ if (outputArg == null) {
+ return null;
+ }
+
+ File outputDirectory = new File(outputArg);
+
+ if(outputDirectory.exists() && !outputDirectory.isDirectory()) {
+ Object[] filler = {outputDirectory.getAbsoluteFile()};
+ handleErrorAndExit(_MESSAGES.get("NotDirectory", filler));
+ }
+
+ return outputDirectory;
+ }
+
+ /**
* Print the version and exit.
*
* @param arguments Command line arguments
@@ -308,6 +334,7 @@
arguments.saveFlagValue(WSDL_DEFINITION_FLAG);
arguments.saveFlagValue(DESCRIPTOR_FLAG);
arguments.saveFlagValue(BASE_DESCRIPTOR_FLAG);
+ arguments.saveFlagValue(OUTPUT_FLAG);
arguments.parse(args);
return arguments;
@@ -326,6 +353,7 @@
DESCRIPTOR_FLAG,
WSDL_DEFINITION_FLAG,
DESCRIPTOR_FLAG,
+ OUTPUT_FLAG,
OVERWRITE_FLAG,
ANALYZER_FLAG,
SYNTHESIZER_FLAG,
@@ -350,6 +378,7 @@
Object filler[] = new Object[] {
WSDL_DEFINITION_FLAG,
WSDL_DEFINITION_FLAG,
+ OUTPUT_FLAG,
OVERWRITE_FLAG,
HELP_FLAG,
HELP_ADVANCED_FLAG
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java?view=diff&rev=509031&r1=509030&r2=509031
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java Sun Feb 18 15:42:31 2007
@@ -62,5 +62,7 @@
String VERSION_FLAG = "-version";
+ String OUTPUT_FLAG = "-output";
+
String MUSE_BASE_DESCRIPTOR = "/resources/common/muse.xml";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org