You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/10/14 04:24:37 UTC

svn commit: r463885 - in /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment: DeploymentEngine.java WarBasedAxisConfigurator.java repository/util/ArchiveReader.java

Author: dims
Date: Fri Oct 13 19:24:36 2006
New Revision: 463885

URL: http://svn.apache.org/viewvc?view=rev&rev=463885
Log:
Additional fix for AXIS2-1344 - pick up wsdl's from WEB-INF for the services specified in WEB-INF\services.xml.


Modified:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?view=diff&rev=463885&r1=463884&r2=463885
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Oct 13 19:24:36 2006
@@ -988,7 +988,6 @@
         try {
 
             Parameter parahotupdate = axisConfig.getParameter(TAG_HOT_UPDATE);
-//        Parameter paraantiJARLocking = axisConfig.getParameter(TAG_ANTI_JAR_LOCKING);
             boolean antiJARLocking = true;
             if (parahotupdate != null) {
                 String value = (String) parahotupdate.getValue();
@@ -1027,18 +1026,19 @@
     public static AxisServiceGroup buildServiceGroup(InputStream servicesxml,
                                                      ClassLoader classLoader,
                                                      String serviceGroupName,
-                                                     AxisConfiguration axisConfig) throws AxisFault {
+                                                     AxisConfiguration axisConfig,
+                                                     ArchiveReader archiveReader,
+                                                     HashMap wsdlServices) throws AxisFault {
         ArchiveFileData currentArchiveFile = new ArchiveFileData(
                 DeploymentConstants.TYPE_SERVICE, "", false);
         currentArchiveFile.setClassLoader(classLoader);
-        ArchiveReader archiveReader = new ArchiveReader();
         AxisServiceGroup serviceGroup = new AxisServiceGroup();
         serviceGroup.setServiceGroupClassLoader(classLoader);
         serviceGroup.setServiceGroupName(serviceGroupName);
         try {
             ArrayList serviceList = archiveReader.buildServiceGroup(servicesxml,
                     currentArchiveFile, serviceGroup,
-                    new HashMap(), axisConfig);
+                    wsdlServices, axisConfig);
             fillServiceGroup(serviceGroup, serviceList, null, axisConfig);
             return serviceGroup;
         } catch (XMLStreamException e) {

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java?view=diff&rev=463885&r1=463884&r2=463885
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java Fri Oct 13 19:24:36 2006
@@ -1,6 +1,7 @@
 package org.apache.axis2.deployment;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisServiceGroup;
@@ -11,12 +12,15 @@
 import org.apache.commons.logging.LogFactory;
 
 import javax.servlet.ServletConfig;
+import javax.xml.stream.XMLStreamException;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.FileNotFoundException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashMap;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
@@ -280,13 +284,24 @@
             InputStream servicexml = config.getServletContext().
                     getResourceAsStream("/WEB-INF/services.xml");
             if (servicexml != null) {
+                HashMap wsdlServices = new HashMap();
+                ArchiveReader archiveReader = new ArchiveReader();
+                String path = config.getServletContext().getRealPath("/WEB-INF");
+                if(path != null){
+                    archiveReader.processFilesInFolder(new File(path),wsdlServices);
+                }
                 AxisServiceGroup serviceGroup = DeploymentEngine.buildServiceGroup(servicexml,
                         Thread.currentThread().getContextClassLoader(),
-                        "annonServiceGroup", axisConfig);
+                        "annonServiceGroup", axisConfig,
+                        archiveReader, wsdlServices);
                 axisConfig.addServiceGroup(serviceGroup);
             }
         } catch (AxisFault axisFault) {
             log.info(axisFault);
+        } catch (FileNotFoundException e) {
+            log.info(e);
+        } catch (XMLStreamException e) {
+            log.info(e);
         }
     }
 

Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?view=diff&rev=463885&r1=463884&r2=463885
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Fri Oct 13 19:24:36 2006
@@ -227,52 +227,8 @@
                     }
                 }
 
