geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r529257 - in /geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder: Axis2Builder.java Axis2BuilderUtil.java
Date Mon, 16 Apr 2007 14:17:18 GMT
Author: dims
Date: Mon Apr 16 07:17:17 2007
New Revision: 529257

URL: http://svn.apache.org/viewvc?view=rev&rev=529257
Log:
Fix for GERONIMO-3100 - Axis2: remove hardcoded 12 jars in Axis2BuilderUtil

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=529257&r1=529256&r2=529257
==============================================================================
--- 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
Mon Apr 16 07:17:17 2007
@@ -46,7 +46,6 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
@@ -312,7 +311,11 @@
         portInfo.setLocation(oldup);
     }
     
-    private String generateWsdl(Module module, String sei, String bindingType, DeploymentContext
context, PortInfo portInfo) throws DeploymentException {
+    private String generateWsdl(Module module, 
+                                String sei, 
+                                String bindingType, 
+                                DeploymentContext context, 
+                                PortInfo portInfo) throws DeploymentException {
         //call wsgen tool to generate the wsdl file based on the bindingtype.
         //let's set the outputDir as the module base directory in server repository.
         File moduleBaseDir = module.getEarContext().getBaseDir();
@@ -323,9 +326,9 @@
         try {
              urls = Axis2BuilderUtil.getWsgenClasspath(context);
         } catch (MalformedURLException e) {
-            log.warn("unable to generate the wsdl file using wsgen.", e);
+            log.warn("unable to generate the wsdl file using wsgen. - unable to get the location
of the required artifact(s).", 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++) {

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=529257&r1=529256&r2=529257
==============================================================================
--- 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
Mon Apr 16 07:17:17 2007
@@ -23,6 +23,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.SortedSet;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceException;
@@ -35,31 +36,31 @@
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.kernel.repository.Version;
 
 public class Axis2BuilderUtil {
 
-    //TODO: need to update to released jars when they are avail.
-    private final static Artifact AXIS2_JAXWS_API_ARTIFACT = new Artifact("org.apache.axis2","axis2-jaxws-api",
"SNAPSHOT", "jar");
-    private final static Artifact AXIS2_SAAJ_API_ARTIFACT = new Artifact("org.apache.axis2","axis2-saaj-api",
"SNAPSHOT", "jar");
-    private final static Artifact AXIS2_SAAJ_ARTIFACT = new Artifact("org.apache.axis2","axis2-saaj",
"SNAPSHOT", "jar");
-    private final static Artifact JAXB_API_ARTIFACT = new Artifact("javax.xml.bind","jaxb-api",
"2.0", "jar");
-    private final static Artifact JAXB_IMPL_ARTIFACT = new Artifact("com.sun.xml.bind","jaxb-impl",
"2.0.3", "jar");
-    private final static Artifact JAXB_XJC_ARTIFACT = new Artifact("com.sun.xml.bind","jaxb-xjc",
"2.0.3", "jar");    
-    private final static Artifact JAXWS_TOOLS_ARTIFACT = new Artifact("com.sun.xml.ws","jaxws-tools",
"2.0", "jar");
-    private final static Artifact JAXWS_RT_ARTIFACT = new Artifact("com.sun.xml.ws","jaxws-rt",
"2.0", "jar");
-    private final static Artifact GERONIMO_ACTIVATION_SPEC_ARTIFACT = new Artifact("org.apache.geronimo.specs","geronimo-activation_1.1_spec",
"1.0-SNAPSHOT", "jar");    
-    private final static Artifact GERONIMO_ANNOTATION_ARTIFACT = new Artifact("org.apache.geronimo.specs","geronimo-annotation_1.0_spec",
"1.0", "jar");     
-    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 Artifact AXIS2_JAXWS_API_ARTIFACT = new Artifact("org.apache.axis2","axis2-jaxws-api",
(Version)null, "jar");
+    private final static Artifact AXIS2_SAAJ_API_ARTIFACT = new Artifact("org.apache.axis2","axis2-saaj-api",
(Version)null, "jar");
+    private final static Artifact AXIS2_SAAJ_ARTIFACT = new Artifact("org.apache.axis2","axis2-saaj",
(Version)null, "jar");
+    private final static Artifact JAXB_API_ARTIFACT = new Artifact("javax.xml.bind","jaxb-api",
(Version)null, "jar");
+    private final static Artifact JAXB_IMPL_ARTIFACT = new Artifact("com.sun.xml.bind","jaxb-impl",
(Version)null, "jar");
+    private final static Artifact JAXB_XJC_ARTIFACT = new Artifact("com.sun.xml.bind","jaxb-xjc",
(Version)null, "jar");    
+    private final static Artifact JAXWS_TOOLS_ARTIFACT = new Artifact("com.sun.xml.ws","jaxws-tools",
(Version)null, "jar");
+    private final static Artifact JAXWS_RT_ARTIFACT = new Artifact("com.sun.xml.ws","jaxws-rt",
(Version)null, "jar");
+    private final static Artifact GERONIMO_ACTIVATION_SPEC_ARTIFACT = new Artifact("org.apache.geronimo.specs","geronimo-activation_1.1_spec",
(Version)null, "jar");    
+    private final static Artifact GERONIMO_ANNOTATION_ARTIFACT = new Artifact("org.apache.geronimo.specs","geronimo-annotation_1.0_spec",
(Version)null, "jar");     
+    private final static Artifact GERONIMO_WS_METADATA_ARTIFACT = new Artifact("org.apache.geronimo.specs","geronimo-ws-metadata_2.0_spec",
(Version)null, "jar");    
     private final static String TOOLS = "tools.jar";
     
-    protected static URL[] getWsgenClasspath(DeploymentContext context) throws DeploymentException,
MalformedURLException {
+    protected static URL[] getWsgenClasspath(DeploymentContext context) 
+        throws DeploymentException, MalformedURLException {
         ArrayList<URL> jars = new ArrayList();
         
         DeploymentConfigurationManager cm = (DeploymentConfigurationManager)context.getConfigurationManager();
-        Collection<Repository> repositories = cm.getRepositories();
+        Collection<ListableRepository> repositories = cm.getRepositories();
 
-        //start classpath with path to tools.jar
         jars.add(getLocation(repositories, JAXB_API_ARTIFACT));
         jars.add(getLocation(repositories, JAXB_IMPL_ARTIFACT));
         jars.add(getLocation(repositories, JAXB_XJC_ARTIFACT));
@@ -90,17 +91,22 @@
         return classpath;
     }
     
-    private static URL getLocation(Collection<Repository> repositories, Artifact artifact)
throws DeploymentException, MalformedURLException {
+    private static URL getLocation(Collection<ListableRepository> repositories, Artifact
artifactQuery) throws DeploymentException, MalformedURLException {
         File file = null;
         
-        for (Repository repository : repositories) {
-            if (repository.contains(artifact)) {
-                file = repository.getLocation(artifact);
+        for (ListableRepository repository : repositories) {
+            SortedSet artifactSet = repository.list(artifactQuery);
+            // if we have exactly one artifact found
+            if (artifactSet.size() == 1) {
+                file = repository.getLocation((Artifact) artifactSet.first());
                 return file.getAbsoluteFile().toURL();
-            }
+            } else if (artifactSet.size() > 1) {// if we have more than 1 artifacts found
use the latest one.
+                file = repository.getLocation((Artifact) artifactSet.last());
+                return file.getAbsoluteFile().toURL();
+            } 
         }
         if (file == null) {
-            throw new DeploymentException("Missing artifact in repositories: " + artifact.toString());
+            throw new DeploymentException("Missing artifact in repositories: " + artifactQuery.toString());
         }
         return null;
     }



Mime
View raw message