synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r589578 - in /webservices/synapse/trunk/java: ./ modules/core/src/main/java/org/apache/synapse/ modules/core/src/main/java/org/apache/synapse/core/ modules/core/src/main/java/org/apache/synapse/core/axis2/ modules/core/src/main/java/org/apa...
Date Mon, 29 Oct 2007 10:58:59 GMT
Author: asankha
Date: Mon Oct 29 03:58:55 2007
New Revision: 589578

URL: http://svn.apache.org/viewvc?rev=589578&view=rev
Log:
fix http://issues.apache.org/jira/browse/SYNAPSE-159
fix Synapse initialization to wait till transports are started before Jobs are run
Properly initialize VFS transport and apply for loaded services that are registered to be
exposed over it
Fix VFS version to a private build that includes a revision and a patch submitted (but not
yet applied to VFS)

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/SynapseServer.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/SynapseEnvironment.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartzJob.java
    webservices/synapse/trunk/java/modules/samples/src/test/java/org/apache/synapse/samples/n2n/AbstractAutomationTestCase.java
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
    webservices/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/UtilsVFSServer.java
    webservices/synapse/trunk/java/pom.xml

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=589578&r1=589577&r2=589578&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
Mon Oct 29 03:58:55 2007
@@ -40,8 +40,8 @@
 public class ServerManager {
 
     private static ServerManager instance;
-    private static Log log = LogFactory.getLog(ServerManager.class);
-    public static String axis2Repolocation;
+    private static final Log log = LogFactory.getLog(ServerManager.class);
+    private String axis2Repolocation;
     private ListenerManager listenerManager;
     private ConfigurationContext configctx;
 
@@ -56,6 +56,10 @@
         return instance;
     }
 
+    public void setAxis2Repolocation(String axis2Repolocation) {
+        this.axis2Repolocation = axis2Repolocation;
+    }
+
     /**
      * starting all the listeners
      */
@@ -109,10 +113,9 @@
                 || !(synEnv.getValue() instanceof SynapseEnvironment)) {
                 log.fatal(message + "Synapse Environment");
                 throw new SynapseException(message + "Synapse Environment");
+            } else {
+                ((SynapseEnvironment) synEnv.getValue()).setInitialized(true);
             }
-
-            //((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/SynapseServer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseServer.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseServer.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseServer.java
Mon Oct 29 03:58:55 2007
@@ -43,8 +43,9 @@
         if (args.length != 1 || !new File(args[0]).exists()) {
             printUsage();
         }
-        ServerManager.axis2Repolocation = args[0];
+
         ServerManager serverManager = ServerManager.getInstance();
+        serverManager.setAxis2Repolocation(args[0]);
         serverManager.start();
         addShutdownHook();
 

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/SynapseEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/SynapseEnvironment.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/SynapseEnvironment.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/SynapseEnvironment.java
Mon Oct 29 03:58:55 2007
@@ -91,4 +91,16 @@
      * @return Returns the ExecutorService
      */
      public ExecutorService getExecutorService();
+
+    /**
+     * Has the Synapse Environment properly initialized?
+     * @return true if the environment is ready for processing
+     */
+    public boolean isInitialized();
+
+    /**
+     * Set the environment as ready for message processing
+     * @param state true means ready for processing
+     */
+    public void setInitialized(boolean state);
 }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2SynapseEnvironment.java
Mon Oct 29 03:58:55 2007
@@ -52,6 +52,7 @@
     private SynapseConfiguration synapseConfig;
     private ConfigurationContext configContext;
     private ExecutorService executorService;
+    private boolean initialized = false;
 
     /** The StatisticsCollector object */
     private StatisticsCollector statisticsCollector;
@@ -262,6 +263,22 @@
      */
     public ExecutorService getExecutorService() {
         return executorService;
+    }
+
+    /**
+     * Has this environment properly initialized?
+     * @return true if ready for processing
+     */
+    public boolean isInitialized() {
+        return initialized;
+    }
+
+    /**
+     * Mark this environment as ready for processing
+     * @param state true means ready for processing
+     */
+    public void setInitialized(boolean state) {
+        this.initialized = state;
     }
 
 }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java
