Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: droolsjbpm/drools
...
head fork: droolsjbpm/drools
  • 8 commits
  • 755 files changed
  • 0 commit comments
  • 2 contributors
Showing with 6,907 additions and 10,820 deletions.
  1. +3 −0  .gitignore
  2. +75 −71 ...ompiler/src/main/java/org/drools/compiler/{compiler → builder/impl}/CompositeKnowledgeBuilderImpl.java
  3. +37 −35 ...iler/{compiler/PackageBuilderConfiguration.java → builder/impl/KnowledgeBuilderConfigurationImpl.java}
  4. +9 −10 drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderFactoryServiceImpl.java
  5. +2,074 −59 drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
  6. +2,062 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationBuilder.java
  7. +24 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDefinition.java
  8. +59 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/ErrorHandler.java
  9. +23 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/FunctionErrorHandler.java
  10. +29 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleErrorHandler.java
  11. +15 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/RuleInvokerErrorHandler.java
  12. +48 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/SrcError.java
  13. +17 −0 drools-compiler/src/main/java/org/drools/compiler/builder/impl/errors/SrcErrorHandler.java
  14. +0 −6 drools-compiler/src/main/java/org/drools/compiler/commons/jci/compilers/NativeJavaCompiler.java
  15. +3 −2 drools-compiler/src/main/java/org/drools/compiler/compiler/BPMN2ProcessFactory.java
  16. +2 −1  drools-compiler/src/main/java/org/drools/compiler/compiler/BPMN2ProcessProvider.java
  17. +8 −4 drools-compiler/src/main/java/org/drools/compiler/compiler/DialectConfiguration.java
  18. +1 −3 drools-compiler/src/main/java/org/drools/compiler/compiler/DroolsParserException.java
  19. +0 −1  drools-compiler/src/main/java/org/drools/compiler/compiler/FactTemplateError.java
  20. +0 −1  drools-compiler/src/main/java/org/drools/compiler/compiler/FieldTemplateError.java
  21. +0 −4,360 drools-compiler/src/main/java/org/drools/compiler/compiler/PackageBuilder.java
  22. +15 −16 drools-compiler/src/main/java/org/drools/compiler/compiler/PackageRegistry.java
  23. +3 −2 drools-compiler/src/main/java/org/drools/compiler/compiler/ProcessBuilderFactory.java
  24. +2 −1  drools-compiler/src/main/java/org/drools/compiler/compiler/ProcessBuilderFactoryService.java
  25. +9 −9 drools-compiler/src/main/java/org/drools/compiler/compiler/ProjectJavaCompiler.java
  26. +2 −1  drools-compiler/src/main/java/org/drools/compiler/compiler/ResourceTypeBuilder.java
  27. +0 −73 drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBaseLoader.java
  28. +4 −4 drools-compiler/src/main/java/org/drools/compiler/compiler/RuleBuildError.java
  29. +2 −2 drools-compiler/src/main/java/org/drools/compiler/compiler/io/memory/MemoryFileSystem.java
  30. +2 −2 drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/AbstractKieModule.java
  31. +1 −2  drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieBuilderSetImpl.java
  32. +14 −14 drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieContainerImpl.java
  33. +1 −1  drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieMetaInfoBuilder.java
  34. +16 −17 drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieModuleCacheHelper.java
  35. +0 −9 drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java
  36. +1 −2  drools-compiler/src/main/java/org/drools/compiler/kie/util/CDIHelper.java
  37. +2 −2 drools-compiler/src/main/java/org/drools/compiler/kie/util/ChangeSetBuilder.java
  38. +0 −1  drools-compiler/src/main/java/org/drools/compiler/lang/DRL5Expressions.java
  39. +0 −1  drools-compiler/src/main/java/org/drools/compiler/lang/DRL6Expressions.java
  40. +1 −1  drools-compiler/src/main/java/org/drools/compiler/lang/MVELDumper.java
  41. +1 −3 drools-compiler/src/main/java/org/drools/compiler/lang/ParseException.java
  42. +5 −5 drools-compiler/src/main/java/org/drools/compiler/lang/descr/CompositePackageDescr.java
  43. +1 −2  drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpanderResolver.java
  44. +10 −10 drools-compiler/src/main/java/org/drools/compiler/reteoo/compiled/ObjectTypeNodeCompiler.java
  45. +2 −2 drools-compiler/src/main/java/org/drools/compiler/rule/builder/ConditionalBranchBuilder.java
  46. +2 −2 drools-compiler/src/main/java/org/drools/compiler/rule/builder/FunctionBuilder.java
  47. +2 −3 drools-compiler/src/main/java/org/drools/compiler/rule/builder/GroupElementBuilder.java
  48. +13 −13 drools-compiler/src/main/java/org/drools/compiler/rule/builder/PackageBuildContext.java
  49. +23 −22 drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java
  50. +2 −2 drools-compiler/src/main/java/org/drools/compiler/rule/builder/QueryBuilder.java
  51. +5 −5 drools-compiler/src/main/java/org/drools/compiler/rule/builder/QueryElementBuilder.java
  52. +15 −16 drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java
  53. +10 −11 drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuilder.java
  54. +17 −19 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/DialectUtil.java
  55. +1 −1  drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/asm/ASMConsequenceBuilder.java
  56. +1 −1  drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/asm/AbstractASMEvalBuilder.java
  57. +2 −2 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/asm/InvokerGenerator.java
  58. +3 −3 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaAccumulateBuilder.java
  59. +32 −30 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaDialect.java
  60. +12 −16 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaDialectConfiguration.java
  61. +3 −4 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaFunctionBuilder.java
  62. +5 −5 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaRuleBuilderHelper.java
  63. +2 −2 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilder.java
  64. +4 −4 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
  65. +42 −39 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELDialect.java
  66. +7 −10 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELDialectConfiguration.java
  67. +4 −3 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELEnabledBuilder.java
  68. +1 −1  drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELEvalBuilder.java
  69. +1 −1  drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELExprAnalyzer.java
  70. +1 −1  drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELFromBuilder.java
  71. +1 −1  drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELObjectExpressionBuilder.java
  72. +5 −4 drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELSalienceBuilder.java
  73. +44 −51 drools-compiler/src/main/java/org/drools/compiler/runtime/pipeline/impl/DroolsJaxbHelperProviderImpl.java
  74. +20 −31 drools-compiler/src/main/java/org/drools/compiler/testframework/RuleCoverageListener.java
  75. +25 −34 drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java
  76. +0 −1  drools-compiler/src/main/resources/org/drools/compiler/lang/DRL5Expressions.g
  77. +0 −1  drools-compiler/src/main/resources/org/drools/compiler/lang/DRL6Expressions.g
  78. +2 −2 drools-compiler/src/main/resources/org/drools/compiler/rule/builder/dialect/java/javaInvokers.mvel
  79. +1 −1  drools-compiler/src/main/resources/org/drools/compiler/rule/builder/dialect/java/javaRule.mvel
  80. +6 −79 drools-compiler/src/test/java/org/drools/compiler/CommonTestMethodBase.java
  81. +1 −1  drools-compiler/src/test/java/org/drools/compiler/beliefsystem/abductive/AbductionTest.java
  82. +141 −146 ...t/java/org/drools/compiler/{compiler/PackageBuilderTest.java → builder/impl/KnowledgeBuilderTest.java}
  83. +1 −2  drools-compiler/src/test/java/org/drools/compiler/common/ActivationIteratorTest.java
  84. +3 −5 drools-compiler/src/test/java/org/drools/compiler/common/ActiveActivationsIteratorTest.java
  85. +4 −3 drools-compiler/src/test/java/org/drools/compiler/compiler/CompilerPerfProfileTest.java
  86. +1 −2  drools-compiler/src/test/java/org/drools/compiler/compiler/DrlParserTest.java
  87. +6 −4 drools-compiler/src/test/java/org/drools/compiler/compiler/Java5Test.java
  88. +37 −40 drools-compiler/src/test/java/org/drools/compiler/compiler/PackageBuilderConfigurationTest.java
  89. +6 −8 drools-compiler/src/test/java/org/drools/compiler/compiler/QueryBuilderTest.java
  90. +0 −41 drools-compiler/src/test/java/org/drools/compiler/compiler/RuleBaseLoaderTest.java
  91. +13 −13 drools-compiler/src/test/java/org/drools/compiler/compiler/TypeDeclarationMergingTest.java
  92. +3 −6 drools-compiler/src/test/java/org/drools/compiler/compiler/TypeDeclarationTest.java
  93. +3 −3 drools-compiler/src/test/java/org/drools/compiler/compiler/xml/changeset/ChangeSetTest.java
  94. +2 −2 drools-compiler/src/test/java/org/drools/compiler/compiler/xml/rules/DumperTestHelper.java
  95. +2 −2 drools-compiler/src/test/java/org/drools/compiler/compiler/xml/rules/XmlPackageReaderTest.java
  96. +11 −12 drools-compiler/src/test/java/org/drools/compiler/factmodel/traits/TraitTest.java
  97. +3 −8 drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
  98. +4 −5 drools-compiler/src/test/java/org/drools/compiler/integrationtests/AlphaNetworkModifyTest.java
  99. +2 −3 drools-compiler/src/test/java/org/drools/compiler/integrationtests/BackwardChainingTest.java
  100. +25 −29 drools-compiler/src/test/java/org/drools/compiler/integrationtests/CepEspTest.java
  101. +24 −28 drools-compiler/src/test/java/org/drools/compiler/integrationtests/ConsequenceOffsetTest.java
  102. +7 −6 drools-compiler/src/test/java/org/drools/compiler/integrationtests/DroolsEventListTest.java
  103. +0 −18 drools-compiler/src/test/java/org/drools/compiler/integrationtests/DroolsTest.java
  104. +0 −1  drools-compiler/src/test/java/org/drools/compiler/integrationtests/DynamicRuleRemovalTest.java
  105. +2 −6 drools-compiler/src/test/java/org/drools/compiler/integrationtests/DynamicRulesChangesTest.java
  106. +6 −10 drools-compiler/src/test/java/org/drools/compiler/integrationtests/DynamicRulesTest.java
  107. +88 −112 drools-compiler/src/test/java/org/drools/compiler/integrationtests/ExecutionFlowControlTest.java
  108. +1 −15 drools-compiler/src/test/java/org/drools/compiler/integrationtests/FirstOrderLogicTest.java
  109. +15 −22 drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java
  110. +10 −10 drools-compiler/src/test/java/org/drools/compiler/integrationtests/IndexingTest.java
  111. +10 −27 drools-compiler/src/test/java/org/drools/compiler/integrationtests/KnowledgeBuilderTest.java
  112. +17 −112 drools-compiler/src/test/java/org/drools/compiler/integrationtests/LargeRuleBase.java
  113. +0 −226 drools-compiler/src/test/java/org/drools/compiler/integrationtests/LargeRuleBaseSerializationTest.java
  114. +30 −30 drools-compiler/src/test/java/org/drools/compiler/integrationtests/LinkingTest.java
  115. +51 −124 drools-compiler/src/test/java/org/drools/compiler/integrationtests/MVELTest.java
  116. +11 −12 drools-compiler/src/test/java/org/drools/compiler/integrationtests/Misc2Test.java
  117. +109 −137 drools-compiler/src/test/java/org/drools/compiler/integrationtests/MiscTest.java
  118. +9 −26 drools-compiler/src/test/java/org/drools/compiler/integrationtests/OutOfMemoryTest.java
  119. +0 −141 drools-compiler/src/test/java/org/drools/compiler/integrationtests/PackageBuilderThreadSafetyTest.java
  120. +31 −32 drools-compiler/src/test/java/org/drools/compiler/integrationtests/PropertySpecificTest.java
  121. +26 −30 drools-compiler/src/test/java/org/drools/compiler/integrationtests/QueryTest.java
  122. +11 −11 drools-compiler/src/test/java/org/drools/compiler/integrationtests/RuleMetadataTest.java
  123. +0 −87 drools-compiler/src/test/java/org/drools/compiler/integrationtests/RulebasePartitioningTest.java
  124. +11 −12 drools-compiler/src/test/java/org/drools/compiler/integrationtests/SegmentCreationTest.java
  125. +1 −88 drools-compiler/src/test/java/org/drools/compiler/integrationtests/SerializationHelper.java
  126. +0 −114 drools-compiler/src/test/java/org/drools/compiler/integrationtests/StatefulSessionTest.java
  127. +0 −221 drools-compiler/src/test/java/org/drools/compiler/integrationtests/StatelessSessionTest.java
  128. +6 −24 drools-compiler/src/test/java/org/drools/compiler/integrationtests/StatelessStressTest.java
  129. +2 −3 drools-compiler/src/test/java/org/drools/compiler/integrationtests/StreamsTest.java
  130. +4 −3 drools-compiler/src/test/java/org/drools/compiler/integrationtests/TimerAndCalendarTest.java
  131. +172 −250 drools-compiler/src/test/java/org/drools/compiler/integrationtests/TruthMaintenanceTest.java
  132. +8 −24 drools-compiler/src/test/java/org/drools/compiler/integrationtests/UnlinkingTest.java
  133. +0 −9 drools-compiler/src/test/java/org/drools/compiler/integrationtests/WorkingMemoryLoggerTest.java
  134. +6 −9 drools-compiler/src/test/java/org/drools/compiler/integrationtests/eventgenerator/AbstractEventListener.java
  135. +9 −16 drools-compiler/src/test/java/org/drools/compiler/integrationtests/eventgenerator/SimpleEventGenerator.java
  136. +38 −55 ...ls-compiler/src/test/java/org/drools/compiler/integrationtests/eventgenerator/SimpleEventGeneratorTest.java
  137. +3 −3 drools-compiler/src/test/java/org/drools/compiler/integrationtests/eventgenerator/SimpleEventListener.java
  138. +13 −42 drools-compiler/src/test/java/org/drools/compiler/integrationtests/eventgenerator/example/ExampleScenario.java
  139. +12 −24 drools-compiler/src/test/java/org/drools/compiler/integrationtests/manners/MannersBenchmark.java
  140. +13 −17 drools-compiler/src/test/java/org/drools/compiler/integrationtests/marshalling/FactHandleMarshallingTest.java
  141. +25 −53 drools-compiler/src/test/java/org/drools/compiler/integrationtests/marshalling/MarshallingTest.java
  142. +0 −240 drools-compiler/src/test/java/org/drools/compiler/integrationtests/marshalling/WorkItemMarshallingTest.java
  143. +0 −11 drools-compiler/src/test/java/org/drools/compiler/integrationtests/sequential/SequentialTest.java
  144. +0 −7 drools-compiler/src/test/java/org/drools/compiler/integrationtests/waltz/ReteOOWaltzTest.java
  145. +0 −46 drools-compiler/src/test/java/org/drools/compiler/integrationtests/waltz/Waltz.java
  146. +2 −1  drools-compiler/src/test/java/org/drools/compiler/kproject/AbstractKnowledgeTest.java
  147. +1 −2  drools-compiler/src/test/java/org/drools/compiler/kproject/KieProjectRuntimeModulesTest.java
  148. +1 −2  drools-compiler/src/test/java/org/drools/compiler/lang/api/DescrBuilderTest.java
  149. +12 −21 drools-compiler/src/test/java/org/drools/compiler/phreak/AddRuleTest.java
  150. +2 −2 drools-compiler/src/test/java/org/drools/compiler/phreak/BetaNodeBuilder.java
  151. +12 −9 drools-compiler/src/test/java/org/drools/compiler/phreak/PhreakJoinNodeTest.java
  152. +11 −8 drools-compiler/src/test/java/org/drools/compiler/phreak/PhreakNotNodeTest.java
  153. +16 −19 drools-compiler/src/test/java/org/drools/compiler/phreak/RemoveRuleTest.java
  154. +14 −13 drools-compiler/src/test/java/org/drools/compiler/phreak/ScenarioTest.java
  155. +12 −9 drools-compiler/src/test/java/org/drools/compiler/phreak/SegmentPropagationTest.java
  156. +1 −9 drools-compiler/src/test/java/org/drools/compiler/reteoo/MockLeftTupleSink.java
  157. +10 −9 drools-compiler/src/test/java/org/drools/compiler/reteoo/ReteooBuilderPerformanceTest.java
  158. +17 −18 drools-compiler/src/test/java/org/drools/compiler/reteoo/ReteooBuilderTest.java
  159. +4 −21 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/JavaAndMVELCombinedTest.java
  160. +6 −6 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/java/JavaAccumulateBuilderTest.java
  161. +40 −40 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/java/JavaConsequenceBuilderTest.java
  162. +7 −6 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/java/JavaDialectBinaryEqualityTest.java
  163. +2 −3 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/java/JavaDialectTest.java
  164. +32 −35 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/java/RuleBuilderTest.java
  165. +4 −4 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/InstrumentedBuildContent.java
  166. +3 −3 ...piler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/InstrumentedDeclarationScopeResolver.java
  167. +21 −19 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java
  168. +50 −56 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
  169. +5 −5 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/MVELDebugTest.java
  170. +16 −20 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
  171. +16 −13 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
  172. +19 −15 drools-compiler/src/test/java/org/drools/compiler/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
  173. +1 −1  drools-compiler/src/test/java/org/drools/compiler/testframework/MockFactHandle.java
  174. +0 −163 drools-compiler/src/test/java/org/drools/compiler/testframework/MockRuleBase.java
  175. +55 −61 drools-compiler/src/test/java/org/drools/compiler/testframework/MockWorkingMemory.java
  176. +19 −23 drools-compiler/src/test/java/org/drools/compiler/testframework/RuleCoverageListenerTest.java
  177. +3 −2 drools-compiler/src/test/java/org/drools/compiler/util/debug/SessionInspectorTest.java
  178. 0  drools-compiler/src/test/resources/org/drools/compiler/{compiler → builder/impl}/bad_rule.drl
  179. +3 −2 drools-compiler/src/test/resources/org/drools/compiler/integrationtests/ruleflowgroup2.drl
  180. +2 −2 drools-compiler/src/test/resources/org/drools/compiler/integrationtests/test_EntryPointReference.drl
  181. +0 −18 drools-compiler/src/test/resources/org/drools/compiler/integrationtests/test_rulebasePartitions1.drl
  182. +1 −1  drools-compiler/src/test/resources/org/drools/compiler/integrationtests/test_salienceExpressionRule.drl
  183. +1 −1  drools-compiler/src/test/resources/org/drools/compiler/integrationtests/test_salienceIntegerRule.drl
  184. +1 −1  drools-compiler/src/test/resources/org/drools/compiler/util/debug/customreports.mvel
  185. +2 −2 drools-core/src/main/java/org/drools/core/ActivationListenerFactory.java
  186. +0 −150 drools-core/src/main/java/org/drools/core/Agenda.java
  187. +0 −64 drools-core/src/main/java/org/drools/core/CheckedDroolsException.java
  188. +0 −54 drools-core/src/main/java/org/drools/core/FactException.java
  189. +0 −23 drools-core/src/main/java/org/drools/core/FactHandle.java
  190. +0 −50 drools-core/src/main/java/org/drools/core/IntegrationException.java
  191. +0 −27 drools-core/src/main/java/org/drools/core/Otherwise.java
  192. +0 −81 drools-core/src/main/java/org/drools/core/PackageIntegrationException.java
  193. +0 −73 drools-core/src/main/java/org/drools/core/ProcessIntegrationException.java
  194. +2 −2 drools-core/src/main/java/org/drools/core/QueryActivationListenerFactory.java
  195. +58 −29 drools-core/src/main/java/org/drools/core/{QueryResults.java → QueryResultsImpl.java}
  196. +8 −11 drools-core/src/main/java/org/drools/core/{QueryResult.java → QueryResultsRowImpl.java}
  197. +2 −2 drools-core/src/main/java/org/drools/core/RuleActivationListenerFactory.java
  198. +0 −179 drools-core/src/main/java/org/drools/core/RuleBase.java
  199. +2 −2 drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java
  200. +0 −50 drools-core/src/main/java/org/drools/core/RuleBaseEventManager.java
  201. +0 −94 drools-core/src/main/java/org/drools/core/RuleBaseFactory.java
  202. +0 −73 drools-core/src/main/java/org/drools/core/RuleIntegrationException.java
  203. +0 −60 drools-core/src/main/java/org/drools/core/RuntimeDroolsException.java
  204. +0 −65 drools-core/src/main/java/org/drools/core/StatefulSession.java
  205. +0 −102 drools-core/src/main/java/org/drools/core/StatelessSession.java
  206. +0 −88 drools-core/src/main/java/org/drools/core/StatelessSessionResult.java
  207. +1 −1  drools-core/src/main/java/org/drools/core/WorkItemHandlerNotFoundException.java
  208. +11 −20 drools-core/src/main/java/org/drools/core/WorkingMemory.java
  209. +9 −18 drools-core/src/main/java/org/drools/core/WorkingMemoryEntryPoint.java
  210. +9 −7 drools-core/src/main/java/org/drools/core/WorkingMemoryEventManager.java
  211. +4 −1 drools-core/src/main/java/org/drools/core/audit/WorkingMemoryFileLogger.java
  212. +150 −200 drools-core/src/main/java/org/drools/core/audit/WorkingMemoryLogger.java
  213. +1 −2  drools-core/src/main/java/org/drools/core/base/BaseClassFieldWriter.java
  214. +2 −3 drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorCache.java
  215. +10 −34 drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java
  216. +1 −25 drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorStore.java
  217. +1 −3 drools-core/src/main/java/org/drools/core/base/ClassTypeResolver.java
  218. +1 −2  drools-core/src/main/java/org/drools/core/base/CopyIdentifiersGlobalExporter.java
  219. +16 −23 drools-core/src/main/java/org/drools/core/base/DefaultKnowledgeHelper.java
  220. +0 −149 drools-core/src/main/java/org/drools/core/base/DelegateJavaFactHandler.java
  221. +4 −4 drools-core/src/main/java/org/drools/core/base/DroolsQuery.java
  222. +2 −2 drools-core/src/main/java/org/drools/core/base/EnabledBoolean.java
  223. +0 −57 drools-core/src/main/java/org/drools/core/base/FireAllRulesRuleBaseUpdateListener.java
  224. +4 −4 drools-core/src/main/java/org/drools/core/base/InternalViewChangedEventListener.java
  225. +2 −2 drools-core/src/main/java/org/drools/core/base/JavaFactRegistryEntry.java
  226. +1 −3 drools-core/src/main/java/org/drools/core/base/ModifyInterceptor.java
  227. +4 −4 drools-core/src/main/java/org/drools/core/base/NonCloningQueryViewListener.java
  228. +2 −10 drools-core/src/main/java/org/drools/core/base/RuleNameEndsWithAgendaFilter.java
  229. +2 −10 drools-core/src/main/java/org/drools/core/base/RuleNameEqualsAgendaFilter.java
  230. +2 −11 drools-core/src/main/java/org/drools/core/base/RuleNameMatchesAgendaFilter.java
  231. +2 −10 drools-core/src/main/java/org/drools/core/base/RuleNameStartsWithAgendaFilter.java
  232. +6 −11 drools-core/src/main/java/org/drools/core/base/SequentialKnowledgeHelper.java
  233. +0 −26 drools-core/src/main/java/org/drools/core/base/ShadowProxy.java
  234. +4 −4 drools-core/src/main/java/org/drools/core/base/StandardQueryViewChangedEventListener.java
  235. +1 −3 drools-core/src/main/java/org/drools/core/base/UndefinedCalendarExcption.java
  236. +2 −3 drools-core/src/main/java/org/drools/core/base/evaluators/AfterEvaluatorDefinition.java
  237. +2 −3 drools-core/src/main/java/org/drools/core/base/evaluators/BeforeEvaluatorDefinition.java
  238. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/CoincidesEvaluatorDefinition.java
  239. +2 −3 drools-core/src/main/java/org/drools/core/base/evaluators/DuringEvaluatorDefinition.java
  240. +6 −7 drools-core/src/main/java/org/drools/core/base/evaluators/EvaluatorRegistry.java
  241. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/FinishedByEvaluatorDefinition.java
  242. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/FinishesEvaluatorDefinition.java
  243. +2 −3 drools-core/src/main/java/org/drools/core/base/evaluators/IncludesEvaluatorDefinition.java
  244. +11 −8 drools-core/src/main/java/org/drools/core/base/evaluators/IsAEvaluatorDefinition.java
  245. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/MeetsEvaluatorDefinition.java
  246. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/MetByEvaluatorDefinition.java
  247. +2 −3 drools-core/src/main/java/org/drools/core/base/evaluators/OverlappedByEvaluatorDefinition.java
  248. +2 −3 drools-core/src/main/java/org/drools/core/base/evaluators/OverlapsEvaluatorDefinition.java
  249. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/StartedByEvaluatorDefinition.java
  250. +3 −4 drools-core/src/main/java/org/drools/core/base/evaluators/StartsEvaluatorDefinition.java
  251. +1 −7 drools-core/src/main/java/org/drools/core/base/evaluators/TimeIntervalParser.java
  252. +2 −3 drools-core/src/main/java/org/drools/core/base/extractors/ArrayElementReader.java
  253. +9 −10 drools-core/src/main/java/org/drools/core/base/extractors/BaseBooleanClassFieldReader.java
  254. +9 −10 drools-core/src/main/java/org/drools/core/base/extractors/BaseBooleanClassFieldWriter.java
  255. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseByteClassFieldReader.java
  256. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseByteClassFieldWriter.java
  257. +3 −4 drools-core/src/main/java/org/drools/core/base/extractors/BaseCharClassFieldReader.java
  258. +3 −4 drools-core/src/main/java/org/drools/core/base/extractors/BaseCharClassFieldWriter.java
  259. +3 −4 drools-core/src/main/java/org/drools/core/base/extractors/BaseDateClassFieldReader.java
  260. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseDoubleClassFieldReader.java
  261. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseDoubleClassFieldWriter.java
  262. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseFloatClassFieldReader.java
  263. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseFloatClassFieldWriter.java
  264. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseIntClassFieldReader.java
  265. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseIntClassFieldWriter.java
  266. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseLongClassFieldReader.java
  267. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseLongClassFieldWriter.java
  268. +3 −4 drools-core/src/main/java/org/drools/core/base/extractors/BaseNumberClassFieldReader.java
  269. +10 −11 drools-core/src/main/java/org/drools/core/base/extractors/BaseObjectClassFieldReader.java
  270. +2 −3 drools-core/src/main/java/org/drools/core/base/extractors/BaseObjectClassFieldWriter.java
  271. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseShortClassFieldReader.java
  272. +4 −5 drools-core/src/main/java/org/drools/core/base/extractors/BaseShortClassFieldWriter.java
  273. +9 −10 drools-core/src/main/java/org/drools/core/base/field/BooleanFieldImpl.java
  274. +4 −5 drools-core/src/main/java/org/drools/core/base/field/ClassFieldImpl.java
  275. +1 −2  drools-core/src/main/java/org/drools/core/base/field/DoubleFieldImpl.java
  276. +1 −2  drools-core/src/main/java/org/drools/core/base/field/LongFieldImpl.java
  277. +9 −10 drools-core/src/main/java/org/drools/core/base/field/ObjectFieldImpl.java
  278. +3 −3 drools-core/src/main/java/org/drools/core/base/mvel/MVELAccumulator.java
  279. +2 −3 drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
  280. +2 −2 drools-core/src/main/java/org/drools/core/base/mvel/MVELConsequence.java
  281. +4 −4 drools-core/src/main/java/org/drools/core/base/mvel/MVELEnabledExpression.java
  282. +2 −2 drools-core/src/main/java/org/drools/core/base/mvel/MVELEvalExpression.java
  283. +2 −2 drools-core/src/main/java/org/drools/core/base/mvel/MVELObjectExpression.java
  284. +2 −2 drools-core/src/main/java/org/drools/core/base/mvel/MVELPredicateExpression.java
  285. +3 −4 drools-core/src/main/java/org/drools/core/base/mvel/MVELReturnValueExpression.java
  286. +2 −2 drools-core/src/main/java/org/drools/core/base/mvel/MVELSalienceExpression.java
  287. +3 −3 drools-core/src/main/java/org/drools/core/beliefsystem/defeasible/DefeasibleBeliefSet.java
  288. +0 −1  drools-core/src/main/java/org/drools/core/beliefsystem/defeasible/DefeasibleBeliefSystem.java
  289. +3 −3 drools-core/src/main/java/org/drools/core/beliefsystem/jtms/JTMSBeliefSystem.java
  290. +1 −2  drools-core/src/main/java/org/drools/core/beliefsystem/simple/BeliefSystemLogicalCallback.java
  291. +1 −1  drools-core/src/main/java/org/drools/core/command/SetVariableCommandFromLastReturn.java
  292. +2 −2 drools-core/src/main/java/org/drools/core/command/impl/CommandBasedStatefulKnowledgeSession.java
  293. +1 −1  drools-core/src/main/java/org/drools/core/command/runtime/GetGlobalCommand.java
  294. +1 −1  drools-core/src/main/java/org/drools/core/command/runtime/SetGlobalCommand.java
  295. +1 −1  drools-core/src/main/java/org/drools/core/command/runtime/rule/ClearRuleFlowGroupCommand.java
  296. +3 −3 drools-core/src/main/java/org/drools/core/command/runtime/rule/FireAllRulesCommand.java
  297. +3 −4 drools-core/src/main/java/org/drools/core/command/runtime/rule/FireUntilHaltCommand.java
  298. +1 −1  drools-core/src/main/java/org/drools/core/command/runtime/rule/GetObjectCommand.java
  299. +1 −1  drools-core/src/main/java/org/drools/core/command/runtime/rule/GetObjectInEntryPointCommand.java
  300. +3 −4 drools-core/src/main/java/org/drools/core/command/runtime/rule/GetObjectsCommand.java
