ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r428234 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: context/ deployment/
Date Thu, 03 Aug 2006 04:42:53 GMT
Author: dims
Date: Wed Aug  2 21:42:52 2006
New Revision: 428234

URL: http://svn.apache.org/viewvc?rev=428234&view=rev
Log:
- DeploymentEngine is for all practical purposes the base class for the 3 configurators, making
that explicity by inheritance.
- Prep work for AXIS2-940, Now we have access to ConfiguarationContext from DeploymentEngine,
So we should be able to support the "Ability to load/init services during container startup"
feature, both for pre-existing and hot-deployed services 



Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=428234&r1=428233&r2=428234&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
Wed Aug  2 21:42:52 2006
@@ -21,6 +21,7 @@
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.FileSystemConfigurator;
 import org.apache.axis2.deployment.URLBasedAxisConfigurator;
+import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisServiceGroup;
@@ -59,6 +60,9 @@
             AxisConfigurator axisConfigurator) throws AxisFault {
         AxisConfiguration axisConfig = axisConfigurator.getAxisConfiguration();
         ConfigurationContext configContext = new ConfigurationContext(axisConfig);
+        if(axisConfigurator instanceof DeploymentEngine) {
+            ((DeploymentEngine)axisConfigurator).setConfigContext(configContext);
+        }
         //To override context path
         setContextPath(axisConfig, configContext);
         //To check whether transport level session managment is require or not

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=428234&r1=428233&r2=428234&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
Wed Aug  2 21:42:52 2006
@@ -20,6 +20,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.repository.util.ArchiveFileData;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.deployment.repository.util.WSInfo;
@@ -28,7 +29,13 @@
 import org.apache.axis2.deployment.scheduler.SchedulerTask;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Flow;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
@@ -38,7 +45,15 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -72,17 +87,12 @@
      * this ref will pass to engine when it call start()
      * method
      */
-    private AxisConfiguration axisConfig;
-    private ArchiveFileData currentArchiveFile;
+    protected AxisConfiguration axisConfig;
+    
+    protected ConfigurationContext configContext;
+    
     private RepositoryListener repoListener;
 
-
-    /**
-     * Default constructor is needed to deploy module and service programatically.
-     */
-    public DeploymentEngine() {
-    }
-
     public void loadServices() {
         repoListener.checkServices();
         if (hotDeployment) {
@@ -143,7 +153,7 @@
                     ArrayList servicelist = populateService(serviceGroup,
                             servicesURL,
                             fileUrl.substring(0, fileUrl.indexOf(".aar")));
-                    addServiceGroup(serviceGroup, servicelist, servicesURL);
+                    addServiceGroup(serviceGroup, servicelist, servicesURL, null);
                 }
             }
         } catch (MalformedURLException e) {
@@ -338,7 +348,8 @@
 
     private void addServiceGroup(AxisServiceGroup serviceGroup,
                                  ArrayList serviceList,
-                                 URL serviceLocation)
+                                 URL serviceLocation,
+                                 ArchiveFileData currentArchiveFile)
             throws AxisFault {
         serviceGroup.setParent(axisConfig);
         // module from services.xml at serviceGroup level
@@ -401,12 +412,7 @@
                     AxisModule module = axisConfig.getModule(moduleName);
 
                     if (module != null) {
-//                        ArrayList controlops = opDesc.engageModule(module, axisConfig);
                         opDesc.engageModule(module, axisConfig);
-//                        for (int j = 0; j < controlops.size(); j++) {
-//                            AxisOperation axisOperation = (AxisOperation) controlops.get(j);
-//                            contolops.add(axisOperation);
-//                        }
                     } else {
                         throw new DeploymentException(
                                 Messages.getMessage(
@@ -415,10 +421,6 @@
                     }
                 }
             }
-//            for (int i = 0; i < contolops.size(); i++) {
-//                AxisOperation axisOperation = (AxisOperation) contolops.get(i);
-//                axisService.addOperation(axisOperation);
-//            }
             contolops.clear();
         }
         axisConfig.addServiceGroup(serviceGroup);
