servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r615879 - /servicemix/smx4/kernel/trunk/filemonitor/src/main/java/org/apache/servicemix/kernel/filemonitor/FileMonitor.java
Date Mon, 28 Jan 2008 13:53:32 GMT
Author: gnodet
Date: Mon Jan 28 05:53:30 2008
New Revision: 615879

URL: http://svn.apache.org/viewvc?rev=615879&view=rev
Log:
Fix deployment of expanded bundles

Modified:
    servicemix/smx4/kernel/trunk/filemonitor/src/main/java/org/apache/servicemix/kernel/filemonitor/FileMonitor.java

Modified: servicemix/smx4/kernel/trunk/filemonitor/src/main/java/org/apache/servicemix/kernel/filemonitor/FileMonitor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/filemonitor/src/main/java/org/apache/servicemix/kernel/filemonitor/FileMonitor.java?rev=615879&r1=615878&r2=615879&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/filemonitor/src/main/java/org/apache/servicemix/kernel/filemonitor/FileMonitor.java
(original)
+++ servicemix/smx4/kernel/trunk/filemonitor/src/main/java/org/apache/servicemix/kernel/filemonitor/FileMonitor.java
Mon Jan 28 05:53:30 2008
@@ -200,15 +200,14 @@
 
         for (Object filename : filenames) {
             String name = filename.toString();
-            boolean added = true;
-            
+
             File file = new File(name);
             try {
                 logger.debug("File changed: " + filename + " with type: " + filename.getClass().getName());
 
                 // Handle config files
                 if (isValidConfigFile(file)) {
-                    if (added) {
+                    if (file.exists()) {
                         updateConfiguration(file);
                     }
                     else {
@@ -217,6 +216,29 @@
                     continue;
                 }
 
+                // Handle exploded artifacts removal
+                if (!file.exists() && file.getName().equals("MANIFEST.MF")) {
+                    File parentFile = file.getParentFile();
+                    if (parentFile.getName().equals("META-INF")) {
+                        File bundleDir = parentFile.getParentFile();
+                        if (isValidBundleSourceDirectory(bundleDir)) {
+                            undeployBundle(bundleDir);
+                            continue;
+                        }
+                    }
+                }
+
+                // Handle exploded artifacts add
+                File jardir = getExpandedBundleRootDirectory(file);
+                if (jardir != null) {
+                    if (bundleJarsCreated.contains(jardir)) {
+                        continue;
+                    }
+                    bundleJarsCreated.add(jardir);
+                    file = createBundleJar(jardir);
+                }
+
+                // Transformation step
                 if (file.exists()) {
                     file = transformArtifact(file);
                     if (file == null) {
@@ -224,7 +246,6 @@
                         continue;
                     }
                 } else {
-                	added = false;
                 	String transformedFile = artifactToBundle.get(name);
                 	if (transformedFile != null) {
                 		file = new File(transformedFile);
@@ -234,31 +255,13 @@
                 	}
                 }
 
-                // Check artifacts
-                // now lets iterate to find the parent directory
-                File jardir = getExpandedBundleRootDirectory(file);
-                if (jardir != null) {
-                    if (file.exists() && !bundleJarsCreated.contains(jardir)) {
-                        bundleJarsCreated.add(jardir);
-                        File newBundle = createBundleJar(jardir);
-                        deployBundle(newBundle);
-                    }
-                }
-                else if (isValidArtifactFile(file)) {
-                    if (added) {
+                // Handle final bundles
+                if (isValidArtifactFile(file)) {
+                    if (file.exists()) {
                         deployBundle(file);
                     }
                     else {
                         undeployBundle(file);
-                    }
-                }
-                else if (file.getName().equals("MANIFEST.MF")) {
-                    File parentFile = file.getParentFile();
-                    if (parentFile.getName().equals("META-INF")) {
-                        File bundleDir = parentFile.getParentFile();
-                        if (isValidBundleSourceDirectory(bundleDir)) {
-                            undeployBundle(bundleDir);
-                        }
                     }
                 }
             }



Mime
View raw message