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 2006/08/31 06:06:28 UTC
svn commit: r438772 - in
/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator:
Messages.properties Wsdl2Java.java Wsdl2JavaConstants.java
Author: aeberbac
Date: Wed Aug 30 21:06:28 2006
New Revision: 438772
URL: http://svn.apache.org/viewvc?rev=438772&view=rev
Log:
cleaned up some code, put better usage, still need to tweak a few things
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?rev=438772&r1=438771&r2=438772&view=diff
==============================================================================
--- 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 Wed Aug 30 21:06:28 2006
@@ -6,13 +6,16 @@
ExistingFound = The file XXX exists. To force it to be overwritten use XXX.
FailedLoadingBuiltinDescriptor = Could not load the built-in descriptor. This is a problem with your classpath and/or muse-tools.jar, try replacing it with a clean version.
FailedLoadingDescriptor = Failed loading descriptor with error: XXX.
-Help = \nWsdl2Java supports the following options \n(the order in which they are specified does not matter):\
-\n\n XXX\t\tThe WSDL definition file to use.\n\t\t(REQUIRED).\
-\n\n XXX\tAn option to overwrite the target \n\t\tfile if it exists \n\t\t(OPTIONAL).\
-\n\n XXX\t\tDisplay this message\n\t\t(OPTIONAL).\
-\n\n XXX\tDisplay more advanced help message\n\t\t(OPTIONAL).
+Help = \nUsage: wsdl2java.[bat|sh] XXX FILE [OPTIONS]\n\
+The following arguments are required:\n\
+ XXX FILE\tThe WSDL definition file to analyze\n\n\
+\
+The following arguments are optional:\n\
+ XXX\tAn option to overwrite the target \nfile if it exists \n\
+ XXX\t\tDisplay this message\n\t\t(OPTIONAL).\
+ XXX\tDisplay more advanced help message\n\t\t(OPTIONAL).
HelpAdvanced = \nWsdl2Java supports the following options \n(the order in which they are specified does not matter):\
-\n\n XXX\t\tThe WSDL definition file to use.\n\t\t(REQUIRED).\
+\n\n XXX\t\tThe WSDL definition file to use.\n(REQUIRED).\
\n\n XXX\tThe Analyzer to use.Must subclass:\n\t\tXXX\n\t\t(OPTIONAL).\
\n\n XXX\tThe Synthesizer to use.Must subclass:\n\t\tXXX\n\t\t(OPTIONAL).\
\n\n XXX\tThe Projectizer to use.Must subclass:\n\t\tXXX\n\t\t(OPTIONAL).\
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?rev=438772&r1=438771&r2=438772&view=diff
==============================================================================
--- 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 Wed Aug 30 21:06:28 2006
@@ -22,7 +22,9 @@
import org.apache.muse.tools.generator.analyzer.Analyzer;
import org.apache.muse.tools.generator.analyzer.SimpleAnalyzer;
import org.apache.muse.tools.generator.projectizer.Axis2Projectizer;
+import org.apache.muse.tools.generator.projectizer.OsgiProjectizer;
import org.apache.muse.tools.generator.projectizer.Projectizer;
+import org.apache.muse.tools.generator.projectizer.ProxyProjectizer;
import org.apache.muse.tools.generator.synthesizer.ProxySynthesizer;
import org.apache.muse.tools.generator.synthesizer.ServerSynthesizer;
import org.apache.muse.tools.generator.synthesizer.Synthesizer;
@@ -91,16 +93,16 @@
* @throws Exception
*/
public Wsdl2Java(File wsdlFile, File descriptorFile, boolean overwrite) throws Exception {
- Document wsdlDocument = getWSDLDocument(wsdlFile);
-
Document descriptorDocument = getDescriptorDocument(descriptorFile);
+ Document[] wsdlDocuments = getWSDLDocuments(wsdlFile, descriptorFile, descriptorDocument);
+
_configuration = new ConfigurationData();
- _configuration.addParameter(ConfigurationData.WSDL_DOCUMENT, wsdlDocument);
+ _configuration.addParameter(ConfigurationData.WSDL_DOCUMENT_LIST, wsdlDocuments);
_configuration.addParameter(ConfigurationData.DESCRIPTOR_DOCUMENT, descriptorDocument);
_configuration.addParameter(ConfigurationData.OVERWRITE, Boolean.valueOf(overwrite));
}
-
+
private Document getDescriptorDocument(File file) {
Document result = null;
@@ -135,6 +137,16 @@
* @throws Exception If anything goes wrong during code generation.
*/
public void run() throws Exception {
+ checkComponents();
+
+ _projectizer.projectize(
+ _synthesizer.synthesize(
+ _analyzer.analyze(_configuration)
+ )
+ );
+ }
+
+ private void checkComponents() {
if (_synthesizer == null) {
_synthesizer = new ServerSynthesizer();
}
@@ -146,12 +158,6 @@
if (_analyzer == null) {
_analyzer = new SimpleAnalyzer();
}
-
- _projectizer.projectize(
- _synthesizer.synthesize(
- _analyzer.analyze(_configuration)
- )
- );
}
public void setAnalyzer(Analyzer analyzer) {
@@ -217,6 +223,7 @@
if(arguments.hasFlag(HELP_ADVANCED_FLAG)) {
Object filler[] = new Object[] {
WSDL_DEFINITION_FLAG,
+ WSDL_DEFINITION_FLAG,
ANALYZER_FLAG,
Analyzer.class.getName(),
SYNTHESIZER_FLAG,
@@ -235,6 +242,7 @@
if(arguments.hasFlag(HELP_FLAG) || hasNoArguments(arguments)) {
Object filler[] = new Object[] {
WSDL_DEFINITION_FLAG,
+ WSDL_DEFINITION_FLAG,
OVERWRITE_FLAG,
HELP_FLAG,
HELP_ADVANCED_FLAG
@@ -286,8 +294,7 @@
String wsdlArg = arguments.getFlagValue(WSDL_DEFINITION_FLAG);
if (wsdlArg == null) {
- Object[] filler = { WSDL_DEFINITION_FLAG };
- handleErrorAndExit(_MESSAGES.get("NoWSDLFlag",filler));
+ return null;
}
File wsdlFile = new File(wsdlArg);
@@ -340,19 +347,10 @@
}
private static Synthesizer checkSynthesizerArg(CommandLine arguments) {
- Synthesizer generator = null;
-
- boolean serverOnly = arguments.hasFlag(SERVER_ONLY_FLAG);
- boolean clientOnly = arguments.hasFlag(CLIENT_ONLY_FLAG);
-
- if (!(clientOnly && serverOnly) && (clientOnly || serverOnly)) {
- if (clientOnly) {
- generator = new ProxySynthesizer();
- } else {
- generator = new ServerSynthesizer();
- }
-
- return generator;
+ Synthesizer synthesizer = null;
+
+ if (arguments.hasFlag(PROXY_FLAG)) {
+ return new ProxySynthesizer();
}
String generatorArg = arguments.getFlagValue(SYNTHESIZER_FLAG);
@@ -363,14 +361,22 @@
handleErrorAndExit(_MESSAGES.get("NullSynthesizer", filler));
}
- generator = (Synthesizer) loadClass(arguments.getFlagValue(SYNTHESIZER_FLAG), Synthesizer.class);
+ synthesizer = (Synthesizer) loadClass(arguments.getFlagValue(SYNTHESIZER_FLAG), Synthesizer.class);
}
- return generator;
+ return synthesizer;
}
private static Projectizer checkProjectizerArg(CommandLine arguments) {
Projectizer projectizer = null;
+
+ if (arguments.hasFlag(PROXY_FLAG)) {
+ return new ProxyProjectizer();
+ }
+
+ if(arguments.hasFlag(OSGI_FLAG)) {
+ return new OsgiProjectizer();
+ }
String projectizerArg = arguments.getFlagValue(PROJECTIZER_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?rev=438772&r1=438771&r2=438772&view=diff
==============================================================================
--- 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 Wed Aug 30 21:06:28 2006
@@ -40,16 +40,18 @@
String BASE_DESCRIPTOR_FLAG = "-dump";
String OVERWRITE_FLAG = "-overwrite";
-
- String MUSE_HOME_FLAG = "-musehome";
-
- String CLIENT_ONLY_FLAG = "-clientonly";
-
- String SERVER_ONLY_FLAG = "-serveronly";
String HELP_FLAG = "-help";
String HELP_ADVANCED_FLAG = "-helpmore";
- String MUSE_BASE_DESCRIPTOR = "/resources/axis2/muse.xml";
+ String VERBOSE_FLAG = "-verbose";
+
+ String QUIET_FLAG = "-quiet";
+
+ String OSGI_FLAG = "-osgi";
+
+ String PROXY_FLAG = "-proxy";
+
+ 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