You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by sa...@apache.org on 2012/05/08 15:27:46 UTC

svn commit: r1335512 - /axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java

Author: sagara
Date: Tue May  8 13:27:46 2012
New Revision: 1335512

URL: http://svn.apache.org/viewvc?rev=1335512&view=rev
Log:
Reverted 1335402 , it seems loading repository from JAR file is required  for Transport tests. Will come up with  a solution. 

Modified:
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=1335512&r1=1335511&r2=1335512&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Tue May  8 13:27:46 2012
@@ -61,7 +61,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -251,21 +250,96 @@ public abstract class DeploymentEngine i
         int lastIndex = fileName.lastIndexOf(".");
         return fileName.substring(lastIndex + 1);
     }
-    
-    @Deprecated
+
     public void loadServicesFromUrl(URL repoURL) {
-        repoListener.checkServices();
-        if (hotDeployment) {
-            startSearch(repoListener);
+        try {
+            String path = servicesPath == null ? DeploymentConstants.SERVICE_PATH : servicesPath;
+            if (!path.endsWith("/")) {
+                path += "/";
+            }
+            String repoPath = repoURL.getPath();
+            if (!repoPath.endsWith("/")) {
+                repoPath += "/";
+                repoURL = new URL(repoURL.getProtocol() + "://" + repoPath);
+            }
+            URL servicesDir = new URL(repoURL, path);
+            URL filelisturl = new URL(servicesDir, "services.list");
+            ArrayList files = getFileList(filelisturl);
+
+            for (Object file : files) {
+                String fileUrl = (String) file;
+                if (fileUrl.endsWith(".aar")) {
+                    AxisServiceGroup serviceGroup = new AxisServiceGroup();
+                    URL servicesURL = new URL(servicesDir, fileUrl);
+                    ArrayList servicelist =
+                            populateService(serviceGroup,
+                                    servicesURL,
+                                    fileUrl.substring(0, fileUrl.indexOf(".aar")));
+                    addServiceGroup(serviceGroup, servicelist, servicesURL, null, axisConfig);
+                    // let the system have hidden services
+                    if (!JavaUtils.isTrueExplicitly(serviceGroup.getParameterValue(
+                            Constants.HIDDEN_SERVICE_PARAM_NAME))) {
+                        log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
+                                serviceGroup.getServiceGroupName(),
+                                servicesURL.toString()));
+                    }
+                }
+            }
+            //Loading other type of services such as custom deployers
+            loadCustomServices(repoURL);
+        } catch (MalformedURLException e) {
+            log.error(e.getMessage(), e);
+        } catch (IOException e) {
+            log.error(e.getMessage(), e);
         }
     }
-    
-    @Deprecated
+
     public void loadRepositoryFromURL(URL repoURL) throws DeploymentException {
         try {
-            loadRepository(new File(repoURL.toURI()).getPath());
-        } catch (URISyntaxException e1) {
-            e1.printStackTrace();
+            String path = modulesPath == null ? DeploymentConstants.MODULE_PATH : modulesPath;
+            if (!path.endsWith("/")) {
+                path = path + "/";
+            }
+            String repoPath = repoURL.getPath();
+            if (!repoPath.endsWith("/")) {
+                repoPath += "/";
+                repoURL = new URL(repoURL.getProtocol() + "://" + repoPath);
+            }
+            URL moduleDir = new URL(repoURL, path);
+            URL filelisturl = new URL(moduleDir, "modules.list");
+            ArrayList files = getFileList(filelisturl);
+            Iterator fileIterator = files.iterator();
+            while (fileIterator.hasNext()) {
+                String fileUrl = (String) fileIterator.next();
+                if (fileUrl.endsWith(".mar")) {
+                    URL moduleurl = new URL(moduleDir, fileUrl);
+                    ClassLoader deploymentClassLoader =
+                            Utils.createClassLoader(
+                                    new URL[]{moduleurl},
+                                    axisConfig.getModuleClassLoader(),
+                                    true,
+                                    (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
+                                    axisConfig.isChildFirstClassLoading());
+                    AxisModule module = new AxisModule();
+                    module.setModuleClassLoader(deploymentClassLoader);
+                    module.setParent(axisConfig);
+                    String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar"));
+                    module.setArchiveName(moduleFile);
+                    populateModule(module, moduleurl);
+                    module.setFileName(moduleurl);
+                    addNewModule(module, axisConfig);
+                    log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
+                            module.getArchiveName(),
+                            moduleurl.toString()));
+                }
+            }
+            org.apache.axis2.util.Utils.
+                    calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
+            axisConfig.validateSystemPredefinedPhases();
+        } catch (MalformedURLException e) {
+            throw new DeploymentException(e);
+        } catch (IOException e) {
+            throw new DeploymentException(e);
         }
     }