You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by di...@apache.org on 2007/04/12 19:47:31 UTC
svn commit: r528061 - in
/geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder:
Axis2Builder.java Axis2BuilderUtil.java
Author: dims
Date: Thu Apr 12 10:47:30 2007
New Revision: 528061
URL: http://svn.apache.org/viewvc?view=rev&rev=528061
Log:
Fix for (GERONIMO-3094) Axis2: need to build the classpath and pass it onto wsgen
Modified:
geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2BuilderUtil.java
Modified: geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?view=diff&rev=528061&r1=528060&r2=528061
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java Thu Apr 12 10:47:30 2007
@@ -320,13 +320,21 @@
outputDir = moduleContext.getBaseDir().getAbsolutePath();
URL[] urls;
+ String classPath = "";
//let's figure out the classpath for wsgen tools
try {
- urls = Axis2BuilderUtil.getWsgenClasspath(module, context);
+ urls = Axis2BuilderUtil.getWsgenClasspath(context);
} catch (MalformedURLException e) {
log.warn("unable to generate the wsdl file using wsgen.", e);
return "";
}
+ //let's figure out the classpath string for the module and wsgen tools.
+ if (urls != null && urls.length > 0) {
+ for (int i = 0; i< urls.length; i++) {
+ classPath += Axis2BuilderUtil.toFile(urls[i]).getAbsolutePath() + ";";
+ }
+ }
+ classPath += Axis2BuilderUtil.getModuleClasspath(module, context);
//create arguments;
String[] arguments = null;
@@ -335,7 +343,7 @@
SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
log.info("wsgen - Generating WSDL with SOAP 1.1 binding type, based on type " + bindingType);
log.info("outputDir is " + outputDir);
- arguments = new String[]{sei, "-keep", "-wsdl:soap1.1", "-d",
+ arguments = new String[]{"-cp", classPath, sei, "-keep", "-wsdl:soap1.1", "-d",
outputDir};
} else if (bindingType.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingType.equals(
SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
@@ -343,7 +351,7 @@
//used in conjunction with the -extension option
log.info("wsgen - Generating WSDL with SOAP 1.2 binding type, based on type " + bindingType);
log.info("outputDir is " + outputDir);
- arguments = new String[]{sei, "-keep", "-extension",
+ arguments = new String[]{"-cp", classPath, sei, "-keep", "-extension",
"-wsdl:Xsoap1.2", "-d", outputDir};
} else {
throw new WebServiceException("The bindingType specified by " + sei
Modified: geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2BuilderUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2BuilderUtil.java?view=diff&rev=528061&r1=528060&r2=528061
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2BuilderUtil.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2BuilderUtil.java Thu Apr 12 10:47:30 2007
@@ -48,11 +48,8 @@
private final static Artifact GERONIMO_WS_METADATA_ARTIFACT = new Artifact("org.apache.geronimo.specs","geronimo-ws-metadata_2.0_spec", "1.1-SNAPSHOT", "jar");
private final static String TOOLS = "tools.jar";
- protected static URL[] getWsgenClasspath(Module module, DeploymentContext context) throws DeploymentException, MalformedURLException {
+ protected static URL[] getWsgenClasspath(DeploymentContext context) throws DeploymentException, MalformedURLException {
ArrayList<URL> jars = new ArrayList();
- EARContext moduleContext = module.getEarContext();
- String baseDir = moduleContext.getBaseDir().getAbsolutePath();
- List<String> moduleClassPath = context.getConfiguration().getClassPath();
DeploymentConfigurationManager cm = (DeploymentConfigurationManager)context.getConfigurationManager();
Collection<Repository> repositories = cm.getRepositories();
@@ -70,12 +67,24 @@
jars.add(getLocation(repositories, GERONIMO_ANNOTATION_ARTIFACT));
jars.add(getLocation(repositories, GERONIMO_WS_METADATA_ARTIFACT));
jars.add(new File(getToolsJarLoc()).toURL());
- jars.addAll(getModuleClassPath(baseDir, moduleClassPath));
return jars.toArray(new URL[jars.size()]);
}
+ protected static String getModuleClasspath(Module module, DeploymentContext context) throws DeploymentException {
+ EARContext moduleContext = module.getEarContext();
+ String baseDir = moduleContext.getBaseDir().getAbsolutePath();
+ List<String> moduleClassPath = context.getConfiguration().getClassPath();
+ String classpath = "";
+ for (String s : moduleClassPath) {
+ if (s.contains("/"))
+ s = s.replace("/", java.io.File.separator);
+ classpath += baseDir + java.io.File.separator + s + java.io.File.pathSeparator;
+ }
+ return classpath;
+ }
+
private static URL getLocation(Collection<Repository> repositories, Artifact artifact) throws DeploymentException, MalformedURLException {
File file = null;
@@ -116,13 +125,20 @@
}
}
- private static List getModuleClassPath(String baseDir, List<String> moduleClassPath) throws MalformedURLException {
- ArrayList jars = new ArrayList();
- for (String s : moduleClassPath) {
- if (s.contains("/"))
- s = s.replace("/", java.io.File.separator);
- jars.add(new File(baseDir + java.io.File.separator + s).toURL());
+ protected static File toFile(URL url) {
+ if (url == null || !url.getProtocol().equals("file")) {
+ return null;
+ } else {
+ String filename = url.getFile().replace('/', File.separatorChar);
+ int pos =0;
+ while ((pos = filename.indexOf('%', pos)) >= 0) {
+ if (pos + 2 < filename.length()) {
+ String hexStr = filename.substring(pos + 1, pos + 3);
+ char ch = (char) Integer.parseInt(hexStr, 16);
+ filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
+ }
+ }
+ return new File(filename);
}
- return jars;
}
}