@@ -486,7 +488,7 @@
     public void doDeploy() {
         if (wsToDeploy.size() > 0) {
             for (int i = 0; i < wsToDeploy.size(); i++) {
-                currentArchiveFile = (ArchiveFileData) wsToDeploy.get(i);
+                ArchiveFileData currentArchiveFile = (ArchiveFileData) wsToDeploy.get(i);
                 boolean explodedDir = currentArchiveFile.getFile().isDirectory();
                 int type = currentArchiveFile.getType();
                 try {
@@ -518,7 +520,7 @@
                                         currentArchiveFile.getAbsolutePath(), currentArchiveFile,
                                         sericeGroup, explodedDir, wsdlservice,
                                         axisConfig);
-                                addServiceGroup(sericeGroup, serviceList, currentArchiveFile.getFile().toURL());
+                                addServiceGroup(sericeGroup, serviceList, currentArchiveFile.getFile().toURL(),
currentArchiveFile);
                                 log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
                                         currentArchiveFile.getName()));
                             } catch (DeploymentException de) {
@@ -746,10 +748,6 @@
         return fileName;
     }
 
-    public ArchiveFileData getCurrentFileItem() {
-        return currentArchiveFile;
-    }
-
     public AxisModule getModule(QName moduleName) throws AxisFault {
         return axisConfig.getModule(moduleName);
     }
