Author: mriou
Date: Wed Sep 27 12:44:32 2006
New Revision: 450554
URL: http://svn.apache.org/viewvc?view=rev&rev=450554
Log:
Another bug in deployment, both .deployed and dir can now be removed to
undeploy. Allowing the use of external (not in the webapp) conf files using a
system property.
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManager.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManagerImpl.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java?view=diff&rev=450554&r1=450553&r2=450554
==============================================================================
---
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java
(original)
+++
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEConfigProperties.java
Wed Sep 27 12:44:32 2006
@@ -48,7 +48,7 @@
private File _installDir;
public ODEConfigProperties(File installRoot) {
- _installDir = new File(installRoot, "conf");
+ _installDir = installRoot;
}
public void load() throws ServletException {
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?view=diff&rev=450554&r1=450553&r2=450554
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
(original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
Wed Sep 27 12:44:32 2006
@@ -102,7 +102,9 @@
TempFileManager.setWorkingDirectory(_appRoot);
__log.debug("Loading properties");
- _odeConfig = new ODEConfigProperties(_appRoot);
+ String confDir = System.getProperty("org.apache.ode.configDir");
+ if (confDir == null) _odeConfig = new ODEConfigProperties(new
File(_appRoot, "conf"));
+ else _odeConfig = new ODEConfigProperties(new File(confDir));
_odeConfig.load();
String wdir = _odeConfig.getWorkingDir();
@@ -388,7 +390,10 @@
throw new ServletException(errmsg,ex);
}
- File hibernatePropFile = new File(_appRoot, "conf" +
File.separatorChar + "hibernate.properties");
+ File hibernatePropFile;
+ String confDir = System.getProperty("org.apache.ode.configDir");
+ if (confDir != null) hibernatePropFile = new File(confDir,
"hibernate.properties");
+ else hibernatePropFile = new File(_appRoot, "conf" +
File.separatorChar + "hibernate.properties");
if (hibernatePropFile.exists()) {
FileInputStream fis;
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java?view=diff&rev=450554&r1=450553&r2=450554
==============================================================================
---
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
(original)
+++
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
Wed Sep 27 12:44:32 2006
@@ -46,6 +46,8 @@
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
/**
* Polls a directory for the deployment of a new deployment unit.
@@ -136,15 +138,27 @@
}
// Removing deployments that disappeared
- for (File m :_deployDir.listFiles(_deployedFilter)) {
- File deployDir = new
File(m.getParentFile(),m.getName().substring(0,m.getName().length()
- - ".deployed".length()));
-
- if (!deployDir.exists()) {
- _odeServer.getBpelServer().undeploy(deployDir);
- m.delete();
+ List<String> deployed =
_odeServer.getBpelServer().getDeploymentsList();
+ for (String s : deployed) {
+ if (s != null) {
+ File deployDir = new File(_deployDir, s);
+ if (!deployDir.exists()) {
+ boolean undeploy =
_odeServer.getBpelServer().undeploy(deployDir);
+ File marker = new File(_deployDir, s + ".deployed");
+ marker.delete();
+ if (undeploy) __log.info("Successfully undeployed " + s);
+ }
}
}
+// for (File m :_deployDir.listFiles(_deployedFilter)) {
+// File deployDir = new
File(m.getParentFile(),m.getName().substring(0,m.getName().length()
+// - ".deployed".length()));
+//
+// if (!deployDir.exists()) {
+// _odeServer.getBpelServer().undeploy(deployDir);
+// m.delete();
+// }
+// }
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManager.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManager.java?view=diff&rev=450554&r1=450553&r2=450554
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManager.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManager.java
Wed Sep 27 12:44:32 2006
@@ -20,6 +20,9 @@
import java.io.File;
import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
import org.apache.ode.bpel.iapi.DeploymentUnit;
@@ -55,5 +58,9 @@
*/
Collection<DeploymentUnitImpl> getDeploymentUnits();
+ /**
+ * @return the list of packages that are declared in the persistent
storage.
+ */
+ Set<String> getDeploymentsList();
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManagerImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManagerImpl.java?view=diff&rev=450554&r1=450553&r2=450554
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManagerImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DeploymentManagerImpl.java
Wed Sep 27 12:44:32 2006
@@ -25,6 +25,8 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.commons.logging.Log;
@@ -40,17 +42,20 @@
public class DeploymentManagerImpl implements DeploymentManager {
private static final Log __log =
LogFactory.getLog(DeploymentManagerImpl.class);
+ private File _deployDir;
private File _deployStateFile;
private ArrayList<DeploymentUnitImpl> _knownDeployments = new
ArrayList<DeploymentUnitImpl>();
+ private HashSet<String> _deploymentsList = new HashSet<String>();
/** Lock to prevent clobbering of the file. */
private ReentrantReadWriteLock _rwLock = new ReentrantReadWriteLock();
private long _lastRead = 0;
- public DeploymentManagerImpl(File deployStateFile) {
- _deployStateFile = deployStateFile;
+ public DeploymentManagerImpl(File deployDir) {
+ _deployDir = deployDir;
+ _deployStateFile = new File(deployDir.getParentFile(),
"ode-deployed.dat");
}
public DeploymentUnitImpl createDeploymentUnit(String location) {
@@ -61,6 +66,7 @@
read();
_rwLock.writeLock().lock();
try {
+ _deploymentsList.add(deploymentUnitDirectory.getName());
DeploymentUnitImpl du = new
DeploymentUnitImpl(deploymentUnitDirectory);
_knownDeployments.add(du);
write();
@@ -71,11 +77,12 @@
}
public void remove(DeploymentUnitImpl du) {
- read();
+// read();
_rwLock.writeLock().lock();
try {
if (!_knownDeployments.remove(du))
return;
+ _deploymentsList.remove(du.getDeployDir().getName());
write();
rm(du.getDeployDir());
} finally {
@@ -126,14 +133,14 @@
try {
String lin;
while ((lin = reader.readLine()) != null) {
+ _deploymentsList.add(lin);
try {
- _knownDeployments.add(new DeploymentUnitImpl(new
File(_deployStateFile.getParentFile(), lin)));
+ _knownDeployments.add(new DeploymentUnitImpl(new
File(_deployDir, lin)));
} catch (Exception ex) {
__log.debug("Failed to load DU (skipping): " +
lin,ex);
- ; // skip it.
}
}
-
+
_lastRead = _deployStateFile.lastModified();
} finally {
reader.close();
@@ -167,5 +174,9 @@
} finally {
_rwLock.writeLock().unlock();
}
+ }
+
+ public Set<String> getDeploymentsList() {
+ return _deploymentsList;
}
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?view=diff&rev=450554&r1=450553&r2=450554
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
Wed Sep 27 12:44:32 2006
@@ -395,7 +395,8 @@
}
_db = new BpelDatabase(_contexts.dao, _contexts.scheduler);
- if (_deploymentManager == null ) _deploymentManager = new
DeploymentManagerImpl(new File(_deployDir, "ode-deployed.dat"));
+ if (_deploymentManager == null )
+ _deploymentManager = new DeploymentManagerImpl(new
File(_deployDir));
_initialized = true;
} finally {
_mngmtLock.writeLock().unlock();
@@ -838,6 +839,11 @@
public void setDeployDir(String deployDir) {
this._deployDir = deployDir;
+ }
+
+
+ public List<String> getDeploymentsList() {
+ return new ArrayList<String>(_deploymentManager.getDeploymentsList());
}
}