From 9672dcb2235e7edcde746d858c76ff64498457db Mon Sep 17 00:00:00 2001 From: sotty Date: Tue, 6 Aug 2013 22:21:43 -0700 Subject: [PATCH] PMML : Initial separation of informer from main PMML module --- .../org/drools/pmml/pmml_4_1/PMML4Compiler.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drools-pmml/src/main/java/org/drools/pmml/pmml_4_1/PMML4Compiler.java b/drools-pmml/src/main/java/org/drools/pmml/pmml_4_1/PMML4Compiler.java index 4b890d6a..19615991 100644 --- a/drools-pmml/src/main/java/org/drools/pmml/pmml_4_1/PMML4Compiler.java +++ b/drools-pmml/src/main/java/org/drools/pmml/pmml_4_1/PMML4Compiler.java @@ -36,6 +36,7 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import java.io.*; +import java.net.URISyntaxException; import java.util.*; import org.dmg.pmml.pmml_4_1.descr.*; @@ -47,8 +48,6 @@ public class PMML4Compiler implements org.drools.compiler.PMMLCompiler { public static final String BASE_PACK = PMML4Compiler.class.getPackage().getName().replace('.','/'); - - public static final String VISITOR_RULES = BASE_PACK + "/pmml_visitor.drl"; public static boolean visitorRules = false; @@ -266,9 +265,13 @@ private static void initVisitor() throws IOException { compilerRules = true; } if ( informerRules == false ) { - Resource res = ResourceFactory.newClassPathResource( INFORMER_RULES ); - if ( res != null && new File( (( ClassPathResource) res).getPath() ).exists() ) { - kBuilder.add( res, ResourceType.DRL ); + Resource res = ResourceFactory.newClassPathResource( INFORMER_RULES, PMML4Compiler.class ); + try { + if ( res != null && new File( (( ClassPathResource) res).getURL().toURI() ).exists() ) { + kBuilder.add( res, ResourceType.DRL ); + } + } catch ( URISyntaxException e ) { + throw new IOException( "Unable to check for informer rules " + e.getMessage() ); } informerRules = true; }