synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject svn commit: r585126 - in /webservices/synapse/trunk/java/modules: core/src/main/java/org/apache/synapse/ core/src/main/java/org/apache/synapse/core/axis2/ handler/src/main/java/org/apache/synapse/handler/
Date Tue, 16 Oct 2007 11:53:12 GMT
Author: ruwan
Date: Tue Oct 16 04:52:57 2007
New Revision: 585126

URL: http://svn.apache.org/viewvc?rev=585126&view=rev
Log:
Fixing the synapseConfig initialization time

Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerManager.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
    webservices/synapse/trunk/java/modules/handler/src/main/java/org/apache/synapse/handler/SynapseModule.java

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerManager.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerManager.java?rev=585126&r1=585125&r2=585126&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerManager.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/ServerManager.java
Tue Oct 16 04:52:57 2007
@@ -21,9 +21,12 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.ListenerManager;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.core.SynapseEnvironment;
+import org.apache.synapse.config.SynapseConfiguration;
 
 import java.io.File;
 import java.net.ServerSocket;
@@ -89,6 +92,27 @@
                 }
                 System.out.println(msg);
             }
+
+            // now initialize SynapseConfig
+            Parameter synEnv
+                = configctx.getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_ENV);
+            Parameter synCfg
+                = configctx.getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_CONFIG);
+            String message = "Unable to initialize the Synapse Configuration : Can not find
the ";
+            if (synCfg == null || synCfg.getValue() == null
+                || !(synCfg.getValue() instanceof SynapseConfiguration)) {
+                log.fatal(message + "Synapse Configuration");
+                throw new SynapseException(message + "Synapse Configuration");
+            }
+
+            if (synEnv == null || synEnv.getValue() == null
+                || !(synEnv.getValue() instanceof SynapseEnvironment)) {
+                log.fatal(message + "Synapse Environment");
+                throw new SynapseException(message + "Synapse Environment");
+            }
+
+            ((SynapseConfiguration) synCfg.getValue()).init((SynapseEnvironment) synEnv.getValue());
+
             System.out.println("[SynapseServer] Ready");
 
         } catch (Throwable t) {

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java?rev=585126&r1=585125&r2=585126&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
Tue Oct 16 04:52:57 2007
@@ -81,7 +81,7 @@
 
         // Initializing the SynapseEnvironment and SynapseConfiguration
         log.info("Initializing the Synapse configuration ...");
-        synCfg = initializeSynapse(configurationContext);
+        synCfg = getConfiguration(configurationContext);
 
         log.info("Deploying the Synapse service..");
         // Dynamically initialize the Synapse Service and deploy it into Axis2
@@ -118,8 +118,7 @@
         log.info("Synapse initialized successfully...!");
     }
 
-    private static SynapseConfiguration initializeSynapse(
-        ConfigurationContext cfgCtx) {
+    private static SynapseConfiguration getConfiguration(ConfigurationContext cfgCtx) {
 
         cfgCtx.setProperty("addressing.validateAction", Boolean.FALSE);
         AxisConfiguration axisConfiguration = cfgCtx.getAxisConfiguration();
@@ -164,9 +163,7 @@
             log.fatal(msg, e);
             throw new SynapseException(msg, e);
         }
-        // now initialize SynapseConfig
         
-        synapseConfiguration.init(synEnv);
         return synapseConfiguration;
     }
 

Modified: webservices/synapse/trunk/java/modules/handler/src/main/java/org/apache/synapse/handler/SynapseModule.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/handler/src/main/java/org/apache/synapse/handler/SynapseModule.java?rev=585126&r1=585125&r2=585126&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/handler/src/main/java/org/apache/synapse/handler/SynapseModule.java
(original)
+++ webservices/synapse/trunk/java/modules/handler/src/main/java/org/apache/synapse/handler/SynapseModule.java
Tue Oct 16 04:52:57 2007
@@ -23,11 +23,15 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.AxisFault;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.core.axis2.SynapseInitializationModule;
+import org.apache.synapse.core.SynapseEnvironment;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -69,6 +73,26 @@
         if (new File(System.getProperty(SynapseConstants.SYNAPSE_XML)).exists()) {
             initializationModule = new org.apache.synapse.core.axis2.SynapseInitializationModule();
             initializationModule.init(configurationContext, axisModule);
+
+            // now initialize SynapseConfig
+            Parameter synEnv = configurationContext
+                .getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_ENV);
+            Parameter synCfg = configurationContext
+                .getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_CONFIG);
+            String message = "Unable to initialize the Synapse Configuration : Can not find
the ";
+            if (synCfg == null || synCfg.getValue() == null
+                || !(synCfg.getValue() instanceof SynapseConfiguration)) {
+                log.fatal(message + "Synapse Configuration");
+                throw new SynapseException(message + "Synapse Configuration");
+            }
+
+            if (synEnv == null || synEnv.getValue() == null
+                || !(synEnv.getValue() instanceof SynapseEnvironment)) {
+                log.fatal(message + "Synapse Environment");
+                throw new SynapseException(message + "Synapse Environment");
+            }
+
+            ((SynapseConfiguration) synCfg.getValue()).init((SynapseEnvironment) synEnv.getValue());
         } else {
             handleException("Unable to initialize the Synapse initializationModule. Couldn't
" +
                     "find the configuration file in the location "



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


Mime
View raw message