Permalink
Browse files

major cleanup 4.x legacy API

  • Loading branch information...
1 parent 16fc9b9 commit 1f8dc32725276a68456c5c4315c6a7c0b3f222ad @mariofusco mariofusco committed Feb 12, 2014
Showing 747 changed files with 15,825 additions and 30,333 deletions.
View
@@ -14,3 +14,6 @@
# generated files
dependency-reduced-pom.xml
+
+# these modules don't exist anymore on master
+/drools-clips/

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -14,24 +14,20 @@
* limitations under the License.
*/
-package org.drools.compiler.compiler;
-
-import java.io.File;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
+package org.drools.compiler.builder.impl;
+import org.drools.compiler.compiler.Dialect;
+import org.drools.compiler.compiler.DialectCompiletimeRegistry;
+import org.drools.compiler.compiler.DialectConfiguration;
+import org.drools.compiler.compiler.DrlParser;
+import org.drools.compiler.compiler.PackageRegistry;
import org.drools.compiler.compiler.xml.RulesSemanticModule;
import org.drools.compiler.rule.builder.DroolsCompilerComponentFactory;
-import org.drools.core.RuntimeDroolsException;
import org.drools.core.base.evaluators.EvaluatorDefinition;
import org.drools.core.base.evaluators.EvaluatorRegistry;
import org.drools.core.common.ProjectClassLoader;
+import org.drools.core.definitions.InternalKnowledgePackage;
import org.drools.core.factmodel.ClassBuilderFactory;
-import org.drools.core.rule.Package;
import org.drools.core.util.ClassUtils;
import org.drools.core.util.ConfFileUtils;
import org.drools.core.util.StringUtils;
@@ -58,9 +54,14 @@
import org.kie.internal.builder.conf.PropertySpecificOption;
import org.kie.internal.builder.conf.SingleValueKnowledgeBuilderOption;
import org.kie.internal.utils.ChainedProperties;
-import org.kie.internal.utils.ClassLoaderUtil;
-import static org.drools.core.common.ProjectClassLoader.createProjectClassLoader;
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
/**
* This class configures the package compiler.
@@ -91,7 +92,7 @@
* drools.problem.severity.<ident> = ERROR|WARNING|INFO
*
*/
-public class PackageBuilderConfiguration
+public class KnowledgeBuilderConfigurationImpl
implements
KnowledgeBuilderConfiguration {
@@ -147,7 +148,7 @@ public void setAllowMultipleNamespaces(boolean allowMultipleNamespaces) {
* Constructor that sets the parent class loader for the package being built/compiled
* @param classLoaders
*/
- public PackageBuilderConfiguration(ClassLoader... classLoaders) {
+ public KnowledgeBuilderConfigurationImpl(ClassLoader... classLoaders) {
init( null,
classLoaders );
}
@@ -156,7 +157,7 @@ public PackageBuilderConfiguration(ClassLoader... classLoaders) {
* Programmatic properties file, added with lease precedence
* @param properties
*/
- public PackageBuilderConfiguration(Properties properties) {
+ public KnowledgeBuilderConfigurationImpl(Properties properties) {
init( properties,
(ClassLoader[]) null );
}
@@ -166,13 +167,13 @@ public PackageBuilderConfiguration(Properties properties) {
* @param classLoaders
* @param properties
*/
- public PackageBuilderConfiguration(Properties properties,
- ClassLoader... classLoaders) {
+ public KnowledgeBuilderConfigurationImpl(Properties properties,
+ ClassLoader... classLoaders) {
init( properties,
classLoaders );
}
- public PackageBuilderConfiguration() {
+ public KnowledgeBuilderConfigurationImpl() {
init( null,
(ClassLoader[]) null );
}
@@ -347,8 +348,8 @@ public void addDialect(String dialectName,
addDialect( dialectName,
dialectConf );
} catch ( Exception e ) {
- throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + ":" + ((cls != null) ? cls.getName() : "null") + "'",
- e );
+ throw new RuntimeException( "Unable to load dialect '" + dialectClass + ":" + dialectName + ":" + ((cls != null) ? cls.getName() : "null") + "'",
+ e );
}
}
@@ -358,12 +359,13 @@ public void addDialect(String dialectName,
dialectConf );
}
- public DialectCompiletimeRegistry buildDialectRegistry(PackageBuilder packageBuilder,
+ public DialectCompiletimeRegistry buildDialectRegistry(ClassLoader rootClassLoader,
+ KnowledgeBuilderConfigurationImpl pkgConf,
PackageRegistry pkgRegistry,
- Package pkg) {
+ InternalKnowledgePackage pkg) {
DialectCompiletimeRegistry registry = new DialectCompiletimeRegistry();
for ( DialectConfiguration conf : this.dialectConfigurations.values() ) {
- Dialect dialect = conf.newDialect( packageBuilder, pkgRegistry, pkg );
+ Dialect dialect = conf.newDialect( rootClassLoader, pkgConf, pkgRegistry, pkg );
registry.addDialect( dialect.getId(), dialect );
}
return registry;
@@ -539,11 +541,11 @@ public void addAccumulateFunction(String identifier,
this.accumulateFunctions.put( identifier,
clazz.newInstance() );
} catch ( InstantiationException e ) {
- throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Instantiation failed for class " + clazz.getName(),
- e );
+ throw new RuntimeException( "Error loading accumulate function for identifier " + identifier + ". Instantiation failed for class " + clazz.getName(),
+ e );
} catch ( IllegalAccessException e ) {
- throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Illegal access to class " + clazz.getName(),
- e );
+ throw new RuntimeException( "Error loading accumulate function for identifier " + identifier + ". Illegal access to class " + clazz.getName(),
+ e );
}
}
@@ -558,14 +560,14 @@ private AccumulateFunction loadAccumulateFunction(String identifier,
Class< ? extends AccumulateFunction> clazz = (Class< ? extends AccumulateFunction>) getClassLoader().loadClass(className);
return clazz.newInstance();
} catch ( ClassNotFoundException e ) {
- throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Class " + className + " not found",
- e );
+ throw new RuntimeException( "Error loading accumulate function for identifier " + identifier + ". Class " + className + " not found",
+ e );
} catch ( InstantiationException e ) {
- throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Instantiation failed for class " + className,
- e );
+ throw new RuntimeException( "Error loading accumulate function for identifier " + identifier + ". Instantiation failed for class " + className,
+ e );
} catch ( IllegalAccessException e ) {
- throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Illegal access to class " + className,
- e );
+ throw new RuntimeException( "Error loading accumulate function for identifier " + identifier + ". Illegal access to class " + className,
+ e );
}
}
@@ -639,7 +641,7 @@ public File getDumpDir() {
public void setDumpDir(File dumpDir) {
if ( !dumpDir.isDirectory() || !dumpDir.canWrite() || !dumpDir.canRead() ) {
- throw new RuntimeDroolsException( "Drools dump directory is not accessible: " + dumpDir.toString() );
+ throw new RuntimeException( "Drools dump directory is not accessible: " + dumpDir.toString() );
}
this.dumpDirectory = dumpDir;
}
@@ -4,9 +4,8 @@
import org.drools.core.builder.conf.impl.DecisionTableConfigurationImpl;
import org.drools.core.builder.conf.impl.JaxbConfigurationImpl;
-import org.drools.compiler.compiler.PackageBuilder;
-import org.drools.compiler.compiler.PackageBuilderConfiguration;
import org.drools.core.builder.conf.impl.ScoreCardConfigurationImpl;
+import org.drools.core.impl.InternalKnowledgeBase;
import org.drools.core.impl.KnowledgeBaseImpl;
import org.kie.internal.KnowledgeBase;
import org.kie.internal.builder.DecisionTableConfiguration;
@@ -21,11 +20,11 @@
public class KnowledgeBuilderFactoryServiceImpl implements KnowledgeBuilderFactoryService {
public KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration() {
- return new PackageBuilderConfiguration();
+ return new KnowledgeBuilderConfigurationImpl();
}
public KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties, ClassLoader... classLoaders) {
- return new PackageBuilderConfiguration(properties, classLoaders);
+ return new KnowledgeBuilderConfigurationImpl(properties, classLoaders);
}
public DecisionTableConfiguration newDecisionTableConfiguration() {
@@ -37,27 +36,27 @@ public ScoreCardConfiguration newScoreCardConfiguration() {
}
public KnowledgeBuilder newKnowledgeBuilder() {
- return new KnowledgeBuilderImpl( new PackageBuilder() );
+ return new KnowledgeBuilderImpl( );
}
public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf) {
- return new KnowledgeBuilderImpl( new PackageBuilder( (PackageBuilderConfiguration) conf ) );
+ return new KnowledgeBuilderImpl( (KnowledgeBuilderConfigurationImpl) conf );
}
public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase) {
if ( kbase != null ) {
- return new KnowledgeBuilderImpl( new PackageBuilder( ((KnowledgeBaseImpl) kbase).ruleBase ) );
+ return new KnowledgeBuilderImpl( (InternalKnowledgeBase)kbase );
} else {
- return new KnowledgeBuilderImpl( new PackageBuilder() );
+ return new KnowledgeBuilderImpl();
}
}
public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase,
KnowledgeBuilderConfiguration conf) {
if ( kbase != null ) {
- return new KnowledgeBuilderImpl( new PackageBuilder( ((KnowledgeBaseImpl) kbase).ruleBase, (PackageBuilderConfiguration) conf ) );
+ return new KnowledgeBuilderImpl( (InternalKnowledgeBase)kbase, (KnowledgeBuilderConfigurationImpl) conf );
} else {
- return new KnowledgeBuilderImpl(new PackageBuilder( (PackageBuilderConfiguration) conf ) );
+ return new KnowledgeBuilderImpl((KnowledgeBuilderConfigurationImpl) conf );
}
}
Oops, something went wrong.

0 comments on commit 1f8dc32

Please sign in to comment.