Mon Oct 29 03:58:55 2007
@@ -60,8 +60,8 @@
             //setting axis2 repository location
             String axis2Repo = System.getProperty(org.apache.axis2.Constants.AXIS2_REPO);
             if (axis2Repo == null) {
-                ServerManager.axis2Repolocation = synapseHome + "/WEB-INF" +
-                    File.separator + "repository";
+                ServerManager.getInstance().setAxis2Repolocation(synapseHome + "/WEB-INF"
+
+                    File.separator + "repository");
                 System.setProperty(org.apache.axis2.Constants.AXIS2_REPO,
                     synapseHome + "/WEB-INF" +
                         File.separator + "repository");

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartz.java
Mon Oct 29 03:58:55 2007
@@ -22,7 +22,6 @@
 import java.util.HashSet;
 import java.util.Random;
 import java.util.Set;
-import java.util.Date;
 
 import javax.xml.namespace.QName;
 
@@ -31,7 +30,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.core.SynapseEnvironment;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.startup.AbstractStartup;
 import org.quartz.CronTrigger;
 import org.quartz.JobDataMap;
@@ -107,7 +105,7 @@
             jobDetail.setGroup("synapse.simple.quartz");
             jobDetail.setJobClass(SimpleQuartzJob.class);
             JobDataMap jdm = new JobDataMap();
-            jdm.put(SimpleQuartzJob.SYNAPSEENVIRONMENT, synapseEnvironment);
+            jdm.put(SimpleQuartzJob.SYNAPSE_ENVIRONMENT, synapseEnvironment);
             jdm.put(SimpleQuartzJob.CLASSNAME, className);
             jdm.put(SimpleQuartzJob.PROPERTIES, xmlProperties);
             jobDetail.setJobDataMap(jdm);

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartzJob.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartzJob.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartzJob.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/startup/quartz/SimpleQuartzJob.java
Mon Oct 29 03:58:55 2007
@@ -16,8 +16,10 @@
 import org.quartz.JobExecutionException;
 
 public class SimpleQuartzJob implements Job {
-    public static final String SYNAPSEENVIRONMENT = "SynapseEnvironment",
-        CLASSNAME = "ClassName", PROPERTIES = "Properties";
+    public static final String
+        SYNAPSE_ENVIRONMENT = "SynapseEnvironment",
+        CLASSNAME = "ClassName",
+        PROPERTIES = "Properties";
     private static final Log log = LogFactory.getLog(SimpleQuartzJob.class);
 
     public void execute(JobExecutionContext ctx) throws JobExecutionException {
@@ -50,7 +52,10 @@
                 ((ManagedLifecycle) task).init(se);
             }
         }
-        task.execute();
+
+        if (se.isInitialized()) {
+            task.execute();
+        }
     }
 
     private void handleException(String msg) throws JobExecutionException {

Modified: webservices/synapse/trunk/java/modules/samples/src/test/java/org/apache/synapse/samples/n2n/AbstractAutomationTestCase.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/test/java/org/apache/synapse/samples/n2n/AbstractAutomationTestCase.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/test/java/org/apache/synapse/samples/n2n/AbstractAutomationTestCase.java
(original)
+++ webservices/synapse/trunk/java/modules/samples/src/test/java/org/apache/synapse/samples/n2n/AbstractAutomationTestCase.java
Mon Oct 29 03:58:55 2007
@@ -52,7 +52,7 @@
         System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
                 "org.apache.xerces.parsers.XMLGrammarCachingConfiguration");
         System.setProperty("axis2.xml", "modules/samples/target/test_repos/synapse/conf/axis2.xml");
