commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r472912 - in /jakarta/commons/sandbox/jci/trunk: ./ compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/ compilers/groovy/src/main/java/org/apache/commons/jci/compilers/ core/src/main/java/ core/src/main/java/org/apache/commons...
Date Thu, 09 Nov 2006 14:26:00 GMT
Author: tcurdt
Date: Thu Nov  9 06:25:58 2006
New Revision: 472912

URL: http://svn.apache.org/viewvc?view=rev&rev=472912
Log:
mostly nitpicking and deprecating things that will change

Added:
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
  (with props)
    jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties   (with props)
Removed:
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/simplelog.properties
Modified:
    jakarta/commons/sandbox/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
    jakarta/commons/sandbox/jci/trunk/compilers/groovy/src/main/java/org/apache/commons/jci/compilers/GroovyJavaCompiler.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/ReloadingClassLoader.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
    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/core/src/main/java/org/apache/commons/jci/listeners/ResourceStoringListener.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/FileResourceReader.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/FileResourceStore.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStore.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStoreClassLoader.java
    jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/TransactionalResourceStore.java
    jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationListener.java
    jakarta/commons/sandbox/jci/trunk/pom.xml

Modified: jakarta/commons/sandbox/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
Thu Nov  9 06:25:58 2006
@@ -49,7 +49,7 @@
 
 public final class EclipseJavaCompiler extends AbstractJavaCompiler {
 
-    private final static Log log = LogFactory.getLog(EclipseJavaCompiler.class);
+    private final Log log = LogFactory.getLog(EclipseJavaCompiler.class);
     private final Map settings;
 
     public EclipseJavaCompiler() {

Modified: jakarta/commons/sandbox/jci/trunk/compilers/groovy/src/main/java/org/apache/commons/jci/compilers/GroovyJavaCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/groovy/src/main/java/org/apache/commons/jci/compilers/GroovyJavaCompiler.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/groovy/src/main/java/org/apache/commons/jci/compilers/GroovyJavaCompiler.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/groovy/src/main/java/org/apache/commons/jci/compilers/GroovyJavaCompiler.java
Thu Nov  9 06:25:58 2006
@@ -10,6 +10,7 @@
 import org.apache.commons.jci.problems.CompilationProblem;
 import org.apache.commons.jci.readers.ResourceReader;
 import org.apache.commons.jci.stores.ResourceStore;
+import org.apache.commons.jci.utils.ClassUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.codehaus.groovy.control.CompilationFailedException;
@@ -41,7 +42,7 @@
         for (int i = 0; i < source.length; i++) {
             final String resourceName = pResourceNames[i];
             source[i] = new SourceUnit(
-                    convertResourceNameToClassName(resourceName),
+                    ClassUtils.convertResourceNameToClassName(resourceName),
                     new String(pReader.getBytes(resourceName)), // FIXME delay the read
                     configuration,
                     groovyClassLoader,

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/ReloadingClassLoader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/ReloadingClassLoader.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/ReloadingClassLoader.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/ReloadingClassLoader.java
Thu Nov  9 06:25:58 2006
@@ -15,7 +15,6 @@
  */
 package org.apache.commons.jci;
 
-import java.io.File;
 import java.io.InputStream;
 import java.net.URL;
 import org.apache.commons.jci.listeners.NotificationListener;
@@ -27,18 +26,17 @@
 
 /**
  * @author tcurdt
- *
  */
 public class ReloadingClassLoader extends ClassLoader implements NotificationListener {
     
-    private final static Log log = LogFactory.getLog(ReloadingClassLoader.class);
+    private final Log log = LogFactory.getLog(ReloadingClassLoader.class);
     
     private final ClassLoader parent;
     //private final Collection reloadingListeners = new HashSet();
     private ResourceStore[] stores = new ResourceStore[0];
     private ClassLoader delegate;
     
-    public ReloadingClassLoader(final ClassLoader pParent) {        
+    public ReloadingClassLoader( final ClassLoader pParent ) {        
         super(pParent);
         parent = pParent;        
 
@@ -55,7 +53,7 @@
         pListener.setNotificationListener(null);
     }
     
-    private boolean addResourceStore(final ResourceStore pStore) {
+    private boolean addResourceStore( final ResourceStore pStore ) {
         try {        
             final int n = stores.length;
             final ResourceStore[] newStores = new ResourceStore[n + 1];
@@ -65,12 +63,12 @@
             delegate = new ResourceStoreClassLoader(parent, stores);
             return true;
         } catch ( final Exception e ) {
-            // FIXME: rethrow?
+            // TODO: rethrow?
         }
         return false;
     }
 
-    private boolean removeResourceStore(final ResourceStore pStore) {
+    private boolean removeResourceStore( final ResourceStore pStore ) {
         try {
             final int n = stores.length;
             int i = 0;
@@ -101,7 +99,7 @@
             return true;
             
         } catch ( final Exception e ) {
-            // FIXME: re-throw?
+            // TODO: re-throw?
         }
                 
         return false;
@@ -155,16 +153,7 @@
         }
     }
     */
-    public static String clazzName( final File base, final File file ) {
-        final int rootLength = base.getAbsolutePath().length();
-        final String absFileName = file.getAbsolutePath();
-        final int p = absFileName.lastIndexOf('.');
-        final String relFileName = absFileName.substring(rootLength + 1, p);
-        final String clazzName = relFileName.replace(File.separatorChar, '.');
-        return clazzName;
-    }
-
-
+    
     public void clearAssertionStatus() {
         delegate.clearAssertionStatus();
     }

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java
Thu Nov  9 06:25:58 2006
@@ -4,46 +4,23 @@
 import org.apache.commons.jci.readers.ResourceReader;
 import org.apache.commons.jci.stores.ResourceStore;
 
-
 public abstract class AbstractJavaCompiler implements JavaCompiler {
 
-    protected CompilationProblemHandler problemHandler;
-    
-    public void setCompilationProblemHandler( final CompilationProblemHandler pHandler )
{
-        problemHandler = pHandler;
-    }
-    
-    public CompilationResult compile(
-                              final String[] pClazzNames,
-                              final ResourceReader pReader,
-                              final ResourceStore pStore
-                              ) {
-        
-        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-        
-        if (classLoader == null) {
-            classLoader = this.getClass().getClassLoader();
-        }
-        
-        return compile(pClazzNames, pReader, pStore, classLoader);
-    }
-    
-    /**
-     * Please do not use - internal
-     * org/my/Class.xxx -> org/my/Class
-     */
-    public static String stripExtension( final String pResourceName ) {
-    	final int i = pResourceName.lastIndexOf('.');
-    	final String withoutExtension = pResourceName.substring(0, i);
-    	return withoutExtension;
-    }
-    
-    /**
-     * Please do not use - internal
-     * org/my/Class.xxx -> org.my.Class
-     */
-    public static String convertResourceNameToClassName( final String pResourceName ) {
-    	return stripExtension(pResourceName).replace('/', '.');
-    }
+	protected CompilationProblemHandler problemHandler;
+
+	public void setCompilationProblemHandler( final CompilationProblemHandler pHandler ) {
+		problemHandler = pHandler;
+	}
+
+	public CompilationResult compile( final String[] pClazzNames, final ResourceReader pReader,
final ResourceStore pStore ) {
+
+		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+		if (classLoader == null) {
+			classLoader = this.getClass().getClassLoader();
+		}
+
+		return compile(pClazzNames, pReader, pStore, classLoader);
+	}
 
 }

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java
Thu Nov  9 06:25:58 2006
@@ -52,18 +52,11 @@
      * @param pStore
      * @return always a CompilationResult
      */
-    CompilationResult compile(
-            final String[] pResourcePaths,
-            final ResourceReader pReader,
-            final ResourceStore pStore );
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader,
final ResourceStore pStore );
 
     /**
      * As the usual compiler but you can provide the classloader
      * and therefor the classpath you are compiling with.
      */
-    CompilationResult compile(
-            final String[] pResourcePaths,
-            final ResourceReader pReader,
-            final ResourceStore pStore,
-            final ClassLoader classLoader );
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader,
final ResourceStore pStore, final ClassLoader classLoader );
 }

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
Thu Nov  9 06:25:58 2006
@@ -18,26 +18,26 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.jci.utils.ClassUtils;
+
 
 
 public final class JavaCompilerFactory {
 
-    private static final JavaCompilerFactory INSTANCE = new JavaCompilerFactory();
+    /**
+     * @deprecated
+     */
+	private static final JavaCompilerFactory INSTANCE = new JavaCompilerFactory();
     
+    /**
+     * @deprecated
+     */
     public static JavaCompilerFactory getInstance() {
         return JavaCompilerFactory.INSTANCE;
     }
 
     private final Map classCache = new HashMap();
     
-    private JavaCompilerFactory() {
-    }
-    
-    private String toJavaCasing(final String pName) {
-        final char[] name = pName.toLowerCase().toCharArray();
-        name[0] = Character.toUpperCase(name[0]);
-        return new String(name);
-    }
     /**
      * Tries to guess the class name by convention. So for compilers
      * following the naming convention
@@ -50,12 +50,14 @@
      * 
      * @param pHint
      * @return JavaCompiler or null
+     * 
+     * TODO use META-INF discovery mechanism
      */
     public JavaCompiler createCompiler(final String pHint) {
         
         final String className;
         if (pHint.indexOf('.') < 0) {
-            className = "org.apache.commons.jci.compilers." + toJavaCasing(pHint) + "JavaCompiler";
+            className = "org.apache.commons.jci.compilers." + ClassUtils.toJavaCasing(pHint)
+ "JavaCompiler";
         } else {
             className = pHint;
         }

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=472912&r1=472911&r2=472912
==============================================================================
--- 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
Thu Nov  9 06:25:58 2006
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
-import org.apache.commons.jci.ReloadingClassLoader;
 import org.apache.commons.jci.compilers.CompilationResult;
 import org.apache.commons.jci.compilers.JavaCompiler;
 import org.apache.commons.jci.compilers.JavaCompilerFactory;
@@ -29,6 +28,7 @@
 import org.apache.commons.jci.stores.MemoryResourceStore;
 import org.apache.commons.jci.stores.ResourceStore;
 import org.apache.commons.jci.stores.TransactionalResourceStore;
+import org.apache.commons.jci.utils.ClassUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -88,7 +88,7 @@
             for (Iterator it = deleted.iterator(); it.hasNext();) {
                 final File file = (File) it.next();
                 // FIXME: does not remove nested classes
-                transactionalStore.remove(ReloadingClassLoader.clazzName(repository, file));
+                transactionalStore.remove(ClassUtils.clazzName(repository, file));
             }
             reload = true;
         }
@@ -119,7 +119,7 @@
             final String[] clazzes = new String[compileables.size()];            
             for (Iterator it = compileables.iterator(); it.hasNext();) {
                 final File file = (File) it.next();
-                clazzes[i] = ReloadingClassLoader.clazzName(repository, file);
+                clazzes[i] = ClassUtils.clazzName(repository, file);
                 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=472912&r1=472911&r2=472912
==============================================================================
--- 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
Thu Nov  9 06:25:58 2006
@@ -26,13 +26,14 @@
 import org.apache.commons.jci.stores.MemoryResourceStore;
 import org.apache.commons.jci.stores.ResourceStore;
 import org.apache.commons.jci.stores.Transactional;
+import org.apache.commons.jci.utils.ClassUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 
 public class ReloadingListener extends ResourceStoringListener {
 
-    private final static Log log = LogFactory.getLog(ReloadingListener.class);
+    private final Log log = LogFactory.getLog(ReloadingListener.class);
 
     protected final Collection created = new ArrayList();
     protected final Collection changed = new ArrayList();
@@ -42,11 +43,11 @@
 
     protected ReloadingClassLoader reloader;
     
-    public ReloadingListener(final File pRepository) {
+    public ReloadingListener( final File pRepository ) {
         this(pRepository, new MemoryResourceStore());
     }
 
-    public ReloadingListener(final File pRepository, final ResourceStore pStore) {
+    public ReloadingListener( final File pRepository, final ResourceStore pStore ) {
         super(pRepository);
         store = pStore;
     }
@@ -76,7 +77,7 @@
         if (deleted.size() > 0) {
             for (Iterator it = deleted.iterator(); it.hasNext();) {
                 final File file = (File) it.next();
-                final String resourceName = ReloadingClassLoader.clazzName(repository, file);
+                final String resourceName = ClassUtils.clazzName(repository, file);
                 //if (resourceName.endsWith(".class")) {
                     store.remove(resourceName);
                 //}
@@ -89,7 +90,7 @@
                 final File file = (File) it.next();
                 try {
                     final byte[] bytes = IOUtils.toByteArray(new FileInputStream(file));
-                    final String resourceName = ReloadingClassLoader.clazzName(repository,
file); 
+                    final String resourceName = ClassUtils.clazzName(repository, file); 
                     //if (resourceName.endsWith(".class")) {
                         store.write(resourceName, bytes);
                     //}
@@ -106,7 +107,7 @@
                 final File file = (File) it.next();
                 try {
                     final byte[] bytes = IOUtils.toByteArray(new FileInputStream(file));
-                    final String resourceName = ReloadingClassLoader.clazzName(repository,
file); 
+                    final String resourceName = ClassUtils.clazzName(repository, file); 
                     //if (resourceName.endsWith(".class")) {
                         store.write(resourceName, bytes);
                     //}

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ResourceStoringListener.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ResourceStoringListener.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ResourceStoringListener.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ResourceStoringListener.java
Thu Nov  9 06:25:58 2006
@@ -6,7 +6,7 @@
 
 public abstract class ResourceStoringListener extends NotifyingListener {
     
-    public ResourceStoringListener(final File pRepository) {
+    public ResourceStoringListener( final File pRepository ) {
         super(pRepository);        
     }
     

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/FileResourceReader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/FileResourceReader.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/FileResourceReader.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/FileResourceReader.java
Thu Nov  9 06:25:58 2006
@@ -23,7 +23,6 @@
 
 /**
  * @author tcurdt
- *
  */
 public final class FileResourceReader implements ResourceReader {
 
@@ -39,23 +38,29 @@
 
     public byte[] getBytes( final String pResourceName ) {
         try {
-            return FileUtils.readFileToString(
-                    new File(root, pResourceName), "UTF-8").getBytes();
+            return FileUtils.readFileToString(new File(root, pResourceName), "UTF-8").getBytes();
         } catch(Exception e) {
+        	// TODO
         }
         return null;
     }
     
+    /**
+     * @deprecated
+     */
     public String[] list() {
         final List files = new ArrayList();
         list(root, files);
         return (String[]) files.toArray(new String[files.size()]);
     }
 
-    private void list(final File pFile, final List pFiles) {
+    /**
+     * @deprecated
+     */
+    private void list( final File pFile, final List pFiles ) {
         if (pFile.isDirectory()) {
             final File[] directoryFiles = pFile.listFiles();
-            for (int i=0; i < directoryFiles.length; i++) {
+            for (int i = 0; i < directoryFiles.length; i++) {
                 list(directoryFiles[i], pFiles);
             }
         } else {

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java
Thu Nov  9 06:25:58 2006
@@ -7,15 +7,15 @@
     
     private Map resources;
 
-    public boolean isAvailable(final String pResourceName) {
+    public boolean isAvailable( final String pResourceName ) {
         if (resources == null) {
             return false;
         }
 
-        return resources.containsKey( pResourceName );
+        return resources.containsKey(pResourceName);
     }
     
-    public void add(final String pResourceName, final byte[] pContent) {
+    public void add( final String pResourceName, final byte[] pContent ) {
         if (resources == null) {
             resources = new HashMap();
         }
@@ -23,18 +23,20 @@
         resources.put(pResourceName, pContent);
     }
     
-    public void remove(final String pResourceName) {
+    public void remove( final String pResourceName ) {
         if (resources != null) {
             resources.remove(pResourceName);
         }    
     }    
     
 
-    public byte[] getBytes(final String pResourceName)
-    {
+    public byte[] getBytes( final String pResourceName ) {
         return (byte[]) resources.get(pResourceName);
     }
 
+    /**
+     * @deprecated
+     */
     public String[] list() {
         if (resources == null) {
             return new String[0];

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/FileResourceStore.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/FileResourceStore.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/FileResourceStore.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/FileResourceStore.java
Thu Nov  9 06:25:58 2006
@@ -34,9 +34,10 @@
 
     private final File root;
 
-    public FileResourceStore(final File pFile) {
+    public FileResourceStore( final File pFile ) {
         root = pFile;
     }
+    
     public byte[] read( final String pResourceName ) {
         InputStream is = null;
         try {
@@ -44,18 +45,22 @@
             final byte[] data = IOUtils.toByteArray(is);
             return data;
         } catch (FileNotFoundException e) {
+        	// TODO
         } catch (IOException e) {
+        	// TODO
         } finally {
             if (is != null) {
                 try {
                     is.close();
                 } catch (IOException e) {
+                	//TODO
                 }
             }
         }
 
         return null;
     }
+    
     public void write( final String pResourceName, final byte[] pData ) {
         OutputStream os = null;
         try {
@@ -69,12 +74,15 @@
             os = new FileOutputStream(file);
             os.write(pData);
         } catch (FileNotFoundException e) {
+        	// TODO
         } catch (IOException e) {
+        	// TODO        	
         } finally {
             if (os != null) {
                 try {
                     os.close();
                 } catch (IOException e) {
+                	//TODO
                 }
             }
         }
@@ -84,17 +92,23 @@
         getFile(pResourceName).delete();
     }
 
-    private File getFile(final String pResourceName) {
+    private File getFile( final String pResourceName ) {
         final String fileName = pResourceName.replace('/', File.separatorChar);
         return new File(root, fileName);
     }
 
+    /**
+     * @deprecated
+     */
     public String[] list() {
         final List files = new ArrayList();
         list(root, files);
         return (String[]) files.toArray(new String[files.size()]);
     }
 
+    /**
+     * @deprecated
+     */
     private void list(final File pFile, final List pFiles) {
         if (pFile.isDirectory()) {
             final File[] directoryFiles = pFile.listFiles();

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
Thu Nov  9 06:25:58 2006
@@ -29,7 +29,7 @@
  */
 public final class MemoryResourceStore implements ResourceStore {
 
-    private final static Log log = LogFactory.getLog(MemoryResourceStore.class);
+    private final Log log = LogFactory.getLog(MemoryResourceStore.class);
 
 	private final Map store = new HashMap();
 	
@@ -47,6 +47,9 @@
         store.remove(pResourceName);
     }
 
+    /**
+     * @deprecated
+     */
     public String[] list() {
         if (store == null) {
             return new String[0];

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStore.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStore.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStore.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStore.java
Thu Nov  9 06:25:58 2006
@@ -17,7 +17,6 @@
 
 /**
  * @author tcurdt
- *
  */
 public interface ResourceStore {
 

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStoreClassLoader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStoreClassLoader.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStoreClassLoader.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/ResourceStoreClassLoader.java
Thu Nov  9 06:25:58 2006
@@ -21,11 +21,10 @@
 
 /**
  * @author tcurdt
- *
  */
 public final class ResourceStoreClassLoader extends ClassLoader {
 
-    private final static Log log = LogFactory.getLog(ResourceStoreClassLoader.class);
+    private final Log log = LogFactory.getLog(ResourceStoreClassLoader.class);
 
     private final ResourceStore[] stores;
     //private final ClassLoader parent;

Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/TransactionalResourceStore.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/TransactionalResourceStore.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/TransactionalResourceStore.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/TransactionalResourceStore.java
Thu Nov  9 06:25:58 2006
@@ -33,13 +33,13 @@
     public void onStop() {
     }
     
-    public byte[] read(final String pResourceName) {
+    public byte[] read( final String pResourceName ) {
         return store.read(pResourceName);
     }
-    public void remove(final String pResourceName) {
+    public void remove( final String pResourceName ) {
         store.remove(pResourceName);
     }
-    public void write(final String pResourceName, final byte[] pResourceData) {
+    public void write( final String pResourceName, final byte[] pResourceData ) {
         store.write(pResourceName, pResourceData);
     }
     

Added: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java?view=auto&rev=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
(added)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
Thu Nov  9 06:25:58 2006
@@ -0,0 +1,41 @@
+package org.apache.commons.jci.utils;
+
+import java.io.File;
+
+
+public final class ClassUtils {
+
+	/**
+	 * Please do not use - internal
+	 * org/my/Class.xxx -> org.my.Class
+	 */
+	public static String convertResourceNameToClassName( final String pResourceName ) {
+		return ClassUtils.stripExtension(pResourceName).replace('/', '.');
+	}
+
+	/**
+	 * Please do not use - internal
+	 * org/my/Class.xxx -> org/my/Class
+	 */
+	public static String stripExtension( final String pResourceName ) {
+		final int i = pResourceName.lastIndexOf('.');
+		final String withoutExtension = pResourceName.substring(0, i);
+		return withoutExtension;
+	}
+
+	public static String toJavaCasing(final String pName) {
+	    final char[] name = pName.toLowerCase().toCharArray();
+	    name[0] = Character.toUpperCase(name[0]);
+	    return new String(name);
+	}
+
+	public static String clazzName( final File base, final File file ) {
+	    final int rootLength = base.getAbsolutePath().length();
+	    final String absFileName = file.getAbsolutePath();
+	    final int p = absFileName.lastIndexOf('.');
+	    final String relFileName = absFileName.substring(rootLength + 1, p);
+	    final String clazzName = relFileName.replace(File.separatorChar, '.');
+	    return clazzName;
+	}
+
+}

Propchange: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties?view=auto&rev=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties (added)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties Thu Nov  9 06:25:58
2006
@@ -0,0 +1,2 @@
+org.apache.commons.logging.simplelog.defaultlog=debug
+org.apache.commons.logging.simplelog.showdatetime=true
\ No newline at end of file

Propchange: jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: jakarta/commons/sandbox/jci/trunk/core/src/test/java/simplelog.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationListener.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationListener.java?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationListener.java
(original)
+++ jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationListener.java
Thu Nov  9 06:25:58 2006
@@ -19,10 +19,12 @@
 
 /**
  * @author tcurdt
- *
  */
 public interface FilesystemAlterationListener {
-    File getRepository(); // FIXME: ugly!!!!
+	/**
+	 * @deprecated
+	 */
+    File getRepository();
     void onStart();
     void onCreateFile( final File file );
     void onChangeFile( final File file );

Modified: jakarta/commons/sandbox/jci/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/pom.xml?view=diff&rev=472912&r1=472911&r2=472912
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/pom.xml (original)
+++ jakarta/commons/sandbox/jci/trunk/pom.xml Thu Nov  9 06:25:58 2006
@@ -8,7 +8,7 @@
   <packaging>pom</packaging>  
   
   <groupId>org.apache.commons</groupId>
-  <artifactId>commons-jci</artifactId>
+  <artifactId>jci</artifactId>
   <version>1.0-SNAPSHOT</version>
   
   <name>jci</name>
@@ -59,12 +59,12 @@
       <name>repository</name>
       <url>scpexe://people.apache.org/x1/www/people.apache.org/maven-snapshot-repository</url>
     </repository>
+-->
     <snapshotRepository>
       <id>apache-maven-snapshot</id>
       <name>repository</name>
-      <url>scpexe://people.apache.org/x1/www/people.apache.org/maven-snapshot-repository</url>
+      <url>scpexe://scpexe://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
     </snapshotRepository>
--->
     <site>
       <id>website</id>
       <url>scpexe://people.apache.org/www/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