[jboss-svn-commits] JBL Code SVN: r9418 - in labs/jbossrules/trunk: drools-compiler and 29 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Feb 9 23:47:48 EST 2007
Author: mark.proctor at jboss.com
Date: 2007-02-09 23:47:47 -0500 (Fri, 09 Feb 2007)
New Revision: 9418
Added:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/
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/compilers/AbstractJavaCompiler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseCompilationProblem.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoCompilationProblem.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
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/problems/CompilationProblem.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java
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/readers/MemoryResourceReader.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/ResourceReader.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/ResourceStore.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/
labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
labs/jbossrules/trunk/repository/janino/
labs/jbossrules/trunk/repository/janino/janino/
labs/jbossrules/trunk/repository/janino/janino/2.5.5/
labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.jar
labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.pom
labs/jbossrules/trunk/repository/org/eclipse/
labs/jbossrules/trunk/repository/org/eclipse/jdt/
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar.sha1
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom.sha1
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar.md5
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom.md5
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar
labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.pom
Modified:
labs/jbossrules/trunk/drools-compiler/.classpath
labs/jbossrules/trunk/drools-compiler/pom.xml
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
labs/jbossrules/trunk/drools-core/.classpath
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
labs/jbossrules/trunk/drools-decisiontables/.classpath
labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/ArrayColumn.java
labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleMatrixSheetListener.java
labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleTemplate.java
labs/jbossrules/trunk/drools-jsr94/.classpath
labs/jbossrules/trunk/drools-jsr94/src/test/resources/org/jcp/jsr94/tck/tck.conf
labs/jbossrules/trunk/pom.xml
Log:
JBRULES-660 Inline JCI and removed uneeded dependencies
-Inline JCI into drools-compiler
-Removed all commons
-Updated Janino and Eclipse
Modified: labs/jbossrules/trunk/drools-compiler/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-compiler/.classpath 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-compiler/.classpath 2007-02-10 04:47:47 UTC (rev 9418)
@@ -1,25 +1,19 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
- <classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.1/commons-io-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-eclipse/3.2.0.666/commons-jci-eclipse-3.2.0.666.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0b5/antlr-3.0b5.jar"/>
- <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
- <classpathentry kind="src" path="/drools-core"/>
- <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/3.0/stringtemplate-3.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/janino/janino/2.4.3/janino-2.4.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-core/1.0-406301/commons-jci-core-1.0-406301.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-janino/2.4.3/commons-jci-janino-2.4.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
-</classpath>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="/drools-core"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/3.0/stringtemplate-3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.5/janino-2.5.5.jar" sourcepath="/M2_REPO/janino/janino/2.5.5/janino-src.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0b5/antlr-3.0b5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Modified: labs/jbossrules/trunk/drools-compiler/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/pom.xml 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-compiler/pom.xml 2007-02-10 04:47:47 UTC (rev 9418)
@@ -19,37 +19,7 @@
</repository>
</repositories>
- <!-- This is needed to copy the generated jars into the IDE/Plugs lib directory -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>package</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <echo message="Copying file ${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging} to ../drools-ide/lib/${project.artifactId}.${project.packaging}"/>
- <copy file="${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging}" tofile="../drools-ide/lib/${project.artifactId}.${project.packaging}"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-antlr</artifactId>
- <version>1.6.5</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
+ <build/>
<dependencies>
<!-- Internal dependencies -->
@@ -59,21 +29,7 @@
</dependency>
<!-- External dependencies -->
- <!-- TODO will keep JCI local for now. Move to ibiblio when its updated -->
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-janino</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-eclipse</artifactId>
- </dependency>
- <!-- TODO only needed for the default expander in parser/lang.. to remove when it is refactored into another module. -->
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
<groupId>antlr</groupId>
<artifactId>stringtemplate</artifactId>
</dependency>
@@ -85,6 +41,14 @@
<groupId>org.eclipse.jdt</groupId>
<artifactId>core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>janino</groupId>
+ <artifactId>janino</artifactId>
+ </dependency>
</dependencies>
</project>
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/AbstractJavaCompiler.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,26 @@
+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 ) {
+ 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);
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/CompilationResult.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,40 @@
+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);
+ }
+ }
+
+ 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;
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseCompilationProblem.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseCompilationProblem.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseCompilationProblem.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,73 @@
+/*
+ * 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) {
+ 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();
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,284 @@
+/*
+ * 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.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+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.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 Map settings;
+
+ public EclipseJavaCompiler() {
+ this(new EclipseJavaCompilerSettings());
+ }
+
+ public EclipseJavaCompiler(final Map pSettings) {
+ settings = pSettings;
+ }
+
+ public EclipseJavaCompiler(final EclipseJavaCompilerSettings pSettings) {
+ 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 pClazzName) {
+ reader = pReader;
+ clazzName = pClazzName;
+ clazzName.replace('.', '/');
+ fileName = clazzName.replace('.', '/') + ".java";
+ int dot = clazzName.lastIndexOf('.');
+ if (dot > 0) {
+ typeName = clazzName.substring(dot + 1).toCharArray();
+ } else {
+ typeName = clazzName.toCharArray();
+ }
+ final StringTokenizer izer = new StringTokenizer(clazzName, ".");
+ packageName = new char[izer.countTokens() - 1][];
+ for (int i = 0; i < packageName.length; i++) {
+ packageName[i] = izer.nextToken().toCharArray();
+ }
+ }
+
+ public char[] getFileName() {
+ return fileName.toCharArray();
+ }
+
+ public char[] getContents() {
+ return new String(reader.getBytes(fileName)).toCharArray();
+ }
+
+ public char[] getMainTypeName() {
+ return typeName;
+ }
+
+ public char[][] getPackageName() {
+ return packageName;
+ }
+ }
+
+ public org.apache.commons.jci.compilers.CompilationResult compile(
+ final String[] pClazzNames,
+ final ResourceReader pReader,
+ final ResourceStore pStore,
+ final ClassLoader classLoader
+ ) {
+
+ final Map settingsMap = settings;
+ final Set clazzIndex = new HashSet();
+ ICompilationUnit[] compilationUnits = new ICompilationUnit[pClazzNames.length];
+ for (int i = 0; i < compilationUnits.length; i++) {
+ final String clazzName = pClazzNames[i];
+ compilationUnits[i] = new CompilationUnit(pReader, clazzName);
+ clazzIndex.add(clazzName);
+ }
+
+ final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
+ final IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());
+ final INameEnvironment nameEnvironment = new INameEnvironment() {
+
+ public NameEnvironmentAnswer findType( final char[][] compoundTypeName ) {
+ final StringBuffer result = new StringBuffer();
+ for (int i = 0; i < compoundTypeName.length; i++) {
+ if (i != 0) {
+ result.append('.');
+ }
+ result.append(compoundTypeName[i]);
+ }
+ return findType(result.toString());
+ }
+
+ public NameEnvironmentAnswer findType( final char[] typeName, final char[][] packageName ) {
+ final StringBuffer result = new StringBuffer();
+ for (int i = 0; i < packageName.length; i++) {
+ result.append(packageName[i]);
+ result.append('.');
+ }
+ result.append(typeName);
+ return findType(result.toString());
+ }
+
+ private NameEnvironmentAnswer findType( final String clazzName ) {
+ byte[] clazzBytes = pStore.read(clazzName);
+ if (clazzBytes != null) {
+ // log.debug("loading from store " + clazzName);
+ final char[] fileName = clazzName.toCharArray();
+ try {
+ final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
+ return new NameEnvironmentAnswer(classFileReader, null);
+ } catch (final ClassFormatException e) {
+ // @TODO: we need to handle this better, maybe a runtime exception?
+ e.printStackTrace();
+ //log.error("wrong class format", e);
+ }
+ } else {
+ if (pReader.isAvailable(clazzName.replace('.', '/') + ".java")) {
+ ICompilationUnit compilationUnit = new CompilationUnit(pReader, clazzName);
+ return new NameEnvironmentAnswer(compilationUnit, null);
+ }
+
+ final String resourceName = clazzName.replace('.', '/') + ".class";
+ final InputStream is = classLoader.getResourceAsStream(resourceName);
+ if (is != 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();
+ clazzBytes = baos.toByteArray();
+ final char[] fileName = clazzName.toCharArray();
+ ClassFileReader classFileReader =
+ new ClassFileReader(clazzBytes, fileName, true);
+ return new NameEnvironmentAnswer(classFileReader, null);
+ } catch (final IOException e) {
+ // @TODO: we need to handle this better, maybe a runtime exception?
+ e.printStackTrace();
+ // log.error("could not read class", e);
+ } catch (final ClassFormatException e) {
+ // @TODO: we need to handle this better, maybe a runtime exception?
+ e.printStackTrace();
+ // log.error("wrong class format", e);
+ } finally {
+ try {
+ baos.close();
+ } catch (final IOException oe) {
+ // @TODO: we need to handle this better, maybe a runtime exception?
+ oe.printStackTrace();
+ //log.error("could not close output stream", oe);
+ }
+ try {
+ is.close();
+ } catch (final IOException ie) {
+ // @TODO: we need to handle this better, maybe a runtime exception?
+ ie.printStackTrace();
+ //log.error("could not close input stream", ie);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean isPackage( final String clazzName ) {
+ final String resourceName = clazzName.replace('.', '/') + ".class";
+ final URL resource = classLoader.getResource(resourceName);
+ return resource == null;
+ }
+
+ public boolean isPackage( char[][] parentPackageName, char[] packageName ) {
+ 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]);
+ }
+ }
+ if (Character.isUpperCase(packageName[0])) {
+ return false;
+ }
+ if (parentPackageName != null && parentPackageName.length > 0) {
+ result.append('.');
+ }
+ result.append(packageName);
+ return isPackage(result.toString());
+ }
+
+ public void cleanup() {
+ }
+ };
+
+ final Collection problems = new ArrayList();
+ final ICompilerRequestor compilerRequestor = new ICompilerRequestor() {
+ public void acceptResult( CompilationResult result ) {
+ if (result.hasProblems()) {
+ final IProblem[] iproblems = result.getProblems();
+ for (int i = 0; i < iproblems.length; i++) {
+ final IProblem iproblem = iproblems[i];
+ final CompilationProblem problem = new EclipseCompilationProblem(iproblem);
+ if (problemHandler != null) {
+ problemHandler.handle(problem);
+ }
+ problems.add(problem);
+ }
+ }
+ if (!result.hasErrors()) {
+ final ClassFile[] clazzFiles = result.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(), 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);
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompilerSettings.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,30 @@
+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() {
+ 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 Map getMap() {
+ final Map map = new HashMap(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;
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoCompilationProblem.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoCompilationProblem.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoCompilationProblem.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,94 @@
+/*
+ * 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) {
+ 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();
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JaninoJavaCompiler.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,167 @@
+/*
+ * 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;
+
+/**
+ * @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);
+ }
+ 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) {
+ // @TODO: we need to handle this better, maybe a runtime exception?
+ e.printStackTrace();
+ //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);
+
+ try {
+ for (int i = 0; i < pClasses.length; i++) {
+ icl.loadIClass(Descriptor.fromClassName(pClasses[i]));
+ }
+ } catch ( 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();
+ pStore.write((String)entry.getKey(), (byte[])entry.getValue());
+ }
+
+ final Collection problems = icl.getProblems();
+ final CompilationProblem[] result = new CompilationProblem[problems.size()];
+ problems.toArray(result);
+ return new CompilationResult(result);
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompiler.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,63 @@
+/*
+ * 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 );
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerFactory.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,89 @@
+/*
+ * 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.apache.commons.jci.utils.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) 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) {
+ t.printStackTrace();
+ return null;
+ }
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/compilers/JavaCompilerSettings.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,47 @@
+/*
+ * 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 ) {
+
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblem.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jci.problems;
+
+public interface CompilationProblem {
+
+ boolean isError();
+
+ String getFileName();
+
+ int getStartLine();
+ int getStartColumn();
+
+ int getEndLine();
+ int getEndColumn();
+
+ String getMessage();
+
+}
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/problems/CompilationProblemHandler.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,36 @@
+/*
+ * 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 );
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/MemoryResourceReader.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,46 @@
+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 (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()]);
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/ResourceReader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/ResourceReader.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/readers/ResourceReader.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,25 @@
+/*
+ * 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 );
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/MemoryResourceStore.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -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.apache.commons.jci.stores;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * @author tcurdt
+ */
+public final class MemoryResourceStore implements ResourceStore {
+
+ private final Map store = new HashMap();
+
+ public byte[] read( final String pResourceName ) {
+ return (byte[]) store.get(pResourceName);
+ }
+
+ public void write( final String pResourceName, final byte[] pData ) {
+ store.put(pResourceName, pData);
+ }
+
+ public void remove( final String pResourceName ) {
+ store.remove(pResourceName);
+ }
+
+ /**
+ * @deprecated
+ */
+ public String[] list() {
+ if (store == null) {
+ return new String[0];
+ }
+ final List names = new ArrayList();
+
+ for (final Iterator it = store.keySet().iterator(); it.hasNext();) {
+ final String name = (String) it.next();
+ names.add(name);
+ }
+
+ return (String[]) names.toArray(new String[store.size()]);
+ }
+
+ public String toString() {
+ return this.getClass().getName() + store.toString();
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/ResourceStore.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/ResourceStore.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/stores/ResourceStore.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -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.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 );
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/apache/commons/jci/utils/ClassUtils.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,41 @@
+package org.apache.commons.jci.utils;
+
+import java.io.File;
+
+
+public final class ClassUtils {
+
+ /**
+ * Please do not use - internal
+ * org/my/Class.xxx -> org.my.Class
+ */
+ public static String convertResourceNameToClassName( final String pResourceName ) {
+ return ClassUtils.stripExtension(pResourceName).replace('/', '.');
+ }
+
+ /**
+ * Please do not use - internal
+ * org/my/Class.xxx -> org/my/Class
+ */
+ public static String stripExtension( final String pResourceName ) {
+ final int i = pResourceName.lastIndexOf('.');
+ final String withoutExtension = pResourceName.substring(0, i);
+ return withoutExtension;
+ }
+
+ public static String toJavaCasing(final String pName) {
+ final char[] name = pName.toLowerCase().toCharArray();
+ name[0] = Character.toUpperCase(name[0]);
+ return new String(name);
+ }
+
+ public static String clazzName( final File base, final File file ) {
+ final int rootLength = base.getAbsolutePath().length();
+ final String absFileName = file.getAbsolutePath();
+ final int p = absFileName.lastIndexOf('.');
+ final String relFileName = absFileName.substring(rootLength + 1, p);
+ final String clazzName = relFileName.replace(File.separatorChar, '.');
+ return clazzName;
+ }
+
+}
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-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -62,6 +62,7 @@
import org.drools.semantics.java.StaticMethodFunctionResolver;
import org.drools.spi.FunctionResolver;
import org.drools.xml.XmlPackageReader;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.xml.sax.SAXException;
/**
@@ -79,7 +80,7 @@
private MemoryResourceReader src;
private PackageBuilderConfiguration configuration;
private Map errorHandlers;
- private List generatedClassList;
+ private List generatedClassList;
private TypeResolver typeResolver;
private FunctionFixer functionFixer;
private FunctionResolver functionResolver;
@@ -604,11 +605,14 @@
case PackageBuilderConfiguration.ECLIPSE :
default : {
final EclipseJavaCompilerSettings eclipseSettings = new EclipseJavaCompilerSettings();
- eclipseSettings.getMap().put( "org.eclipse.jdt.core.compiler.codegen.targetPlatform",
- this.configuration.getJavaLanguageLevel() );
- eclipseSettings.getMap().put( "org.eclipse.jdt.core.compiler.source",
- this.configuration.getJavaLanguageLevel() );
- this.compiler = new EclipseJavaCompiler( eclipseSettings );
+ Map map = eclipseSettings.getMap();
+ map.put( CompilerOptions.OPTION_TargetPlatform,
+ this.configuration.getJavaLanguageLevel() );
+
+ // We now default this to 1.5, so we can use static imports.
+ map.put( CompilerOptions.OPTION_Source,
+ "1.5" );
+ this.compiler = new EclipseJavaCompiler( map );
break;
}
}
@@ -619,7 +623,7 @@
}
public static class MissingPackageNameException extends IllegalArgumentException {
- private static final long serialVersionUID = 4056984379574366454L;
+ private static final long serialVersionUID = 320L;
public MissingPackageNameException(final String message) {
super( message );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -71,7 +71,15 @@
return languageLevel;
}
+ /**
+ * You cannot set language level below 1.5, as we need static imports, 1.5 is now the default.
+ * @param level
+ */
public void setJavaLanguageLevel(String level) {
+ if ( level.equals( "1.4" ) ) {
+ // can't set to 1.4, as we need static imports
+ level = "1.5";
+ }
languageLevel = level;
}
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-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -937,27 +937,28 @@
EclipseJavaCompiler eclipseCompiler = (EclipseJavaCompiler) compiler;
Field settingsField = eclipseCompiler.getClass().getDeclaredField( "settings" );
settingsField.setAccessible( true );
- EclipseJavaCompilerSettings settings = (EclipseJavaCompilerSettings) settingsField.get( eclipseCompiler );
+ Map map = (Map) settingsField.get( eclipseCompiler );
assertEquals( "1.4",
- settings.getMap().get( "org.eclipse.jdt.core.compiler.codegen.targetPlatform" ) );
- assertEquals( "1.4",
- settings.getMap().get( "org.eclipse.jdt.core.compiler.source" ) );
+ map.get( "org.eclipse.jdt.core.compiler.codegen.targetPlatform" ) );
+ assertEquals( "1.5",
+ map.get( "org.eclipse.jdt.core.compiler.source" ) );
// test eclipse jdt core with property settings and jdk1.5 source level
conf = new PackageBuilderConfiguration();
conf.setCompiler( PackageBuilderConfiguration.ECLIPSE );
- conf.setJavaLanguageLevel( "1.5" );
+ conf.setJavaLanguageLevel( "1.4" );
builder = new PackageBuilder( conf );;
compiler = (JavaCompiler) compilerField.get( builder );
assertSame( EclipseJavaCompiler.class,
compiler.getClass() );
eclipseCompiler = (EclipseJavaCompiler) compiler;
- settings = (EclipseJavaCompilerSettings) settingsField.get( eclipseCompiler );
+ map = (Map) settingsField.get( eclipseCompiler );
assertEquals( "1.5",
- settings.getMap().get( "org.eclipse.jdt.core.compiler.codegen.targetPlatform" ) );
+ map.get( "org.eclipse.jdt.core.compiler.codegen.targetPlatform" ) );
+ // it cannot be set below 1.5, so if they add 1.4, it still ends up at 1.5.
assertEquals( "1.5",
- settings.getMap().get( "org.eclipse.jdt.core.compiler.source" ) );
+ map.get( "org.eclipse.jdt.core.compiler.source" ) );
}
private void createReturnValueRule(final PackageDescr packageDescr,
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -1651,6 +1651,9 @@
final XmlDumper xmlDumper = new XmlDumper();
final String xmlResult = xmlDumper.dump( pkg );
+
+ System.out.println( xmlResult );
+
builder = new PackageBuilder();
builder.addPackageFromXml( new StringReader( xmlResult ) );
Modified: labs/jbossrules/trunk/drools-core/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-core/.classpath 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-core/.classpath 2007-02-10 04:47:47 UTC (rev 9418)
@@ -5,8 +5,8 @@
<classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
<classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
</classpath>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -266,8 +266,12 @@
for ( final Iterator it = newGlobals.keySet().iterator(); it.hasNext(); ) {
final String identifier = (String) it.next();
final Class type = (Class) newGlobals.get( identifier );
- if ( this.globals.containsKey( identifier ) && !this.globals.get( identifier ).equals( type ) ) {
- throw new PackageIntegrationException( pkg );
+ boolean f = this.globals.containsKey( identifier );
+ if ( f ) {
+ boolean y = !this.globals.get( identifier ).equals( type );
+ if ( f && y ) {
+ throw new PackageIntegrationException( pkg );
+ }
}
}
this.globals.putAll( newGlobals );
Modified: labs/jbossrules/trunk/drools-decisiontables/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/.classpath 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-decisiontables/.classpath 2007-02-10 04:47:47 UTC (rev 9418)
@@ -5,23 +5,16 @@
<classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0b5/antlr-3.0b5.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.1/commons-io-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/3.0/stringtemplate-3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-eclipse/3.2.0.666/commons-jci-eclipse-3.2.0.666.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
+ <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.5/janino-2.5.5.jar"/>
<classpathentry kind="var" path="M2_REPO/jexcelapi/jxl/2.4.2/jxl-2.4.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0b5/antlr-3.0b5.jar"/>
<classpathentry kind="src" path="/drools-core"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/3.0/stringtemplate-3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar"/>
<classpathentry kind="src" path="/drools-compiler"/>
- <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-core/1.0-406301/commons-jci-core-1.0-406301.jar"/>
- <classpathentry kind="var" path="M2_REPO/janino/janino/2.4.3/janino-2.4.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-janino/2.4.3/commons-jci-janino-2.4.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
</classpath>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/ArrayColumn.java
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/ArrayColumn.java 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/ArrayColumn.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -16,7 +16,6 @@
* limitations under the License.
*/
import org.antlr.stringtemplate.StringTemplate;
-import org.apache.commons.lang.StringUtils;
public class ArrayColumn extends Column {
Modified: labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleMatrixSheetListener.java
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleMatrixSheetListener.java 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleMatrixSheetListener.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
import org.drools.decisiontable.model.Condition;
import org.drools.decisiontable.model.Consequence;
import org.drools.decisiontable.model.Rule;
Modified: labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleTemplate.java
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleTemplate.java 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleTemplate.java 2007-02-10 04:47:47 UTC (rev 9418)
@@ -23,9 +23,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
public class RuleTemplate
{
private String name;
@@ -81,11 +78,9 @@
* @see java.lang.Object#toString()
*/
public String toString() {
- return new ToStringBuilder(this).append("name", this.name).append(
- "notColumns", this.notColumns)
- .append("contents", this.contents).append("columns",
- this.columns).toString();
+ return "RuleTemplate[name,"+this.name+"notColumns,"+this.notColumns+"contents,"+this.columns+"columns";
}
+
private String replaceOptionals(String contents) {
try {
final Pattern pattern = Pattern.compile("\\$(.[^\\$]*)\\$");
Modified: labs/jbossrules/trunk/drools-jsr94/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-jsr94/.classpath 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-jsr94/.classpath 2007-02-10 04:47:47 UTC (rev 9418)
@@ -5,26 +5,19 @@
<classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-core/1.0-406301/commons-jci-core-1.0-406301.jar"/>
- <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-eclipse/3.2.0.666/commons-jci-eclipse-3.2.0.666.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jsr94/jsr94/1.1/jsr94-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-tck/1.0.3/jsr94-tck-1.0.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0b5/antlr-3.0b5.jar"/>
<classpathentry kind="src" path="/drools-core"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.1/commons-io-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-tck/1.0.3/jsr94-tck-1.0.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar"/>
<classpathentry kind="src" path="/drools-compiler"/>
- <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-sigtest/1.1/jsr94-sigtest-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-jci-janino/2.4.3/commons-jci-janino-2.4.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mvel/mvel14/1.2beta6/mvel14-1.2beta6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0b5/antlr-3.0b5.jar"/>
<classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/3.0/stringtemplate-3.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/jsr94/jsr94/1.1/jsr94-1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/janino/janino/2.4.3/janino-2.4.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-sigtest/1.1/jsr94-sigtest-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.5/janino-2.5.5.jar"/>
</classpath>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-jsr94/src/test/resources/org/jcp/jsr94/tck/tck.conf
===================================================================
--- labs/jbossrules/trunk/drools-jsr94/src/test/resources/org/jcp/jsr94/tck/tck.conf 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/drools-jsr94/src/test/resources/org/jcp/jsr94/tck/tck.conf 2007-02-10 04:47:47 UTC (rev 9418)
@@ -4,7 +4,7 @@
<test-factory>org.jcp.jsr94.tck.util.TestFactory</test-factory>
<rule-service-provider>org.drools.jsr94.rules.RuleServiceProviderImpl</rule-service-provider>
- <rule-service-provider-jar-url>file:target/drools-jsr94.jar</rule-service-provider-jar-url>
- <rule-execution-set-location>target/test-classes/org/jcp/jsr94/tck</rule-execution-set-location>
+ <rule-service-provider-jar-url>file://c:/dev/jbossrules/trunk/drools-jsr94/target/drools-jsr94.jar</rule-service-provider-jar-url>
+ <rule-execution-set-location>/dev/jbossrules/trunk/drools-jsr94/target/test-classes/org/jcp/jsr94/tck</rule-execution-set-location>
</tck-configuration>
Modified: labs/jbossrules/trunk/pom.xml
===================================================================
--- labs/jbossrules/trunk/pom.xml 2007-02-09 22:13:39 UTC (rev 9417)
+++ labs/jbossrules/trunk/pom.xml 2007-02-10 04:47:47 UTC (rev 9418)
@@ -518,21 +518,6 @@
<!-- drools-compiler -->
<!-- TODO will keep JCI local for now. Move to ibiblio when its updated -->
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-janino</artifactId>
- <version>2.4.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-eclipse</artifactId>
- <version>3.2.0.666</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
<groupId>antlr</groupId>
<artifactId>stringtemplate</artifactId>
<version>3.0</version>
@@ -545,8 +530,13 @@
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>core</artifactId>
- <version>3.2.0.666</version>
+ <version>3.2.1.v_677_R32x</version>
</dependency>
+ <dependency>
+ <groupId>janino</groupId>
+ <artifactId>janino</artifactId>
+ <version>2.5.5</version>
+ </dependency>
<!-- drools-jsr94 -->
<dependency>
Added: labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.pom
===================================================================
--- labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.pom (rev 0)
+++ labs/jbossrules/trunk/repository/janino/janino/2.5.5/janino-2.5.5.pom 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,25 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>janino</groupId>
+ <artifactId>janino</artifactId>
+ <version>2.5.5</version>
+ <packaging>jar</packaging>
+
+ <name>Janino</name>
+ <description>Janino is a run-time Java compiler</description>
+ <url>http://janino.net</url>
+
+ <licenses>
+ <license>
+ <name>BSD</name>
+ <url>http://janino.net/javadoc/org/codehaus/janino/doc-files/new_bsd_license.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <url>http://cvs.codehaus.org/viewrep/janino</url>
+ </scm>
+
+ <dependencies/>
+</project>
\ No newline at end of file
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar.sha1
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar.sha1 (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.jar.sha1 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1 @@
+22e4919bcddc95f360119482321323f33bb5abd4
\ No newline at end of file
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,7 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.2.0.658</version>
+ <dependencies/>
+</project>
\ No newline at end of file
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom.sha1
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom.sha1 (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.658/core-3.2.0.658.pom.sha1 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1 @@
+7ed898f20508930520b36664133dd8731c3408b0
\ No newline at end of file
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar.md5
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar.md5 (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar.md5 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1 @@
+328a3c673887b0e7f5a6206c099527f6 ./maven2/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.jar
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,7 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.2.0.666</version>
+ <dependencies/>
+</project>
\ No newline at end of file
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom.md5
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom.md5 (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom.md5 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1 @@
+272966edbdc07060969c08236f797336 ./maven2/org/eclipse/jdt/core/3.2.0.666/core-3.2.0.666.pom
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.pom
===================================================================
--- labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.pom (rev 0)
+++ labs/jbossrules/trunk/repository/org/eclipse/jdt/core/3.2.1.v_677_R32x/core-3.2.1.v_677_R32x.pom 2007-02-10 04:47:47 UTC (rev 9418)
@@ -0,0 +1,7 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.2.0.666</version>
+ <dependencies/>
+</project>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list