commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r514864 - in /jakarta/commons/sandbox/jci/trunk: core/src/main/java/org/apache/commons/jci/listeners/CompilingListener.java core/src/main/java/org/apache/commons/jci/listeners/ReloadingListener.java maven-jci-plugin/ pom.xml
Date Mon, 05 Mar 2007 21:03:46 GMT
Author: tcurdt
Date: Mon Mar  5 13:03:46 2007
New Revision: 514864

URL: http://svn.apache.org/viewvc?view=rev&rev=514864
Log:
removed the maven jci plugin experiment (will be moved to the mojo project at codehaus),
hopefully fixed windows/unix incompatibility of compiling/reloading listener,
fixed the poms


Removed:
    jakarta/commons/sandbox/jci/trunk/maven-jci-plugin/
Modified:
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/CompilingListener.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadingListener.java
    jakarta/commons/sandbox/jci/trunk/pom.xml

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/CompilingListener.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/CompilingListener.java?view=diff&rev=514864&r1=514863&r2=514864
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/CompilingListener.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/CompilingListener.java
Mon Mar  5 13:03:46 2007
@@ -89,12 +89,13 @@
             for (Iterator it = deleted.iterator(); it.hasNext();) {
                 final File deletedFile = (File) it.next();
 
-                if (deletedFile.getName().endsWith(".java")) {
+                final String resourceName = getResourceNameFromRelativeFileName(ClassUtils.relative(pObserver.getRootDirectory(),
deletedFile));
+                
+                if (resourceName.endsWith(".java")) {
                     transactionalStore.remove(
-                    		ClassUtils.stripExtension(
-                    				ClassUtils.relative(pObserver.getRootDirectory(), deletedFile)) +
".class");
+                    		ClassUtils.stripExtension(resourceName) + ".class");
                 } else {
-                    transactionalStore.remove(ClassUtils.relative(pObserver.getRootDirectory(),
deletedFile));                	
+                    transactionalStore.remove(resourceName);                	
                 }
 
                 
@@ -128,7 +129,8 @@
             final String[] sourceFiles = new String[compileables.size()];            
             for (Iterator it = compileables.iterator(); it.hasNext();) {
                 final File file = (File) it.next();
-                sourceFiles[i] = ClassUtils.relative(pObserver.getRootDirectory(), file);
+                final String resourceName = getResourceNameFromRelativeFileName(ClassUtils.relative(pObserver.getRootDirectory(),
file));
+                sourceFiles[i] = resourceName;
                 i++;
             }
             

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadingListener.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadingListener.java?view=diff&rev=514864&r1=514863&r2=514864
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadingListener.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadingListener.java
Mon Mar  5 13:03:46 2007
@@ -37,7 +37,7 @@
 public class ReloadingListener extends AbstractFilesystemAlterationListener {
 
     private final Log log = LogFactory.getLog(ReloadingListener.class);
-
+    
     private final Set notificationListeners = new HashSet();
     private final ResourceStore store;
     
@@ -62,6 +62,14 @@
     	
     }
     
+    public String getResourceNameFromRelativeFileName( final String pRelativeFileName ) {
+    	if ('/' == File.pathSeparatorChar) {
+    		return pRelativeFileName;
+    	}
+    	
+    	return pRelativeFileName.replace(File.pathSeparatorChar, '/');
+    }
+    
     public boolean isReloadRequired( final FilesystemAlterationObserver pObserver ) {
     	boolean reload = false;
     	
@@ -74,10 +82,8 @@
         if (deleted.size() > 0) {
             for (Iterator it = deleted.iterator(); it.hasNext();) {
                 final File file = (File) it.next();
-                final String resourceName = ClassUtils.relative(pObserver.getRootDirectory(),
file);
-                //if (resourceName.endsWith(".class")) {
-                    store.remove(resourceName);
-                //}
+                final String resourceName = getResourceNameFromRelativeFileName(ClassUtils.relative(pObserver.getRootDirectory(),
file));
+                store.remove(resourceName);
             }
             reload = true;
         }
@@ -87,16 +93,12 @@
                 final File file = (File) it.next();
                 try {
                     final byte[] bytes = IOUtils.toByteArray(new FileInputStream(file));
-                    final String resourceName = ClassUtils.relative(pObserver.getRootDirectory(),
file); 
-                    //if (resourceName.endsWith(".class")) {
-                        store.write(resourceName, bytes);
-                    //}
+                    final String resourceName = getResourceNameFromRelativeFileName(ClassUtils.relative(pObserver.getRootDirectory(),
file));
+                     store.write(resourceName, bytes);
                 } catch(final Exception e) {
                     log.error("could not load " + file, e);
                 }
             }
-            // FIXME: not necessary
-            //reload = true;
         }
 
         if (changed.size() > 0) {
@@ -104,10 +106,8 @@
                 final File file = (File) it.next();
                 try {
                     final byte[] bytes = IOUtils.toByteArray(new FileInputStream(file));
-                    final String resourceName = ClassUtils.relative(pObserver.getRootDirectory(),
file); 
-                    //if (resourceName.endsWith(".class")) {
-                        store.write(resourceName, bytes);
-                    //}
+                    final String resourceName = getResourceNameFromRelativeFileName(ClassUtils.relative(pObserver.getRootDirectory(),
file));
+                    store.write(resourceName, bytes);
                 } catch(final Exception e) {
                     log.error("could not load " + file, e);
                 }

Modified: jakarta/commons/sandbox/jci/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/pom.xml?view=diff&rev=514864&r1=514863&r2=514864
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/pom.xml (original)
+++ jakarta/commons/sandbox/jci/trunk/pom.xml Mon Mar  5 13:03:46 2007
@@ -8,7 +8,7 @@
         <version>1</version>
     </parent>
     <packaging>pom</packaging>
-    <artifactId>jci</artifactId>
+    <artifactId>commons-jci</artifactId>
     <version>1.0-SNAPSHOT</version>
     <name>Commons JCI</name>
     <url>http://jakarta.apache.org/commons/sandbox/jci/</url>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message