-        ServerManager.axis2Repolocation = SYNAPSE_REPO;
+        ServerManager.getInstance().setAxis2Repolocation(SYNAPSE_REPO);
         ServerManager.getInstance().start();
     }
 

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
(original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractPollingTransportListener.java
Mon Oct 29 03:58:55 2007
@@ -31,7 +31,7 @@
     /** the parameter in the services.xml that specifies the poll interval for a service
*/
     public static final String TRANSPORT_POLL_INTERVAL = "transport.PollInterval";
     /** the default poll interval */
-    public static final int DEFAULT_POLL_INTERVAL = 5 * 60 * 1000; // 5 mins by default
+    public static final int DEFAULT_POLL_INTERVAL = 5 * 60; // 5 mins by default
 
     /** default interval in ms before polls */
     protected int pollInterval = DEFAULT_POLL_INTERVAL;
@@ -47,9 +47,11 @@
     /**
      * Schedule a repeated poll at the specified interval for the given service
      * @param service the service to be polled
-     * @param pollInterval the interval between successive polls
+     * @param pollInterval the interval between successive polls in seconds
      */
     public void schedulePoll(AxisService service, long pollInterval) {
+        pollInterval *= 1000; // convert to millisecs
+        
         TimerTask task = (TimerTask) serviceToTimerTaskMap.get(service);
 
         // if a timer task exists, cancel it first and create a new one

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
(original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
Mon Oct 29 03:58:55 2007
@@ -92,6 +92,16 @@
 
         // register to receive updates on services for lifetime management
         cfgCtx.getAxisConfiguration().addObservers(axisObserver);
+
+        // iterate through deployed services and start
+        Iterator services = cfgCtx.getAxisConfiguration().getServices().values().iterator();
+
+        while (services.hasNext()) {
+            AxisService service = (AxisService) services.next();
+            if (BaseUtils.isUsingTransport(service, transportName)) {
+                startListeningForService(service);
+            }
+        }
     }
 
     public void destroy() {

Modified: webservices/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/UtilsVFSServer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/UtilsVFSServer.java?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/UtilsVFSServer.java
(original)
+++ webservices/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/UtilsVFSServer.java
Mon Oct 29 03:58:55 2007
@@ -60,7 +60,7 @@
         parameters.add(new Parameter("transport.vfs.ReplyFileURI",
             "vfs:file://" + new File(".").getAbsolutePath() + File.separator + "target/vfs1/res"));
         parameters.add(new Parameter("transport.vfs.ContentType", "text/xml"));
-        parameters.add(new Parameter("transport.PollInterval", "2000"));
+        parameters.add(new Parameter("transport.PollInterval", "2"));
 
         parameters.add(new Parameter("transport.vfs.ActionAfterProcess", "DELETE"));
         deployEchoService("Service1", parameters);
@@ -74,7 +74,7 @@
         parameters.add(new Parameter("transport.vfs.ReplyFileURI",
             "vfs:file://" + new File(".").getAbsolutePath() + File.separator + "target/vfs2/res"));
         parameters.add(new Parameter("transport.vfs.ContentType", "text/xml"));
-        parameters.add(new Parameter("transport.PollInterval", "2000"));
+        parameters.add(new Parameter("transport.PollInterval", "2"));
 
         parameters.add(new Parameter("transport.vfs.ActionAfterProcess", "DELETE"));
         deployEchoService("Service2", parameters);

Modified: webservices/synapse/trunk/java/pom.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/pom.xml?rev=589578&r1=589577&r2=589578&view=diff
==============================================================================
--- webservices/synapse/trunk/java/pom.xml (original)
+++ webservices/synapse/trunk/java/pom.xml Mon Oct 29 03:58:55 2007
@@ -1057,7 +1057,7 @@
         <jms.spec.version>1.0</jms.spec.version>
         <commons.dbcp.version>1.2.2</commons.dbcp.version>
         <commons.pool.version>1.3</commons.pool.version>
-        <commons.vfs.version>1.1-SNAPSHOT</commons.vfs.version>
+        <commons.vfs.version>1.1-587797</commons.vfs.version>
         <truezip.version>6.6</truezip.version>
         <commons.net.version>1.4.1</commons.net.version>
         <jsch.version>0.1.31</jsch.version>



---------------------------------------------------------------------
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