@@ -895,5 +893,9 @@
 
     public void setWebLocationString(String webLocationString) {
         this.webLocationString = webLocationString;
+    }
+
+    public void setConfigContext(ConfigurationContext configContext) {
+        this.configContext = configContext;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java?rev=428234&r1=428233&r2=428234&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
Wed Aug  2 21:42:52 2006
@@ -31,7 +31,7 @@
 *
 */
 
-public class FileSystemConfigurator implements AxisConfigurator {
+public class FileSystemConfigurator extends DeploymentEngine implements AxisConfigurator
{
 
 	private static final Log log = LogFactory.getLog(FileSystemConfigurator.class);
     /**
@@ -39,8 +39,6 @@
      */
     private String axis2xml = null;
     private String repoLocation = null;
-    private DeploymentEngine deploymentEngine;
-    private AxisConfiguration axisConfiguration;
 
     /**
      * Load an AxisConfiguration from the repository directory specified
@@ -91,8 +89,6 @@
         }
 
         this.axis2xml = axis2xml;
-
-        deploymentEngine = new DeploymentEngine();
     }
 
     /**
@@ -110,28 +106,27 @@
                 ClassLoader cl = Thread.currentThread().getContextClassLoader();
                 axis2xmlSream = cl.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
             }
-            axisConfiguration = deploymentEngine.populateAxisConfiguration(axis2xmlSream);
+            axisConfig = populateAxisConfiguration(axis2xmlSream);
         } catch (FileNotFoundException e) {
             throw new AxisFault("System can not find the given axis2.xml " + axis2xml);
         }
-        Parameter axis2repoPara = axisConfiguration.getParameter(DeploymentConstants.AXIS2_REPO);
+        Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
         if (axis2repoPara != null) repoLocation = (String) axis2repoPara.getValue();
         if (!(repoLocation == null || "".equals(repoLocation))) {
-            deploymentEngine.loadRepository(repoLocation);
+            loadRepository(repoLocation);
         } else {
-            deploymentEngine.loadFromClassPath();
+            loadFromClassPath();
         }
-        return axisConfiguration;
+        return axisConfig;
     }
 
     public void engageGlobalModules() throws AxisFault {
-        deploymentEngine.engageModules();
+        engageModules();
     }
 
     public void loadServices() {
         if (!(repoLocation == null || "".equals(repoLocation))) {
-            deploymentEngine.loadServices();
+            super.loadServices();
         }
-
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java?rev=428234&r1=428233&r2=428234&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/URLBasedAxisConfigurator.java
Wed Aug  2 21:42:52 2006
@@ -29,14 +29,11 @@
 *
 */
 
-public class URLBasedAxisConfigurator implements AxisConfigurator {
+public class URLBasedAxisConfigurator extends DeploymentEngine implements AxisConfigurator
{
 
 	private static final Log log = LogFactory.getLog(URLBasedAxisConfigurator.class);
     private URL axis2xml;
     private URL repositoy;
-    private DeploymentEngine deploymentEngine;
-    private AxisConfiguration axisConfiguration;
-    ;
 
     public URLBasedAxisConfigurator(URL axis2xml, URL repositoy) throws AxisFault {
         this.axis2xml = axis2xml;
@@ -44,7 +41,6 @@
     }
 
     public AxisConfiguration getAxisConfiguration() throws AxisFault {
-        deploymentEngine = new DeploymentEngine();
         InputStream axis2xmlStream;
         try {
             if (axis2xml == null) {
@@ -53,53 +49,53 @@
             } else {
                 axis2xmlStream = axis2xml.openStream();
             }
-            axisConfiguration = deploymentEngine.populateAxisConfiguration(axis2xmlStream);
+            axisConfig = populateAxisConfiguration(axis2xmlStream);
             if (repositoy == null) {
-                Parameter axis2repoPara = axisConfiguration.getParameter(DeploymentConstants.AXIS2_REPO);
+                Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
                 if (axis2repoPara != null) {
                     String repoValue = (String) axis2repoPara.getValue();
                     if (repoValue != null && !"".equals(repoValue.trim())) {
                         if (repoValue.startsWith("file://")) {
                             // we treat this case specialy , by assuming file is
                             // locate in the local machine
-                            deploymentEngine.loadRepository(repoValue);
+                            loadRepository(repoValue);
                         } else {
-                            deploymentEngine.loadRepositoryFromURL(new URL(repoValue));
+                            loadRepositoryFromURL(new URL(repoValue));
                         }
                     }
                 } else {
                     log.info("No repository found , module will be loded using class path");
-                    deploymentEngine.loadFromClassPath();
+                    loadFromClassPath();
                 }
             } else {
-                deploymentEngine.loadRepositoryFromURL(repositoy);
+                loadRepositoryFromURL(repositoy);
             }
 
         } catch (IOException e) {
             throw new AxisFault(e.getMessage());
         }
-        return axisConfiguration;
+        return axisConfig;
     }
 
     //to load services
     public void loadServices() {
         try {
             if (repositoy == null) {
-                Parameter axis2repoPara = axisConfiguration.getParameter(DeploymentConstants.AXIS2_REPO);
+                Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
                 if (axis2repoPara != null) {
                     String repoValue = (String) axis2repoPara.getValue();
                     if (repoValue != null && !"".equals(repoValue.trim())) {
                         if (repoValue.startsWith("file://")) {
                             // we treat this case specialy , by assuming file is
                             // locate in the local machine
-                            deploymentEngine.loadServices();
+                            super.loadServices();
                         } else {
-                            deploymentEngine.loadServicesFromUrl(new URL(repoValue));
+                            loadServicesFromUrl(new URL(repoValue));
                         }
                     }
                 }
             } else {
-                deploymentEngine.loadServices();
+                super.loadServices();
             }
         } catch (MalformedURLException e) {
             log.info(e);
@@ -108,6 +104,6 @@
 
     //To engage globally listed modules
     public void engageGlobalModules() throws AxisFault {
-        deploymentEngine.engageModules();
+        engageModules();
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java?rev=428234&r1=428233&r2=428234&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
Wed Aug  2 21:42:52 2006
@@ -37,13 +37,10 @@
  * This allows the location of the axis2.xml and the module repository to be different from
the default locations.
  * The init parameters support alternate file, or URL values for both of these.
  */
-public class WarBasedAxisConfigurator implements AxisConfigurator {
+public class WarBasedAxisConfigurator extends DeploymentEngine implements AxisConfigurator
{
 
-    private AxisConfiguration axisConfig;
     private static final Log log = LogFactory.getLog(WarBasedAxisConfigurator.class);
     private ServletConfig config;
-    private DeploymentEngine deploymentEngine;
-
 
     /**
      * The name of the init parameter (axis2.xml.path) that can be used to override the default
location for the axis2.xml file. When both this init parameter, and the axis2.xml.url init
parameters are not specified in the axis servlet init-parameter, the default location of ${app}/WEB-INF/conf/axis2.xml
is used.
@@ -87,7 +84,6 @@
     public WarBasedAxisConfigurator(ServletConfig svconfig) {
         try {
             this.config = svconfig;
-            deploymentEngine = new DeploymentEngine();
             InputStream axis2Stream = null;
 
             try {
@@ -105,7 +101,7 @@
                     String axisurl = config.getInitParameter(PARAM_AXIS2_XML_URL);
                     if (axisurl != null) {
                         axis2Stream = new URL(axisurl).openStream();
-                        axisConfig = deploymentEngine.populateAxisConfiguration(axis2Stream);
+                        axisConfig = populateAxisConfiguration(axis2Stream);
                         log.debug("loading axis2.xml from URL: " + axisurl);
                     }
                 }
@@ -127,7 +123,7 @@
                 ClassLoader cl = Thread.currentThread().getContextClassLoader();
                 axis2Stream = cl.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
             }
-            axisConfig = deploymentEngine.populateAxisConfiguration(axis2Stream);
+            axisConfig = populateAxisConfiguration(axis2Stream);
 
             // when the module is an unpacked war file,
             // we can set the web location path in the deployment engine.
@@ -136,7 +132,7 @@
             if (webpath != null && !"".equals(webpath)) {
                 log.debug("setting web location string: " + webpath);
                 File weblocation = new File(webpath);
-                deploymentEngine.setWebLocationString(weblocation.getAbsolutePath());
+                setWebLocationString(weblocation.getAbsolutePath());
             } // if webpath not null
 
 
@@ -178,7 +174,7 @@
             if (repository == null) {
                 repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_PATH);
                 if (repository != null) {
-                    deploymentEngine.loadRepository(repository);
+                    loadRepository(repository);
                     log.debug("loaded repository from path: " + repository);
                 }
             }
@@ -186,7 +182,7 @@
             if (repository == null) {
                 repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_URL);
                 if (repository != null) {
-                    deploymentEngine.loadRepositoryFromURL(new URL(repository));
+                    loadRepositoryFromURL(new URL(repository));
                     log.debug("loaded repository from url: " + repository);
                 }
             }
@@ -197,7 +193,7 @@
                     repository = config.getServletContext().getRealPath("/WEB-INF");
                 }
                 if (repository != null) {
-                    deploymentEngine.loadRepository(repository);
+                    loadRepository(repository);
                     log.debug("loaded repository from /WEB-INF folder (unpacked war)");
                 }
             }
@@ -206,19 +202,19 @@
                 URL url = config.getServletContext().getResource("/WEB-INF/");
                 if (url != null) {
                     repository = url.toString();
-                    deploymentEngine.loadRepositoryFromURL(url);
+                    loadRepositoryFromURL(url);
                     log.debug("loaded repository from /WEB-INF/ folder (URL)");
                 }
             }
 
             if (repository == null) {
-                deploymentEngine.loadFromClassPath();
+                loadFromClassPath();
                 log.debug("loaded repository from classpath");
             }
 
         } catch (Exception ex) {
             log.error(ex + ": loading repository from classpath");
-            deploymentEngine.loadFromClassPath();
+            loadFromClassPath();
         }
         return axisConfig;
     }
@@ -237,31 +233,28 @@
 
             repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_PATH);
             if (repository != null) {
-                deploymentEngine.loadServices();
+                super.loadServices();
                 log.debug("loaded services from path: " + repository);
+                return;
             }
 
-            if (repository == null) {
-                repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_URL);
-                if (repository != null) {
-                    deploymentEngine.loadServicesFromUrl(new URL(repository));
-                    log.debug("loaded services from URL: " + repository);
-                }
+            repository = config.getInitParameter(PARAM_AXIS2_REPOSITORY_URL);
+            if (repository != null) {
+                loadServicesFromUrl(new URL(repository));
+                log.debug("loaded services from URL: " + repository);
+                return;
             }
 
-            if (repository == null) {
-                if (config.getServletContext().getRealPath("") != null) {
-                    deploymentEngine.loadServices();
-                    log.debug("loaded services from webapp");
-                }
-            } // else
+            if (config.getServletContext().getRealPath("") != null) {
+                super.loadServices();
+                log.debug("loaded services from webapp");
+                return;
+            }
 
-            if (repository == null) {
-                URL url = config.getServletContext().getResource("/WEB-INF/");
-                if (url != null) {
-                    deploymentEngine.loadServicesFromUrl(url);
-                    log.debug("loaded services from /WEB-INF/ folder (URL)");
-                }
+            URL url = config.getServletContext().getResource("/WEB-INF/");
+            if (url != null) {
+                loadServicesFromUrl(url);
+                log.debug("loaded services from /WEB-INF/ folder (URL)");
             }
         } catch (MalformedURLException e) {
             log.info(e.getMessage());
@@ -270,6 +263,6 @@
 
     //To engage globally listed modules
     public void engageGlobalModules() throws AxisFault {
-        deploymentEngine.engageModules();
+        engageModules();
     }
 }



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


Mime
View raw message