You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "pibizza (via GitHub)" <gi...@apache.org> on 2025/09/02 13:39:18 UTC
[PR] [NO ISSUE} Remove getknowledgebase usages [incubator-kie-drools]
pibizza opened a new pull request, #6440:
URL: https://github.com/apache/incubator-kie-drools/pull/6440
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
This is another patch related to cleaning and simplifying drools core.
The strategy is always the same - remove excessive reliance on ReteEvaluator as a mother object. Where possible, split dependency and provide reference directly to the underlying objects.
This patch focuses mostly removing usages of getKnowledgeBase and passing directly the rule base in the constructor.
All tests pass and PR should be straightforward.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [NO ISSUE] Remove getknowledgebase usages [incubator-kie-drools]
Posted by "pibizza (via GitHub)" <gi...@apache.org>.
pibizza commented on code in PR #6440:
URL: https://github.com/apache/incubator-kie-drools/pull/6440#discussion_r2318991729
##########
drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java:
##########
@@ -248,15 +247,17 @@ class StackedAgendaGroupsManager implements AgendaGroupsManager {
private Deque<InternalAgendaGroup> focusStack = new ArrayDeque<>();
private InternalAgendaGroup mainAgendaGroup;
private InternalWorkingMemory workingMemory;
+ private InternalRuleBase kieBase;
public StackedAgendaGroupsManager() { }
- public StackedAgendaGroupsManager(InternalWorkingMemory workingMemory) {
+ public StackedAgendaGroupsManager(InternalRuleBase kieBase, InternalWorkingMemory workingMemory) {
this.agendaGroupFactory = RuntimeComponentFactory.get().getAgendaGroupFactory();
+ this.kieBase = kieBase;
// stacked agenda groups are supported only for InternalWorkingMemory
this.workingMemory = workingMemory;
if (this.mainAgendaGroup == null) {
- initMainAgendaGroup(workingMemory.getKnowledgeBase());
+ initMainAgendaGroup(kieBase);
Review Comment:
@mariofusco this is resolved
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [NO ISSUE} Remove getknowledgebase usages [incubator-kie-drools]
Posted by "Rikkola (via GitHub)" <gi...@apache.org>.
Rikkola commented on code in PR #6440:
URL: https://github.com/apache/incubator-kie-drools/pull/6440#discussion_r2317805347
##########
drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java:
##########
@@ -248,15 +247,17 @@ class StackedAgendaGroupsManager implements AgendaGroupsManager {
private Deque<InternalAgendaGroup> focusStack = new ArrayDeque<>();
private InternalAgendaGroup mainAgendaGroup;
private InternalWorkingMemory workingMemory;
+ private InternalRuleBase kieBase;
public StackedAgendaGroupsManager() { }
- public StackedAgendaGroupsManager(InternalWorkingMemory workingMemory) {
+ public StackedAgendaGroupsManager(InternalRuleBase kieBase, InternalWorkingMemory workingMemory) {
this.agendaGroupFactory = RuntimeComponentFactory.get().getAgendaGroupFactory();
+ this.kieBase = kieBase;
// stacked agenda groups are supported only for InternalWorkingMemory
this.workingMemory = workingMemory;
if (this.mainAgendaGroup == null) {
- initMainAgendaGroup(workingMemory.getKnowledgeBase());
+ initMainAgendaGroup(kieBase);
Review Comment:
If initMainAgendeGroup always takes in this.kieBase would it be better to not pass it in as a parameter? Just a note.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [NO ISSUE} Remove getknowledgebase usages [incubator-kie-drools]
Posted by "pibizza (via GitHub)" <gi...@apache.org>.
pibizza commented on code in PR #6440:
URL: https://github.com/apache/incubator-kie-drools/pull/6440#discussion_r2318414161
##########
drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java:
##########
@@ -248,15 +247,17 @@ class StackedAgendaGroupsManager implements AgendaGroupsManager {
private Deque<InternalAgendaGroup> focusStack = new ArrayDeque<>();
private InternalAgendaGroup mainAgendaGroup;
private InternalWorkingMemory workingMemory;
+ private InternalRuleBase kieBase;
public StackedAgendaGroupsManager() { }
- public StackedAgendaGroupsManager(InternalWorkingMemory workingMemory) {
+ public StackedAgendaGroupsManager(InternalRuleBase kieBase, InternalWorkingMemory workingMemory) {
this.agendaGroupFactory = RuntimeComponentFactory.get().getAgendaGroupFactory();
+ this.kieBase = kieBase;
// stacked agenda groups are supported only for InternalWorkingMemory
this.workingMemory = workingMemory;
if (this.mainAgendaGroup == null) {
- initMainAgendaGroup(workingMemory.getKnowledgeBase());
+ initMainAgendaGroup(kieBase);
Review Comment:
@Rikkola fixed, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [NO ISSUE} Remove getknowledgebase usages [incubator-kie-drools]
Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco commented on code in PR #6440:
URL: https://github.com/apache/incubator-kie-drools/pull/6440#discussion_r2317947988
##########
drools-core/src/main/java/org/drools/core/common/AgendaGroupsManager.java:
##########
@@ -248,15 +247,17 @@ class StackedAgendaGroupsManager implements AgendaGroupsManager {
private Deque<InternalAgendaGroup> focusStack = new ArrayDeque<>();
private InternalAgendaGroup mainAgendaGroup;
private InternalWorkingMemory workingMemory;
+ private InternalRuleBase kieBase;
public StackedAgendaGroupsManager() { }
- public StackedAgendaGroupsManager(InternalWorkingMemory workingMemory) {
+ public StackedAgendaGroupsManager(InternalRuleBase kieBase, InternalWorkingMemory workingMemory) {
this.agendaGroupFactory = RuntimeComponentFactory.get().getAgendaGroupFactory();
+ this.kieBase = kieBase;
// stacked agenda groups are supported only for InternalWorkingMemory
this.workingMemory = workingMemory;
if (this.mainAgendaGroup == null) {
- initMainAgendaGroup(workingMemory.getKnowledgeBase());
+ initMainAgendaGroup(kieBase);
Review Comment:
@pibizza please give a look at @Rikkola's comment and then I will merge this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] [NO ISSUE] Remove getknowledgebase usages [incubator-kie-drools]
Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco merged PR #6440:
URL: https://github.com/apache/incubator-kie-drools/pull/6440
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org