You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2011/12/24 10:13:13 UTC
svn commit: r1222941 -
/openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
Author: rmannibucau
Date: Sat Dec 24 09:13:12 2011
New Revision: 1222941
URL: http://svn.apache.org/viewvc?rev=1222941&view=rev
Log:
trying to be a bit more clever when running on felix
Modified:
openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
Modified: openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java?rev=1222941&r1=1222940&r2=1222941&view=diff
==============================================================================
--- openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java (original)
+++ openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java Sat Dec 24 09:13:12 2011
@@ -107,7 +107,7 @@ public class Deployer implements BundleL
File bundleDump = bundle.getBundleContext().getDataFile(bundle.getSymbolicName() + "/" + bundle.getVersion() + "/");
// TODO: what should happen if there is multiple versions?
if (!bundleDump.exists() && bundle.getBundleContext().getDataFile("") != null) { // felix. TODO: maybe find something better
- bundleDump = new File(bundle.getBundleContext().getDataFile("").getParentFile(), "version0.0/bundle.jar");
+ bundleDump = findFelixJar(bundle.getBundleContext());
}
if (!bundleDump.exists()) {
@@ -143,26 +143,23 @@ public class Deployer implements BundleL
}
}
- private static boolean delete(File dir) {
- if (dir == null) return true;
-
- if (dir.isDirectory()) {
- String fileNames[] = dir.list();
- if (fileNames == null) {
- fileNames = new String[0];
- }
- for (String fileName : fileNames) {
- File file = new File(dir, fileName);
- if (file.isDirectory()) {
- delete(file);
- } else {
- file.delete();
- }
- }
- return dir.delete();
- } else {
- return dir.delete();
- }
+ private static File findFelixJar(BundleContext bundleContext) {
+ final File root = bundleContext.getDataFile("").getParentFile();
+ int min = 0;
+ int max = 0;
+ File out;
+ File f = null;
+ do {
+ do {
+ out = f;
+ f = new File(root, "version" + max + "." + min + "/bundle.jar");
+ min++;
+ } while (f.exists());
+ min = 0;
+ max++;
+ f = new File(root, "version" + max + "." + min + "/bundle.jar");
+ } while (f.exists());
+ return out;
}
private void undeploy(Bundle bundle) {