Sorry, we could not display the entire diff because too many files (755) changed.
3  .gitignore
View
@@ -14,3 +14,6 @@
# generated files
dependency-reduced-pom.xml
+
+# these modules don't exist anymore on master
+/drools-clips/
146 ...piler/compiler/CompositeKnowledgeBuilderImpl.java → ...r/builder/impl/CompositeKnowledgeBuilderImpl.java
View
@@ -1,12 +1,8 @@
-package org.drools.compiler.compiler;
+package org.drools.compiler.builder.impl;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.drools.compiler.compiler.PackageBuilder.TypeDefinition;
+import org.drools.compiler.builder.impl.TypeDefinition;
+import org.drools.compiler.compiler.BPMN2ProcessFactory;
+import org.drools.compiler.compiler.PackageRegistry;
import org.drools.compiler.lang.descr.CompositePackageDescr;
import org.drools.compiler.lang.descr.ImportDescr;
import org.drools.compiler.lang.descr.PackageDescr;
@@ -20,9 +16,17 @@
import org.kie.internal.builder.ResourceChange;
import org.kie.internal.builder.ResourceChangeSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.drools.core.util.StringUtils.isEmpty;
+
public class CompositeKnowledgeBuilderImpl implements CompositeKnowledgeBuilder {
- private final PackageBuilder pkgBuilder;
+ private final KnowledgeBuilderImpl kBuilder;
private final Map<ResourceType, List<ResourceDescr>> resourcesByType = new HashMap<ResourceType, List<ResourceDescr>>();
@@ -30,8 +34,8 @@
public ResourceType currentType = null;
- public CompositeKnowledgeBuilderImpl(PackageBuilder pkgBuilder) {
- this.pkgBuilder = pkgBuilder;
+ public CompositeKnowledgeBuilderImpl(KnowledgeBuilderImpl kBuilder) {
+ this.kBuilder = kBuilder;
}
public CompositeKnowledgeBuilder type(ResourceType type) {
@@ -81,7 +85,7 @@ public CompositeKnowledgeBuilder add(Resource resource, ResourceType type, Resou
public void build() {
buildException = null;
- pkgBuilder.registerBuildResources(getResources());
+ kBuilder.registerBuildResources(getResources());
registerDSL();
buildResources();
buildPackages();
@@ -104,9 +108,9 @@ private void registerDSL() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addDsl(resourceDescr.resource);
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addDsl(resourceDescr.resource);
+ kBuilder.setAssetFilter(null);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -125,8 +129,8 @@ private void buildResources() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addProcessFromXml(resourceDescr.resource);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addProcessFromXml(resourceDescr.resource);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -136,7 +140,7 @@ private void buildResources() {
buildException = new RuntimeException( e );
}
} finally{
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(null);
}
}
}
@@ -145,9 +149,9 @@ private void buildResources() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- BPMN2ProcessFactory.configurePackageBuilder( pkgBuilder );
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addProcessFromXml(resourceDescr.resource);
+ BPMN2ProcessFactory.configurePackageBuilder(kBuilder);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addProcessFromXml(resourceDescr.resource);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -157,7 +161,7 @@ private void buildResources() {
buildException = new RuntimeException( e );
}
} finally{
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(null);
}
}
}
@@ -166,8 +170,8 @@ private void buildResources() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addPackageFromInputStream(resourceDescr.resource);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addPackageFromInputStream(resourceDescr.resource);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -177,7 +181,7 @@ private void buildResources() {
buildException = new RuntimeException( e );
}
} finally{
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(null);
}
}
}
@@ -186,8 +190,8 @@ private void buildResources() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addPackageFromChangeSet(resourceDescr.resource);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addPackageFromChangeSet(resourceDescr.resource);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -197,7 +201,7 @@ private void buildResources() {
buildException = new RuntimeException( e );
}
} finally{
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(null);
}
}
}
@@ -206,8 +210,8 @@ private void buildResources() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addPackageFromXSD(resourceDescr.resource, (JaxbConfigurationImpl) resourceDescr.configuration);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addPackageFromXSD(resourceDescr.resource, (JaxbConfigurationImpl) resourceDescr.configuration);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -217,7 +221,7 @@ private void buildResources() {
buildException = new RuntimeException( e );
}
} finally{
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(null);
}
}
}
@@ -226,8 +230,8 @@ private void buildResources() {
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addPackageFromPMML(resourceDescr.resource, ResourceType.PMML, resourceDescr.configuration);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addPackageFromPMML(resourceDescr.resource, ResourceType.PMML, resourceDescr.configuration);
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -237,7 +241,7 @@ private void buildResources() {
buildException = new RuntimeException( e );
}
} finally{
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(null);
}
}
}
@@ -247,9 +251,9 @@ private void buildOthers() {
try {
for (Map.Entry<ResourceType, List<ResourceDescr>> entry : resourcesByType.entrySet()) {
for (ResourceDescr resourceDescr : entry.getValue()) {
- pkgBuilder.setAssetFilter(resourceDescr.getFilter());
- pkgBuilder.addPackageForExternalType(resourceDescr.resource, entry.getKey(), resourceDescr.configuration);
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(resourceDescr.getFilter());
+ kBuilder.addPackageForExternalType(resourceDescr.resource, entry.getKey(), resourceDescr.configuration);
+ kBuilder.setAssetFilter(null);
}
}
} catch (RuntimeException e) {
@@ -261,58 +265,58 @@ private void buildOthers() {
private void buildOtherDeclarations(Collection<CompositePackageDescr> packages) {
for (CompositePackageDescr packageDescr : packages) {
- pkgBuilder.setAssetFilter(packageDescr.getFilter());
- PackageRegistry pkgRegistry = pkgBuilder.getPackageRegistry(packageDescr.getNamespace());
- pkgBuilder.processOtherDeclarations(pkgRegistry, packageDescr);
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(packageDescr.getFilter());
+ PackageRegistry pkgRegistry = kBuilder.getPackageRegistry(packageDescr.getNamespace());
+ kBuilder.processOtherDeclarations(pkgRegistry, packageDescr);
+ kBuilder.setAssetFilter(null);
}
}
private void buildRules(Collection<CompositePackageDescr> packages) {
for (CompositePackageDescr packageDescr : packages) {
- pkgBuilder.setAssetFilter(packageDescr.getFilter());
- PackageRegistry pkgRegistry = pkgBuilder.getPackageRegistry(packageDescr.getNamespace());
- pkgBuilder.compileAllRules(packageDescr, pkgRegistry);
- pkgBuilder.setAssetFilter(null);
+ kBuilder.setAssetFilter(packageDescr.getFilter());
+ PackageRegistry pkgRegistry = kBuilder.getPackageRegistry(packageDescr.getNamespace());
+ kBuilder.compileAllRules(packageDescr, pkgRegistry);
+ kBuilder.setAssetFilter(null);
}
}
private void buildTypeDeclarations(Collection<CompositePackageDescr> packages) {
for (CompositePackageDescr packageDescr : packages) {
for (TypeDeclarationDescr typeDeclarationDescr : packageDescr.getTypeDeclarations()) {
- if (pkgBuilder.isEmpty( typeDeclarationDescr.getNamespace() )) {
+ if (isEmpty( typeDeclarationDescr.getNamespace() )) {
typeDeclarationDescr.setNamespace( packageDescr.getNamespace() ); // set the default namespace
}
- pkgBuilder.registerGeneratedType(typeDeclarationDescr);
+ kBuilder.getTypeBuilder().registerGeneratedType(typeDeclarationDescr);
}
}
- List<PackageBuilder.TypeDefinition> unresolvedTypes = new ArrayList<PackageBuilder.TypeDefinition>();
+ List<TypeDefinition> unresolvedTypes = new ArrayList<TypeDefinition>();
for (CompositePackageDescr packageDescr : packages) {
buildTypeDeclarations(packageDescr, unresolvedTypes);
}
- for (PackageBuilder.TypeDefinition unresolvedType : unresolvedTypes) {
- pkgBuilder.processUnresolvedType(pkgBuilder.getPackageRegistry(unresolvedType.getNamespace()), unresolvedType);
+ for (TypeDefinition unresolvedType : unresolvedTypes) {
+ kBuilder.getTypeBuilder().processUnresolvedType(kBuilder.getPackageRegistry(unresolvedType.getNamespace()), unresolvedType);
}
for (CompositePackageDescr packageDescr : packages) {
for (ImportDescr importDescr : packageDescr.getImports()) {
- pkgBuilder.getPackageRegistry(packageDescr.getNamespace()).addImport( importDescr );
+ kBuilder.getPackageRegistry(packageDescr.getNamespace()).addImport( importDescr );
}
}
}
- private List<PackageBuilder.TypeDefinition> buildTypeDeclarations(CompositePackageDescr packageDescr, List<PackageBuilder.TypeDefinition> unresolvedTypes) {
- pkgBuilder.setAssetFilter(packageDescr.getFilter());
- PackageRegistry pkgRegistry = pkgBuilder.createPackageRegistry(packageDescr);
+ private List<TypeDefinition> buildTypeDeclarations(CompositePackageDescr packageDescr, List<TypeDefinition> unresolvedTypes) {
+ kBuilder.setAssetFilter(packageDescr.getFilter());
+ PackageRegistry pkgRegistry = kBuilder.createPackageRegistry(packageDescr);
if (pkgRegistry == null) {
return null;
}
- pkgBuilder.processEntryPointDeclarations(pkgRegistry, packageDescr);
- List<TypeDefinition> processTypeDeclarations = pkgBuilder.processTypeDeclarations(pkgRegistry, packageDescr, unresolvedTypes);
- pkgBuilder.setAssetFilter(null);
+ kBuilder.processEntryPointDeclarations(pkgRegistry, packageDescr);
+ List<TypeDefinition> processTypeDeclarations = kBuilder.getTypeBuilder().processTypeDeclarations(pkgRegistry, packageDescr, unresolvedTypes);
+ kBuilder.setAssetFilter(null);
return processTypeDeclarations;
}
@@ -335,7 +339,7 @@ private void buildResource(Map<String, CompositePackageDescr> packages, Resource
if (resourcesByType != null) {
for (ResourceDescr resourceDescr : resourcesByType) {
try {
- registerPackageDescr(resourceDescr, packages, resourceDescr.resource, mapper.map(pkgBuilder, resourceDescr));
+ registerPackageDescr(resourceDescr, packages, resourceDescr.resource, mapper.map(kBuilder, resourceDescr));
} catch (RuntimeException e) {
if (buildException == null) {
buildException = e;
@@ -382,11 +386,11 @@ private ResourceDescr(ResourceConfiguration configuration, Resource resource, Re
}
}
- public PackageBuilder.AssetFilter getFilter() {
+ public KnowledgeBuilderImpl.AssetFilter getFilter() {
return changeMap == null ? null : this.new ChangeSetAssetFilter();
}
- private class ChangeSetAssetFilter implements PackageBuilder.AssetFilter {
+ private class ChangeSetAssetFilter implements KnowledgeBuilderImpl.AssetFilter {
@Override
public Action accept(String pkgName, String assetName) {
ResourceChange change = changeMap.get(assetName);
@@ -405,36 +409,36 @@ public Action accept(String pkgName, String assetName) {
}
private interface ResourceToPkgDescrMapper {
- PackageDescr map(PackageBuilder pkgBuilder, ResourceDescr resourceDescr) throws Exception;
+ PackageDescr map(KnowledgeBuilderImpl kBuilder, ResourceDescr resourceDescr) throws Exception;
}
private static final ResourceToPkgDescrMapper DRL_TO_PKG_DESCR = new ResourceToPkgDescrMapper() {
- public PackageDescr map(PackageBuilder pkgBuilder, ResourceDescr resourceDescr) throws Exception {
- return pkgBuilder.drlToPackageDescr(resourceDescr.resource);
+ public PackageDescr map(KnowledgeBuilderImpl kBuilder, ResourceDescr resourceDescr) throws Exception {
+ return kBuilder.drlToPackageDescr(resourceDescr.resource);
}
};
private static final ResourceToPkgDescrMapper DSLR_TO_PKG_DESCR = new ResourceToPkgDescrMapper() {
- public PackageDescr map(PackageBuilder pkgBuilder, ResourceDescr resourceDescr) throws Exception {
- return pkgBuilder.dslrToPackageDescr(resourceDescr.resource);
+ public PackageDescr map(KnowledgeBuilderImpl kBuilder, ResourceDescr resourceDescr) throws Exception {
+ return kBuilder.dslrToPackageDescr(resourceDescr.resource);
}
};
private static final ResourceToPkgDescrMapper XML_TO_PKG_DESCR = new ResourceToPkgDescrMapper() {
- public PackageDescr map(PackageBuilder pkgBuilder, ResourceDescr resourceDescr) throws Exception {
- return pkgBuilder.xmlToPackageDescr(resourceDescr.resource);
+ public PackageDescr map(KnowledgeBuilderImpl kBuilder, ResourceDescr resourceDescr) throws Exception {
+ return kBuilder.xmlToPackageDescr(resourceDescr.resource);
}
};
private static final ResourceToPkgDescrMapper DTABLE_TO_PKG_DESCR = new ResourceToPkgDescrMapper() {
- public PackageDescr map(PackageBuilder pkgBuilder, ResourceDescr resourceDescr) throws Exception {
- return pkgBuilder.decisionTableToPackageDescr(resourceDescr.resource, resourceDescr.configuration);
+ public PackageDescr map(KnowledgeBuilderImpl kBuilder, ResourceDescr resourceDescr) throws Exception {
+ return kBuilder.decisionTableToPackageDescr(resourceDescr.resource, resourceDescr.configuration);
}
};
private static final ResourceToPkgDescrMapper SCARD_TO_PKG_DESCR = new ResourceToPkgDescrMapper() {
- public PackageDescr map(PackageBuilder pkgBuilder, ResourceDescr resourceDescr) throws Exception {
- return pkgBuilder.scoreCardToPackageDescr(resourceDescr.resource, resourceDescr.configuration);
+ public PackageDescr map(KnowledgeBuilderImpl kBuilder, ResourceDescr resourceDescr) throws Exception {
+ return kBuilder.scoreCardToPackageDescr(resourceDescr.resource, resourceDescr.configuration);
}
};
}
72 ...ompiler/compiler/PackageBuilderConfiguration.java → ...ilder/impl/KnowledgeBuilderConfigurationImpl.java
View
@@ -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;
}
19 drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderFactoryServiceImpl.java
View
@@ -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 );
}
}
2,133 drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
View
@@ -1,113 +1,2128 @@
package org.drools.compiler.builder.impl;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl;
+import org.drools.compiler.compiler.BPMN2ProcessFactory;
+import org.drools.compiler.compiler.BaseKnowledgeBuilderResultImpl;
+import org.drools.compiler.compiler.ConfigurableSeverityResult;
+import org.drools.compiler.compiler.DecisionTableFactory;
+import org.drools.compiler.compiler.DeprecatedResourceTypeWarning;
+import org.drools.compiler.compiler.Dialect;
+import org.drools.compiler.compiler.DialectCompiletimeRegistry;
+import org.drools.compiler.compiler.DrlParser;
+import org.drools.compiler.compiler.DroolsError;
+import org.drools.compiler.compiler.DroolsErrorWrapper;
+import org.drools.compiler.compiler.DroolsParserException;
import org.drools.compiler.compiler.DroolsWarning;
-import org.drools.compiler.compiler.PackageBuilder;
-import org.drools.core.definitions.impl.KnowledgePackageImp;
+import org.drools.compiler.compiler.DroolsWarningWrapper;
+import org.drools.compiler.compiler.DuplicateFunction;
+import org.drools.compiler.compiler.DuplicateRule;
+import org.drools.compiler.compiler.GlobalError;
+import org.drools.compiler.compiler.PMMLCompiler;
+import org.drools.compiler.compiler.PMMLCompilerFactory;
+import org.drools.compiler.compiler.PackageBuilderErrors;
+import org.drools.compiler.compiler.PackageBuilderResults;
+import org.drools.compiler.compiler.PackageRegistry;
+import org.drools.compiler.compiler.ParserError;
+import org.drools.compiler.compiler.ProcessBuilder;
+import org.drools.compiler.compiler.ProcessBuilderFactory;
+import org.drools.compiler.compiler.ProcessLoadError;
+import org.drools.compiler.compiler.ResourceTypeBuilder;
+import org.drools.compiler.compiler.ResourceTypeBuilderRegistry;
+import org.drools.compiler.compiler.ResourceTypeDeclarationWarning;
+import org.drools.compiler.compiler.RuleBuildError;
+import org.drools.compiler.compiler.ScoreCardFactory;
+import org.drools.compiler.compiler.xml.XmlPackageReader;
+import org.drools.compiler.lang.ExpanderException;
+import org.drools.compiler.lang.descr.AccumulateImportDescr;
+import org.drools.compiler.lang.descr.AttributeDescr;
+import org.drools.compiler.lang.descr.EntryPointDeclarationDescr;
+import org.drools.compiler.lang.descr.FunctionDescr;
+import org.drools.compiler.lang.descr.FunctionImportDescr;
+import org.drools.compiler.lang.descr.GlobalDescr;
+import org.drools.compiler.lang.descr.ImportDescr;
+import org.drools.compiler.lang.descr.PackageDescr;
+import org.drools.compiler.lang.descr.RuleDescr;
+import org.drools.compiler.lang.descr.WindowDeclarationDescr;
+import org.drools.compiler.lang.dsl.DSLMappingFile;
+import org.drools.compiler.lang.dsl.DSLTokenizedMappingFile;
+import org.drools.compiler.lang.dsl.DefaultExpander;
+import org.drools.compiler.rule.builder.RuleBuildContext;
+import org.drools.compiler.rule.builder.RuleBuilder;
+import org.drools.compiler.rule.builder.RuleConditionBuilder;
+import org.drools.compiler.rule.builder.dialect.DialectError;
+import org.drools.compiler.runtime.pipeline.impl.DroolsJaxbHelperProviderImpl;
+import org.drools.core.base.ClassFieldAccessorCache;
+import org.drools.core.builder.conf.impl.JaxbConfigurationImpl;
+import org.drools.core.common.ProjectClassLoader;
+import org.drools.core.definitions.InternalKnowledgePackage;
+import org.drools.core.definitions.impl.KnowledgePackageImpl;
+import org.drools.core.definitions.rule.impl.RuleImpl;
+import org.drools.core.impl.InternalKnowledgeBase;
import org.drools.core.io.impl.BaseResource;
-import org.drools.core.rule.Package;
+import org.drools.core.io.impl.ClassPathResource;
+import org.drools.core.io.impl.DescrResource;
+import org.drools.core.io.impl.ReaderResource;
+import org.drools.core.io.internal.InternalResource;
+import org.drools.core.rule.Function;
+import org.drools.core.rule.ImportDeclaration;
+import org.drools.core.rule.JavaDialectRuntimeData;
+import org.drools.core.rule.Pattern;
+import org.drools.core.rule.TypeDeclaration;
+import org.drools.core.rule.WindowDeclaration;
+import org.drools.core.type.DateFormats;
+import org.drools.core.type.DateFormatsImpl;
+import org.drools.core.util.DroolsStreamUtils;
+import org.drools.core.util.StringUtils;
+import org.drools.core.xml.XmlChangeSetReader;
+import org.kie.api.definition.process.Process;
+import org.kie.api.io.Resource;
+import org.kie.api.io.ResourceConfiguration;
+import org.kie.api.io.ResourceType;
+import org.kie.api.runtime.rule.AccumulateFunction;
+import org.kie.internal.ChangeSet;
import org.kie.internal.KnowledgeBase;
import org.kie.internal.KnowledgeBaseFactory;
import org.kie.internal.builder.CompositeKnowledgeBuilder;
+import org.kie.internal.builder.DecisionTableConfiguration;
import org.kie.internal.builder.KnowledgeBuilder;
import org.kie.internal.builder.KnowledgeBuilderError;
import org.kie.internal.builder.KnowledgeBuilderErrors;
+import org.kie.internal.builder.KnowledgeBuilderResult;
import org.kie.internal.builder.KnowledgeBuilderResults;
import org.kie.internal.builder.ResultSeverity;
+import org.kie.internal.builder.ScoreCardConfiguration;
import org.kie.internal.definition.KnowledgePackage;
-import org.kie.api.io.Resource;
-import org.kie.api.io.ResourceConfiguration;
-import org.kie.api.io.ResourceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+
+import static org.drools.core.util.ClassUtils.convertClassToResourcePath;
+import static org.drools.core.util.StringUtils.isEmpty;
public class KnowledgeBuilderImpl implements KnowledgeBuilder {
protected static transient Logger logger = LoggerFactory.getLogger(KnowledgeBuilderImpl.class);
- private PackageBuilder pkgBuilder;
+ private final Map<String, PackageRegistry> pkgRegistryMap;
+
+ private List<KnowledgeBuilderResult> results;
+
+ private final KnowledgeBuilderConfigurationImpl configuration;
+
+ public static final RuleBuilder ruleBuilder = new RuleBuilder();
+
+ /**
+ * Optional RuleBase for incremental live building
+ */
+ private InternalKnowledgeBase kBase;
+
+ /**
+ * default dialect
+ */
+ private final String defaultDialect;
+
+ private ClassLoader rootClassLoader;
+
+ private final Map<String, Class<?>> globals = new HashMap<String, Class<?>>();
+
+ private Resource resource;
+
+ private List<DSLTokenizedMappingFile> dslFiles;
+
+ protected DateFormats dateFormats;
+
+ private final org.drools.compiler.compiler.ProcessBuilder processBuilder;
+
+ private IllegalArgumentException processBuilderCreationFailure;
+
+ private PMMLCompiler pmmlCompiler;
+
+ //This list of package level attributes is initialised with the PackageDescr's attributes added to the builder.
+ //The package level attributes are inherited by individual rules not containing explicit overriding parameters.
+ //The map is keyed on the PackageDescr's namespace and contains a map of AttributeDescr's keyed on the
+ //AttributeDescr's name.
+ private final Map<String, Map<String, AttributeDescr>> packageAttributes = new HashMap<String, Map<String, AttributeDescr>>();
+
+ //PackageDescrs' list of ImportDescrs are kept identical as subsequent PackageDescrs are added.
+ private final Map<String, List<PackageDescr>> packages = new HashMap<String, List<PackageDescr>>();
+
+ private final Stack<List<Resource>> buildResources = new Stack<List<Resource>>();
+
+ private int currentRulePackage = 0;
- public KnowledgeBuilderImpl(PackageBuilder pkgBuilder) {
- this.pkgBuilder = pkgBuilder;
+ private AssetFilter assetFilter = null;
+
+ private final TypeDeclarationBuilder typeBuilder;
+
+ /**
+ * Use this when package is starting from scratch.
+ */
+ public KnowledgeBuilderImpl() {
+ this((InternalKnowledgeBase) null,
+ null);
}
- public void add(Resource resource, ResourceType type) {
- ResourceConfiguration resourceConfiguration = resource instanceof BaseResource ? ((BaseResource) resource).getConfiguration() : null;
- add(resource, type, resourceConfiguration) ;
+ /**
+ * This will allow you to merge rules into this pre existing package.
+ */
+
+ public KnowledgeBuilderImpl(final InternalKnowledgePackage pkg) {
+ this(pkg,
+ null);
}
- public CompositeKnowledgeBuilder batch() {
- return new CompositeKnowledgeBuilderImpl(pkgBuilder);
+ public KnowledgeBuilderImpl(final InternalKnowledgeBase kBase) {
+ this(kBase,
+ null);
}
- public void add(Resource resource,
- ResourceType type,
- ResourceConfiguration configuration) {
- pkgBuilder.registerBuildResource(resource, type);
- pkgBuilder.addKnowledgeResource( resource, type, configuration );
+ /**
+ * Pass a specific configuration for the PackageBuilder
+ *
+ * PackageBuilderConfiguration is not thread safe and it also contains
+ * state. Once it is created and used in one or more PackageBuilders it
+ * should be considered immutable. Do not modify its properties while it is
+ * being used by a PackageBuilder.
+ */
+ public KnowledgeBuilderImpl(final KnowledgeBuilderConfigurationImpl configuration) {
+ this((InternalKnowledgeBase) null,
+ configuration);
}
- public void undo() {
- pkgBuilder.undo();
+ public KnowledgeBuilderImpl(InternalKnowledgePackage pkg,
+ KnowledgeBuilderConfigurationImpl configuration) {
+ if (configuration == null) {
+ this.configuration = new KnowledgeBuilderConfigurationImpl();
+ } else {
+ this.configuration = configuration;
+ }
+
+ this.dateFormats = null;//(DateFormats) this.environment.get( EnvironmentName.DATE_FORMATS );
+ if (this.dateFormats == null) {
+ this.dateFormats = new DateFormatsImpl();
+ //this.environment.set( EnvironmentName.DATE_FORMATS , this.dateFormats );
+ }
+
+ this.rootClassLoader = this.configuration.getClassLoader();
+
+ this.defaultDialect = this.configuration.getDefaultDialect();
+
+ this.pkgRegistryMap = new LinkedHashMap<String, PackageRegistry>();
+ this.results = new ArrayList<KnowledgeBuilderResult>();
+
+ PackageRegistry pkgRegistry = new PackageRegistry(rootClassLoader, this.configuration, pkg);
+ pkgRegistry.setDialect(this.defaultDialect);
+ this.pkgRegistryMap.put(pkg.getName(),
+ pkgRegistry);
+
+ // add imports to pkg registry
+ for (final ImportDeclaration implDecl : pkg.getImports().values()) {
+ pkgRegistry.addImport(new ImportDescr(implDecl.getTarget()));
+ }
+
+ processBuilder = createProcessBuilder();
+ typeBuilder = new TypeDeclarationBuilder(this);
}
- public Collection<KnowledgePackage> getKnowledgePackages() {
- if ( pkgBuilder.hasErrors() ) {
- return new ArrayList<KnowledgePackage>( 0 );
+ public KnowledgeBuilderImpl(InternalKnowledgeBase kBase,
+ KnowledgeBuilderConfigurationImpl configuration) {
+ if (configuration == null) {
+ this.configuration = new KnowledgeBuilderConfigurationImpl();
+ } else {
+ this.configuration = configuration;
}
- Package[] pkgs = pkgBuilder.getPackages();
- List<KnowledgePackage> list = new ArrayList<KnowledgePackage>( pkgs.length );
+ if (kBase != null) {
+ this.rootClassLoader = kBase.getRootClassLoader();
+ } else {
+ this.rootClassLoader = this.configuration.getClassLoader();
+ }
- for ( Package pkg : pkgs ) {
- list.add( new KnowledgePackageImp( pkg ) );
+ this.dateFormats = null;//(DateFormats) this.environment.get( EnvironmentName.DATE_FORMATS );
+ if (this.dateFormats == null) {
+ this.dateFormats = new DateFormatsImpl();
+ //this.environment.set( EnvironmentName.DATE_FORMATS , this.dateFormats );
}
- return list;
+ // FIXME, we need to get drools to support "default" namespace.
+ //this.defaultNamespace = pkg.getName();
+ this.defaultDialect = this.configuration.getDefaultDialect();
+
+ this.pkgRegistryMap = new LinkedHashMap<String, PackageRegistry>();
+ this.results = new ArrayList<KnowledgeBuilderResult>();
+
+ this.kBase = kBase;
+
+ processBuilder = createProcessBuilder();
+ typeBuilder = new TypeDeclarationBuilder(this);
}
- public KnowledgeBase newKnowledgeBase() {
- KnowledgeBuilderErrors errors = getErrors();
- if (errors.size() > 0) {
- for (KnowledgeBuilderError error: errors) {
- logger.error(error.toString());
+ private ProcessBuilder createProcessBuilder() {
+ try {
+ return ProcessBuilderFactory.newProcessBuilder(this);
+ } catch (IllegalArgumentException e) {
+ processBuilderCreationFailure = e;
+ return null;
+ }
+ }
+
+ private PMMLCompiler getPMMLCompiler() {
+ if (this.pmmlCompiler == null) {
+ this.pmmlCompiler = PMMLCompilerFactory.getPMMLCompiler();
+ }
+ return this.pmmlCompiler;
+ }
+
+ Resource getCurrentResource() {
+ return resource;
+ }
+
+ InternalKnowledgeBase getKnowledgeBase() {
+ return kBase;
+ }
+
+ TypeDeclarationBuilder getTypeBuilder() {
+ return typeBuilder;
+ }
+
+ /**
+ * Load a rule package from DRL source.
+ *
+ * @throws DroolsParserException
+ * @throws java.io.IOException
+ */
+ public void addPackageFromDrl(final Reader reader) throws DroolsParserException,
+ IOException {
+ addPackageFromDrl(reader, new ReaderResource(reader, ResourceType.DRL));
+ }
+
+ /**
+ * Load a rule package from DRL source and associate all loaded artifacts
+ * with the given resource.
+ *
+ * @param reader
+ * @param sourceResource the source resource for the read artifacts
+ * @throws DroolsParserException
+ * @throws IOException
+ */
+ public void addPackageFromDrl(final Reader reader,
+ final Resource sourceResource) throws DroolsParserException,
+ IOException {
+ this.resource = sourceResource;
+ final DrlParser parser = new DrlParser(configuration.getLanguageLevel());
+ final PackageDescr pkg = parser.parse(sourceResource, reader);
+ this.results.addAll(parser.getErrors());
+ if (pkg == null) {
+ addBuilderResult(new ParserError(sourceResource, "Parser returned a null Package", 0, 0));
+ }
+
+ if (!parser.hasErrors()) {
+ addPackage(pkg);
+ }
+ this.resource = null;
+ }
+
+ public void addPackageFromDecisionTable(Resource resource,
+ ResourceConfiguration configuration) throws DroolsParserException,
+ IOException {
+ this.resource = resource;
+ addPackage(decisionTableToPackageDescr(resource, configuration));
+ this.resource = null;
+ }
+
+ PackageDescr decisionTableToPackageDescr(Resource resource,
+ ResourceConfiguration configuration) throws DroolsParserException,
+ IOException {
+ DecisionTableConfiguration dtableConfiguration = configuration instanceof DecisionTableConfiguration ?
+ (DecisionTableConfiguration) configuration :
+ null;
+ String string = DecisionTableFactory.loadFromInputStream(resource.getInputStream(), dtableConfiguration);
+
+ DrlParser parser = new DrlParser(this.configuration.getLanguageLevel());
+ PackageDescr pkg = parser.parse(resource, new StringReader(string));
+ this.results.addAll(parser.getErrors());
+ if (pkg == null) {
+ addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
+ }
+ return parser.hasErrors() ? null : pkg;
+ }
+
+ public void addPackageFromScoreCard(Resource resource,
+ ResourceConfiguration configuration) throws DroolsParserException,
+ IOException {
+ this.resource = resource;
+ addPackage(scoreCardToPackageDescr(resource, configuration));
+ this.resource = null;
+ }
+
+ PackageDescr scoreCardToPackageDescr(Resource resource,
+ ResourceConfiguration configuration) throws DroolsParserException,
+ IOException {
+ ScoreCardConfiguration scardConfiguration = configuration instanceof ScoreCardConfiguration ?
+ (ScoreCardConfiguration) configuration :
+ null;
+ String string = ScoreCardFactory.loadFromInputStream(resource.getInputStream(), scardConfiguration);
+
+ DrlParser parser = new DrlParser(this.configuration.getLanguageLevel());
+ PackageDescr pkg = parser.parse(resource, new StringReader(string));
+ this.results.addAll(parser.getErrors());
+ if (pkg == null) {
+ addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
+ }
+ return parser.hasErrors() ? null : pkg;
+ }
+
+ public void addPackageFromDrl(Resource resource) throws DroolsParserException,
+ IOException {
+ this.resource = resource;
+ addPackage(drlToPackageDescr(resource));
+ this.resource = null;
+ }
+
+ PackageDescr drlToPackageDescr(Resource resource) throws DroolsParserException,
+ IOException {
+ PackageDescr pkg;
+ boolean hasErrors = false;
+ if (resource instanceof DescrResource) {
+ pkg = (PackageDescr) ((DescrResource) resource).getDescr();
+ } else {
+ final DrlParser parser = new DrlParser(configuration.getLanguageLevel());
+ pkg = parser.parse(resource);
+ this.results.addAll(parser.getErrors());
+ if (pkg == null) {
+ addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
}
- throw new IllegalArgumentException("Could not parse knowledge.");
+ hasErrors = parser.hasErrors();
}
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages(getKnowledgePackages());
- return kbase;
+ if (pkg != null) {
+ pkg.setResource(resource);
+ }
+ return hasErrors ? null : pkg;
}
- public boolean hasErrors() {
- return pkgBuilder.hasErrors();
+ /**
+ * Load a rule package from XML source.
+ *
+ * @param reader
+ * @throws DroolsParserException
+ * @throws IOException
+ */
+ public void addPackageFromXml(final Reader reader) throws DroolsParserException,
+ IOException {
+ this.resource = new ReaderResource(reader, ResourceType.XDRL);
+ final XmlPackageReader xmlReader = new XmlPackageReader(this.configuration.getSemanticModules());
+ xmlReader.getParser().setClassLoader(this.rootClassLoader);
+
+ try {
+ xmlReader.read(reader);
+ } catch (final SAXException e) {
+ throw new DroolsParserException(e.toString(),
+ e.getCause());
+ }
+
+ addPackage(xmlReader.getPackageDescr());
+ this.resource = null;
}
- public KnowledgeBuilderErrors getErrors() {
- return pkgBuilder.getErrors();
+ public void addPackageFromXml(final Resource resource) throws DroolsParserException,
+ IOException {
+ this.resource = resource;
+ addPackage(xmlToPackageDescr(resource));
+ this.resource = null;
}
-
- public boolean hasWarnings() {
- return pkgBuilder.hasWarnings();
+
+ PackageDescr xmlToPackageDescr(Resource resource) throws DroolsParserException,
+ IOException {
+ final XmlPackageReader xmlReader = new XmlPackageReader(this.configuration.getSemanticModules());
+ xmlReader.getParser().setClassLoader(this.rootClassLoader);
+
+ Reader reader = null;
+ try {
+ reader = resource.getReader();
+ xmlReader.read(reader);
+ } catch (final SAXException e) {
+ throw new DroolsParserException(e.toString(),
+ e.getCause());
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ return xmlReader.getPackageDescr();
}
- public List<DroolsWarning> getWarnings() {
- return pkgBuilder.getWarningList();
+ /**
+ * Load a rule package from DRL source using the supplied DSL configuration.
+ *
+ * @param source
+ * The source of the rules.
+ * @param dsl
+ * The source of the domain specific language configuration.
+ * @throws DroolsParserException
+ * @throws IOException
+ */
+ public void addPackageFromDrl(final Reader source,
+ final Reader dsl) throws DroolsParserException,
+ IOException {
+ this.resource = new ReaderResource(source, ResourceType.DSLR);
+
+ final DrlParser parser = new DrlParser(configuration.getLanguageLevel());
+ final PackageDescr pkg = parser.parse(source, dsl);
+ this.results.addAll(parser.getErrors());
+ if (!parser.hasErrors()) {
+ addPackage(pkg);
+ }
+ this.resource = null;
+ }
+
+ public void addPackageFromDslr(final Resource resource) throws DroolsParserException,
+ IOException {
+ this.resource = resource;
+ addPackage(dslrToPackageDescr(resource));
+ this.resource = null;
+ }
+
+ PackageDescr dslrToPackageDescr(Resource resource) throws DroolsParserException {
+ boolean hasErrors;
+ PackageDescr pkg;
+
+ DrlParser parser = new DrlParser(configuration.getLanguageLevel());
+ DefaultExpander expander = getDslExpander();
+
+ Reader reader = null;
+ try {
+ if (expander == null) {
+ expander = new DefaultExpander();
+ }
+ reader = resource.getReader();
+ String str = expander.expand(reader);
+ if (expander.hasErrors()) {
+ for (ExpanderException error : expander.getErrors()) {
+ error.setResource(resource);
+ addBuilderResult(error);
+ }
+ }
+
+ pkg = parser.parse(resource, str);
+ this.results.addAll(parser.getErrors());
+ hasErrors = parser.hasErrors();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ return hasErrors ? null : pkg;
+ }
+
+ public void addDsl(Resource resource) throws IOException {
+ this.resource = resource;
+ DSLTokenizedMappingFile file = new DSLTokenizedMappingFile();
+
+ Reader reader = null;
+ try {
+ reader = resource.getReader();
+ if (!file.parseAndLoad(reader)) {
+ this.results.addAll(file.getErrors());
+ }
+ if (this.dslFiles == null) {
+ this.dslFiles = new ArrayList<DSLTokenizedMappingFile>();
+ }
+ this.dslFiles.add(file);
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ this.resource = null;
+ }
+
+ }
+
+ /**
+ * Add a ruleflow (.rfm) asset to this package.
+ */
+ public void addRuleFlow(Reader processSource) {
+ addProcessFromXml(processSource);
+ }
+
+ public void addProcessFromXml(Resource resource) {
+ if (processBuilder == null) {
+ throw new RuntimeException("Unable to instantiate a process builder", processBuilderCreationFailure);
+ }
+
+ if (ResourceType.DRF.equals(resource.getResourceType())) {
+ addBuilderResult(new DeprecatedResourceTypeWarning(resource, "RF"));
+ }
+
+ this.resource = resource;
+
+ try {
+ this.results.addAll(processBuilder.addProcessFromXml(resource));
+ processBuilder.getErrors().clear();
+ } catch (Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ }
+ addBuilderResult(new ProcessLoadError(resource, "Unable to load process.", e));
+ }
+ this.results = getResults(this.results);
+ this.resource = null;
+ }
+
+ public void addProcessFromXml(Reader processSource) {
+ addProcessFromXml(new ReaderResource(processSource, ResourceType.DRF));
+ }
+
+ public void addKnowledgeResource(Resource resource,
+ ResourceType type,
+ ResourceConfiguration configuration) {
+ try {
+ ((InternalResource) resource).setResourceType(type);
+ if (ResourceType.DRL.equals(type)) {
+ addPackageFromDrl(resource);
+ } else if (ResourceType.GDRL.equals(type)) {
+ addPackageFromDrl(resource);
+ } else if (ResourceType.RDRL.equals(type)) {
+ addPackageFromDrl(resource);
+ } else if (ResourceType.DESCR.equals(type)) {
+ addPackageFromDrl(resource);
+ } else if (ResourceType.DSLR.equals(type)) {
+ addPackageFromDslr(resource);
+ } else if (ResourceType.RDSLR.equals(type)) {
+ addPackageFromDslr(resource);
+ } else if (ResourceType.DSL.equals(type)) {
+ addDsl(resource);
+ } else if (ResourceType.XDRL.equals(type)) {
+ addPackageFromXml(resource);
+ } else if (ResourceType.DRF.equals(type)) {
+ addProcessFromXml(resource);
+ } else if (ResourceType.BPMN2.equals(type)) {
+ BPMN2ProcessFactory.configurePackageBuilder(this);
+ addProcessFromXml(resource);
+ } else if (ResourceType.DTABLE.equals(type)) {
+ addPackageFromDecisionTable(resource, configuration);
+ } else if (ResourceType.PKG.equals(type)) {
+ addPackageFromInputStream(resource);
+ } else if (ResourceType.CHANGE_SET.equals(type)) {
+ addPackageFromChangeSet(resource);
+ } else if (ResourceType.XSD.equals(type)) {
+ addPackageFromXSD(resource, (JaxbConfigurationImpl) configuration);
+ } else if (ResourceType.PMML.equals(type)) {
+ addPackageFromPMML(resource, type, configuration);
+ } else if (ResourceType.SCARD.equals(type)) {
+ addPackageFromScoreCard(resource, configuration);
+ } else {
+ addPackageForExternalType(resource, type, configuration);