You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/01/26 01:25:30 UTC

svn commit: r372379 - /incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java

Author: gnodet
Date: Wed Jan 25 16:25:28 2006
New Revision: 372379

URL: http://svn.apache.org/viewcvs?rev=372379&view=rev
Log:
By default. the SU manager is non-persistent: it means that it does not store the state of deployed sus.
In this case, we redeploy the service unit when initialized (on restart, there is no re-deploy).

Modified:
    incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java

Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java?rev=372379&r1=372378&r2=372379&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java (original)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java Wed Jan 25 16:25:28 2006
@@ -38,10 +38,17 @@
     
     protected Deployer[] deployers;
     
+    protected boolean persistent;
+    
     public BaseServiceUnitManager(BaseComponent component, Deployer[] deployers) {
+        this(component, deployers, false);
+    }
+
+    public BaseServiceUnitManager(BaseComponent component, Deployer[] deployers, boolean persistent) {
         this.component = component;
         this.logger = component.logger;
         this.deployers = deployers;
+        this.persistent = persistent;
     }
     
     /* (non-Javadoc)
@@ -95,7 +102,15 @@
                 throw new IllegalArgumentException("serviceUnitName should be non null and non empty");
             }
             if (getServiceUnit(serviceUnitName) == null) {
-                throw failure("init", "Service Unit '" + serviceUnitName + "' is not deployed", null);
+                if (!persistent) {
+                    ServiceUnit su = doDeploy(serviceUnitName, serviceUnitRootPath);
+                    if (su == null) {
+                        throw failure("deploy", "Unable to find suitable deployer for Service Unit '" + serviceUnitName + "'", null);
+                    }
+                    component.getRegistry().registerServiceUnit(su);
+                } else {
+                    throw failure("init", "Service Unit '" + serviceUnitName + "' is not deployed", null);
+                }
             }
             doInit(serviceUnitName, serviceUnitRootPath);
             if (logger.isDebugEnabled()) {