You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by tc...@apache.org on 2005/01/12 23:30:51 UTC

cvs commit: jakarta-commons-sandbox/jci .classpath

tcurdt      2005/01/12 14:30:51

  Modified:    jci/src/java/org/apache/jci CompilingClassLoader.java
                        ResourceStoreClassLoader.java
               jci/src/java/org/apache/jci/compilers/groovy
                        GroovyJavaCompiler.java
               jci/src/java/org/apache/jci/compilers/eclipse
                        EclipseJavaCompiler.java
               jci/src/java/org/apache/jci/monitor AlterationMonitor.java
                        Test.java
               jci/src/java/org/apache/jci/stores MemoryResourceStore.java
                        FileResourceStore.java
               jci/src/java/org/apache/jci/problems
                        ConsoleCompilationProblemHandler.java
               jci      .classpath
  Log:
  use commons-logging
  
  Revision  Changes    Path
  1.2       +9 -5      jakarta-commons-sandbox/jci/src/java/org/apache/jci/CompilingClassLoader.java
  
  Index: CompilingClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/CompilingClassLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompilingClassLoader.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ CompilingClassLoader.java	12 Jan 2005 22:30:50 -0000	1.2
  @@ -22,6 +22,8 @@
   import java.util.Collection;
   import java.util.Iterator;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.jci.compilers.JavaCompiler;
   import org.apache.jci.compilers.eclipse.EclipseJavaCompiler;
   import org.apache.jci.monitor.AlterationListener;
  @@ -38,6 +40,8 @@
    */
   public class CompilingClassLoader extends ClassLoader {
       
  +    private final static Log log = LogFactory.getLog(CompilingClassLoader.class);
  +    
       private final ClassLoader parent;
       private final File repository;
       private ClassLoader delegate;
  @@ -86,7 +90,7 @@
               }
               public void onStop() {
                   /*
  -                System.out.println("resources " +
  +                log.debug("resources " +
                           created.size() + " created, " + 
                           changed.size() + " changed, " + 
                           deleted.size() + " deleted");
  @@ -114,7 +118,7 @@
                       for (Iterator it = compileables.iterator(); it.hasNext();) {
                           final File file = (File) it.next();
                           clazzes[i] = clazzName(fam.getRoot(),file);
  -                        //System.out.println(clazzes[i]);
  +                        //log.debug(clazzes[i]);
                           i++;
                       }
                       
  @@ -128,7 +132,7 @@
                               );
                       
                       
  -                    System.out.println(
  +                    log.debug(
                               problemHandler.getErrorCount() + " errors, " +
                               problemHandler.getWarningCount() + " warnings"
                               );
  @@ -145,7 +149,7 @@
   
                   store.onStop();
   
  -                //System.out.println(store);
  +                //log.debug(store);
                   
                   if (reload) {
                       reload();
  @@ -180,7 +184,7 @@
       }
   
       private void reload() {
  -        System.out.println("reloading");
  +        log.debug("reloading");
           delegate = new ResourceStoreClassLoader(parent, store );
           
       }
  
  
  
  1.2       +6 -2      jakarta-commons-sandbox/jci/src/java/org/apache/jci/ResourceStoreClassLoader.java
  
  Index: ResourceStoreClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/ResourceStoreClassLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceStoreClassLoader.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ ResourceStoreClassLoader.java	12 Jan 2005 22:30:50 -0000	1.2
  @@ -15,6 +15,8 @@
    */
   package org.apache.jci;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.jci.stores.ResourceStore;
   
   
  @@ -24,6 +26,8 @@
    */
   public final class ResourceStoreClassLoader extends ClassLoader {
   
  +    private final static Log log = LogFactory.getLog(ResourceStoreClassLoader.class);
  +
       private final ResourceStore store;
       private final ClassLoader parent;
   
  @@ -54,13 +58,13 @@
                   final ClassLoader parent = getParent();
                   if (parent != null) {
                       clazz = parent.loadClass(name);
  -                    //System.out.println("loaded from parent: " + name);
  +                    //log.debug("loaded from parent: " + name);
                   } else {
                       throw new ClassNotFoundException(name);
                   }
                   
               } else {
  -                System.out.println("loaded from store: " + name);
  +                log.debug("loaded from store: " + name);
               }
           }
   
  
  
  
  1.2       +7 -3      jakarta-commons-sandbox/jci/src/java/org/apache/jci/compilers/groovy/GroovyJavaCompiler.java
  
  Index: GroovyJavaCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/compilers/groovy/GroovyJavaCompiler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GroovyJavaCompiler.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ GroovyJavaCompiler.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -1,5 +1,7 @@
   package org.apache.jci.compilers.groovy;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.jci.compilers.JavaCompiler;
   import org.apache.jci.problems.CompilationProblemHandler;
   import org.apache.jci.problems.ConsoleCompilationProblemHandler;
  @@ -9,14 +11,16 @@
   import org.apache.jci.stores.ResourceStore;
   
   public final class GroovyJavaCompiler implements JavaCompiler {
  -    
  +
  +    private final static Log log = LogFactory.getLog(GroovyJavaCompiler.class);
  +
       public void compile(
               final String[] clazzNames,
               final ResourceReader reader,
               final ResourceStore store,
               final CompilationProblemHandler problemHandler
               ) {
  -
  +        throw new RuntimeException("NYI");
       }
   
       public static void main(String[] args) throws Exception {
  @@ -31,7 +35,7 @@
                   problemHandler
                   );
           
  -        System.out.println(
  +        log.debug(
                   problemHandler.getErrorCount() + " errors, " +
                   problemHandler.getWarningCount() + " warnings"
                   );
  
  
  
  1.2       +15 -11    jakarta-commons-sandbox/jci/src/java/org/apache/jci/compilers/eclipse/EclipseJavaCompiler.java
  
  Index: EclipseJavaCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/compilers/eclipse/EclipseJavaCompiler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EclipseJavaCompiler.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ EclipseJavaCompiler.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -25,6 +25,8 @@
   import java.util.StringTokenizer;
   
   import org.apache.commons.lang.StringUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.jci.compilers.JavaCompiler;
   import org.apache.jci.problems.CompilationProblem;
   import org.apache.jci.problems.CompilationProblemHandler;
  @@ -50,7 +52,9 @@
   import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
   
   public final class EclipseJavaCompiler implements JavaCompiler {
  -    
  +
  +    private final static Log log = LogFactory.getLog(EclipseJavaCompiler.class);
  +
       final class CompilationUnit implements ICompilationUnit {
   
           final private String clazzName;
  @@ -120,7 +124,7 @@
               final String clazzName = clazzNames[i];
               compilationUnits[i] = new CompilationUnit(reader, clazzName);
               clazzIndex.add(clazzName);
  -            System.out.println("compiling " + clazzName);
  +            log.debug("compiling " + clazzName);
           }
           
           final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
  @@ -128,7 +132,7 @@
           final INameEnvironment nameEnvironment = new INameEnvironment() {
   
               public NameEnvironmentAnswer findType( final char[][] compoundTypeName ) {
  -                //System.out.println("NameEnvironment.findType compound");
  +                //log.debug("NameEnvironment.findType compound");
   
                   final StringBuffer result = new StringBuffer();
                   for (int i = 0; i < compoundTypeName.length; i++) {
  @@ -142,7 +146,7 @@
               }
   
               public NameEnvironmentAnswer findType( final char[] typeName, final char[][] packageName ) {
  -                //System.out.println("NameEnvironment.findType");
  +                //log.debug("NameEnvironment.findType");
   
                   final StringBuffer result = new StringBuffer();
                   for (int i = 0; i < packageName.length; i++) {
  @@ -160,11 +164,11 @@
               }
   
               private NameEnvironmentAnswer findType(final String clazzName) {
  -                //System.out.println("NameEnvironment.findType " + clazzName);
  +                //log.debug("NameEnvironment.findType " + clazzName);
   
                   byte[] clazzBytes = store.read(clazzName);
                   if (clazzBytes != null) {
  -                    //System.out.println("loading from store " + clazzName);
  +                    //log.debug("loading from store " + clazzName);
   
                       final char[] fileName = clazzName.toCharArray();
                       try {
  @@ -178,7 +182,7 @@
                   else {
   
                       if (reader.isAvailable(clazzName.replace('.', '/') + ".java")) {
  -	                    System.out.println("compile " + clazzName);
  +	                    log.debug("compile " + clazzName);
   	                    ICompilationUnit compilationUnit = new CompilationUnit(reader, clazzName);
   	                    return new NameEnvironmentAnswer(compilationUnit);                                            
                       }
  @@ -188,7 +192,7 @@
                           
                           if (is != null) {
                               
  -    	                    //System.out.println("loading from classloader " + clazzName);
  +    	                    //log.debug("loading from classloader " + clazzName);
                               final byte[] buffer = new byte[8192];
                               ByteArrayOutputStream baos = new ByteArrayOutputStream(buffer.length);
                               int count;
  @@ -208,7 +212,7 @@
       	                }
                       }
                   }
  -                //System.out.println("not found " + clazzName);
  +                //log.debug("not found " + clazzName);
                   return null;    	                    
               }
   
  @@ -217,7 +221,7 @@
                   final String resourceName = clazzName.replace('.', '/') + ".class";
                   final InputStream is = this.getClass().getClassLoader().getResourceAsStream(resourceName);
                   boolean result = (is == null);
  -                //System.out.println("NameEnvironment.isPackage " + resourceName + " = " + result);
  +                //log.debug("NameEnvironment.isPackage " + resourceName + " = " + result);
                   return result;
               }
   
  @@ -318,7 +322,7 @@
                   problemHandler
                   );
           
  -        System.out.println(
  +        log.debug(
                   problemHandler.getErrorCount() + " errors, " +
                   problemHandler.getWarningCount() + " warnings"
                   );
  
  
  
  1.2       +12 -7     jakarta-commons-sandbox/jci/src/java/org/apache/jci/monitor/AlterationMonitor.java
  
  Index: AlterationMonitor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/monitor/AlterationMonitor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AlterationMonitor.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ AlterationMonitor.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -21,6 +21,9 @@
   import java.util.Iterator;
   import java.util.Set;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   
   /**
    * @author tcurdt
  @@ -28,6 +31,8 @@
    */
   public final class AlterationMonitor implements Runnable {
       
  +    private final static Log log = LogFactory.getLog(AlterationMonitor.class);
  +    
       public class Entry {
           private final File file;
           private long lastModified;
  @@ -155,14 +160,14 @@
       private void onCreate( final Entry entry ) {
           
           if (entry.isDirectory()) {
  -            System.out.println("* created dir " + entry);
  +            log.debug("* created dir " + entry);
               for (Iterator it = listeners.iterator(); it.hasNext();) {
                   final AlterationListener listener = (AlterationListener) it.next();
                   listener.onCreateDirectory(entry.getFile());
               }
           }
           else {
  -            System.out.println("* created file " + entry);
  +            log.debug("* created file " + entry);
               for (Iterator it = listeners.iterator(); it.hasNext();) {
                   final AlterationListener listener = (AlterationListener) it.next();
                   listener.onCreateFile(entry.getFile());
  @@ -173,14 +178,14 @@
       }
       private void onChange( final Entry entry ) {
           if (entry.isDirectory()) {
  -            System.out.println("* changed dir " + entry);
  +            log.debug("* changed dir " + entry);
               for (Iterator it = listeners.iterator(); it.hasNext();) {
                   final AlterationListener listener = (AlterationListener) it.next();
                   listener.onChangeDirectory(entry.getFile());
               }
           }
           else {
  -            System.out.println("* changed file " + entry);            
  +            log.debug("* changed file " + entry);            
               for (Iterator it = listeners.iterator(); it.hasNext();) {
                   final AlterationListener listener = (AlterationListener) it.next();
                   listener.onChangeFile(entry.getFile());
  @@ -190,14 +195,14 @@
       }
       private void onDelete( final Entry entry ) {
           if (entry.isDirectory()) {
  -            System.out.println("* deleted dir " + entry);
  +            log.debug("* deleted dir " + entry);
               for (Iterator it = listeners.iterator(); it.hasNext();) {
                   final AlterationListener listener = (AlterationListener) it.next();
                   listener.onDeleteDirectory(entry.getFile());
               }
           }
           else {
  -            System.out.println("* deleted file " + entry);            
  +            log.debug("* deleted file " + entry);            
               for (Iterator it = listeners.iterator(); it.hasNext();) {
                   final AlterationListener listener = (AlterationListener) it.next();
                   listener.onDeleteFile(entry.getFile());
  @@ -268,7 +273,7 @@
       
       public void run() {
           while(running) {
  -	        //System.out.println("*");
  +	        //log.debug("*");
   
   	        if (!root.isDelected()) {
   		        onStart();
  
  
  
  1.2       +9 -5      jakarta-commons-sandbox/jci/src/java/org/apache/jci/monitor/Test.java
  
  Index: Test.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/monitor/Test.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Test.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ Test.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -20,6 +20,8 @@
   import java.util.Collection;
   import java.util.Iterator;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.jci.compilers.JavaCompiler;
   import org.apache.jci.compilers.eclipse.EclipseJavaCompiler;
   import org.apache.jci.problems.ConsoleCompilationProblemHandler;
  @@ -35,6 +37,8 @@
    */
   public final class Test {
   
  +    private final static Log log = LogFactory.getLog(Test.class);
  +
       public static String clazzName( final File base, final File file ) {
           final int rootLength = base.getAbsolutePath().length();
           final String absFileName = file.getAbsolutePath();
  @@ -68,9 +72,9 @@
                   deleted.clear();
               }
               public void onStop() {
  -                System.out.println(created.size() + " resources created");
  -                System.out.println(changed.size() + " resources changed");
  -                System.out.println(deleted.size() + " resources deleted");
  +                log.debug(created.size() + " resources created");
  +                log.debug(changed.size() + " resources changed");
  +                log.debug(deleted.size() + " resources deleted");
   
                   if (deleted.size() > 0) {
   	                for (Iterator it = deleted.iterator(); it.hasNext();) {
  @@ -90,7 +94,7 @@
   	                for (Iterator it = compileables.iterator(); it.hasNext();) {
   	                    final File file = (File) it.next();
   	                    clazzes[i] = clazzName(fam.getRoot(),file);
  -	                    System.out.println(clazzes[i]);
  +	                    log.debug(clazzes[i]);
   	                    i++;
   	                }
   	                
  @@ -104,7 +108,7 @@
   	                        );
   	                
   	                
  -	                System.out.println(
  +	                log.debug(
   	                        problemHandler.getErrorCount() + " errors, " +
   	                        problemHandler.getWarningCount() + " warnings"
   	                        );
  
  
  
  1.2       +8 -3      jakarta-commons-sandbox/jci/src/java/org/apache/jci/stores/MemoryResourceStore.java
  
  Index: MemoryResourceStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/stores/MemoryResourceStore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryResourceStore.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ MemoryResourceStore.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -18,6 +18,9 @@
   import java.util.HashMap;
   import java.util.Map;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   
   /**
    * @author tcurdt
  @@ -25,20 +28,22 @@
    */
   public final class MemoryResourceStore implements ResourceStore {
   
  +    private final static Log log = LogFactory.getLog(MemoryResourceStore.class);
  +
   	private final Map store = new HashMap();
   	
   	public byte[] read( final String resourceName ) {
  -		//System.out.println("looking up class " + resourceName);
  +		//log.debug("looking up class " + resourceName);
   		return (byte[]) store.get(resourceName);
   	}
   
   	public void write( final String resourceName, final byte[] clazzData ) {
  -		System.out.println("storing class " + resourceName);
  +		log.debug("storing class " + resourceName);
   		store.put(resourceName, clazzData);
   	}
   	
       public void remove( final String resourceName ) {
  -        System.out.println("removing resource " + resourceName);
  +        log.debug("removing resource " + resourceName);
           store.remove(resourceName);
       }
   
  
  
  
  1.2       +4 -3      jakarta-commons-sandbox/jci/src/java/org/apache/jci/stores/FileResourceStore.java
  
  Index: FileResourceStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/stores/FileResourceStore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileResourceStore.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ FileResourceStore.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -23,11 +23,12 @@
   public final class FileResourceStore implements ResourceStore {
   
       public byte[] read( final String resourceName ) {
  -        return null;
  +        throw new RuntimeException("NYI");
       }
       public void write( final String resourceName, final byte[] clazzData ) {
  -    }
  -    
  +        throw new RuntimeException("NYI");
  +    }    
       public void remove( final String resourceName ) {
  +        throw new RuntimeException("NYI");
       }
   }
  
  
  
  1.2       +6 -1      jakarta-commons-sandbox/jci/src/java/org/apache/jci/problems/ConsoleCompilationProblemHandler.java
  
  Index: ConsoleCompilationProblemHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/src/java/org/apache/jci/problems/ConsoleCompilationProblemHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConsoleCompilationProblemHandler.java	3 Jan 2005 23:54:18 -0000	1.1
  +++ ConsoleCompilationProblemHandler.java	12 Jan 2005 22:30:51 -0000	1.2
  @@ -15,6 +15,9 @@
    */
   package org.apache.jci.problems;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   
   
   /**
  @@ -22,6 +25,8 @@
    *
    */
   public class ConsoleCompilationProblemHandler implements CompilationProblemHandler {
  +    
  +    private final static Log log = LogFactory.getLog(ConsoleCompilationProblemHandler.class);
   
       private int errors;
       private int warnings;
  @@ -33,7 +38,7 @@
               warnings++;
           }
           
  -        System.out.println(pProblem);
  +        log.debug(pProblem);
       }
       
       
  
  
  
  1.2       +2 -0      jakarta-commons-sandbox/jci/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jci/.classpath,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .classpath	3 Jan 2005 23:54:18 -0000	1.1
  +++ .classpath	12 Jan 2005 22:30:51 -0000	1.2
  @@ -6,5 +6,7 @@
   	<classpathentry kind="var" path="MAVEN_REPO/commons-io/jars/commons-io-1.0.jar"/>
   	<classpathentry kind="var" path="MAVEN_REPO/commons-lang/jars/commons-lang-2.0.jar"/>
   	<classpathentry kind="var" path="MAVEN_REPO/eclipse/jars/jdtcore-3.0.1.jar"/>
  +	<classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.4.jar"/>
  +	<classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-api-1.0.4.jar"/>
   	<classpathentry kind="output" path="bin"/>
   </classpath>
  
  
  

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