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 2007/03/10 19:55:33 UTC
svn commit: r516766 - in /jakarta/commons/sandbox/jci/trunk:
compilers/javac/src/main/java/org/apache/commons/jci/compilers/
core/src/main/java/org/apache/commons/jci/
core/src/main/java/org/apache/commons/jci/compilers/
core/src/main/java/org/apache/c...
Author: tcurdt
Date: Sat Mar 10 10:55:32 2007
New Revision: 516766
URL: http://svn.apache.org/viewvc?view=rev&rev=516766
Log:
clean ups,
documentation
Modified:
jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileInputStreamProxy.java
jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileOutputStreamProxy.java
jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacClassLoader.java
jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacCompilationProblem.java
jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompiler.java
jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompilerSettings.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/CompilationResult.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/compilers/JavaCompilerSettings.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/FileChangeListener.java
jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadNotificationListener.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/problems/CompilationProblem.java
jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.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/readers/ResourceReader.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/Transactional.java
jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/TransactionalResourceStore.java
jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/AbstractTestCase.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/CompilingClassLoaderTestCase.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/ReloadingClassLoaderTestCase.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/ExtendedDump.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/SimpleDump.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/compilers/AbstractCompilerTestCase.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/readers/ResourceReaderTestCase.java
jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/stores/ResourceStoreTestCase.java
jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserver.java
jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserverImpl.java
jakarta/commons/sandbox/jci/trunk/fam/src/test/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java
Modified: jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileInputStreamProxy.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileInputStreamProxy.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileInputStreamProxy.java (original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileInputStreamProxy.java Sat Mar 10 10:55:32 2007
@@ -10,7 +10,7 @@
import org.apache.commons.jci.readers.ResourceReader;
import org.apache.commons.jci.utils.ClassUtils;
-public class FileInputStreamProxy extends InputStream {
+public final class FileInputStreamProxy extends InputStream {
private final static ThreadLocal readerThreadLocal = new ThreadLocal();
Modified: jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileOutputStreamProxy.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileOutputStreamProxy.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileOutputStreamProxy.java (original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/FileOutputStreamProxy.java Sat Mar 10 10:55:32 2007
@@ -10,7 +10,7 @@
import org.apache.commons.jci.stores.ResourceStore;
import org.apache.commons.jci.utils.ClassUtils;
-public class FileOutputStreamProxy extends OutputStream {
+public final class FileOutputStreamProxy extends OutputStream {
private final static ThreadLocal storeThreadLocal = new ThreadLocal();
Modified: jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacClassLoader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacClassLoader.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacClassLoader.java (original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacClassLoader.java Sat Mar 10 10:55:32 2007
@@ -18,9 +18,23 @@
import org.vafer.dependency.asm.RenamingVisitor;
import org.vafer.dependency.utils.ResourceRenamer;
+
+/**
+ * This classloader injects the FileIn/OutputStream wrappers
+ * into javac. Access to the store/reader is done via ThreadLocals.
+ * It also tries to find the javac class on the system and expands
+ * the classpath accordingly.
+ *
+ * @author tcurdt
+ */
public final class JavacClassLoader extends URLClassLoader {
+
+ private final Map loaded = new HashMap();
-
+ public JavacClassLoader( final ClassLoader pParent ) {
+ super(getToolsJar(), pParent);
+ }
+
private static URL[] getToolsJar() {
try {
Class.forName("com.sun.tools.javac.Main");
@@ -55,17 +69,9 @@
throw new RuntimeException(sb.toString());
}
-
- private final Map loaded = new HashMap();
-
- public JavacClassLoader( final ClassLoader pParent ) {
- super(getToolsJar(), pParent);
- }
-
+
protected Class findClass( final String name ) throws ClassNotFoundException {
- //System.out.println("findClass " + name);
-
if (name.startsWith("java.")) {
return super.findClass(name);
}
@@ -86,11 +92,9 @@
new ClassReader(classStream).accept(new RenamingVisitor(new CheckClassAdapter(renamedCw), new ResourceRenamer() {
public String getNewNameFor(final String pOldName) {
if (pOldName.startsWith(FileOutputStream.class.getName())) {
-// System.out.println("rewriting FOS " + name);
return FileOutputStreamProxy.class.getName();
}
if (pOldName.startsWith(FileInputStream.class.getName())) {
-// System.out.println("rewriting FIS " + name);
return FileInputStreamProxy.class.getName();
}
return pOldName;
@@ -100,7 +104,6 @@
classBytes = renamedCw.toByteArray();
} else {
-// classBytes = IOUtils.toByteArray(classStream);
return super.findClass(name);
}
Modified: jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacCompilationProblem.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacCompilationProblem.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacCompilationProblem.java (original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacCompilationProblem.java Sat Mar 10 10:55:32 2007
@@ -2,33 +2,22 @@
import org.apache.commons.jci.problems.CompilationProblem;
-public class JavacCompilationProblem implements CompilationProblem
-{
+public class JavacCompilationProblem implements CompilationProblem {
private int endCoumn;
-
private int endLine;
-
private String fileName;
-
private String message;
-
private int startCoumn;
-
private int startLine;
-
private boolean isError;
- public JavacCompilationProblem(String message, boolean isError)
- {
+ public JavacCompilationProblem(String message, boolean isError) {
this.message = message;
this.isError = isError;
this.fileName = "";
}
- public JavacCompilationProblem(String fileName, boolean isError,
- int startLine, int startCoumn, int endLine, int endCoumn,
- String message)
- {
+ public JavacCompilationProblem(String fileName, boolean isError, int startLine, int startCoumn, int endLine, int endCoumn, String message) {
this.message = message;
this.isError = isError;
this.fileName = fileName;
@@ -38,43 +27,35 @@
this.endLine = endLine;
}
- public int getEndColumn()
- {
+ public int getEndColumn() {
return endCoumn;
}
- public int getEndLine()
- {
+ public int getEndLine() {
return endLine;
}
- public String getFileName()
- {
+ public String getFileName() {
return fileName;
}
- public String getMessage()
- {
+ public String getMessage() {
return message;
}
- public int getStartColumn()
- {
+ public int getStartColumn() {
return startCoumn;
}
- public int getStartLine()
- {
+ public int getStartLine() {
return startLine;
}
- public boolean isError()
- {
+ public boolean isError() {
return isError;
}
- public String toString()
- {
+ public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(getFileName()).append(" (");
sb.append(getStartLine());
Modified: jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompiler.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompiler.java (original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompiler.java Sat Mar 10 10:55:32 2007
@@ -15,6 +15,16 @@
import org.apache.commons.jci.readers.ResourceReader;
import org.apache.commons.jci.stores.ResourceStore;
+/**
+ * Compiler leveraging the javac from tools.jar. Using byte code rewriting
+ * it is tricked not to read/write from/to disk but use the ResourceReader and
+ * ResourceStore provided instead.
+ *
+ * NOTE: (As of now) this compiler only works up until java5. Java6 comes with
+ * a new API based on jsr199. So please use that jsr199 compiler instead.
+ *
+ * @author tcurdt
+ */
public final class JavacJavaCompiler extends AbstractJavaCompiler {
private static final String EOL = System.getProperty("line.separator");
@@ -22,15 +32,14 @@
private static final String NOTE_PREFIX = "Note: ";
private static final String ERROR_PREFIX = "error: ";
- private final JavacJavaCompilerSettings settings;
+// private final JavacJavaCompilerSettings settings;
public JavacJavaCompiler() {
- settings = null;
+// settings = null;
}
-
public JavacJavaCompiler( final JavacJavaCompilerSettings pSettings ) {
- settings = pSettings;
+// settings = pSettings;
}
public CompilationResult compile( final String[] pSourcePaths, final ResourceReader pReader, ResourceStore pStore, final ClassLoader pClasspathClassLoader) {
@@ -58,6 +67,10 @@
} catch(Exception e) {
return new CompilationResult(new CompilationProblem[] {
new JavacCompilationProblem("Error while executing the compiler: " + e.toString(), true) });
+ } finally {
+ // help GC
+ FileInputStreamProxy.setResourceReader(null);
+ FileOutputStreamProxy.setResourceStore(null);
}
}
@@ -154,73 +167,73 @@
}
}
- private String[] buildCompilerArguments( final String[] resourcePaths )
- {
- final List args = new ArrayList();
- for (int i = 0; i < resourcePaths.length; i++) {
- args.add(resourcePaths[i]);
- }
-
- if (settings != null) {
- if (settings.isOptimize()) {
- args.add("-O");
- }
-
- if (settings.isDebug()) {
- args.add("-g");
- }
-
- if (settings.isVerbose()) {
- args.add("-verbose");
- }
-
- if (settings.isShowDeprecation()) {
- args.add("-deprecation");
- // This is required to actually display the deprecation messages
- settings.setShowWarnings(true);
- }
-
- if (settings.getMaxmem() != null) {
- args.add("-J-Xmx" + settings.getMaxmem());
- }
-
- if (settings.getMeminitial() != null) {
- args.add("-J-Xms" + settings.getMeminitial());
- }
-
- if (!settings.isShowWarnings()) {
- args.add("-nowarn");
- }
-
- // TODO: this could be much improved
- if (settings.getTargetVersion() != null) {
- // Required, or it defaults to the target of your JDK (eg 1.5)
- args.add("-target");
- args.add("1.1");
- } else {
- args.add("-target");
- args.add(settings.getTargetVersion());
- }
-
- // TODO suppressSource
- if (settings.getSourceVersion() != null) {
- // If omitted, later JDKs complain about a 1.1 target
- args.add("-source");
- args.add("1.3");
- } else {
- args.add("-source");
- args.add(settings.getSourceVersion());
- }
-
- // TODO suppressEncoding
- if (settings.getSourceEncoding() != null) {
- args.add("-encoding");
- args.add(settings.getSourceEncoding());
- }
-
- // TODO CustomCompilerArguments
- }
-
- return (String[]) args.toArray(new String[args.size()]);
- }
+// private String[] buildCompilerArguments( final String[] resourcePaths )
+// {
+// final List args = new ArrayList();
+// for (int i = 0; i < resourcePaths.length; i++) {
+// args.add(resourcePaths[i]);
+// }
+//
+// if (settings != null) {
+// if (settings.isOptimize()) {
+// args.add("-O");
+// }
+//
+// if (settings.isDebug()) {
+// args.add("-g");
+// }
+//
+// if (settings.isVerbose()) {
+// args.add("-verbose");
+// }
+//
+// if (settings.isShowDeprecation()) {
+// args.add("-deprecation");
+// // This is required to actually display the deprecation messages
+// settings.setShowWarnings(true);
+// }
+//
+// if (settings.getMaxmem() != null) {
+// args.add("-J-Xmx" + settings.getMaxmem());
+// }
+//
+// if (settings.getMeminitial() != null) {
+// args.add("-J-Xms" + settings.getMeminitial());
+// }
+//
+// if (!settings.isShowWarnings()) {
+// args.add("-nowarn");
+// }
+//
+// // TODO: this could be much improved
+// if (settings.getTargetVersion() != null) {
+// // Required, or it defaults to the target of your JDK (eg 1.5)
+// args.add("-target");
+// args.add("1.1");
+// } else {
+// args.add("-target");
+// args.add(settings.getTargetVersion());
+// }
+//
+// // TODO suppressSource
+// if (settings.getSourceVersion() != null) {
+// // If omitted, later JDKs complain about a 1.1 target
+// args.add("-source");
+// args.add("1.3");
+// } else {
+// args.add("-source");
+// args.add(settings.getSourceVersion());
+// }
+//
+// // TODO suppressEncoding
+// if (settings.getSourceEncoding() != null) {
+// args.add("-encoding");
+// args.add(settings.getSourceEncoding());
+// }
+//
+// // TODO CustomCompilerArguments
+// }
+//
+// return (String[]) args.toArray(new String[args.size()]);
+// }
}
Modified: jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompilerSettings.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompilerSettings.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompilerSettings.java (original)
+++ jakarta/commons/sandbox/jci/trunk/compilers/javac/src/main/java/org/apache/commons/jci/compilers/JavacJavaCompilerSettings.java Sat Mar 10 10:55:32 2007
@@ -2,137 +2,106 @@
import java.util.List;
-public class JavacJavaCompilerSettings extends JavaCompilerSettings
-{
- private boolean optimize;
+public class JavacJavaCompilerSettings extends JavaCompilerSettings {
+ private boolean optimize;
private boolean debug;
-
private boolean verbose;
-
private boolean showDeprecation;
-
private String maxmem;
-
private String meminitial;
-
private boolean showWarnings;
-
private String targetVersion;
-
private String sourceVersion;
-
private String sourceEncoding;
private List customCompilerArguments;
- public List getCustomCompilerArguments()
- {
+ public List getCustomCompilerArguments() {
return customCompilerArguments;
}
- public void setCustomCompilerArguments(List customCompilerArguments)
- {
+ public void setCustomCompilerArguments(List customCompilerArguments) {
this.customCompilerArguments = customCompilerArguments;
}
- public boolean isDebug()
- {
+ public boolean isDebug() {
return debug;
}
- public void setDebug(boolean debug)
- {
+ public void setDebug(boolean debug) {
this.debug = debug;
}
- public boolean isShowDeprecation()
- {
+ public boolean isShowDeprecation() {
return showDeprecation;
}
- public void setShowDeprecation(boolean deprecation)
- {
+ public void setShowDeprecation(boolean deprecation) {
this.showDeprecation = deprecation;
}
- public String getMaxmem()
- {
+ public String getMaxmem() {
return maxmem;
}
- public void setMaxmem(String maxmem)
- {
+ public void setMaxmem(String maxmem) {
this.maxmem = maxmem;
}
- public String getMeminitial()
- {
+ public String getMeminitial() {
return meminitial;
}
- public void setMeminitial(String meminitial)
- {
+ public void setMeminitial(String meminitial) {
this.meminitial = meminitial;
}
- public boolean isOptimize()
- {
+ public boolean isOptimize() {
return optimize;
}
- public void setOptimize(boolean optimize)
- {
+ public void setOptimize(boolean optimize) {
this.optimize = optimize;
}
- public boolean isShowWarnings()
- {
+ public boolean isShowWarnings() {
return showWarnings;
}
- public void setShowWarnings(boolean showWarnings)
- {
+ public void setShowWarnings(boolean showWarnings) {
this.showWarnings = showWarnings;
}
- public String getSourceEncoding()
- {
+ public String getSourceEncoding() {
return sourceEncoding;
}
- public void setSourceEncoding(String sourceEncoding)
- {
+ public void setSourceEncoding(String sourceEncoding) {
this.sourceEncoding = sourceEncoding;
}
- public String getSourceVersion()
- {
+ public String getSourceVersion() {
return sourceVersion;
}
- public void setSourceVersion(String sourceVersion)
- {
+ public void setSourceVersion(String sourceVersion) {
this.sourceVersion = sourceVersion;
}
- public String getTargetVersion()
- {
+ public String getTargetVersion() {
return targetVersion;
}
- public void setTargetVersion(String targetVersion)
- {
+ public void setTargetVersion(String targetVersion) {
this.targetVersion = targetVersion;
}
- public boolean isVerbose()
- {
+ public boolean isVerbose() {
return verbose;
}
- public void setVerbose(boolean verbose)
- {
+ public void setVerbose(boolean verbose) {
this.verbose = verbose;
}
}
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci;
import java.io.InputStream;
@@ -26,6 +27,11 @@
import org.apache.commons.logging.LogFactory;
/**
+ * The ReloadingClassLoader uses a delegation mechansim to allow
+ * classes to be reloaded. That means that loadClass calls may
+ * return different results if the class was change in the underlying
+ * ResoruceStore.
+ *
* @author tcurdt
*/
public class ReloadingClassLoader extends ClassLoader implements ReloadNotificationListener {
@@ -36,8 +42,6 @@
private ResourceStore[] stores = new ResourceStore[0];
private ClassLoader delegate;
- //private final Collection reloadingListeners = new HashSet();
-
public ReloadingClassLoader( final ClassLoader pParent ) {
super(pParent);
parent = pParent;
@@ -45,16 +49,6 @@
delegate = new ResourceStoreClassLoader(parent, stores);
}
-// public void addListener(final ReloadingListener pListener) {
-//// pListener.setNotificationListener(this);
-// addResourceStore(pListener.getStore());
-// }
-
-// public void removeListener(final ReloadingListener pListener) {
-// removeResourceStore(pListener.getStore());
-//// pListener.setNotificationListener(null);
-// }
-
public boolean addResourceStore( final ResourceStore pStore ) {
try {
final int n = stores.length;
@@ -71,89 +65,40 @@
}
public boolean removeResourceStore( final ResourceStore pStore ) {
- try {
- final int n = stores.length;
- int i = 0;
-
- //find the pStore and index position with var i
- while ( ( i <= n ) && ( stores[i] != pStore ) ) {
- i++;
- }
-
- //pStore was not found
- if ( i == n ) {
- throw new Exception( "store" + pStore + " was not found" );
- }
+
+ final int n = stores.length;
+ int i = 0;
+
+ // FIXME: this should be improved with a Map
+ // find the pStore and index position with var i
+ while ( ( i <= n ) && ( stores[i] != pStore ) ) {
+ i++;
+ }
+
+ // pStore was not found
+ if ( i == n ) {
+ return false;
+ }
+
+ // if stores length > 1 then array copy old values, else create new empty store
+ if (n > 1) {
+ final ResourceStore[] newStores = new ResourceStore[n - 1];
- // if stores length > 1 then array copy old values, else create new empty store
- if (n > 1) {
- final ResourceStore[] newStores = new ResourceStore[n - 1];
-
- System.arraycopy(stores, 0, newStores, 0, i-1);
- System.arraycopy(stores, i, newStores, i, newStores.length - 1);
-
- stores = newStores;
- delegate = new ResourceStoreClassLoader(parent, stores);
- } else {
- stores = new ResourceStore[0];
- }
- return true;
+ System.arraycopy(stores, 0, newStores, 0, i-1);
+ System.arraycopy(stores, i, newStores, i, newStores.length - 1);
- } catch ( final Exception e ) {
- log.error("could not remove resource store " + pStore, e);
+ stores = newStores;
+ delegate = new ResourceStoreClassLoader(parent, stores);
+ } else {
+ stores = new ResourceStore[0];
}
-
- return false;
- }
-
- /*
- public void start() {
- fam = new FilesystemAlterationMonitor();
- fam.addListener(new ReloadingListener(store) {
- protected void needsReload( boolean pReload ) {
- super.needsReload(pReload);
- if (pReload) {
- ReloadingClassLoader.this.reload();
- } else {
- ReloadingClassLoader.this.notifyReloadingListeners(false);
- }
- }
- }, repository);
- fam.start();
- }
-
- public void stop() {
- fam.stop();
- }
- */
- /*
- public void addListener(final ReloadingClassLoaderListener pListener) {
- synchronized (reloadingListeners) {
- reloadingListeners.add(pListener);
- }
+ return true;
}
- public boolean removeListener(final ReloadingClassLoaderListener pListener) {
- synchronized (reloadingListeners) {
- return reloadingListeners.remove(pListener);
- }
- }
- */
public void handleNotification() {
log.debug("reloading");
delegate = new ResourceStoreClassLoader(parent, stores);
- //notifyReloadingListeners();
- }
- /*
- private void notifyReloadingListeners() {
- synchronized (reloadingListeners) {
- for (final Iterator it = reloadingListeners.iterator(); it.hasNext();) {
- final ReloadingClassLoaderListener listener = (ReloadingClassLoaderListener) it.next();
- listener.hasReloaded();
- }
- }
}
- */
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -1,9 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.compilers;
import org.apache.commons.jci.problems.CompilationProblemHandler;
import org.apache.commons.jci.readers.ResourceReader;
import org.apache.commons.jci.stores.ResourceStore;
+
+/**
+ * Base class for compiler implementations. Provides just a few
+ * convenience methods.
+ *
+ * @author tcurdt
+ */
public abstract class AbstractJavaCompiler implements JavaCompiler {
protected CompilationProblemHandler problemHandler;
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java Sat Mar 10 10:55:32 2007
@@ -1,10 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.compilers;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.jci.problems.CompilationProblem;
-
+/**
+ * A CompilationResult represents the result of a compilation.
+ * It includes errors (which failed the compilation) or warnings
+ * (that can be ignored and do not affect the creation of the
+ * class files)
+ *
+ * @author tcurdt
+ */
public final class CompilationResult {
private final CompilationProblem[] errors;
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.compilers;
import org.apache.commons.jci.problems.CompilationProblemHandler;
@@ -22,6 +23,17 @@
/**
+ * The general compiler interface. All compilers implementing
+ * this interface should read the resources from the reader
+ * and store the java class files into the ResourceStore.
+ *
+ * The actual compilation language does not matter. But the
+ * contract is that the result of the compilation will be a
+ * class file.
+ *
+ * If possible the compiler should notify the optional
+ * CompilationProblemHandler as soon as a problem is found.
+ *
* @author tcurdt
*/
public interface JavaCompiler {
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.compilers;
import java.util.HashMap;
@@ -22,23 +23,29 @@
import org.apache.commons.jci.utils.ClassUtils;
-
+/**
+ * Creates JavaCompilers
+ *
+ * TODO use META-INF discovery mechanism
+ *
+ * @author tcurdt
+ */
public final class JavaCompilerFactory {
/**
- * @deprecated
+ * @deprecated will be remove after the next release, please create an instance yourself
*/
private static final JavaCompilerFactory INSTANCE = new JavaCompilerFactory();
+
+ private final Map classCache = new HashMap();
/**
- * @deprecated
+ * @deprecated will be remove after the next release, please create an instance yourself
*/
public static JavaCompilerFactory getInstance() {
return JavaCompilerFactory.INSTANCE;
}
- private final Map classCache = new HashMap();
-
/**
* Tries to guess the class name by convention. So for compilers
* following the naming convention
@@ -51,8 +58,6 @@
*
* @param pHint
* @return JavaCompiler or null
- *
- * TODO use META-INF discovery mechanism
*/
public JavaCompiler createCompiler(final String pHint) {
@@ -81,7 +86,6 @@
try {
return (JavaCompiler) clazz.newInstance();
} catch (Throwable t) {
- t.printStackTrace();
return null;
}
}
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java Sat Mar 10 10:55:32 2007
@@ -14,34 +14,80 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.jci.compilers;
+package org.apache.commons.jci.compilers;
+/**
+ * Most common denominator for JavaCompiler settings.
+ *
+ * If you need more specific settings you have to provide
+ * the native compiler configurations to the compilers.
+ * Writing of custom factory is suggested.
+ *
+ * @author tcurdt
+ */
public class JavaCompilerSettings {
+ private String targetVersion;
+ private String sourceVersion;
+ private String sourceEncoding;
+ private boolean warnings;
+ private boolean deprecations;
+ private boolean verbose;
+
+
public void setTargetVersion( final String pTargetVersion ) {
-
+ targetVersion = pTargetVersion;
+ }
+
+ public String getTargetVersion() {
+ return targetVersion;
}
+
public void setSourceVersion( final String pSourceVersion ) {
-
+ sourceVersion = pSourceVersion;
+ }
+
+ public String getSourceVersion() {
+ return sourceVersion;
}
+
public void setSourceEncoding( final String pSourceEncoding ) {
-
+ sourceEncoding = pSourceEncoding;
}
+
+ public String getSourceEncoding() {
+ return sourceEncoding;
+ }
+
public void setWarnings( final boolean pWarnings ) {
-
+ warnings = pWarnings;
}
+
+ public boolean isWarnings() {
+ return warnings;
+ }
+
public void setDeprecations( final boolean pDeprecations ) {
-
+ deprecations = pDeprecations;
}
+
+ public boolean isDeprecations() {
+ return deprecations;
+ }
+
public void setVerbose( final boolean pVerbose ) {
-
+ verbose = pVerbose;
+ }
+
+ public boolean isVerbose() {
+ return verbose;
}
}
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.listeners;
import java.io.File;
@@ -35,7 +36,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+/**
+ *
+ * @author tcurdt
+ */
public class CompilingListener extends ReloadingListener {
private final Log log = LogFactory.getLog(CompilingListener.class);
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/FileChangeListener.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/FileChangeListener.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/FileChangeListener.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/FileChangeListener.java Sat Mar 10 10:55:32 2007
@@ -1,10 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.listeners;
import java.io.File;
import org.apache.commons.jci.monitor.FilesystemAlterationObserver;
-
+/**
+ *
+ * @author tcurdt
+ */
public class FileChangeListener extends AbstractFilesystemAlterationListener {
private boolean changed;
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadNotificationListener.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadNotificationListener.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadNotificationListener.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/listeners/ReloadNotificationListener.java Sat Mar 10 10:55:32 2007
@@ -1,5 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.listeners;
+/**
+ *
+ * @author tcurdt
+ */
public interface ReloadNotificationListener {
+
void handleNotification();
+
}
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.listeners;
import java.io.File;
@@ -33,7 +34,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+/**
+ *
+ * @author tcurdt
+ */
public class ReloadingListener extends AbstractFilesystemAlterationListener {
private final Log log = LogFactory.getLog(ReloadingListener.class);
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java Sat Mar 10 10:55:32 2007
@@ -14,8 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.problems;
+/**
+ *
+ * @author tcurdt
+ */
public interface CompilationProblem {
boolean isError();
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.problems;
@@ -32,5 +33,7 @@
* @author tcurdt
*/
public interface CompilationProblemHandler {
- boolean handle( final CompilationProblem pProblem );
+
+ boolean handle( final CompilationProblem pProblem );
+
}
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.readers;
import java.io.File;
@@ -41,9 +42,8 @@
try {
return FileUtils.readFileToString(new File(root, pResourceName), "UTF-8").getBytes();
} catch(Exception e) {
- // TODO
+ return null;
}
- return null;
}
/**
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -1,8 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.readers;
import java.util.Map;
import java.util.HashMap;
+/**
+ *
+ * @author tcurdt
+ */
public class MemoryResourceReader implements ResourceReader {
private Map resources;
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/ResourceReader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/ResourceReader.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/ResourceReader.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/readers/ResourceReader.java Sat Mar 10 10:55:32 2007
@@ -14,12 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.readers;
/**
* @author tcurdt
*/
public interface ResourceReader {
- boolean isAvailable( final String pResourceName );
+
+ boolean isAvailable( final String pResourceName );
byte[] getBytes( final String pResourceName );
+
}
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.stores;
import java.io.File;
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.stores;
import java.util.ArrayList;
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -21,9 +21,7 @@
*/
public interface ResourceStore {
- void write( final String pResourceName, final byte[] pResourceData );
-
+ void write( final String pResourceName, final byte[] pResourceData );
byte[] read( final String pResourceName );
-
void remove( final String pResourceName );
}
Modified: jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/Transactional.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/Transactional.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/Transactional.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/stores/Transactional.java Sat Mar 10 10:55:32 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.stores;
public interface Transactional {
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=516766&r1=516765&r2=516766
==============================================================================
--- 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 Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.stores;
Modified: 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=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/main/java/org/apache/commons/jci/utils/ClassUtils.java Sat Mar 10 10:55:32 2007
@@ -1,8 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.utils;
import java.io.File;
-
+/**
+ *
+ * @author tcurdt
+ */
public final class ClassUtils {
/**
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/AbstractTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/AbstractTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/AbstractTestCase.java Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci;
import java.io.File;
@@ -25,7 +26,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+/**
+ *
+ * @author tcurdt
+ */
public abstract class AbstractTestCase extends TestCase {
private final Log log = LogFactory.getLog(AbstractTestCase.class);
@@ -115,6 +119,4 @@
protected void tearDown() throws Exception {
FileUtils.deleteDirectory(directory);
}
-
-
}
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/CompilingClassLoaderTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/CompilingClassLoaderTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/CompilingClassLoaderTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/CompilingClassLoaderTestCase.java Sat Mar 10 10:55:32 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci;
import java.io.File;
@@ -17,7 +34,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+/**
+ *
+ * @author tcurdt
+ */
public final class CompilingClassLoaderTestCase extends AbstractTestCase {
private final Log log = LogFactory.getLog(CompilingClassLoaderTestCase.class);
@@ -323,13 +343,9 @@
// bar1.setFoo(foo2);
// }
-
-
-
protected void tearDown() throws Exception {
fam.removeListener(listener);
fam.stop();
super.tearDown();
- }
-
+ }
}
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/ReloadingClassLoaderTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/ReloadingClassLoaderTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/ReloadingClassLoaderTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/ReloadingClassLoaderTestCase.java Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci;
import java.io.File;
@@ -25,7 +26,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+/**
+ *
+ * @author tcurdt
+ */
public final class ReloadingClassLoaderTestCase extends AbstractTestCase {
private final Log log = LogFactory.getLog(ReloadingClassLoaderTestCase.class);
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/ExtendedDump.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/ExtendedDump.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/ExtendedDump.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/ExtendedDump.java Sat Mar 10 10:55:32 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.classes;
import org.objectweb.asm.ClassWriter;
@@ -11,9 +28,7 @@
public static byte[] dump() throws Exception {
ClassWriter cw = new ClassWriter(true);
-// FieldVisitor fv;
MethodVisitor mv;
-// AnnotationVisitor av0;
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, "jci/Extended", null, "jci/Simple", null);
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/SimpleDump.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/SimpleDump.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/SimpleDump.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/classes/SimpleDump.java Sat Mar 10 10:55:32 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.classes;
import org.objectweb.asm.ClassWriter;
@@ -9,46 +26,44 @@
public static byte[] dump( final String to ) throws Exception {
- ClassWriter cw = new ClassWriter(true);
-// FieldVisitor fv;
- MethodVisitor mv;
-// AnnotationVisitor av0;
-
- cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, "jci/Simple", null, "java/lang/Object", null);
-
- cw.visitSource("Simple.java", null);
-
- {
- mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- mv.visitLineNumber(3, l0);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
- mv.visitInsn(RETURN);
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLocalVariable("this", "Ljci/Simple;", null, l0, l1, 0);
- mv.visitMaxs(1, 1);
- mv.visitEnd();
- }
- {
- mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- mv.visitLineNumber(6, l0);
- mv.visitLdcInsn(to);
- mv.visitInsn(ARETURN);
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLocalVariable("this", "Ljci/Simple;", null, l0, l1, 0);
- mv.visitMaxs(1, 1);
- mv.visitEnd();
- }
- cw.visitEnd();
+ ClassWriter cw = new ClassWriter(true);
+ MethodVisitor mv;
+
+ cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, "jci/Simple", null, "java/lang/Object", null);
+
+ cw.visitSource("Simple.java", null);
+
+ {
+ mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitLineNumber(3, l0);
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+ mv.visitInsn(RETURN);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLocalVariable("this", "Ljci/Simple;", null, l0, l1, 0);
+ mv.visitMaxs(1, 1);
+ mv.visitEnd();
+ }
+ {
+ mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitLineNumber(6, l0);
+ mv.visitLdcInsn(to);
+ mv.visitInsn(ARETURN);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLocalVariable("this", "Ljci/Simple;", null, l0, l1, 0);
+ mv.visitMaxs(1, 1);
+ mv.visitEnd();
+ }
+ cw.visitEnd();
- return cw.toByteArray();
+ return cw.toByteArray();
}
}
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/compilers/AbstractCompilerTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/compilers/AbstractCompilerTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/compilers/AbstractCompilerTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/compilers/AbstractCompilerTestCase.java Sat Mar 10 10:55:32 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.compilers;
import java.util.HashMap;
@@ -9,6 +26,11 @@
import org.apache.commons.jci.readers.ResourceReader;
import org.apache.commons.jci.stores.MemoryResourceStore;
+/**
+ * Providing convenience methods for JavaCompiler TestCases
+ *
+ * @author tcurdt
+ */
public abstract class AbstractCompilerTestCase extends TestCase {
public abstract JavaCompiler createJavaCompiler();
@@ -27,15 +49,17 @@
final JavaCompiler compiler = createJavaCompiler();
final ResourceReader reader = new ResourceReader() {
- final private Map sources = new HashMap() {{
- put("jci/Simple.java", (
- "package jci;\n" +
- "public class Simple {\n" +
- " public String toString() {\n" +
- " return \"Simple\";\n" +
- " }\n" +
- "}").getBytes());
- }};
+ final private Map sources = new HashMap() {
+ private static final long serialVersionUID = 1L;
+ {
+ put("jci/Simple.java", (
+ "package jci;\n" +
+ "public class Simple {\n" +
+ " public String toString() {\n" +
+ " return \"Simple\";\n" +
+ " }\n" +
+ "}").getBytes());
+ }};
public byte[] getBytes( final String pResourceName ) {
return (byte[]) sources.get(pResourceName);
@@ -65,22 +89,24 @@
final JavaCompiler compiler = createJavaCompiler();
final ResourceReader reader = new ResourceReader() {
- final private Map sources = new HashMap() {{
- put("jci/Simple.java", (
- "package jci;\n" +
- "public class Simple {\n" +
- " public String toString() {\n" +
- " return \"Simple\";\n" +
- " }\n" +
+ final private Map sources = new HashMap() {
+ private static final long serialVersionUID = 1L;
+ {
+ put("jci/Simple.java", (
+ "package jci;\n" +
+ "public class Simple {\n" +
+ " public String toString() {\n" +
+ " return \"Simple\";\n" +
+ " }\n" +
"}").getBytes());
- put("jci/Extended.java", (
- "package jci;\n" +
- "public class Extended extends Simple {\n" +
- " public String toString() {\n" +
- " return \"Extended\" + super.toString();\n" +
- " }\n" +
- "}").getBytes());
- }};
+ put("jci/Extended.java", (
+ "package jci;\n" +
+ "public class Extended extends Simple {\n" +
+ " public String toString() {\n" +
+ " return \"Extended\" + super.toString();\n" +
+ " }\n" +
+ "}").getBytes());
+ }};
public byte[] getBytes( final String pResourceName ) {
return (byte[]) sources.get(pResourceName);
@@ -115,18 +141,20 @@
final JavaCompiler compiler = createJavaCompiler();
final ResourceReader reader = new ResourceReader() {
- final private Map sources = new HashMap() {{
- put("jci/Simple.java", (
- "package jci;\n" +
- "public class Simple {\n" +
- " private class Sub {\n" +
- " }\n" +
- " public String toString() {\n" +
- " new Sub();\n" +
- " return \"Simple\";\n" +
- " }\n" +
+ final private Map sources = new HashMap() {
+ private static final long serialVersionUID = 1L;
+ {
+ put("jci/Simple.java", (
+ "package jci;\n" +
+ "public class Simple {\n" +
+ " private class Sub {\n" +
+ " }\n" +
+ " public String toString() {\n" +
+ " new Sub();\n" +
+ " return \"Simple\";\n" +
+ " }\n" +
"}").getBytes());
- }};
+ }};
public byte[] getBytes( final String pResourceName ) {
return (byte[]) sources.get(pResourceName);
@@ -161,15 +189,17 @@
final JavaCompiler compiler = createJavaCompiler();
final ResourceReader reader = new ResourceReader() {
- final private Map sources = new HashMap() {{
- put("Jci/Simple.java", (
- "package Jci;\n" +
- "public class Simple {\n" +
- " public String toString() {\n" +
- " return \"Simple\";\n" +
- " }\n" +
+ final private Map sources = new HashMap() {
+ private static final long serialVersionUID = 1L;
+ {
+ put("Jci/Simple.java", (
+ "package Jci;\n" +
+ "public class Simple {\n" +
+ " public String toString() {\n" +
+ " return \"Simple\";\n" +
+ " }\n" +
"}").getBytes());
- }};
+ }};
public byte[] getBytes( final String pResourceName ) {
return (byte[]) sources.get(pResourceName);
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/readers/ResourceReaderTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/readers/ResourceReaderTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/readers/ResourceReaderTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/readers/ResourceReaderTestCase.java Sat Mar 10 10:55:32 2007
@@ -1,8 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.readers;
import org.apache.commons.jci.AbstractTestCase;
-
+/**
+ *
+ * @author tcurdt
+ */
public final class ResourceReaderTestCase extends AbstractTestCase {
public void testFileResourceReader() throws Exception {
Modified: jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/stores/ResourceStoreTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/stores/ResourceStoreTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/stores/ResourceStoreTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/core/src/test/java/org/apache/commons/jci/stores/ResourceStoreTestCase.java Sat Mar 10 10:55:32 2007
@@ -1,9 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.commons.jci.stores;
import org.apache.commons.jci.AbstractTestCase;
import org.apache.commons.lang.ArrayUtils;
+/**
+ *
+ * @author tcurdt
+ */
public final class ResourceStoreTestCase extends AbstractTestCase {
public void testMemoryResourceStore() {
@@ -45,8 +66,5 @@
final byte[] empty = pStore.read("key");
assertTrue(empty == null);
- }
-
-
-
+ }
}
Modified: jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserver.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserver.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserver.java (original)
+++ jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserver.java Sat Mar 10 10:55:32 2007
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.monitor;
import java.io.File;
@@ -26,17 +27,14 @@
*/
public interface FilesystemAlterationObserver {
- // FilesystemAlterationObserver( final File pRootDirectory );
-
File getRootDirectory();
-
void checkAndNotify();
-
void addListener( final FilesystemAlterationListener pListener );
void removeListener( final FilesystemAlterationListener pListener );
FilesystemAlterationListener[] getListeners();
+
}
Modified: jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserverImpl.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserverImpl.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserverImpl.java (original)
+++ jakarta/commons/sandbox/jci/trunk/fam/src/main/java/org/apache/commons/jci/monitor/FilesystemAlterationObserverImpl.java Sat Mar 10 10:55:32 2007
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.monitor;
import java.io.File;
Modified: jakarta/commons/sandbox/jci/trunk/fam/src/test/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/jci/trunk/fam/src/test/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java?view=diff&rev=516766&r1=516765&r2=516766
==============================================================================
--- jakarta/commons/sandbox/jci/trunk/fam/src/test/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java (original)
+++ jakarta/commons/sandbox/jci/trunk/fam/src/test/java/org/apache/commons/jci/monitor/FilesystemAlterationMonitorTestCase.java Sat Mar 10 10:55:32 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jci.monitor;
import java.io.File;
@@ -29,7 +30,10 @@
import org.apache.commons.logging.LogFactory;
-
+/**
+ *
+ * @author tcurdt
+ */
public final class FilesystemAlterationMonitorTestCase extends TestCase {
private final Log log = LogFactory.getLog(FilesystemAlterationMonitorTestCase.class);
@@ -37,7 +41,7 @@
private FilesystemAlterationMonitor fam;
private MyFilesystemAlterationListener listener;
- protected File directory;
+ private File directory;
protected void setUp() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org