-                File files[] = metaInfFolder.listFiles();
-                for (int i = 0; i < files.length; i++) {
-                    File file1 = files[i];
-                    if (file1.getName().toLowerCase().endsWith(SUFFIX_WSDL)) {
-                        InputStream in = new FileInputStream(file1);
-                        FileInputStream in2 = null;
+                processFilesInFolder(metaInfFolder, servicesMap);
 
-                        // now the question is which version of WSDL file this archive contains.
-                        // lets check the namespace of the root element and decide. But since we are
-                        // using axiom (dude, you are becoming handy here :)), we will not build the
-                        // whole thing.
-                        OMNamespace documentElementNS = new StAXOMBuilder(in).getDocumentElement().getNamespace();
-                        if (documentElementNS != null) {
-                            WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
-                            if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getNamespaceURI())) {
-                                // we have a WSDL 2.0 document here.
-                                in2 = new FileInputStream(file1);
-                                wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(in2, null, null);
-                            } else if (Constants.NS_URI_WSDL11.
-                                    equals(documentElementNS.getNamespaceURI())) {
-                                in2 = new FileInputStream(file1);
-                                wsdlToAxisServiceBuilder = new WSDL11ToAxisServiceBuilder(in2, null, null);
-                            } else {
-                                new DeploymentException(Messages.getMessage("invalidWSDLFound"));
-                            }
-
-                            FileInputStream in3 = new FileInputStream(file1);
-                            AxisService service = processWSDLFile(wsdlToAxisServiceBuilder, file1, false, in2);
-                            try {
-                                if (in2 != null) {
-                                    in2.close();
-                                }
-                                in3.close();
-                            } catch (IOException e) {
-                                log.info(e);
-                            }
-                            servicesMap.put(service.getName(), service);
-                        }
-
-                        try {
-                            in.close();
-                        } catch (IOException e) {
-                            log.info(e);
-                        }
-                    }
-                }
             } catch (FileNotFoundException e) {
                 throw new DeploymentException(e);
             } catch (IOException e) {
@@ -355,6 +311,54 @@
         return servicesMap;
     }
 
+    public void processFilesInFolder(File folder, HashMap servicesMap) throws FileNotFoundException, XMLStreamException, DeploymentException {
+        File files[] = folder.listFiles();
+        for (int i = 0; i < files.length; i++) {
+            File file1 = files[i];
+            if (file1.getName().toLowerCase().endsWith(SUFFIX_WSDL)) {
+                InputStream in = new FileInputStream(file1);
+                FileInputStream in2 = null;
+
+                // now the question is which version of WSDL file this archive contains.
+                // lets check the namespace of the root element and decide. But since we are
+                // using axiom (dude, you are becoming handy here :)), we will not build the
+                // whole thing.
+                OMNamespace documentElementNS = new StAXOMBuilder(in).getDocumentElement().getNamespace();
+                if (documentElementNS != null) {
+                    WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
+                    if (WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getNamespaceURI())) {
+                        // we have a WSDL 2.0 document here.
+                        in2 = new FileInputStream(file1);
+                        wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(in2, null, null);
+                    } else if (Constants.NS_URI_WSDL11.
+                            equals(documentElementNS.getNamespaceURI())) {
+                        in2 = new FileInputStream(file1);
+                        wsdlToAxisServiceBuilder = new WSDL11ToAxisServiceBuilder(in2, null, null);
+                    } else {
+                        new DeploymentException(Messages.getMessage("invalidWSDLFound"));
+                    }
+
+                    FileInputStream in3 = new FileInputStream(file1);
+                    AxisService service = processWSDLFile(wsdlToAxisServiceBuilder, file1, false, in2);
+                    try {
+                        if (in2 != null) {
+                            in2.close();
+                        }
+                        in3.close();
+                    } catch (IOException e) {
+                        log.info(e);
+                    }
+                    servicesMap.put(service.getName(), service);
+                }
+
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    log.info(e);
+                }
+            }
+        }
+    }
     public void readModuleArchive(ArchiveFileData archiveFile,
                                   AxisModule module, boolean explodedDir,
                                   AxisConfiguration axisConfig)



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org