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 de...@apache.org on 2005/05/16 10:46:34 UTC

svn commit: r170340 - in /webservices/axis/trunk/java/modules/core/src/org/apache/axis: context/EngineContextFactory.java deployment/DeploymentEngine.java

Author: deepal
Date: Mon May 16 01:46:33 2005
New Revision: 170340

URL: http://svn.apache.org/viewcvs?rev=170340&view=rev
Log:
adding client side config building facility from Deployment 

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java?rev=170340&r1=170339&r2=170340&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java Mon May 16 01:46:33 2005
@@ -44,8 +44,7 @@
     public ConfigurationContext buildClientEngineContext(String axis2home) throws DeploymentException {
         ConfigurationContext engineContext = null;
         try {
-            DeploymentEngine deploymentEngine = new DeploymentEngine(axis2home);
-            AxisConfiguration configuration = deploymentEngine.loadClient();
+            AxisConfiguration configuration = new DeploymentEngine().loadClient(axis2home);
             PhaseResolver phaseResolver = new PhaseResolver(configuration);
             engineContext = phaseResolver.buildGlobalChains();
             phaseResolver.buildTranspotsChains();

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java?rev=170340&r1=170339&r2=170340&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java Mon May 16 01:46:33 2005
@@ -213,9 +213,10 @@
     }
 
 
-    public AxisConfiguration loadClient() throws DeploymentException {
+    public AxisConfiguration loadClient(String clientHome) throws DeploymentException {
+        checkClientHome(clientHome);
         if (engineConfigName == null) {
-            throw new DeploymentException("path to Client.xml can not be NUll");
+            throw new DeploymentException("path to client.xml can not be NUll");
         }
         File tempfile = new File(engineConfigName);
         try {
@@ -240,6 +241,48 @@
         return axisConfig;
     }
 
+
+    private void checkClientHome(String clientHome) throws DeploymentException {
+        String clientXML = "client.xml";
+        this.folderName = clientHome;
+        File repository = new File(clientHome);
+        if (!repository.exists()) {
+            repository.mkdirs();
+            File servcies = new File(repository, "services");
+            File modules = new File(repository, "modules");
+            modules.mkdirs();
+            servcies.mkdirs();
+        }
+        File serverConf = new File(repository, clientXML);
+        if (!serverConf.exists()) {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            InputStream in = cl.getResourceAsStream("org/apache/axis/deployment/client.xml");
+            if (in != null) {
+                try {
+                    serverConf.createNewFile();
+                    FileOutputStream out = new FileOutputStream(serverConf);
+                    int BUFSIZE = 512; // since only a test file going to load , the size has selected
+                    byte[] buf = new byte[BUFSIZE];
+                    int read;
+                    while ((read = in.read(buf)) > 0) {
+                        out.write(buf, 0, read);
+                    }
+                    in.close();
+                    out.close();
+                } catch (IOException e) {
+                    throw new DeploymentException(e.getMessage());
+                }
+
+
+            } else {
+                throw new DeploymentException("can not found org/apache/axis/deployment/client.xml");
+
+            }
+        }
+        factory = new EngineContextFactory();
+        this.engineConfigName = clientHome + '/' + clientXML;
+    }
+
     /**
      * This methode used to check the modules referd by server.xml
      * are exist , or they have deployed
@@ -579,6 +622,7 @@
 
     /**
      * This method can be used to build ModuleDescription for a given module archiev file
+     *
      * @param modulearchive
      * @return
      * @throws DeploymentException