[jboss-svn-commits] JBL Code SVN: r21078 - labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 17 00:35:24 EDT 2008
Author: mark.proctor at jboss.com
Date: 2008-07-17 00:35:24 -0400 (Thu, 17 Jul 2008)
New Revision: 21078
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
Log:
JBRULES-1686 XSD model generation and JAXB DataLoader
-added in Src compiler capabilities.
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 2008-07-17 04:05:53 UTC (rev 21077)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2008-07-17 04:35:24 UTC (rev 21078)
@@ -417,10 +417,8 @@
compileAll();
reloadAll();
+ updateResults();
- // some of the rules and functions may have been redefined
- this.results = getResults( this.results );
-
// iterate and compile
if ( this.ruleBase != null ) {
for ( final Iterator it = packageDescr.getRules().iterator(); it.hasNext(); ) {
@@ -435,14 +433,19 @@
public boolean isEmpty(String string) {
return (string == null || string.trim().length() == 0);
}
+
+ public void updateResults() {
+ // some of the rules and functions may have been redefined
+ this.results = getResults( this.results );
+ }
- private void compileAll() {
+ public void compileAll() {
for ( PackageRegistry pkgRegistry : this.pkgRegistryMap.values() ) {
pkgRegistry.compileAll();
}
}
- private void reloadAll() {
+ public void reloadAll() {
for ( PackageRegistry pkgRegistry : this.pkgRegistryMap.values() ) {
pkgRegistry.getDialectRuntimeRegistry().reloadDirty();
}
@@ -965,6 +968,7 @@
}
}
+
public static class RuleErrorHandler extends ErrorHandler {
private BaseDescr descr;
@@ -1053,7 +1057,63 @@
}
}
+
+ public static class SrcErrorHandler extends ErrorHandler {
+
+ public SrcErrorHandler(final String message) {
+ this.message = message;
+ }
+
+ public DroolsError getError() {
+ return new SrcError( collectCompilerProblems(),
+ this.message );
+ }
+
+ }
+
+ public static class SrcError extends DroolsError {
+ private Object object;
+ private String message;
+ private int[] errorLines = new int[0];
+
+ public SrcError(Object object, String message) {
+ this.object = object;
+ this.message = message;
+ }
+
+ public Object getObject() {
+ return this.object;
+ }
+
+ public int[] getErrorLines() {
+ return this.errorLines;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public String toString() {
+ final StringBuffer buf = new StringBuffer();
+ buf.append( this.message );
+ buf.append( " : " );
+ buf.append( "\n" );
+ if ( this.object instanceof CompilationProblem[] ) {
+ final CompilationProblem[] problem = (CompilationProblem[]) this.object;
+ for ( int i = 0; i < problem.length; i++ ) {
+ buf.append( "\t" );
+ buf.append( problem[i] );
+ buf.append( "\n" );
+ }
+ } else if ( this.object != null ) {
+ buf.append( this.object );
+ }
+ return buf.toString();
+ }
+
+ }
+
private String ucFirst(final String name) {
return name.toUpperCase().charAt( 0 ) + name.substring( 1 );
}
More information about the jboss-svn-commits
mailing list