[jboss-svn-commits] JBL Code SVN: r12816 - in labs/jbossrules/trunk/drools-compiler/src: main/java/org/drools and 9 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Jun 24 22:21:58 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-06-24 22:21:57 -0400 (Sun, 24 Jun 2007)
New Revision: 12816

Added:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java
Removed:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java
Modified:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FactTemplateError.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FieldTemplateError.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/RuleError.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
Log:
-refactored org.apache.commons.jci to org.drools.commons.jci

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers (from rev 12812, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers)

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,33 +0,0 @@
-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;
-
-public abstract class AbstractJavaCompiler
-    implements
-    JavaCompiler {
-
-    protected CompilationProblemHandler problemHandler;
-
-    public void setCompilationProblemHandler(final CompilationProblemHandler pHandler) {
-        this.problemHandler = pHandler;
-    }
-
-    public CompilationResult compile(final String[] pClazzNames,
-                                     final ResourceReader pReader,
-                                     final ResourceStore pStore) {
-
-        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
-        if ( classLoader == null ) {
-            classLoader = this.getClass().getClassLoader();
-        }
-
-        return compile( pClazzNames,
-                        pReader,
-                        pStore,
-                        classLoader );
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/AbstractJavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,54 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import org.drools.commons.jci.problems.CompilationProblemHandler;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.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;
+
+    public void setCompilationProblemHandler( final CompilationProblemHandler pHandler ) {
+        problemHandler = pHandler;
+    }
+
+    public CompilationResult compile( final String[] pClazzNames, final ResourceReader pReader, final ResourceStore pStore ) {
+
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+        if (classLoader == null) {
+            classLoader = this.getClass().getClassLoader();
+        }
+
+        return compile(pClazzNames, pReader, pStore, classLoader, createDefaultSettings());
+    }
+
+    public CompilationResult compile( final String[] pClazzNames, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader ) {
+        return compile(pClazzNames, pReader, pStore, pClassLoader, createDefaultSettings());
+    }
+
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,39 +0,0 @@
-package org.apache.commons.jci.compilers;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.commons.jci.problems.CompilationProblem;
-
-public final class CompilationResult {
-
-    private final CompilationProblem[] errors;
-    private final CompilationProblem[] warnings;
-
-    public CompilationResult(final CompilationProblem[] pProblems) {
-        final Collection errorsColl = new ArrayList();
-        final Collection warningsColl = new ArrayList();
-
-        for ( int i = 0; i < pProblems.length; i++ ) {
-            final CompilationProblem problem = pProblems[i];
-            if ( problem.isError() ) {
-                errorsColl.add( problem );
-            } else {
-                warningsColl.add( problem );
-            }
-        }
-
-        this.errors = new CompilationProblem[errorsColl.size()];
-        errorsColl.toArray( this.errors );
-
-        this.warnings = new CompilationProblem[warningsColl.size()];
-        warningsColl.toArray( this.warnings );
-    }
-
-    public CompilationProblem[] getErrors() {
-        return this.errors;
-    }
-
-    public CompilationProblem[] getWarnings() {
-        return this.warnings;
-    }
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/CompilationResult.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,65 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.drools.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;
+    private final CompilationProblem[] warnings;
+        
+    public CompilationResult( final CompilationProblem[] pProblems ) {
+        final Collection errorsColl = new ArrayList();
+        final Collection warningsColl = new ArrayList();
+
+        for (int i = 0; i < pProblems.length; i++) {
+            final CompilationProblem problem = pProblems[i];
+            if (problem.isError()) {
+                errorsColl.add(problem);
+            } else {
+                warningsColl.add(problem);
+            }
+        }
+        
+        errors = new CompilationProblem[errorsColl.size()];
+        errorsColl.toArray(errors);
+
+        warnings = new CompilationProblem[warningsColl.size()];
+        warningsColl.toArray(warnings);
+    }
+    
+    public CompilationProblem[] getErrors() {
+        return errors;
+    }
+
+    public CompilationProblem[] getWarnings() {
+        return warnings;
+    }
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseCompilationProblem.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,75 +0,0 @@
-/*
- * 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.CompilationProblem;
-import org.eclipse.jdt.core.compiler.IProblem;
-
-public class EclipseCompilationProblem
-    implements
-    CompilationProblem {
-
-    private final IProblem problem;
-
-    public EclipseCompilationProblem(final IProblem pProblem) {
-        this.problem = pProblem;
-    }
-
-    public boolean isError() {
-        return this.problem.isError();
-    }
-
-    public String getFileName() {
-        return new String( this.problem.getOriginatingFileName() );
-    }
-
-    public int getStartLine() {
-        return this.problem.getSourceLineNumber();
-    }
-
-    public int getStartColumn() {
-        return this.problem.getSourceStart();
-    }
-
-    public int getEndLine() {
-        return getStartLine();
-    }
-
-    public int getEndColumn() {
-        return this.problem.getSourceEnd();
-    }
-
-    public String getMessage() {
-        return this.problem.getMessage();
-    }
-
-    public String toString() {
-        final StringBuffer sb = new StringBuffer();
-        sb.append( getFileName() ).append( " (" );
-        sb.append( getStartLine() );
-        sb.append( ":" );
-        sb.append( getStartColumn() );
-        sb.append( ") : " );
-        sb.append( getMessage() );
-        return sb.toString();
-    }
-
-    public int getId() {
-        return this.problem.getID();
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseCompilationProblem.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseCompilationProblem.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,79 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.eclipse.jdt.core.compiler.IProblem;
+
+/**
+ * Wrapping an Eclipse compiler problem
+ * 
+ * @author tcurdt
+ */
+public final class EclipseCompilationProblem implements CompilationProblem {
+
+    private final IProblem problem;
+
+    public EclipseCompilationProblem(final IProblem pProblem) {
+        problem = pProblem;
+    }
+
+    public boolean isError() {
+        return problem.isError();
+    }
+
+    public String getFileName() {
+        return new String(problem.getOriginatingFileName());
+    }
+
+    public int getStartLine() {
+        return problem.getSourceLineNumber();
+    }
+
+    public int getStartColumn() {
+        return problem.getSourceStart();
+    }
+
+    public int getEndLine() {
+        return getStartLine();
+    }
+
+    public int getEndColumn() {
+        return problem.getSourceEnd();
+    }
+
+    public String getMessage() {
+        return problem.getMessage();
+    }
+
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append(getFileName()).append(" (");
+        sb.append(getStartLine());
+        sb.append(":");
+        sb.append(getStartColumn());
+        sb.append(") : ");
+        sb.append(getMessage());
+        return sb.toString();
+    }
+
+    public int getId() {
+        return problem.getID();
+    }
+
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,338 +0,0 @@
-/*
- * 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.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Locale;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.apache.commons.jci.problems.CompilationProblem;
-import org.apache.commons.jci.readers.ResourceReader;
-import org.apache.commons.jci.stores.ResourceStore;
-import org.drools.util.ClassUtils;
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.internal.compiler.ClassFile;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.Compiler;
-import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
-import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
-import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
-import org.eclipse.jdt.internal.compiler.IProblemFactory;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-
-public final class EclipseJavaCompiler extends AbstractJavaCompiler {
-
-    //private final Log log = LogFactory.getLog(EclipseJavaCompiler.class);
-    private final Map settings;
-
-    public EclipseJavaCompiler() {
-        this( new EclipseJavaCompilerSettings() );
-    }
-
-    public EclipseJavaCompiler(final Map pSettings) {
-        this.settings = pSettings;
-    }
-
-    public EclipseJavaCompiler(final EclipseJavaCompilerSettings pSettings) {
-        this.settings = pSettings.getMap();
-    }
-
-    final class CompilationUnit
-        implements
-        ICompilationUnit {
-
-        final private String         clazzName;
-        final private String         fileName;
-        final private char[]         typeName;
-        final private char[][]       packageName;
-        final private ResourceReader reader;
-
-        CompilationUnit(final ResourceReader pReader,
-                        final String pSourceFile) {
-            this.reader = pReader;
-            this.clazzName = ClassUtils.convertResourceToClassName( pSourceFile );
-            this.fileName = pSourceFile;
-            final int dot = this.clazzName.lastIndexOf( '.' );
-            if ( dot > 0 ) {
-                this.typeName = this.clazzName.substring( dot + 1 ).toCharArray();
-            } else {
-                this.typeName = this.clazzName.toCharArray();
-            }
-
-            //            log.debug("className=" + clazzName);
-            //            log.debug("fileName=" + fileName);
-            //            log.debug("typeName=" + new String(typeName)); 
-
-            final StringTokenizer izer = new StringTokenizer( this.clazzName,
-                                                              "." );
-            this.packageName = new char[izer.countTokens() - 1][];
-            for ( int i = 0; i < this.packageName.length; i++ ) {
-                this.packageName[i] = izer.nextToken().toCharArray();
-                //                log.debug("package[" + i + "]=" + new String(packageName[i]));
-            }
-        }
-
-        public char[] getFileName() {
-            return this.fileName.toCharArray();
-        }
-
-        public char[] getContents() {
-            return new String( this.reader.getBytes( this.fileName ) ).toCharArray();
-        }
-
-        public char[] getMainTypeName() {
-            return this.typeName;
-        }
-
-        public char[][] getPackageName() {
-            return this.packageName;
-        }
-    }
-
-    public org.apache.commons.jci.compilers.CompilationResult compile(final String[] pSourceFiles,
-                                                                      final ResourceReader pReader,
-                                                                      final ResourceStore pStore,
-                                                                      final ClassLoader pClassLoader) {
-
-        final Map settingsMap = this.settings;
-        //        final Set sourceFileIndex = new HashSet();
-        final ICompilationUnit[] compilationUnits = new ICompilationUnit[pSourceFiles.length];
-        for ( int i = 0; i < compilationUnits.length; i++ ) {
-            final String sourceFile = pSourceFiles[i];
-            compilationUnits[i] = new CompilationUnit( pReader,
-                                                       sourceFile );
-            //            sourceFileIndex.add(sourceFile);
-            //            log.debug("compiling " + sourceFile);
-        }
-
-        final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
-        final IProblemFactory problemFactory = new DefaultProblemFactory( Locale.getDefault() );
-        final INameEnvironment nameEnvironment = new INameEnvironment() {
-
-            public NameEnvironmentAnswer findType(final char[][] pCompoundTypeName) {
-                final StringBuffer result = new StringBuffer();
-                for ( int i = 0; i < pCompoundTypeName.length; i++ ) {
-                    if ( i != 0 ) {
-                        result.append( '.' );
-                    }
-                    result.append( pCompoundTypeName[i] );
-                }
-
-                //log.debug("finding compoundTypeName=" + result.toString());
-
-                return findType( result.toString() );
-            }
-
-            public NameEnvironmentAnswer findType(final char[] pTypeName,
-                                                  final char[][] pPackageName) {
-                final StringBuffer result = new StringBuffer();
-                for ( int i = 0; i < pPackageName.length; i++ ) {
-                    result.append( pPackageName[i] );
-                    result.append( '.' );
-                }
-
-                //            	log.debug("finding typeName=" + new String(typeName) + " packageName=" + result.toString());
-
-                result.append( pTypeName );
-                return findType( result.toString() );
-            }
-
-            private NameEnvironmentAnswer findType(final String pClazzName) {
-
-                if ( isPackage( pClazzName ) ) {
-                    return null;
-                }
-
-                //            	log.debug("finding " + pClazzName);
-
-                final String resourceName = ClassUtils.convertClassToResourcePath( pClazzName );
-
-                final byte[] clazzBytes = pStore.read( pClazzName );
-                if ( clazzBytes != null ) {
-                    //                    log.debug("loading from store " + pClazzName);
-
-                    final char[] fileName = pClazzName.toCharArray();
-                    try {
-                        final ClassFileReader classFileReader = new ClassFileReader( clazzBytes,
-                                                                                     fileName,
-                                                                                     true );
-                        return new NameEnvironmentAnswer( classFileReader,
-                                                          null );
-                    } catch ( final ClassFormatException e ) {
-                        //                        log.error("wrong class format", e);
-                        return null;
-                    }
-                }
-
-                //            	log.debug("not in store " + pClazzName);
-
-                //                if (pReader.isAvailable(clazzName.replace('.', '/') + ".java")) {
-                //                    log.debug("compile " + clazzName);
-                //                    ICompilationUnit compilationUnit = new CompilationUnit(pReader, clazzName);
-                //                    return new NameEnvironmentAnswer(compilationUnit, null);
-                //                }
-
-                final InputStream is = pClassLoader.getResourceAsStream( resourceName );
-                if ( is == null ) {
-                    //                	log.debug("class " + pClazzName + " not found");
-                    return null;
-                }
-
-                final byte[] buffer = new byte[8192];
-                final ByteArrayOutputStream baos = new ByteArrayOutputStream( buffer.length );
-                int count;
-                try {
-                    while ( (count = is.read( buffer,
-                                              0,
-                                              buffer.length )) > 0 ) {
-                        baos.write( buffer,
-                                    0,
-                                    count );
-                    }
-                    baos.flush();
-                    final char[] fileName = pClazzName.toCharArray();
-                    final ClassFileReader classFileReader = new ClassFileReader( baos.toByteArray(),
-                                                                                 fileName,
-                                                                                 true );
-                    return new NameEnvironmentAnswer( classFileReader,
-                                                      null );
-                } catch ( final IOException e ) {
-                    e.printStackTrace();
-                    //                    log.error("could not read class", e);
-                    return null;
-                } catch ( final ClassFormatException e ) {
-                    e.printStackTrace();
-                    //                    log.error("wrong class format", e);
-                    return null;
-                } finally {
-                    try {
-                        baos.close();
-                    } catch ( final IOException oe ) {
-                        oe.printStackTrace();
-                        //                        log.error("could not close output stream", oe);
-                    }
-                    try {
-                        is.close();
-                    } catch ( final IOException ie ) {
-                        ie.printStackTrace();
-                        //                        log.error("could not close input stream", ie);
-                    }
-                }
-            }
-
-            private boolean isPackage(final String pClazzName) {
-
-                final InputStream is = pClassLoader.getResourceAsStream( ClassUtils.convertClassToResourcePath( pClazzName ) );
-                if ( is != null ) {
-                    //                	log.debug("found the class for " + pClazzName + "- no package");
-                    return false;
-                }
-
-                final String source = pClazzName.replace( '.',
-                                                          '/' ) + ".java";
-                if ( pReader.isAvailable( source ) ) {
-                    //                	log.debug("found the source " + source + " for " + pClazzName + " - no package ");
-                    return false;
-                }
-
-                return true;
-            }
-
-            public boolean isPackage(char[][] parentPackageName,
-                                     char[] pPackageName) {
-                final StringBuffer result = new StringBuffer();
-                if ( parentPackageName != null ) {
-                    for ( int i = 0; i < parentPackageName.length; i++ ) {
-                        if ( i != 0 ) {
-                            result.append( '.' );
-                        }
-                        result.append( parentPackageName[i] );
-                    }
-                }
-
-                //                log.debug("isPackage parentPackageName=" + result.toString() + " packageName=" + new String(packageName));
-
-                if ( parentPackageName != null && parentPackageName.length > 0 ) {
-                    result.append( '.' );
-                }
-                result.append( pPackageName );
-                return isPackage( result.toString() );
-            }
-
-            public void cleanup() {
-                //            	log.debug("cleanup");
-            }
-        };
-
-        final Collection problems = new ArrayList();
-        final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
-            public void acceptResult(final CompilationResult pResult) {
-                if ( pResult.hasProblems() ) {
-                    final IProblem[] iproblems = pResult.getProblems();
-                    for ( int i = 0; i < iproblems.length; i++ ) {
-                        final IProblem iproblem = iproblems[i];
-                        final CompilationProblem problem = new EclipseCompilationProblem( iproblem );
-                        if ( EclipseJavaCompiler.this.problemHandler != null ) {
-                            EclipseJavaCompiler.this.problemHandler.handle( problem );
-                        }
-                        problems.add( problem );
-                    }
-                }
-                if ( !pResult.hasErrors() ) {
-                    final ClassFile[] clazzFiles = pResult.getClassFiles();
-                    for ( int i = 0; i < clazzFiles.length; i++ ) {
-                        final ClassFile clazzFile = clazzFiles[i];
-                        final char[][] compoundName = clazzFile.getCompoundName();
-                        final StringBuffer clazzName = new StringBuffer();
-                        for ( int j = 0; j < compoundName.length; j++ ) {
-                            if ( j != 0 ) {
-                                clazzName.append( '.' );
-                            }
-                            clazzName.append( compoundName[j] );
-                        }
-                        pStore.write( clazzName.toString().replace( '.',
-                                                                    '/' ) + ".class",
-                                      clazzFile.getBytes() );
-                    }
-                }
-            }
-        };
-
-        final Compiler compiler = new Compiler( nameEnvironment,
-                                                policy,
-                                                settingsMap,
-                                                compilerRequestor,
-                                                problemFactory,
-                                                false );
-
-        compiler.compile( compilationUnits );
-
-        final CompilationProblem[] result = new CompilationProblem[problems.size()];
-        problems.toArray( result );
-        return new org.apache.commons.jci.compilers.CompilationResult( result );
-    }
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,382 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+import org.drools.util.ClassUtils;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.internal.compiler.ClassFile;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
+import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
+import org.eclipse.jdt.internal.compiler.IProblemFactory;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+
+/**
+ * Eclipse compiler implemenation
+ * 
+ * @author tcurdt
+ */
+public final class EclipseJavaCompiler extends AbstractJavaCompiler {
+
+    private final EclipseJavaCompilerSettings defaultSettings;
+
+    public EclipseJavaCompiler() {
+        this( new EclipseJavaCompilerSettings() );
+    }
+
+    public EclipseJavaCompiler(final Map pSettings) {
+        this.defaultSettings = new EclipseJavaCompilerSettings( pSettings );
+    }
+
+    public EclipseJavaCompiler(final EclipseJavaCompilerSettings pSettings) {
+        this.defaultSettings = pSettings;
+    }
+
+    final class CompilationUnit
+        implements
+        ICompilationUnit {
+
+        final private String         clazzName;
+        final private String         fileName;
+        final private char[]         typeName;
+        final private char[][]       packageName;
+        final private ResourceReader reader;
+
+        CompilationUnit(final ResourceReader pReader,
+                        final String pSourceFile) {
+            this.reader = pReader;
+            this.clazzName = ClassUtils.convertResourceToClassName( pSourceFile );
+            this.fileName = pSourceFile;
+            final int dot = this.clazzName.lastIndexOf( '.' );
+            if ( dot > 0 ) {
+                this.typeName = this.clazzName.substring( dot + 1 ).toCharArray();
+            } else {
+                this.typeName = this.clazzName.toCharArray();
+            }
+
+            final StringTokenizer izer = new StringTokenizer( this.clazzName,
+                                                              "." );
+            this.packageName = new char[izer.countTokens() - 1][];
+            for ( int i = 0; i < this.packageName.length; i++ ) {
+                this.packageName[i] = izer.nextToken().toCharArray();
+            }
+        }
+
+        public char[] getFileName() {
+            return this.fileName.toCharArray();
+        }
+
+        public char[] getContents() {
+            final byte[] content = this.reader.getBytes( this.fileName );
+
+            if ( content == null ) {
+                return null;
+                //throw new RuntimeException("resource " + fileName + " could not be found");
+            }
+
+            return new String( content ).toCharArray();
+        }
+
+        public char[] getMainTypeName() {
+            return this.typeName;
+        }
+
+        public char[][] getPackageName() {
+            return this.packageName;
+        }
+    }
+
+    public org.drools.commons.jci.compilers.CompilationResult compile(final String[] pSourceFiles,
+                                                                      final ResourceReader pReader,
+                                                                      final ResourceStore pStore,
+                                                                      final ClassLoader pClassLoader,
+                                                                      final JavaCompilerSettings pSettings) {
+
+        final Map settingsMap = ((EclipseJavaCompilerSettings) pSettings).getMap();
+
+        final Collection problems = new ArrayList();
+
+        final ICompilationUnit[] compilationUnits = new ICompilationUnit[pSourceFiles.length];
+        for ( int i = 0; i < compilationUnits.length; i++ ) {
+            final String sourceFile = pSourceFiles[i];
+
+            if ( pReader.isAvailable( sourceFile ) ) {
+                compilationUnits[i] = new CompilationUnit( pReader,
+                                                           sourceFile );
+            } else {
+
+                final CompilationProblem problem = new CompilationProblem() {
+
+                    public int getEndColumn() {
+                        return 0;
+                    }
+
+                    public int getEndLine() {
+                        return 0;
+                    }
+
+                    public String getFileName() {
+                        return sourceFile;
+                    }
+
+                    public String getMessage() {
+                        return "Source " + sourceFile + " could not be found";
+                    }
+
+                    public int getStartColumn() {
+                        return 0;
+                    }
+
+                    public int getStartLine() {
+                        return 0;
+                    }
+
+                    public boolean isError() {
+                        return true;
+                    }
+
+                    public String toString() {
+                        return getMessage();
+                    }
+                };
+
+                if ( this.problemHandler != null ) {
+                    this.problemHandler.handle( problem );
+                }
+
+                problems.add( problem );
+            }
+        }
+
+        if ( problems.size() > 0 ) {
+            final CompilationProblem[] result = new CompilationProblem[problems.size()];
+            problems.toArray( result );
+            return new org.drools.commons.jci.compilers.CompilationResult( result );
+        }
+
+        final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
+        final IProblemFactory problemFactory = new DefaultProblemFactory( Locale.getDefault() );
+        final INameEnvironment nameEnvironment = new INameEnvironment() {
+
+            public NameEnvironmentAnswer findType(final char[][] pCompoundTypeName) {
+                final StringBuffer result = new StringBuffer();
+                for ( int i = 0; i < pCompoundTypeName.length; i++ ) {
+                    if ( i != 0 ) {
+                        result.append( '.' );
+                    }
+                    result.append( pCompoundTypeName[i] );
+                }
+
+                //log.debug("finding compoundTypeName=" + result.toString());
+
+                return findType( result.toString() );
+            }
+
+            public NameEnvironmentAnswer findType(final char[] pTypeName,
+                                                  final char[][] pPackageName) {
+                final StringBuffer result = new StringBuffer();
+                for ( int i = 0; i < pPackageName.length; i++ ) {
+                    result.append( pPackageName[i] );
+                    result.append( '.' );
+                }
+
+                //                log.debug("finding typeName=" + new String(typeName) + " packageName=" + result.toString());
+
+                result.append( pTypeName );
+                return findType( result.toString() );
+            }
+
+            private NameEnvironmentAnswer findType(final String pClazzName) {
+
+                if ( isPackage( pClazzName ) ) {
+                    return null;
+                }
+
+                final String resourceName = ClassUtils.convertClassToResourcePath( pClazzName );
+
+                final byte[] clazzBytes = pStore.read( pClazzName );
+                if ( clazzBytes != null ) {
+
+                    final char[] fileName = pClazzName.toCharArray();
+                    try {
+                        final ClassFileReader classFileReader = new ClassFileReader( clazzBytes,
+                                                                                     fileName,
+                                                                                     true );
+                        return new NameEnvironmentAnswer( classFileReader,
+                                                          null );
+                    } catch ( final ClassFormatException e ) {
+                        throw new RuntimeException( "ClassFormatException in loading class '" + fileName + "' with JCI." );
+                    }
+                }
+
+                final InputStream is = pClassLoader.getResourceAsStream( resourceName );
+                if ( is == null ) {
+                    return null;
+                }
+
+                final byte[] buffer = new byte[8192];
+                final ByteArrayOutputStream baos = new ByteArrayOutputStream( buffer.length );
+                int count;
+                try {
+                    while ( (count = is.read( buffer,
+                                              0,
+                                              buffer.length )) > 0 ) {
+                        baos.write( buffer,
+                                    0,
+                                    count );
+                    }
+                    baos.flush();
+                    final char[] fileName = pClazzName.toCharArray();
+                    final ClassFileReader classFileReader = new ClassFileReader( baos.toByteArray(),
+                                                                                 fileName,
+                                                                                 true );
+                    return new NameEnvironmentAnswer( classFileReader,
+                                                      null );
+                } catch ( final IOException e ) {
+                    throw new RuntimeException( "could not read class",
+                                                e );
+                } catch ( final ClassFormatException e ) {
+                    throw new RuntimeException( "wrong class format",
+                                                e );
+                } finally {
+                    try {
+                        baos.close();
+                    } catch ( final IOException oe ) {
+                        throw new RuntimeException( "could not close output stream",
+                                                    oe );
+                    }
+                    try {
+                        is.close();
+                    } catch ( final IOException ie ) {
+                        throw new RuntimeException( "could not close input stream",
+                                                    ie );
+                    }
+                }
+            }
+
+            private boolean isPackage(final String pClazzName) {
+
+                final InputStream is = pClassLoader.getResourceAsStream( ClassUtils.convertClassToResourcePath( pClazzName ) );
+                if ( is != null ) {
+                    return false;
+                }
+
+                // FIXME: this should not be tied to the extension
+                final String source = pClazzName.replace( '.',
+                                                          '/' ) + ".java";
+                if ( pReader.isAvailable( source ) ) {
+                    return false;
+                }
+
+                return true;
+            }
+
+            public boolean isPackage(char[][] parentPackageName,
+                                     char[] pPackageName) {
+                final StringBuffer result = new StringBuffer();
+                if ( parentPackageName != null ) {
+                    for ( int i = 0; i < parentPackageName.length; i++ ) {
+                        if ( i != 0 ) {
+                            result.append( '.' );
+                        }
+                        result.append( parentPackageName[i] );
+                    }
+                }
+
+                //                log.debug("isPackage parentPackageName=" + result.toString() + " packageName=" + new String(packageName));
+
+                if ( parentPackageName != null && parentPackageName.length > 0 ) {
+                    result.append( '.' );
+                }
+                result.append( pPackageName );
+                return isPackage( result.toString() );
+            }
+
+            public void cleanup() {
+            }
+        };
+
+        final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
+            public void acceptResult(final CompilationResult pResult) {
+                if ( pResult.hasProblems() ) {
+                    final IProblem[] iproblems = pResult.getProblems();
+                    for ( int i = 0; i < iproblems.length; i++ ) {
+                        final IProblem iproblem = iproblems[i];
+                        final CompilationProblem problem = new EclipseCompilationProblem( iproblem );
+                        if ( EclipseJavaCompiler.this.problemHandler != null ) {
+                            EclipseJavaCompiler.this.problemHandler.handle( problem );
+                        }
+                        problems.add( problem );
+                    }
+                }
+                if ( !pResult.hasErrors() ) {
+                    final ClassFile[] clazzFiles = pResult.getClassFiles();
+                    for ( int i = 0; i < clazzFiles.length; i++ ) {
+                        final ClassFile clazzFile = clazzFiles[i];
+                        final char[][] compoundName = clazzFile.getCompoundName();
+                        final StringBuffer clazzName = new StringBuffer();
+                        for ( int j = 0; j < compoundName.length; j++ ) {
+                            if ( j != 0 ) {
+                                clazzName.append( '.' );
+                            }
+                            clazzName.append( compoundName[j] );
+                        }
+                        pStore.write( clazzName.toString().replace( '.',
+                                                                    '/' ) + ".class",
+                                      clazzFile.getBytes() );
+                    }
+                }
+            }
+        };
+
+        final Compiler compiler = new Compiler( nameEnvironment,
+                                                policy,
+                                                settingsMap,
+                                                compilerRequestor,
+                                                problemFactory,
+                                                false );
+
+        compiler.compile( compilationUnits );
+
+        final CompilationProblem[] result = new CompilationProblem[problems.size()];
+        problems.toArray( result );
+        return new org.drools.commons.jci.compilers.CompilationResult( result );
+    }
+
+    public JavaCompilerSettings createDefaultSettings() {
+        return this.defaultSettings;
+    }
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,37 +0,0 @@
-package org.apache.commons.jci.compilers;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.jci.compilers.JavaCompilerSettings;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-
-public class EclipseJavaCompilerSettings extends JavaCompilerSettings {
-
-    final private Map defaultEclipseSettings = new HashMap();
-
-    public EclipseJavaCompilerSettings() {
-        this.defaultEclipseSettings.put( CompilerOptions.OPTION_LineNumberAttribute,
-                                    CompilerOptions.GENERATE );
-        this.defaultEclipseSettings.put( CompilerOptions.OPTION_SourceFileAttribute,
-                                    CompilerOptions.GENERATE );
-        this.defaultEclipseSettings.put( CompilerOptions.OPTION_ReportUnusedImport,
-                                    CompilerOptions.IGNORE );
-        this.defaultEclipseSettings.put( CompilerOptions.OPTION_LocalVariableAttribute,
-                                    CompilerOptions.GENERATE );
-    }
-
-    public Map getMap() {
-        final Map map = new HashMap( this.defaultEclipseSettings );
-
-        map.put( CompilerOptions.OPTION_ReportDeprecation,
-                 CompilerOptions.GENERATE );
-        map.put( CompilerOptions.OPTION_TargetPlatform,
-                 CompilerOptions.VERSION_1_4 );
-        map.put( CompilerOptions.OPTION_Source,
-                 CompilerOptions.VERSION_1_4 );
-        map.put( CompilerOptions.OPTION_Encoding,
-                 "UTF-8" );
-
-        return map;
-    }
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/EclipseJavaCompilerSettings.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,67 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+/**
+ * Native Eclipse compiler settings
+ * 
+ * @author tcurdt
+ */
+public final class EclipseJavaCompilerSettings extends JavaCompilerSettings {
+
+    final private Map defaultEclipseSettings = new HashMap();
+
+    public EclipseJavaCompilerSettings() {
+        defaultEclipseSettings.put( CompilerOptions.OPTION_LineNumberAttribute,
+                                    CompilerOptions.GENERATE );
+        defaultEclipseSettings.put( CompilerOptions.OPTION_SourceFileAttribute,
+                                    CompilerOptions.GENERATE );
+        defaultEclipseSettings.put( CompilerOptions.OPTION_ReportUnusedImport,
+                                    CompilerOptions.IGNORE );
+        defaultEclipseSettings.put( CompilerOptions.OPTION_LocalVariableAttribute,
+                                    CompilerOptions.GENERATE );
+    }
+
+    public EclipseJavaCompilerSettings(final Map pMap) {
+        defaultEclipseSettings.putAll( pMap );
+    }
+
+    public Map getMap() {
+        final Map map = new HashMap( defaultEclipseSettings );
+
+        map.put( CompilerOptions.OPTION_ReportDeprecation,
+                 CompilerOptions.GENERATE ); // Not sure what we put here from JavaCompilerSettings
+        map.put( CompilerOptions.OPTION_TargetPlatform,
+                 (getTargetVersion() != null) ? getTargetVersion() : CompilerOptions.VERSION_1_4 );
+        map.put( CompilerOptions.OPTION_Source,
+                 (getSourceVersion() != null) ? getSourceVersion() : CompilerOptions.VERSION_1_4 );
+        map.put( CompilerOptions.OPTION_Encoding,
+                 (getSourceEncoding() != null) ? getSourceEncoding() : "UTF-8" );
+
+        return map;
+    }
+
+    public String toString() {
+        return defaultEclipseSettings.toString();
+    }
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoCompilationProblem.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,111 +0,0 @@
-/*
- * 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.CompilationProblem;
-import org.codehaus.janino.Location;
-import org.codehaus.janino.Scanner.LocatedException;
-
-public class JaninoCompilationProblem
-    implements
-    CompilationProblem {
-
-    private final Location location;
-    private final String   fileName;
-    private final String   message;
-    private final boolean  error;
-
-    public JaninoCompilationProblem(final LocatedException pLocatedException) {
-        this( pLocatedException.getLocation(),
-              pLocatedException.getMessage(),
-              true );
-    }
-
-    public JaninoCompilationProblem(final Location pLocation,
-                                    final String pMessage,
-                                    final boolean pError) {
-        this( pLocation.getFileName(),
-              pLocation,
-              pMessage,
-              pError );
-    }
-
-    public JaninoCompilationProblem(final String pFilename,
-                                    final String pMessage,
-                                    final boolean pError) {
-        this( pFilename,
-              null,
-              pMessage,
-              pError );
-    }
-
-    public JaninoCompilationProblem(final String pFilename,
-                                    final Location pLocation,
-                                    final String pMessage,
-                                    final boolean pError) {
-        this.location = pLocation;
-        this.fileName = pFilename;
-        this.message = pMessage;
-        this.error = pError;
-    }
-
-    public boolean isError() {
-        return this.error;
-    }
-
-    public String getFileName() {
-        return this.fileName;
-    }
-
-    public int getStartLine() {
-        if ( this.location == null ) {
-            return 0;
-        }
-        return this.location.getLineNumber();
-    }
-
-    public int getStartColumn() {
-        if ( this.location == null ) {
-            return 0;
-        }
-        return this.location.getColumnNumber();
-    }
-
-    public int getEndLine() {
-        return getStartLine();
-    }
-
-    public int getEndColumn() {
-        return getStartColumn();
-    }
-
-    public String getMessage() {
-        return this.message;
-    }
-
-    public String toString() {
-        final StringBuffer sb = new StringBuffer();
-        sb.append( getFileName() ).append( " (" );
-        sb.append( getStartLine() );
-        sb.append( ":" );
-        sb.append( getStartColumn() );
-        sb.append( ") : " );
-        sb.append( getMessage() );
-        return sb.toString();
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoCompilationProblem.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoCompilationProblem.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,100 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import org.codehaus.janino.Location;
+import org.codehaus.janino.Scanner.LocatedException;
+import org.drools.commons.jci.problems.CompilationProblem;
+
+/**
+ * Janino version of a CompilationProblem
+ * 
+ * @author tcurdt
+ */
+public final class JaninoCompilationProblem implements CompilationProblem {
+
+    private final Location location;
+    private final String fileName;
+    private final String message;
+    private final boolean error;
+
+    public JaninoCompilationProblem(final LocatedException pLocatedException) {
+        this(pLocatedException.getLocation(), pLocatedException.getMessage(), true);
+    }
+
+    public JaninoCompilationProblem(final Location pLocation, final String pMessage, final boolean pError) {
+      this(pLocation.getFileName(), pLocation, pMessage, pError);
+    }
+
+    public JaninoCompilationProblem(final String pFilename, final String pMessage, final boolean pError) {
+        this(pFilename, null, pMessage, pError);
+    }
+
+    public JaninoCompilationProblem(final String pFilename, final Location pLocation, final String pMessage, final boolean pError) {
+        location = pLocation;
+        fileName = pFilename;
+        message = pMessage;
+        error = pError;
+    }
+
+    public boolean isError() {
+        return error;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public int getStartLine() {
+        if (location == null) {
+            return 0;
+        }
+        return location.getLineNumber();
+    }
+
+    public int getStartColumn() {
+        if (location == null) {
+            return 0;
+        }
+        return location.getColumnNumber();
+    }
+
+    public int getEndLine() {
+        return getStartLine();
+    }
+
+    public int getEndColumn() {
+        return getStartColumn();
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append(getFileName()).append(" (");
+        sb.append(getStartLine());
+        sb.append(":");
+        sb.append(getStartColumn());
+        sb.append(") : ");
+        sb.append(getMessage());
+        return sb.toString();
+    }
+
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,188 +0,0 @@
-/*
- * 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.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.commons.jci.problems.CompilationProblem;
-import org.apache.commons.jci.readers.ResourceReader;
-import org.apache.commons.jci.stores.ResourceStore;
-import org.codehaus.janino.ClassLoaderIClassLoader;
-import org.codehaus.janino.CompileException;
-import org.codehaus.janino.DebuggingInformation;
-import org.codehaus.janino.Descriptor;
-import org.codehaus.janino.IClass;
-import org.codehaus.janino.IClassLoader;
-import org.codehaus.janino.Java;
-import org.codehaus.janino.Location;
-import org.codehaus.janino.Parser;
-import org.codehaus.janino.Scanner;
-import org.codehaus.janino.UnitCompiler;
-import org.codehaus.janino.WarningHandler;
-import org.codehaus.janino.Scanner.LocatedException;
-import org.codehaus.janino.UnitCompiler.ErrorHandler;
-import org.codehaus.janino.util.ClassFile;
-import org.drools.util.ClassUtils;
-
-/**
- * @author art at gramlich-net.com
- */
-public final class JaninoJavaCompiler extends AbstractJavaCompiler {
-
-    //    private final Log log = LogFactory.getLog(JaninoJavaCompiler.class);
-
-    private class CompilingIClassLoader extends IClassLoader {
-
-        private final Map            types    = new HashMap();
-        private final ResourceReader resourceReader;
-        private final Map            classes;
-        private final Collection     problems = new ArrayList();
-
-        private CompilingIClassLoader(final ResourceReader pResourceReader,
-                                      final Map pClasses,
-                                      final ClassLoader classLoader) {
-            super( new ClassLoaderIClassLoader( classLoader ) );
-            this.resourceReader = pResourceReader;
-            this.classes = pClasses;
-            super.postConstruct();
-        }
-
-        protected Collection getProblems() {
-            return this.problems;
-        }
-
-        protected IClass findIClass(final String pType) {
-            final String className = Descriptor.toClassName( pType );
-            if ( this.types.containsKey( pType ) ) {
-                return (IClass) this.types.get( pType );
-            }
-            final String resourceNameFromClass = className.replace( '.',
-                                                                    '/' ) + ".java";
-
-            final byte[] content = this.resourceReader.getBytes( resourceNameFromClass );
-            if ( content == null ) {
-                return null;
-            }
-            final Reader reader = new BufferedReader( new StringReader( new String( content ) ) );
-            Scanner scanner = null;
-            try {
-                scanner = new Scanner( resourceNameFromClass,
-                                       reader );
-                final Java.CompilationUnit unit = new Parser( scanner ).parseCompilationUnit();
-                final UnitCompiler uc = new UnitCompiler( unit,
-                                                          this );
-                uc.setCompileErrorHandler( new ErrorHandler() {
-                    public void handleError(final String pMessage,
-                                            final Location pOptionalLocation) throws CompileException {
-                        final CompilationProblem problem = new JaninoCompilationProblem( pOptionalLocation,
-                                                                                         pMessage,
-                                                                                         true );
-                        if ( JaninoJavaCompiler.this.problemHandler != null ) {
-                            JaninoJavaCompiler.this.problemHandler.handle( problem );
-                        }
-                        CompilingIClassLoader.this.problems.add( problem );
-                    }
-                } );
-                uc.setWarningHandler( new WarningHandler() {
-                    public void handleWarning(final String pHandle,
-                                              final String pMessage,
-                                              final Location pOptionalLocation) {
-                        final CompilationProblem problem = new JaninoCompilationProblem( pOptionalLocation,
-                                                                                         pMessage,
-                                                                                         false );
-                        if ( JaninoJavaCompiler.this.problemHandler != null ) {
-                            JaninoJavaCompiler.this.problemHandler.handle( problem );
-                        }
-                        CompilingIClassLoader.this.problems.add( problem );
-                    }
-                } );
-                //                log.debug("compile " + className);
-                final ClassFile[] classFiles = uc.compileUnit( DebuggingInformation.ALL );
-                for ( int i = 0; i < classFiles.length; i++ ) {
-                    //                    log.debug("compiled " + classFiles[i].getThisClassName());
-                    this.classes.put( classFiles[i].getThisClassName(),
-                                 classFiles[i].toByteArray() );
-                }
-                final IClass ic = uc.findClass( className );
-                if ( null != ic ) {
-                    this.types.put( pType,
-                               ic );
-                }
-                return ic;
-            } catch ( final LocatedException e ) {
-                this.problems.add( new JaninoCompilationProblem( e ) );
-            } catch ( final IOException e ) {
-                this.problems.add( new JaninoCompilationProblem( resourceNameFromClass,
-                                                            "IOException:" + e.getMessage(),
-                                                            true ) );
-            } catch ( final Exception e ) {
-                this.problems.add( new JaninoCompilationProblem( resourceNameFromClass,
-                                                            "Exception:" + e.getMessage(),
-                                                            true ) );
-            } finally {
-                if ( scanner != null ) {
-                    try {
-                        scanner.close();
-                    } catch ( final IOException e ) {
-                        //                        log.error("IOException occured while compiling " + className, e);
-                    }
-                }
-            }
-            return null;
-        }
-    }
-
-    public CompilationResult compile(final String[] pClasses,
-                                     final ResourceReader pResourceReader,
-                                     final ResourceStore pStore,
-                                     final ClassLoader classLoader) {
-        final Map classFilesByName = new HashMap();
-
-        final CompilingIClassLoader icl = new CompilingIClassLoader( pResourceReader,
-                                                                     classFilesByName,
-                                                                     classLoader );
-        for ( int i = 0; i < pClasses.length; i++ ) {
-            try {
-                icl.loadIClass( Descriptor.fromClassName( ClassUtils.convertResourceToClassName( pClasses[i] ) ) );
-            } catch ( final ClassNotFoundException e ) {
-                // @TODO: if an exception is thrown here, how do we handle it?
-                e.printStackTrace();
-            }
-        }
-        // Store all fully compiled classes
-        for ( final Iterator i = classFilesByName.entrySet().iterator(); i.hasNext(); ) {
-            final Map.Entry entry = (Map.Entry) i.next();
-            final String clazzName = (String) entry.getKey();
-            pStore.write( ClassUtils.convertClassToResourcePath( clazzName ),
-                          (byte[]) entry.getValue() );
-        }
-
-        final Collection problems = icl.getProblems();
-        final CompilationProblem[] result = new CompilationProblem[problems.size()];
-        problems.toArray( result );
-        return new CompilationResult( result );
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,171 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.codehaus.janino.ClassLoaderIClassLoader;
+import org.codehaus.janino.CompileException;
+import org.codehaus.janino.DebuggingInformation;
+import org.codehaus.janino.Descriptor;
+import org.codehaus.janino.IClass;
+import org.codehaus.janino.IClassLoader;
+import org.codehaus.janino.Java;
+import org.codehaus.janino.Location;
+import org.codehaus.janino.Parser;
+import org.codehaus.janino.Scanner;
+import org.codehaus.janino.UnitCompiler;
+import org.codehaus.janino.WarningHandler;
+import org.codehaus.janino.Scanner.LocatedException;
+import org.codehaus.janino.UnitCompiler.ErrorHandler;
+import org.codehaus.janino.util.ClassFile;
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+import org.drools.util.ClassUtils;
+
+/**
+ * @author art at gramlich-net.com
+ */
+public final class JaninoJavaCompiler extends AbstractJavaCompiler {
+
+    private class CompilingIClassLoader extends IClassLoader {
+
+        private final Map types = new HashMap();
+        private final ResourceReader resourceReader;
+        private final Map classes;
+        private final Collection problems = new ArrayList();
+
+        private CompilingIClassLoader(final ResourceReader pResourceReader, final Map pClasses, final ClassLoader classLoader) {
+            super( new ClassLoaderIClassLoader( classLoader ) );
+            resourceReader = pResourceReader;
+            classes = pClasses;
+            super.postConstruct();
+        }
+
+        protected Collection getProblems() {
+            return problems;
+        }
+        
+        protected IClass findIClass(final String pType) {
+            final String className = Descriptor.toClassName(pType);
+            if (types.containsKey(pType)) {
+                return (IClass) types.get(pType);
+            }
+            
+            // FIXME: should not be tied to the extension            
+            final String resourceNameFromClass = className.replace('.', '/') + ".java";
+
+            final byte[] content = resourceReader.getBytes(resourceNameFromClass);
+            if (content == null) {
+                return null;
+            }
+            final Reader reader = new BufferedReader(new StringReader(new String(content)));
+            Scanner scanner = null;
+            try {
+                scanner = new Scanner(resourceNameFromClass, reader);
+                final Java.CompilationUnit unit = new Parser(scanner).parseCompilationUnit();
+                final UnitCompiler uc = new UnitCompiler(unit, this);
+                uc.setCompileErrorHandler(new ErrorHandler() {
+                    public void handleError(final String pMessage, final Location pOptionalLocation) throws CompileException {
+                        final CompilationProblem problem = new JaninoCompilationProblem(pOptionalLocation, pMessage, true);
+                        if (problemHandler != null) {
+                            problemHandler.handle(problem);
+                        }
+                        problems.add(problem);
+                    }
+                });
+                uc.setWarningHandler(new WarningHandler() {
+                    public void handleWarning(final String pHandle, final String pMessage, final Location pOptionalLocation) {
+                        final CompilationProblem problem = new JaninoCompilationProblem(pOptionalLocation, pMessage, false);
+                        if (problemHandler != null) {
+                            problemHandler.handle(problem);
+                        }
+                        problems.add(problem);
+                    }
+                });
+                
+                final ClassFile[] classFiles = uc.compileUnit(DebuggingInformation.ALL);
+                for (int i = 0; i < classFiles.length; i++) {
+                    classes.put(classFiles[i].getThisClassName(), classFiles[i].toByteArray());
+                }
+                final IClass ic = uc.findClass(className);
+                if (null != ic) {
+                    types.put(pType, ic);
+                }
+                return ic;
+            } catch (final LocatedException e) {
+                problems.add(new JaninoCompilationProblem(e));
+            } catch (final IOException e) {
+                problems.add(new JaninoCompilationProblem(resourceNameFromClass, "IOException:" + e.getMessage(), true));
+            } catch (final Exception e) {
+                problems.add(new JaninoCompilationProblem(resourceNameFromClass, "Exception:" + e.getMessage(), true));
+            } finally {
+                if (scanner != null) {
+                    try {
+                        scanner.close();
+                    } catch (IOException e) {
+                    	throw new RuntimeException( "IOException occured while compiling " + className, e );
+                    }
+                }
+            }
+            return null;
+        }
+    }
+
+    public CompilationResult compile( final String[] pSourceNames, final ResourceReader pResourceReader, final ResourceStore pStore, final ClassLoader pClassLoader, final JavaCompilerSettings pSettings ) {
+
+        final Map classFilesByName = new HashMap();       
+        
+        final CompilingIClassLoader icl = new CompilingIClassLoader(pResourceReader, classFilesByName, pClassLoader);
+        for (int i = 0; i < pSourceNames.length; i++) {
+        	try {
+        		icl.loadIClass(Descriptor.fromClassName(ClassUtils.convertResourceToClassName(pSourceNames[i])));
+            } catch ( final ClassNotFoundException e ) {
+                // @TODO: if an exception is thrown here, how do we handle it?
+                e.printStackTrace();
+            }        		
+        }
+        
+        // Store all fully compiled classes
+        for (Iterator i = classFilesByName.entrySet().iterator(); i.hasNext();) {
+            final Map.Entry entry = (Map.Entry)i.next();
+            final String clazzName = (String)entry.getKey(); 
+            pStore.write(ClassUtils.convertClassToResourcePath(clazzName), (byte[])entry.getValue());
+        }
+        
+        final Collection problems = icl.getProblems();
+        final CompilationProblem[] result = new CompilationProblem[problems.size()];
+        problems.toArray(result);
+        return new CompilationResult(result);
+    }
+
+    public JavaCompilerSettings createDefaultSettings() {
+        // FIXME
+        return null;
+    }
+    
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompilerSettings.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JaninoJavaCompilerSettings.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,22 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+public final class JaninoJavaCompilerSettings extends JavaCompilerSettings {
+    // TODO: implement the native janino compiler settings
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,67 +0,0 @@
-/*
- * 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;
-
-/**
- * @author tcurdt
- */
-public interface JavaCompiler {
-
-    /**
-     * Set the the handler that gets the notification of an error
-     * or warning as soon as this information is available from
-     * the compiler.
-     * Note: Some compilers might not support this feature.
-     * 
-     * @param pHandler
-     */
-    void setCompilationProblemHandler(final CompilationProblemHandler pHandler);
-
-    /**
-     * Compiles the java resources "some/path/to/MyJava.java"
-     * read through the ResourceReader and then stores the resulting
-     * classes in the ResourceStore under "some/path/to/MyJava.class".
-     * Note: As these are resource path you always have to use "/" 
-     * 
-     * The result of the compilation run including detailed error
-     * information is returned as CompilationResult. If you need to
-     * get notified already during the compilation process you can
-     * register a CompilationProblemHandler.
-     * Note: Not all compilers might support this notification mechanism.
-     * 
-     * @param pResourcePaths
-     * @param pReader
-     * @param pStore
-     * @return always a CompilationResult
-     */
-    CompilationResult compile(final String[] pResourcePaths,
-                              final ResourceReader pReader,
-                              final ResourceStore pStore);
-
-    /**
-     * As the usual compiler but you can provide the classloader
-     * and therefor the classpath you are compiling with.
-     */
-    CompilationResult compile(final String[] pResourcePaths,
-                              final ResourceReader pReader,
-                              final ResourceStore pStore,
-                              final ClassLoader classLoader);
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompiler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,87 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import org.drools.commons.jci.problems.CompilationProblemHandler;
+import org.drools.commons.jci.readers.ResourceReader;
+import org.drools.commons.jci.stores.ResourceStore;
+
+
+/**
+ * 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 {
+
+    /**
+     * Set the the handler that gets the notification of an error
+     * or warning as soon as this information is available from
+     * the compiler.
+     * Note: Some compilers might not support this feature.
+     * 
+     * @param pHandler
+     */
+    void setCompilationProblemHandler( final CompilationProblemHandler pHandler );
+
+    /**
+     * factory method to create the underlying default settings
+     */
+    JavaCompilerSettings createDefaultSettings();
+    
+    /**
+     * uses the default compiler settings and the current classloader
+     */
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader, final ResourceStore pStore );
+
+    /**
+     * uses the default compiler settings
+     */
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader );
+
+    /**
+     * Compiles the java resources "some/path/to/MyJava.java"
+     * read through the ResourceReader and then stores the resulting
+     * classes in the ResourceStore under "some/path/to/MyJava.class".
+     * Note: As these are resource path you always have to use "/" 
+     * 
+     * The result of the compilation run including detailed error
+     * information is returned as CompilationResult. If you need to
+     * get notified already during the compilation process you can
+     * register a CompilationProblemHandler.
+     * Note: Not all compilers might support this notification mechanism.
+     * 
+     * @param pResourcePaths
+     * @param pReader
+     * @param pStore
+     * @param pClassLoader
+     * @param pSettings
+     * @return always a CompilationResult
+     */
+    CompilationResult compile( final String[] pResourcePaths, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader, final JavaCompilerSettings pSettings );
+
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,88 +0,0 @@
-/*
- * 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;
-import java.util.Map;
-
-import org.drools.util.ClassUtils;
-
-public final class JavaCompilerFactory {
-
-    /**
-     * @deprecated
-     */
-    private static final JavaCompilerFactory INSTANCE = new JavaCompilerFactory();
-
-    /**
-     * @deprecated
-     */
-    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
-     * 
-     *   org.apache.commons.jci.compilers.SomeJavaCompiler
-     *   
-     * you can use the short-hands "some"/"Some"/"SOME". Otherwise
-     * you have to provide the full class name. The compiler is
-     * getting instanciated via (cached) reflection.
-     * 
-     * @param pHint
-     * @return JavaCompiler or null
-     * 
-     * TODO use META-INF discovery mechanism
-     */
-    public JavaCompiler createCompiler(final String pHint) {
-
-        final String className;
-        if ( pHint.indexOf( '.' ) < 0 ) {
-            className = "org.apache.commons.jci.compilers." + ClassUtils.toJavaCasing( pHint ) + "JavaCompiler";
-        } else {
-            className = pHint;
-        }
-
-        Class clazz = (Class) this.classCache.get( className );
-
-        if ( clazz == null ) {
-            try {
-                clazz = Class.forName( className );
-                this.classCache.put( className,
-                                clazz );
-            } catch ( final ClassNotFoundException e ) {
-                clazz = null;
-            }
-        }
-
-        if ( clazz == null ) {
-            return null;
-        }
-
-        try {
-            return (JavaCompiler) clazz.newInstance();
-        } catch ( final Throwable t ) {
-            t.printStackTrace();
-            return null;
-        }
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerFactory.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,93 @@
+/*
+ * 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.drools.commons.jci.compilers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.util.ClassUtils;
+
+
+/**
+ * Creates JavaCompilers
+ * 
+ * TODO use META-INF discovery mechanism
+ * 
+ * @author tcurdt
+ */
+public final class JavaCompilerFactory {
+
+    /**
+     * @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 will be remove after the next release, please create an instance yourself
+     */
+    public static JavaCompilerFactory getInstance() {
+        return JavaCompilerFactory.INSTANCE;
+    }
+
+    /**
+     * Tries to guess the class name by convention. So for compilers
+     * following the naming convention
+     * 
+     *   org.apache.commons.jci.compilers.SomeJavaCompiler
+     *   
+     * you can use the short-hands "some"/"Some"/"SOME". Otherwise
+     * you have to provide the full class name. The compiler is
+     * getting instanciated via (cached) reflection.
+     * 
+     * @param pHint
+     * @return JavaCompiler or null
+     */
+    public JavaCompiler createCompiler(final String pHint) {
+        
+        final String className;
+        if (pHint.indexOf('.') < 0) {
+            className = "org.drools.commons.jci.compilers." + ClassUtils.toJavaCasing(pHint) + "JavaCompiler";
+        } else {
+            className = pHint;
+        }
+        
+        Class clazz = (Class) classCache.get(className);
+        
+        if (clazz == null) {
+            try {
+                clazz = Class.forName(className);
+                classCache.put(className, clazz);
+            } catch (ClassNotFoundException e) {
+                clazz = null;
+            }
+        }
+
+        if (clazz == null) {
+            return null;
+        }
+        
+        try {
+            return (JavaCompiler) clazz.newInstance();
+        } catch (Throwable t) {
+            return null;
+        }
+    }
+    
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,45 +0,0 @@
-/*
- * 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;
-
-public class JavaCompilerSettings {
-
-    public void setTargetVersion(final String pTargetVersion) {
-
-    }
-
-    public void setSourceVersion(final String pSourceVersion) {
-
-    }
-
-    public void setSourceEncoding(final String pSourceEncoding) {
-
-    }
-
-    public void setWarnings(final boolean pWarnings) {
-
-    }
-
-    public void setDeprecations(final boolean pDeprecations) {
-
-    }
-
-    public void setVerbose(final boolean pVerbose) {
-
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/compilers/JavaCompilerSettings.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,93 @@
+/*
+ * 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.drools.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 a 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;
+    }
+
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems (from rev 12812, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems)

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,35 +0,0 @@
-/*
- * 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.problems;
-
-public interface CompilationProblem {
-
-    boolean isError();
-
-    String getFileName();
-
-    int getStartLine();
-
-    int getStartColumn();
-
-    int getEndLine();
-
-    int getEndColumn();
-
-    String getMessage();
-
-}
\ No newline at end of file

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblem.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,65 @@
+/*
+ * 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.drools.commons.jci.problems;
+
+/**
+ * An abstract definition of a compilation problem
+ * 
+ * @author tcurdt
+ */
+public interface CompilationProblem {
+
+    /**
+     * is the problem an error and compilation cannot continue
+     * or just a warning and compilation can proceed
+     * 
+     * @return
+     */
+    boolean isError();
+
+    /**
+     * name of the file where the problem occurred
+     * 
+     * @return
+     */
+    String getFileName();
+
+    /**
+     * position of where the problem starts in the source code
+     * 
+     * @return
+     */
+    int getStartLine();
+    int getStartColumn();
+
+    /**
+     * position of where the problem stops in the source code
+     * 
+     * @return
+     */
+    int getEndLine();
+    int getEndColumn();
+
+    /**
+     * the description of the problem
+     * 
+     * @return
+     */
+    String getMessage();
+
+}
\ No newline at end of file

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,35 +0,0 @@
-/*
- * 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.problems;
-
-/**
- * A CompilationProblemHandler gets access to a problem
- * as soon as the problem is available while the
- * CompilationResult only represents a summary at the
- * end.
- * The handler can be used to asynchronously update a
- * GUI or stop compilation by returning false (e.g.
- * when a maximum number of erros has been reached)
- * 
- * NOTE:
- * has to be supported by the compiler implementation!!
- * 
- * @author tcurdt
- */
-public interface CompilationProblemHandler {
-    boolean handle(final CompilationProblem pProblem);
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/problems/CompilationProblemHandler.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,39 @@
+/*
+ * 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.drools.commons.jci.problems;
+
+
+/**
+ * A CompilationProblemHandler gets access to a problem
+ * as soon as the problem is available while the
+ * CompilationResult only represents a summary at the
+ * end.
+ * The handler can be used to asynchronously update a
+ * GUI or stop compilation by returning false (e.g.
+ * when a maximum number of erros has been reached)
+ * 
+ * NOTE:
+ * has to be supported by the compiler implementation!!
+ * 
+ * @author tcurdt
+ */
+public interface CompilationProblemHandler {
+
+    boolean handle( final CompilationProblem pProblem );
+
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers (from rev 12812, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers)

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,49 +0,0 @@
-package org.apache.commons.jci.readers;
-
-import java.util.Map;
-import java.util.HashMap;
-
-public class MemoryResourceReader
-    implements
-    ResourceReader {
-
-    private Map resources;
-
-    public boolean isAvailable(final String pResourceName) {
-        if ( this.resources == null ) {
-            return false;
-        }
-
-        return this.resources.containsKey( pResourceName );
-    }
-
-    public void add(final String pResourceName,
-                    final byte[] pContent) {
-        if ( this.resources == null ) {
-            this.resources = new HashMap();
-        }
-
-        this.resources.put( pResourceName,
-                       pContent );
-    }
-
-    public void remove(final String pResourceName) {
-        if ( this.resources != null ) {
-            this.resources.remove( pResourceName );
-        }
-    }
-
-    public byte[] getBytes(final String pResourceName) {
-        return (byte[]) this.resources.get( pResourceName );
-    }
-
-    /**
-     * @deprecated
-     */
-    public String[] list() {
-        if ( this.resources == null ) {
-            return new String[0];
-        }
-        return (String[]) this.resources.keySet().toArray( new String[this.resources.size()] );
-    }
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/MemoryResourceReader.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +1,68 @@
+/*
+ * 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.drools.commons.jci.readers;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * A memory based reader to compile from memory
+ * 
+ * @author tcurdt
+ */
+public class MemoryResourceReader implements ResourceReader {
+    
+    private Map resources;
+
+    public boolean isAvailable( final String pResourceName ) {
+        if (resources == null) {
+            return false;
+        }
+
+        return resources.containsKey(pResourceName);
+    }
+    
+    public void add( final String pResourceName, final byte[] pContent ) {
+        if (resources == null) {
+            resources = new HashMap();
+        }
+        
+        resources.put(pResourceName, pContent);
+    }
+    
+    public void remove( final String pResourceName ) {
+        if (resources != null) {
+            resources.remove(pResourceName);
+        }    
+    }    
+    
+
+    public byte[] getBytes( final String pResourceName ) {
+        return (byte[]) resources.get(pResourceName);
+    }
+
+    /**
+     * @deprecated
+     */
+    public String[] list() {
+        if (resources == null) {
+            return new String[0];
+        }
+        return (String[]) resources.keySet().toArray(new String[resources.size()]);
+    }
+}

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/ResourceReader.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,26 +0,0 @@
-/*
- * 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;
-
-/**
- * @author tcurdt
- */
-public interface ResourceReader {
-    boolean isAvailable(final String pResourceName);
-
-    byte[] getBytes(final String pResourceName);
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/ResourceReader.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/readers/ResourceReader.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +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.drools.commons.jci.readers;
+
+/**
+ * A ResourceReader provide acces to resource like e.g. source code
+ * 
+ * @author tcurdt
+ */
+public interface ResourceReader {
+
+    boolean isAvailable( final String pResourceName );
+    byte[] getBytes( final String pResourceName );
+
+}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores (from rev 12812, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores)

Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/ResourceStore.java	2007-06-25 00:09:36 UTC (rev 12812)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -1,30 +0,0 @@
-/*
- * 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;
-
-/**
- * @author tcurdt
- */
-public interface ResourceStore {
-
-    void write(final String pResourceName,
-               final byte[] pResourceData);
-
-    byte[] read(final String pResourceName);
-
-    void remove(final String pResourceName);
-}

Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java (from rev 12815, labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/ResourceStore.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/commons/jci/stores/ResourceStore.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -0,0 +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.drools.commons.jci.stores;
+
+/**
+ * A Store is where the compilers are storing the results
+ * 
+ * @author tcurdt
+ */
+public interface ResourceStore {
+
+    void write( final String pResourceName, final byte[] pResourceData );
+    byte[] read( final String pResourceName );
+    void remove( final String pResourceName );
+}

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FactTemplateError.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FactTemplateError.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FactTemplateError.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.problems.CompilationProblem;
 import org.drools.lang.descr.BaseDescr;
 import org.drools.rule.Package;
 

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FieldTemplateError.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FieldTemplateError.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/FieldTemplateError.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.problems.CompilationProblem;
 import org.drools.lang.descr.BaseDescr;
 import org.drools.rule.Package;
 

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -24,11 +24,11 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.jci.problems.CompilationProblem;
 import org.drools.RuntimeDroolsException;
 import org.drools.base.ClassFieldExtractorCache;
 import org.drools.base.ClassTypeResolver;
 import org.drools.base.TypeResolver;
+import org.drools.commons.jci.problems.CompilationProblem;
 import org.drools.facttemplates.FactTemplate;
 import org.drools.facttemplates.FactTemplateImpl;
 import org.drools.facttemplates.FieldTemplate;

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/RuleError.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/RuleError.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/RuleError.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.problems.CompilationProblem;
 import org.drools.lang.descr.BaseDescr;
 import org.drools.rule.Rule;
 

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -8,17 +8,17 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.jci.compilers.CompilationResult;
-import org.apache.commons.jci.compilers.EclipseJavaCompiler;
-import org.apache.commons.jci.compilers.EclipseJavaCompilerSettings;
-import org.apache.commons.jci.compilers.JavaCompiler;
-import org.apache.commons.jci.compilers.JavaCompilerFactory;
-import org.apache.commons.jci.compilers.JavaCompilerSettings;
-import org.apache.commons.jci.problems.CompilationProblem;
-import org.apache.commons.jci.readers.MemoryResourceReader;
-import org.apache.commons.jci.readers.ResourceReader;
 import org.drools.base.ClassFieldExtractorCache;
 import org.drools.base.TypeResolver;
+import org.drools.commons.jci.compilers.CompilationResult;
+import org.drools.commons.jci.compilers.EclipseJavaCompiler;
+import org.drools.commons.jci.compilers.EclipseJavaCompilerSettings;
+import org.drools.commons.jci.compilers.JavaCompiler;
+import org.drools.commons.jci.compilers.JavaCompilerFactory;
+import org.drools.commons.jci.compilers.JavaCompilerSettings;
+import org.drools.commons.jci.problems.CompilationProblem;
+import org.drools.commons.jci.readers.MemoryResourceReader;
+import org.drools.commons.jci.readers.ResourceReader;
 import org.drools.compiler.PackageBuilder;
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.compiler.RuleError;

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/PackageStore.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -18,7 +18,7 @@
 
 import java.util.List;
 
-import org.apache.commons.jci.stores.ResourceStore;
+import org.drools.commons.jci.stores.ResourceStore;
 import org.drools.rule.PackageCompilationData;
 
 public class PackageStore

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java	2007-06-25 02:18:11 UTC (rev 12815)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java	2007-06-25 02:21:57 UTC (rev 12816)
@@ -31,9 +31,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.jci.compilers.EclipseJavaCompiler;
-import org.apache.commons.jci.compilers.JaninoJavaCompiler;
-import org.apache.commons.jci.compilers.JavaCompiler;
 import org.drools.Cheese;
 import org.drools.DroolsTestCase;
 import org.drools.FactHandle;
@@ -50,6 +47,9 @@
 import org.drools.common.InternalFactHandle;
 import org.drools.common.LogicalDependency;
 import org.drools.common.RuleFlowGroupNode;
+import org.drools.commons.jci.compilers.EclipseJavaCompiler;
+import org.drools.commons.jci.compilers.JaninoJavaCompiler;
+import org.drools.commons.jci.compilers.JavaCompiler;
 import org.drools.facttemplates.Fact;
 import org.drools.lang.descr.AndDescr;
 import org.drools.lang.descr.BaseDescr;




More information about the jboss-svn-commits mailing list