This commit is contained in:
nheron 2025-02-22 11:33:10 +01:00
commit 6dfd6e4148
83 changed files with 1276 additions and 3084 deletions

View file

@ -1,115 +0,0 @@
package org.chtijbug.drools;
import java.time.LocalDateTime;
/**
* Created by nheron on 07/07/2016.
*/
public class ChtijbugObjectRequest {
private String transactionID;
private LocalDateTime transactionStartTimeStamp;
private LocalDateTime transactionEndTimeStamp;
private String processID;
private String containerID;
private String artifactID;
private String groupID;
private String version;
private Object objectRequest;
private SessionContext sessionLogging;
private boolean disableLogging;
public String getTransactionID() {
return transactionID;
}
public void setTransactionID(String transactionID) {
this.transactionID = transactionID;
}
public LocalDateTime getTransactionStartTimeStamp() {
return transactionStartTimeStamp;
}
public void setTransactionStartTimeStamp(LocalDateTime transactionStartTimeStamp) {
this.transactionStartTimeStamp = transactionStartTimeStamp;
}
public LocalDateTime getTransactionEndTimeStamp() {
return transactionEndTimeStamp;
}
public void setTransactionEndTimeStamp(LocalDateTime transactionEndTimeStamp) {
this.transactionEndTimeStamp = transactionEndTimeStamp;
}
public Object getObjectRequest() {
return objectRequest;
}
public void setObjectRequest(Object objectRequest) {
this.objectRequest = objectRequest;
}
public SessionContext getSessionLogging() {
return sessionLogging;
}
public void setSessionLogging(SessionContext sessionLogging) {
this.sessionLogging = sessionLogging;
}
public String getProcessID() {
return processID;
}
public void setProcessID(String processID) {
this.processID = processID;
}
public String getContainerID() {
return containerID;
}
public void setContainerID(String containerID) {
this.containerID = containerID;
}
public String getArtifactID() {
return artifactID;
}
public void setArtifactID(String artifactID) {
this.artifactID = artifactID;
}
public String getGroupID() {
return groupID;
}
public void setGroupID(String groupID) {
this.groupID = groupID;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public boolean isDisableLogging() {
return disableLogging;
}
public void setDisableLogging(boolean disableLogging) {
this.disableLogging = disableLogging;
}
}

View file

@ -1,62 +0,0 @@
package org.chtijbug.drools;
import java.util.ArrayList;
import java.util.List;
public class KieContainerResponse {
public enum STATUS {
ERROR,
SUCCESS
}
private KieContainerUpdate kieContainerUpdate;
private String messageError;
private STATUS status;
private List<String> errorMessages= new ArrayList<>();
public KieContainerUpdate getKieContainerUpdate() {
return kieContainerUpdate;
}
public void setKieContainerUpdate(KieContainerUpdate kieContainerUpdate) {
this.kieContainerUpdate = kieContainerUpdate;
}
public String getMessageError() {
return messageError;
}
public void setMessageError(String messageError) {
this.messageError = messageError;
}
public List<String> getErrorMessages() {
return errorMessages;
}
public void setErrorMessages(List<String> errorMessages) {
this.errorMessages = errorMessages;
}
public STATUS getStatus() {
return status;
}
public void setStatus(STATUS status) {
this.status = status;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("KieContainerResponse{");
sb.append("kieContainerUpdate=").append(kieContainerUpdate);
sb.append(", messageError='").append(messageError).append('\'');
sb.append(", status=").append(status);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,94 +0,0 @@
package org.chtijbug.drools;
public class KieContainerUpdate {
public enum STATUS {
TODEPLOY,
TODELETE
}
private String mainClass;
private String groupID;
private String artifactID;
private String processID;
private String projectVersion;
private String containerID;
private STATUS action;
public String getMainClass() {
return mainClass;
}
public void setMainClass(String mainClass) {
this.mainClass = mainClass;
}
public String getGroupID() {
return groupID;
}
public void setGroupID(String groupID) {
this.groupID = groupID;
}
public String getArtifactID() {
return artifactID;
}
public void setArtifactID(String artifactID) {
this.artifactID = artifactID;
}
public String getProcessID() {
return processID;
}
public void setProcessID(String processID) {
this.processID = processID;
}
public String getProjectVersion() {
return projectVersion;
}
public void setProjectVersion(String projectVersion) {
this.projectVersion = projectVersion;
}
public String getContainerID() {
return containerID;
}
public void setContainerID(String containerID) {
this.containerID = containerID;
}
public STATUS getAction() {
return action;
}
public void setAction(STATUS action) {
this.action = action;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("KieContainerUpdate{");
sb.append("mainClass='").append(mainClass).append('\'');
sb.append(", groupID='").append(groupID).append('\'');
sb.append(", artifactID='").append(artifactID).append('\'');
sb.append(", processID='").append(processID).append('\'');
sb.append(", projectVersion='").append(projectVersion).append('\'');
sb.append(", containerID='").append(containerID).append('\'');
sb.append(", action=").append(action);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,46 +0,0 @@
package org.chtijbug.drools;
import java.util.ArrayList;
import java.util.List;
public class ReverseProxyUpdate implements java.io.Serializable{
private String path;
private String tokenUUID;
private String containerID;
List<String> serverNames = new ArrayList<>();
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getTokenUUID() {
return tokenUUID;
}
public void setTokenUUID(String tokenUUID) {
this.tokenUUID = tokenUUID;
}
public List<String> getServerNames() {
return serverNames;
}
public void setServerNames(List<String> serverNames) {
this.serverNames = serverNames;
}
public void setContainerID(String containerID) {
this.containerID = containerID;
}
public String getContainerID() {
return containerID;
}
}

View file

@ -1,170 +0,0 @@
package org.chtijbug.drools;
import org.chtijbug.drools.logging.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by nheron on 11/06/15.
*/
public class SessionContext {
private SessionExecution sessionExecution;
private ProcessExecution processExecution;
private List<RuleflowGroup> ruleflowGroups = new ArrayList<>();
private RuleExecution ruleExecution;
private FireAllRulesExecution fireAllRulesExecution;
private Fact fact;
private String groupID;
private String artefactID;
private String version;
private String containerId;
private String serverName;
private Date startTime;
private Date stopTime;
public SessionExecution getSessionExecution() {
return sessionExecution;
}
public void setSessionExecution(SessionExecution sessionExecution) {
this.sessionExecution = sessionExecution;
}
public ProcessExecution getProcessExecution() {
return processExecution;
}
public void setProcessExecution(ProcessExecution processExecution) {
this.processExecution = processExecution;
}
public List<RuleflowGroup> getRuleflowGroups() {
return ruleflowGroups;
}
public void setRuleflowGroups(List<RuleflowGroup> ruleflowGroups) {
this.ruleflowGroups = ruleflowGroups;
}
public RuleflowGroup findRuleFlowGroup(String name) {
RuleflowGroup result = null;
for (RuleflowGroup r : ruleflowGroups) {
if (r.getRuleflowGroup() != null && r.getRuleflowGroup().equals(name)) {
result = r;
}
}
return result;
}
public RuleExecution getRuleExecution() {
return ruleExecution;
}
public void setRuleExecution(RuleExecution ruleExecution) {
this.ruleExecution = ruleExecution;
}
public Fact getFact() {
return fact;
}
public void setFact(Fact fact) {
this.fact = fact;
}
public FireAllRulesExecution getFireAllRulesExecution() {
return fireAllRulesExecution;
}
public void setFireAllRulesExecution(FireAllRulesExecution fireAllRulesExecution) {
this.fireAllRulesExecution = fireAllRulesExecution;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getStopTime() {
return stopTime;
}
public void setStopTime(Date stopTime) {
this.stopTime = stopTime;
}
public String getGroupID() {
return groupID;
}
public void setGroupID(String groupID) {
this.groupID = groupID;
}
public String getArtefactID() {
return artefactID;
}
public void setArtefactID(String artefactID) {
this.artefactID = artefactID;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getContainerId() {
return containerId;
}
public void setContainerId(String containerId) {
this.containerId = containerId;
}
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("SessionContext{");
sb.append("groupID='").append(groupID).append('\'');
sb.append(", artefactID='").append(artefactID).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", containerId='").append(containerId).append('\'');
sb.append(", serverName='").append(serverName).append('\'');
sb.append(", startTime=").append(startTime);
sb.append(", stopTime=").append(stopTime);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,175 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
/**
* @author nheron
*/
public class DroolsFactObject implements Serializable {
private static Logger logger = LoggerFactory.getLogger(DroolsFactObject.class);
/**
*
*/
private static final long serialVersionUID = 8185674445343213645L;
private transient Object realObject;
protected int version;
private String fullClassName;
private int hashCode;
private List<DroolsFactObjectAttribute> listfactObjectAttributes = new ArrayList<DroolsFactObjectAttribute>();
private String realObject_JSON;
private static ObjectMapper mapper = new ObjectMapper();
private ClassLoader classLoader = null;
/**
*
*/
public DroolsFactObject() {
realObject = null;
}
public DroolsFactObject(Object realObject, int version) throws IOException {
this.realObject = realObject;
this.version = version;
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, realObject);
this.realObject_JSON = strWriter.toString();
if (realObject != null) {
this.classLoader = realObject.getClass().getClassLoader();
}
}
public void updateRealObjectFromJSON() throws ClassNotFoundException, IOException {
if (this.realObject_JSON != null) {
ClassLoader localClassLoader=null;
try {
localClassLoader = Thread.currentThread()
.getContextClassLoader();
}catch (ClassCastException e){
logger.info("DroolsFactObject.updateRealObjectFromJSON",e);
}
try {
Class targetClass=null;
if (this.classLoader != null) {
Thread.currentThread().setContextClassLoader(
this.classLoader);
targetClass=this.classLoader.loadClass(this.fullClassName);
}
if (targetClass==null){
targetClass=Class.forName(this.fullClassName);
}
Object result = null;
result = mapper.readValue(this.realObject_JSON,targetClass );
this.realObject = result;
} catch (ClassNotFoundException e) {
logger.error("getRealObjectFromJSON");
} catch (IOException e) {
e.printStackTrace();
} finally {
if (localClassLoader!= null) {
Thread.currentThread().setContextClassLoader(localClassLoader);
}
}
}
}
public Object getRealObjectFromJSON() {
try {
this.updateRealObjectFromJSON();
} catch (ClassNotFoundException e) {
logger.error("getRealObjectFromJSON");
} catch (IOException e) {
e.printStackTrace();
}
return realObject;
}
;
public String getRealObject_JSON() {
return realObject_JSON;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsFactObject");
sb.append("{fullClassName='").append(fullClassName).append('\'');
sb.append(", hashCode=").append(hashCode);
sb.append(", version=").append(version);
sb.append(", listfactObjectAttributes=").append(listfactObjectAttributes);
sb.append("attributes :\n");
for (DroolsFactObjectAttribute foa : this.getListfactObjectAttributes()) {
sb.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
sb.append(", realObject=").append(realObject);
sb.append('}');
return sb.toString();
}
public int getObjectVersion() {
return version;
}
public int getNextObjectVersion() {
return version + 1;
}
public List<DroolsFactObjectAttribute> getListfactObjectAttributes() {
return listfactObjectAttributes;
}
public void setListfactObjectAttributes(List<DroolsFactObjectAttribute> listfactObjectAttributes) {
this.listfactObjectAttributes = listfactObjectAttributes;
}
public String getFullClassName() {
return fullClassName;
}
public void setFullClassName(String fullClassName) {
this.fullClassName = fullClassName;
}
public int getHashCode() {
return hashCode;
}
public void setHashCode(int hashCode) {
this.hashCode = hashCode;
}
public Object getRealObject() {
return realObject;
}
}

View file

@ -1,65 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author nheron
*/
public class DroolsFactObjectAttribute implements Serializable {
private static final long serialVersionUID = 2251337648100424168L;
private String attributeName;
private String attributeValue;
private String attributeType;
/**
*
*/
public DroolsFactObjectAttribute() {
}
public DroolsFactObjectAttribute(String attributeName, String attributeValue, String attributeType) {
this.attributeName = attributeName;
this.attributeValue = attributeValue;
this.attributeType = attributeType;
}
public String getAttributeName() {
return attributeName;
}
public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
public String getAttributeType() {
return attributeType;
}
public void setAttributeType(String attributeType) {
this.attributeType = attributeType;
}
public String getAttributeValue() {
return attributeValue;
}
public void setAttributeValue(String attributeValue) {
this.attributeValue = attributeValue;
}
}

View file

@ -1,65 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
public class DroolsJbpmVariableObject implements Serializable {
private final transient Object variableValue;
private String variableId;
private String variableInstanceId;
public DroolsJbpmVariableObject() {
this.variableValue = null;
}
public DroolsJbpmVariableObject(String variableId, String variableInstanceId, Object variableValue) {
this.variableId = variableId;
this.variableInstanceId = variableInstanceId;
this.variableValue = variableValue;
}
public String getVariableInstanceId() {
return variableInstanceId;
}
public void setVariableInstanceId(String variableInstanceId) {
this.variableInstanceId = variableInstanceId;
}
public String getVariableId() {
return variableId;
}
public void setVariableId(String variableId) {
this.variableId = variableId;
}
public Object getVariableValue() {
return variableValue;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("DroolsJbpmVariableObject{");
sb.append("variableId='").append(variableId).append('\'');
sb.append(", variableValue=").append(variableValue);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,90 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author nheron
*/
public class DroolsNodeInstanceObject implements Serializable {
/**
*
*/
private static final long serialVersionUID = 9121172218519979577L;
protected String id;
protected DroolsNodeObject node;
/**
*
*/
public DroolsNodeInstanceObject() {
}
protected DroolsNodeInstanceObject(String id, DroolsNodeObject node) {
this.id = id;
this.node = node;
}
public static DroolsNodeInstanceObject createDroolsNodeInstanceObject(String nodeInstanceId, DroolsNodeObject nodeObject) {
return new DroolsNodeInstanceObject(nodeInstanceId, nodeObject);
}
public String getId() {
return id;
}
public DroolsNodeObject getNode() {
return node;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsNodeInstanceObject other = (DroolsNodeInstanceObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
if (this.node != other.node && (this.node == null || !this.node.equals(other.node))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 71 * hash + (this.id != null ? this.id.hashCode() : 0);
hash = 71 * hash + (this.node != null ? this.node.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsNodeInstanceObject");
sb.append("{id='").append(id).append('\'');
sb.append(", node=").append(node.toString());
sb.append('}');
return sb.toString();
}
}

View file

@ -1,108 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author nheron
*/
public class DroolsNodeObject implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2149698078767524188L;
protected String id;
private DroolsNodeType nodeType = DroolsNodeType.Other;
private String ruleflowGroupName;
/**
*
*/
public DroolsNodeObject() {
}
public DroolsNodeObject(String id, DroolsNodeType nodeType) {
this.id = id;
this.nodeType = nodeType;
}
protected DroolsNodeObject(String id) {
this.id = id;
this.nodeType = DroolsNodeType.Other;
}
public static DroolsNodeObject createDroolsNodeObject(String id, DroolsNodeType nodeType) {
return new DroolsNodeObject(id, nodeType);
}
public String getId() {
return id;
}
public DroolsNodeType getNodeType() {
return nodeType;
}
public void setNodeType(DroolsNodeType nodeType) {
this.nodeType = nodeType;
}
public String getRuleflowGroupName() {
return ruleflowGroupName;
}
public void setRuleflowGroupName(String ruleflowGroupName) {
if (ruleflowGroupName != null && ruleflowGroupName.length() > 0) {
this.nodeType = DroolsNodeType.RuleNode;
}
this.ruleflowGroupName = ruleflowGroupName;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsNodeObject other = (DroolsNodeObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + (this.id != null ? this.id.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsNodeObject");
sb.append("{id='").append(id).append('\'');
sb.append("nodeType='").append(nodeType).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -1,26 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
/**
* Created by IntelliJ IDEA.
* Date: 28/03/14
* Time: 14:29
* To change this template use File | Settings | File Templates.
*/
public enum DroolsNodeType {
RuleNode, StartNode, SplitNode, JoinNode, EndNode, Other
}

View file

@ -1,145 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author nheron
*/
public class DroolsProcessInstanceObject implements Serializable {
private static final long serialVersionUID = 5436434746711988139L;
protected String id;
protected DroolsProcessObject process;
protected Map<String, DroolsNodeInstanceObject> nodeInstances;
private String name;
private String packageName;
private String type;
private String version;
/**
*
*/
public DroolsProcessInstanceObject() {
}
protected DroolsProcessInstanceObject(String id, DroolsProcessObject process) {
this.id = id;
this.name = process.getName();
this.packageName = process.getPackageName();
this.type = process.getType();
this.version = process.getVersion();
this.process = process;
nodeInstances = new HashMap<String, DroolsNodeInstanceObject>();
}
public static DroolsProcessInstanceObject createDroolsProcessInstanceObject(String processInstanceID, DroolsProcessObject process) {
return new DroolsProcessInstanceObject(processInstanceID, process);
}
public String getId() {
return id;
}
public DroolsProcessObject getProcess() {
return process;
}
public void addDroolsNodeInstanceObject(DroolsNodeInstanceObject droolsNodeInstanceObject) {
nodeInstances.put(droolsNodeInstanceObject.getId(), droolsNodeInstanceObject);
}
public DroolsNodeInstanceObject getDroolsNodeInstanceObjet(String id) {
return nodeInstances.get(id);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsProcessInstanceObject other = (DroolsProcessInstanceObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
if (this.process != other.process && (this.process == null || !this.process.equals(other.process))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 17 * hash + (this.id != null ? this.id.hashCode() : 0);
hash = 17 * hash + (this.process != null ? this.process.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsProcessInstanceObject");
sb.append("{id='").append(id).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", packageName='").append(packageName).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", process=").append(process);
sb.append(", nodeInstances=").append(nodeInstances);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,116 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author nheron
*/
public class DroolsProcessObject implements Serializable {
private static final long serialVersionUID = 4718079763911002405L;
protected String id;
protected String name;
protected String packageName;
protected String type;
protected String version;
protected Map<String, DroolsNodeObject> nodeLists;
public DroolsProcessObject() {
}
public DroolsProcessObject(String id, String name, String packageName, String type, String version) {
this.id = id;
this.name = name;
this.packageName = packageName;
this.type = type;
this.version = version;
this.nodeLists = new HashMap<String, DroolsNodeObject>();
}
public static DroolsProcessObject createDroolsProcessObject(String id, String processInstanceID, String packageName, String type, String version) {
return new DroolsProcessObject(id, processInstanceID, packageName, type, version);
}
public void addDroolsNodeObject(DroolsNodeObject droolsNodeObject) {
nodeLists.put(droolsNodeObject.getId(), droolsNodeObject);
}
public DroolsNodeObject getDroolsNodeObjet(String id) {
return nodeLists.get(id);
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getPackageName() {
return packageName;
}
public String getType() {
return type;
}
public String getVersion() {
return version;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsProcessObject other = (DroolsProcessObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 41 * hash + (this.packageName != null ? this.packageName.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsProcessObject");
sb.append("{id='").append(id).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", packageName='").append(packageName).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", nodeLists=").append(nodeLists);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,55 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* Date: 23/11/12
* Time: 15:13
* To change this template use File | Settings | File Templates.
*/
public class DroolsRuleFlowGroupObject implements Serializable {
private int ruleFlowInstanceID;
private String name;
public DroolsRuleFlowGroupObject() {
}
public DroolsRuleFlowGroupObject(int ruleFlowInstanceID, String name) {
this.ruleFlowInstanceID = ruleFlowInstanceID;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsRuleFlowGroupObject");
sb.append("{ruleFlowInstanceID=").append(ruleFlowInstanceID);
sb.append(", name='").append(name).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -1,84 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author Bertrand Gressier
*/
public class DroolsRuleObject implements Serializable {
/**
*
*/
private static final long serialVersionUID = -716077698281963299L;
protected String ruleName;
protected String rulePackageName;
protected String ruleFlowGroup;
/**
*
*/
public DroolsRuleObject() {
}
/**
* @param ruleName - the rule name added to the knowledge base
* @param rulePackageName - the package of the rule
*/
protected DroolsRuleObject(String ruleName, String rulePackageName) {
this.ruleName = ruleName;
this.rulePackageName = rulePackageName;
}
public static DroolsRuleObject createDroolRuleObject(String ruleName, String rulePackageName) {
return new DroolsRuleObject(ruleName, rulePackageName);
}
/**
* @return the ruleName
*/
public String getRuleName() {
return ruleName;
}
/**
* @return the rulePackageName
*/
public String getRulePackageName() {
return rulePackageName;
}
public String getRuleFlowGroup() {
return ruleFlowGroup;
}
public void setRuleFlowGroup(String ruleFlowGroup) {
this.ruleFlowGroup = ruleFlowGroup;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Rule object with name :" + getRuleName();
}
}

View file

@ -1,23 +0,0 @@
package org.chtijbug.drools.entity.history;
import java.util.concurrent.atomic.AtomicLong;
public final class EventCounter {
private AtomicLong nextEventId = new AtomicLong(1L);
private EventCounter() {
}
public static EventCounter newCounter() {
return new EventCounter();
}
public Long next() {
return nextEventId.getAndIncrement();
}
public Long current() {
return nextEventId.get();
}
}

View file

@ -1,75 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity.history;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
/**
* @author nheron
*/
public class HistoryContainer implements Serializable {
private static final long serialVersionUID = 5645452451089006572L;
protected List<HistoryEvent> listHistoryEvent = new LinkedList<HistoryEvent>();
private Long sessionID;
private HistoryListener historylistener = null;
public HistoryContainer() {
}
/**
*
*/
public HistoryContainer(Long sessionID, HistoryListener historylistener) {
this.sessionID = sessionID;
this.historylistener = historylistener;
}
public Long getSessionID() {
return sessionID;
}
public void setSessionID(Long sessionID) {
this.sessionID = sessionID;
}
public List<HistoryEvent> getListHistoryEvent() {
return listHistoryEvent;
}
public void addHistoryElement(Long ruleBaseID, Long sessionID, HistoryEvent newHistoryElement) {
DroolsChtijbugException error = null;
newHistoryElement.setRuleBaseID(ruleBaseID);
newHistoryElement.setSessionId(sessionID);
try {
if (historylistener != null) {
historylistener.fireEvent(newHistoryElement);
}
} catch (DroolsChtijbugException e) {
error = e;
} finally {
if (error != null) {
newHistoryElement.setDroolsChtijbugException(error);
}
this.listHistoryEvent.add(newHistoryElement);
}
}
}

View file

@ -1,109 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.entity.history;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
/**
* @author nheron
*/
public class HistoryEvent implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6640538290066213804L;
protected Date dateEvent;
protected TypeEvent typeEvent;
private Long eventID;
private Long ruleBaseID;
private Long sessionId;
private DroolsChtijbugException droolsChtijbugException;
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<KnowledgeResource>();
private ClassLoader businessClassLoader;
/**
* Mandatory for GWT Serialization
*/
public HistoryEvent() {
}
public void setBusinessClassLoader(ClassLoader businessClassLoader) {
this.businessClassLoader = businessClassLoader;
}
public HistoryEvent(Long eventID, Date dateEvent, TypeEvent typeEvent) {
this.eventID = eventID;
this.dateEvent = dateEvent;
this.typeEvent = typeEvent;
}
public ArrayList<KnowledgeResource> getKnowledgeResources() {
return knowledgeResources;
}
public void setKnowledgeResources(ArrayList<KnowledgeResource> knowledgeResources) {
this.knowledgeResources = knowledgeResources;
}
public DroolsChtijbugException getDroolsChtijbugException() {
return droolsChtijbugException;
}
public void setDroolsChtijbugException(DroolsChtijbugException droolsChtijbugException) {
this.droolsChtijbugException = droolsChtijbugException;
}
public Date getDateEvent() {
return dateEvent;
}
public TypeEvent getTypeEvent() {
return typeEvent;
}
public Long getEventID() {
return eventID;
}
public void setEventID(Long eventID) {
this.eventID = eventID;
}
public Long getRuleBaseID() {
return ruleBaseID;
}
public void setRuleBaseID(Long ruleBaseID) {
this.ruleBaseID = ruleBaseID;
}
public Long getSessionId() {
return sessionId;
}
public void setSessionId(Long sessionId) {
this.sessionId = sessionId;
}
public enum TypeEvent {
Fact, Rule, BPMN, RuleFlowGroup, KnowledgeBaseSingleton, Session
}
}

View file

@ -1,26 +0,0 @@
package org.chtijbug.drools.jms;
import org.chtijbug.drools.ReverseProxyUpdate;
import org.springframework.jms.core.MessageCreator;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.Session;
public class ReverseProxyMessageCreator implements MessageCreator {
private ReverseProxyUpdate reverseProxyUpdate;
public ReverseProxyMessageCreator(ReverseProxyUpdate reverseProxyUpdate) {
this.reverseProxyUpdate = reverseProxyUpdate;
}
@Override
public Message createMessage(Session session) throws JMSException {
ObjectMessage objectMessage = session.createObjectMessage();
objectMessage.setObject(reverseProxyUpdate);
return objectMessage;
}
}

View file

@ -1,103 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
public class Fact {
private Object realFact;
private Integer objectVersion;
private String fullClassName;
private Date modificationDate;
private FactType factType;
private Long eventid;
public Fact() {
}
public Object getRealFact() {
return realFact;
}
public void setRealFact(Object realFact) {
this.realFact = realFact;
}
public Integer getObjectVersion() {
return objectVersion;
}
public void setObjectVersion(Integer objectVersion) {
this.objectVersion = objectVersion;
}
public String getFullClassName() {
return fullClassName;
}
public void setFullClassName(String fullClassName) {
this.fullClassName = fullClassName;
}
public FactType getFactType() {
return factType;
}
public void setFactType(FactType factType) {
this.factType = factType;
}
public Date getModificationDate() {
return modificationDate;
}
public void setModificationDate(Date modificationDate) {
this.modificationDate = modificationDate;
}
public Long getEventid() {
return eventid;
}
public void setEventid(Long eventid) {
this.eventid = eventid;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Fact{");
sb.append(", jsonFact='").append(realFact).append('\'');
sb.append(", objectVersion=").append(objectVersion);
sb.append(", fullClassName='").append(fullClassName).append('\'');
sb.append(", modificationDate=").append(modificationDate);
sb.append(", factType=").append(factType);
sb.append(", eventid=").append(eventid);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,28 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public enum FactType {
WHEN, INSERTED, UPDATED_OLDVALUE, UPDATED_NEWVALUE, DELETED, INPUTDATA, OUTPUTDATA;
public static FactType getEnum(String factType) {
for (FactType type : FactType.values()) {
if (type.name().equals(factType))
return type;
}
return null;
}
}

View file

@ -1,154 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
public class FireAllRulesExecution {
private Date startDate;
private Date endDate;
private Long nbreRulesFired;
private Long maxNbreRulesDefinedForSession;
private Long executionTime;
private Long startEventID;
private FireAllRulesExecutionStatus fireAllRulesExecutionStatus;
private Long stopEventID;
private Long maxRulesEventID;
public FireAllRulesExecution() {
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getNbreRulesFired() {
return nbreRulesFired;
}
public void setNbreRulesFired(Long nbreRulesFired) {
this.nbreRulesFired = nbreRulesFired;
}
public Long getExecutionTime() {
return executionTime;
}
public void setExecutionTime(Long executionTime) {
this.executionTime = executionTime;
}
public FireAllRulesExecutionStatus getFireAllRulesExecutionStatus() {
return fireAllRulesExecutionStatus;
}
public void setFireAllRulesExecutionStatus(FireAllRulesExecutionStatus fireAllRulesExecutionStatus) {
this.fireAllRulesExecutionStatus = fireAllRulesExecutionStatus;
}
public Long getMaxNbreRulesDefinedForSession() {
return maxNbreRulesDefinedForSession;
}
public void setMaxNbreRulesDefinedForSession(Long maxNbreRulesDefinedForSession) {
this.maxNbreRulesDefinedForSession = maxNbreRulesDefinedForSession;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public Long getMaxRulesEventID() {
return maxRulesEventID;
}
public void setMaxRulesEventID(Long maxRulesEventID) {
this.maxRulesEventID = maxRulesEventID;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("FireRulesRuntime{");
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", nbreRulesFired=").append(nbreRulesFired);
sb.append(", maxNbreRulesDefinedForSession=").append(maxNbreRulesDefinedForSession);
sb.append(", executionTime=").append(executionTime);
sb.append(", startEventID=").append(startEventID);
sb.append(", fireRulesRuntimeStatus=").append(fireAllRulesExecutionStatus);
sb.append('}');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof FireAllRulesExecution)) return false;
FireAllRulesExecution that = (FireAllRulesExecution) o;
if (!startDate.equals(that.startDate)) return false;
return true;
}
@Override
public int hashCode() {
int result = startDate.hashCode();
return result;
}
}

View file

@ -1,20 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public enum FireAllRulesExecutionStatus {
STARTED, STOPPED, CRASHED, MAXNBRULES
}

View file

@ -1,20 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public class NodeRuntime {
}

View file

@ -1,60 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
/**
* Created by alexandre on 17/07/2014.
*/
public class Page {
private Integer currentIndex;
private Long totalCount;
/**
* Setting a default value tha we can override
*/
private Integer maxItemPerPage = 5;
public Page() {/** nop */}
public Page(Integer currentIndex, Long totalCount, Integer maxItemPerPage) {
this.currentIndex = currentIndex;
this.totalCount = totalCount;
this.maxItemPerPage = maxItemPerPage;
}
public Integer getCurrentIndex() {
return currentIndex;
}
public void setCurrentIndex(Integer currentIndex) {
this.currentIndex = currentIndex;
}
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public Integer getMaxItemPerPage() {
return maxItemPerPage;
}
public void setMaxItemPerPage(Integer maxItemPerPage) {
this.maxItemPerPage = maxItemPerPage;
}
}

View file

@ -1,8 +0,0 @@
package org.chtijbug.drools.logging;
/**
* Created by nheron on 10/03/15.
*/
public enum PlatformRuntimeEnvironment {
DEV, INT, PROD
}

View file

@ -1,101 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import com.google.common.base.Objects;
import java.util.Date;
public class PlatformRuntimeFilter {
private String packageName;
private String status;
private String hostname;
private Date startDate;
private Date endDate;
private String onlyRunningInstances;
private Page page;
public PlatformRuntimeFilter() {/* nop */}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getOnlyRunningInstances() {
return onlyRunningInstances;
}
public void setOnlyRunningInstances(String onlyRunningInstances) {
this.onlyRunningInstances = onlyRunningInstances;
}
public Page getPage() {
return page;
}
public void setPage(Page page) {
this.page = page;
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("packageName", packageName)
.add("status", status)
.add("hostname", hostname)
.add("startDate", startDate)
.add("endDate", endDate)
.add("onlyRunningInstances", onlyRunningInstances)
.toString();
}
}

View file

@ -1,30 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public enum PlatformRuntimeInstanceStatus {
INITMODE, STARTED, NOT_JOINGNABLE, STOPPED, CRASHED;
public static PlatformRuntimeInstanceStatus getEnum(String assetStatus) {
for (PlatformRuntimeInstanceStatus status : PlatformRuntimeInstanceStatus.values()) {
if (status.name().equals(assetStatus))
return status;
}
return null;
}
}

View file

@ -1,8 +0,0 @@
package org.chtijbug.drools.logging;
/**
* Created by nheron on 26/02/15.
*/
public enum PlatformRuntimeMode {
Debug, platformRuntimeMode, Info
}

View file

@ -1,188 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
import java.util.LinkedList;
public class ProcessExecution {
private String processName;
private Date startDate;
private Date endDate;
private ProcessExecutionStatus processExecutionStatus;
private Long startEventID;
private Long stopEventID;
private String ProcessInstanceId;
private String processPackageName;
private String processVersion;
private String processType;
private String processId;
private LinkedList<RuleflowGroup> ruleflowGroups = new LinkedList<RuleflowGroup>();
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public ProcessExecutionStatus getProcessExecutionStatus() {
return processExecutionStatus;
}
public void setProcessExecutionStatus(ProcessExecutionStatus processExecutionStatus) {
this.processExecutionStatus = processExecutionStatus;
}
public String getProcessInstanceId() {
return ProcessInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
ProcessInstanceId = processInstanceId;
}
public String getProcessPackageName() {
return processPackageName;
}
public void setProcessPackageName(String processPackageName) {
this.processPackageName = processPackageName;
}
public String getProcessVersion() {
return processVersion;
}
public void setProcessVersion(String processVersion) {
this.processVersion = processVersion;
}
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public String getProcessId() {
return processId;
}
public void setProcessId(String processId) {
this.processId = processId;
}
public LinkedList<RuleflowGroup> getRuleflowGroups() {
return ruleflowGroups;
}
public void setRuleflowGroups(LinkedList<RuleflowGroup> ruleflowGroups) {
this.ruleflowGroups = ruleflowGroups;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("ProcessRuntime{");
sb.append(", processName='").append(processName).append('\'');
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", processRuntimeStatus=").append(processExecutionStatus);
sb.append(", startEventID=").append(startEventID);
sb.append(", ProcessInstanceId='").append(ProcessInstanceId).append('\'');
sb.append(", processPackageName='").append(processPackageName).append('\'');
sb.append(", processVersion='").append(processVersion).append('\'');
sb.append(", processType='").append(processType).append('\'');
sb.append(", processId='").append(processId).append('\'');
sb.append('}');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ProcessExecution)) return false;
ProcessExecution that = (ProcessExecution) o;
if (!processName.equals(that.processName)) return false;
if (!startDate.equals(that.startDate)) return false;
return true;
}
@Override
public int hashCode() {
int result = processName.hashCode();
result = 31 * result + startDate.hashCode();
return result;
}
}

View file

@ -1,21 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public enum ProcessExecutionStatus {
SESSIONSTARTED, JBPMSTARTED, JBPMSTOPPED, CRASHED
}

View file

@ -1,110 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RuleExecution {
private String ruleName;
private String packageName;
private Date startDate;
private Date endDate;
private Long startEventID;
private Long stopEventID;
private List<Fact> whenFacts = new ArrayList<Fact>();
private List<Fact> thenFacts = new ArrayList<Fact>();
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public List<Fact> getWhenFacts() {
return whenFacts;
}
public void setWhenFacts(List<Fact> whenFacts) {
this.whenFacts = whenFacts;
}
public List<Fact> getThenFacts() {
return thenFacts;
}
public void setThenFacts(List<Fact> thenFacts) {
this.thenFacts = thenFacts;
}
}

View file

@ -1,129 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
import java.util.LinkedList;
public class RuleflowGroup {
private String ruleflowGroup;
private LinkedList<RuleExecution> ruleExecutionList = new LinkedList<>();
private Date startDate;
private Date endDate;
private Long startEventID;
private Long stopEventID;
private RuleflowGroupStatus ruleflowGroupStatus;
public String getRuleflowGroup() {
return ruleflowGroup;
}
public void setRuleflowGroup(String ruleflowGroup) {
this.ruleflowGroup = ruleflowGroup;
}
public LinkedList<RuleExecution> getRuleExecutionList() {
return ruleExecutionList;
}
public void setRuleExecutionList(LinkedList<RuleExecution> ruleExecutionList) {
this.ruleExecutionList = ruleExecutionList;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public RuleflowGroupStatus getRuleflowGroupStatus() {
return ruleflowGroupStatus;
}
public void setRuleflowGroupStatus(RuleflowGroupStatus ruleflowGroupStatus) {
this.ruleflowGroupStatus = ruleflowGroupStatus;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RuleflowGroup)) return false;
RuleflowGroup that = (RuleflowGroup) o;
if (!ruleflowGroup.equals(that.ruleflowGroup)) return false;
return true;
}
@Override
public int hashCode() {
int result = ruleflowGroup.hashCode();
return result;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("RuleflowGroupRuntime{");
sb.append(", ruleflowGroup='").append(ruleflowGroup).append('\'');
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", ruleflowGroupRuntimeStatus=").append(ruleflowGroupStatus);
sb.append('}');
return sb.toString();
}
}

View file

@ -1,21 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public enum RuleflowGroupStatus {
STARTED, STOPPED, CRASHED
}

View file

@ -1,173 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SessionExecution {
private Long id;
private Long sessionId;
private Date startDate;
private Date endDate;
private Long startEventID;
private Long stopEventID;
private PlatformRuntimeMode platformRuntimeMode = PlatformRuntimeMode.Debug;
private SessionExecutionStatus sessionExecutionStatus;
private List<RuleExecution> ruleExecutions = new ArrayList<>();
private List<ProcessExecution> processExecutions = new ArrayList<>();
private List<FireAllRulesExecution> fireAllRulesExecutions = new ArrayList<>();
private List<Fact> facts = new ArrayList<Fact>();
private Date processingStartDate;
private Date processingStopDate;
public SessionExecution() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSessionId() {
return sessionId;
}
public void setSessionId(Long sessionId) {
this.sessionId = sessionId;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public SessionExecutionStatus getSessionExecutionStatus() {
return sessionExecutionStatus;
}
public void setSessionExecutionStatus(SessionExecutionStatus sessionExecutionStatus) {
this.sessionExecutionStatus = sessionExecutionStatus;
}
public List<FireAllRulesExecution> getFireAllRulesExecutions() {
return fireAllRulesExecutions;
}
public void setFireAllRulesExecutions(List<FireAllRulesExecution> fireAllRulesExecutions) {
this.fireAllRulesExecutions = fireAllRulesExecutions;
}
public List<RuleExecution> getRuleExecutions() {
return ruleExecutions;
}
public void setRuleExecutions(List<RuleExecution> ruleExecutions) {
this.ruleExecutions = ruleExecutions;
}
public List<ProcessExecution> getProcessExecutions() {
return processExecutions;
}
public void setProcessExecutions(List<ProcessExecution> processExecutions) {
this.processExecutions = processExecutions;
}
public List<Fact> getFacts() {
return facts;
}
public void setFacts(List<Fact> facts) {
this.facts = facts;
}
public java.util.Collection<Fact> getFactsByType(final FactType factType) {
if (this.getFacts().isEmpty())
return Lists.newArrayList();
return Collections2.filter(this.getFacts(), fact -> fact.getFactType().equals(factType));
}
public Date getProcessingStartDate() {
return processingStartDate;
}
public void setProcessingStartDate(Date processionStartDate) {
this.processingStartDate = processionStartDate;
}
public Date getProcessingStopDate() {
return processingStopDate;
}
public void setProcessingStopDate(Date processingStopDate) {
this.processingStopDate = processingStopDate;
}
public PlatformRuntimeMode getPlatformRuntimeMode() {
return platformRuntimeMode;
}
public void setPlatformRuntimeMode(PlatformRuntimeMode platformRuntimeMode) {
this.platformRuntimeMode = platformRuntimeMode;
}
}

View file

@ -1,21 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.logging;
public enum SessionExecutionStatus {
STARTED, DISPOSED, CRASHED
}

View file

@ -1,63 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.runtime;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* Date: 24/04/12
* Time: 18:11
* To change this template use File | Settings | File Templates.
*/
public class DroolsChtijbugException extends Exception implements Serializable {
public static String insertByReflection = "insertByReflection";
public static String MaxNumberRuleExecutionReached = "MaxNumberRuleExecutionReached";
public static String fireAllRules = "fireAllRules";
public static String KbaseAcquire = "KbaseAcquire";
public static String KbaseNotInitialised = "KbaseNotInitialised";
public static String ErrorToLoadAgent = "ErrorToLoadAgent";
public static String UnknowFileExtension = "UnknowFileExtension";
public static String ErrorRegisteringMBeans = "";
public static String RessourceAlreadyAdded = "RessourceAlreadyAdded";
public static String RessourceDoesNotExist = "RessourceNotExisting";
private String key;
private String Description;
private Exception originException;
public DroolsChtijbugException() {
}
public DroolsChtijbugException(String key, String description, Exception originException) {
super(key + description, originException);
this.key = key;
Description = description;
this.originException = originException;
}
public String getKey() {
return key;
}
public String getDescription() {
return Description;
}
public Exception getOriginException() {
return originException;
}
}

View file

@ -1,32 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.runtime.listener;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import java.io.Serializable;
public interface HistoryListener extends Serializable {
public void fireEvent(HistoryEvent newHistoryEvent) throws DroolsChtijbugException;
public boolean withDetails();
public void setDetails(Boolean details);
}

View file

@ -1,18 +0,0 @@
package org.chtijbug.drools.runtimeevent;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
/**
* Created by nheron on 11/06/15.
*/
public interface AbstractMemoryEventHandlerStrategy {
public abstract void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner);
public abstract boolean isEventSupported(HistoryEvent historyEvent);
}

View file

@ -1,110 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed 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.
*/
package org.chtijbug.drools.runtimeevent;
import com.rits.cloning.Cloner;
import com.rits.cloning.ObjenesisInstantiationStrategy;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.runtimeevent.impl.fact.*;
import org.chtijbug.drools.runtimeevent.impl.knowledgeSession.*;
import org.chtijbug.drools.runtimeevent.impl.process.*;
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleFiredEventStrategy;
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleflowGroupActivatedEventStrategy;
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleflowGroupDeactivatedEventStrategy;
import org.chtijbug.drools.runtimeevent.impl.rule.BeforeRuleFiredEventStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
public class MessageHandlerResolver {
private static final Logger logger = LoggerFactory.getLogger(MessageHandlerResolver.class);
@Resource
private List<AbstractMemoryEventHandlerStrategy> allMemoryStrategies = new ArrayList<>();
private ClassLoader classLoader;
public MessageHandlerResolver() {
allMemoryStrategies.add(new DeleteFactEventStrategy());
allMemoryStrategies.add(new InsertedByRelectionFactEndEventStrategy());
allMemoryStrategies.add(new InsertedByRelectionFactStartEventStrategy());
allMemoryStrategies.add(new InsertedFactEventStrategy());
allMemoryStrategies.add(new UpdatedFactEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionCreateEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionDisposeEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesAndStartProcessEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesBeginEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesEndEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesMaxRulesEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionProcessBeginEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionProcessEndEventStrategy());
allMemoryStrategies.add(new AfterNodeInstanceTriggeredEventStrategy());
allMemoryStrategies.add(new AfterNodeLeftEventStrategy());
allMemoryStrategies.add(new AfterProcessEndHistoryEventStrategy());
allMemoryStrategies.add(new AfterProcessStartEventStrategy());
allMemoryStrategies.add(new AfterVariableChangeEventStrategy());
allMemoryStrategies.add(new BeforeNodeInstanceTriggeredEventStrategy());
allMemoryStrategies.add(new BeforeNodeLeftEventStrategy());
allMemoryStrategies.add(new BeforeProcessEndEventStrategy());
allMemoryStrategies.add(new BeforeProcessStartEventStrategy());
allMemoryStrategies.add(new BeforeVariableChangeEventStrategy());
allMemoryStrategies.add(new AfterRuleFiredEventStrategy());
allMemoryStrategies.add(new AfterRuleflowGroupActivatedEventStrategy());
allMemoryStrategies.add(new AfterRuleflowGroupDeactivatedEventStrategy());
allMemoryStrategies.add(new BeforeRuleFiredEventStrategy());
}
public SessionContext getSessionFromHistoryEvent(List<HistoryEvent> historyEvents) {
Thread currentThread = Thread.currentThread();
ClassLoader old = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(classLoader);
SessionContext sessionContext = new SessionContext();
Cloner cloner=new Cloner(new ObjenesisInstantiationStrategy());
for (HistoryEvent historyEvent : historyEvents) {
AbstractMemoryEventHandlerStrategy strategy = this.resolveMessageHandlerMemory(historyEvent);
if (strategy != null) {
try {
strategy.handleMessageInternally(historyEvent, sessionContext,cloner);
}catch (Exception e){
logger.error("MessageHandle for class" + historyEvent.getClass().toString(), historyEvent, e);
}
}
}
sessionContext.getRuleflowGroups().clear();
currentThread.setContextClassLoader(old);
return sessionContext;
}
public AbstractMemoryEventHandlerStrategy resolveMessageHandlerMemory(HistoryEvent historyEvent) {
for (AbstractMemoryEventHandlerStrategy strategy : allMemoryStrategies) {
if (strategy.isEventSupported(historyEvent))
return strategy;
}
return null;
}
public void setClassLoader(ClassLoader classLoader) {
this.classLoader=classLoader;
}
}

View file

@ -0,0 +1,24 @@
package org.chtijbug.drools
import java.time.LocalDateTime
class ChtijbugObjectRequest {
var transactionID: String? = null
var transactionStartTimeStamp: LocalDateTime? = null
var transactionEndTimeStamp: LocalDateTime? = null
var processID: String? = null
var containerID: String? = null
var artifactID: String? = null
var groupID: String? = null
var version: String? = null
var objectRequest: Any? = null
var sessionLogging: SessionContext? = null
var disableLogging = false
}

View file

@ -0,0 +1,25 @@
package org.chtijbug.drools
class KieContainerResponse {
enum class STATUS {
ERROR,
SUCCESS
}
var kieContainerUpdate: KieContainerUpdate? = null
var messageError: String? = null
var status: STATUS? = null
var errorMessages: List<String> = ArrayList()
override fun toString(): String {
val sb = StringBuffer("KieContainerResponse{")
sb.append("kieContainerUpdate=").append(kieContainerUpdate)
sb.append(", messageError='").append(messageError).append('\'')
sb.append(", status=").append(status)
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,23 @@
package org.chtijbug.drools
class KieContainerUpdate {
enum class STATUS {
TODEPLOY,
TODELETE
}
var mainClass: String? = null
var groupID: String? = null
var artifactID: String? = null
var processID: String? = null
var projectVersion: String? = null
var containerID: String? = null
var action: STATUS? = null
}

View file

@ -0,0 +1,15 @@
package org.chtijbug.drools
import java.io.Serializable
class ReverseProxyUpdate : Serializable{
var path: String? = null
var tokenUUID: String? = null
var containerID: String? = null
var serverNames: List<String> = ArrayList()
}

View file

@ -0,0 +1,47 @@
package org.chtijbug.drools
import org.chtijbug.drools.logging.*
import java.util.*
class SessionContext {
var sessionExecution: SessionExecution? = null
var processExecution: ProcessExecution? = null
var ruleflowGroups: ArrayList<RuleflowGroup> = ArrayList()
var ruleExecution: RuleExecution? = null
var fireAllRulesExecution: FireAllRulesExecution? = null
var fact: Fact? = null
var groupID: String? = null
var artefactID: String? = null
var version: String? = null
var containerId: String? = null
var serverName: String? = null
var startTime: Date? = null
var stopTime: Date? = null
fun findRuleFlowGroup(name: String): RuleflowGroup? {
var result: RuleflowGroup? = null
for (r in ruleflowGroups) {
if (r.ruleflowGroup != null && r.ruleflowGroup == name) {
result = r
}
}
return result
}
}

View file

@ -0,0 +1,152 @@
package org.chtijbug.drools.entity
import com.fasterxml.jackson.databind.ObjectMapper
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.io.IOException
import java.io.StringWriter
import java.io.Writer
class DroolsFactObject {
val logger: Logger = LoggerFactory.getLogger(DroolsFactObject::class.java)
val serialVersionUID: Long = 8185674445343213645L
@Transient
private var realObject: Any? = null
protected var version: Int = 0
private var fullClassName: String? = null
private var hashCode = 0
private var listfactObjectAttributes: List<DroolsFactObjectAttribute> = ArrayList()
private var realObject_JSON: String? = null
val mapper: ObjectMapper = ObjectMapper()
private var classLoader: ClassLoader? = null
/**
*
*/
constructor() {
realObject = null
}
@Throws(IOException::class)
constructor(realObject: Any?, version: Int) {
this.realObject = realObject
this.version = version
val strWriter: Writer = StringWriter()
mapper.writeValue(strWriter, realObject)
this.realObject_JSON = strWriter.toString()
if (realObject != null) {
this.classLoader = realObject.javaClass.classLoader
}
}
@Throws(ClassNotFoundException::class, IOException::class)
fun updateRealObjectFromJSON() {
if (this.realObject_JSON != null) {
var localClassLoader: ClassLoader? = null
try {
localClassLoader = Thread.currentThread()
.contextClassLoader
} catch (e: ClassCastException) {
logger.info("DroolsFactObject.updateRealObjectFromJSON", e)
}
try {
var targetClass: Class<*>? = null
if (this.classLoader != null) {
Thread.currentThread().contextClassLoader = classLoader
targetClass = classLoader!!.loadClass(this.fullClassName)
}
if (targetClass == null) {
targetClass = Class.forName(this.fullClassName)
}
var result: Any? = null
result = mapper.readValue(this.realObject_JSON, targetClass)
this.realObject = result
} catch (e: ClassNotFoundException) {
logger.error("getRealObjectFromJSON")
} catch (e: IOException) {
e.printStackTrace()
} finally {
if (localClassLoader != null) {
Thread.currentThread().contextClassLoader = localClassLoader
}
}
}
}
fun getRealObjectFromJSON(): Any? {
try {
this.updateRealObjectFromJSON()
} catch (e: ClassNotFoundException) {
logger.error("getRealObjectFromJSON")
} catch (e: IOException) {
e.printStackTrace()
}
return realObject
}
;
fun getRealObject_JSON(): String? {
return realObject_JSON
}
override fun toString(): String {
val sb = StringBuffer()
sb.append("DroolsFactObject")
sb.append("{fullClassName='").append(fullClassName).append('\'')
sb.append(", hashCode=").append(hashCode)
sb.append(", version=").append(version)
sb.append(", listfactObjectAttributes=").append(listfactObjectAttributes)
sb.append("attributes :\n")
for (foa in this.getListfactObjectAttributes()) {
sb.append("- " + foa.attributeType + " " + foa.attributeName + "=" + foa.attributeValue + "\n")
}
sb.append(", realObject=").append(realObject)
sb.append('}')
return sb.toString()
}
fun getObjectVersion(): Int {
return version
}
fun getNextObjectVersion(): Int {
return version + 1
}
fun getListfactObjectAttributes(): List<DroolsFactObjectAttribute> {
return listfactObjectAttributes
}
fun setListfactObjectAttributes(listfactObjectAttributes: List<DroolsFactObjectAttribute>) {
this.listfactObjectAttributes = listfactObjectAttributes
}
fun getFullClassName(): String? {
return fullClassName
}
fun setFullClassName(fullClassName: String?) {
this.fullClassName = fullClassName
}
fun getHashCode(): Int {
return hashCode
}
fun setHashCode(hashCode: Int) {
this.hashCode = hashCode
}
fun getRealObject(): Any? {
return realObject
}
}

View file

@ -0,0 +1,22 @@
package org.chtijbug.drools.entity
import java.io.Serializable
class DroolsFactObjectAttribute : Serializable{
val serialVersionUID: Long = 2251337648100424168L
var attributeName: String? = null
var attributeValue: String? = null
var attributeType: String? = null
/**
*
*/
constructor() {
}
constructor(attributeName: String?, attributeValue: String?, attributeType: String?) {
this.attributeName = attributeName
this.attributeValue = attributeValue
this.attributeType = attributeType
}
}

View file

@ -0,0 +1,30 @@
package org.chtijbug.drools.entity
class DroolsJbpmVariableObject {
@Transient
private var variableValue: Any? = null
private var variableId: String? = null
private var variableInstanceId: String? = null
constructor() {
this.variableValue = null
}
constructor(variableId: String?, variableInstanceId: String?, variableValue: Any?) {
this.variableId = variableId
this.variableInstanceId = variableInstanceId
this.variableValue = variableValue
}
override fun toString(): String {
val sb = StringBuffer("DroolsJbpmVariableObject{")
sb.append("variableId='").append(variableId).append('\'')
sb.append(", variableValue=").append(variableValue)
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,64 @@
package org.chtijbug.drools.entity
import java.io.Serializable
class DroolsNodeInstanceObject : Serializable {
val serialVersionUID: Long = 9121172218519979577L
var id: String? = null
var node: DroolsNodeObject? = null
constructor() {
}
constructor(id: String?, node: DroolsNodeObject?) {
this.id = id
this.node = node
}
companion object {
fun createDroolsNodeInstanceObject(
nodeInstanceId: String?,
nodeObject: DroolsNodeObject?
): DroolsNodeInstanceObject {
return org.chtijbug.drools.entity.DroolsNodeInstanceObject(nodeInstanceId, nodeObject)
}
}
override fun equals(obj: Any?): Boolean {
if (obj == null) {
return false
}
if (javaClass != obj.javaClass) {
return false
}
val other = obj as DroolsNodeInstanceObject
if (if (this.id == null) (other.id != null) else (this.id != other.id)) {
return false
}
if (this.node !== other.node && (this.node == null || this.node != other.node)) {
return false
}
return true
}
override fun hashCode(): Int {
var hash = 5
hash = 71 * hash + (if (this.id != null) id.hashCode() else 0)
hash = 71 * hash + (if (this.node != null) node.hashCode() else 0)
return hash
}
override fun toString(): String {
val sb = StringBuffer()
sb.append("DroolsNodeInstanceObject")
sb.append("{id='").append(id).append('\'')
sb.append(", node=").append(node.toString())
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,82 @@
package org.chtijbug.drools.entity
import java.io.Serializable
class DroolsNodeObject : Serializable {
val serialVersionUID: Long = 2149698078767524188L
var id: String? = null
var nodeType = DroolsNodeType.Other
private var ruleflowGroupName: String? = null
/**
*
*/
constructor() {
}
constructor(id: String?, nodeType: DroolsNodeType) {
this.id = id
this.nodeType = nodeType
}
constructor(id: String?) {
this.id = id
this.nodeType = DroolsNodeType.Other
}
companion object{
fun createDroolsNodeObject(id: String?, nodeType: DroolsNodeType): DroolsNodeObject {
return org.chtijbug.drools.entity.DroolsNodeObject(id, nodeType)
}
}
fun getRuleflowGroupName(): String? {
return ruleflowGroupName
}
fun setRuleflowGroupName(ruleflowGroupName: String?) {
if (ruleflowGroupName != null && ruleflowGroupName.length > 0) {
this.nodeType = DroolsNodeType.RuleNode
}
this.ruleflowGroupName = ruleflowGroupName
}
override fun equals(obj: Any?): Boolean {
if (obj == null) {
return false
}
if (javaClass != obj.javaClass) {
return false
}
val other = obj as DroolsNodeObject
if (if (this.id == null) (other.id != null) else (this.id != other.id)) {
return false
}
return true
}
override fun hashCode(): Int {
var hash = 7
hash = 53 * hash + (if (this.id != null) id.hashCode() else 0)
return hash
}
override fun toString(): String {
val sb = StringBuffer()
sb.append("DroolsNodeObject")
sb.append("{id='").append(id).append('\'')
sb.append("nodeType='").append(nodeType).append('\'')
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,5 @@
package org.chtijbug.drools.entity
enum class DroolsNodeType {
RuleNode, StartNode, SplitNode, JoinNode, EndNode, Other
}

View file

@ -0,0 +1,87 @@
package org.chtijbug.drools.entity
class DroolsProcessInstanceObject {
val serialVersionUID: Long = 5436434746711988139L
var id: String? = null
var process: DroolsProcessObject? = null
var nodeInstances: MutableMap<String?, DroolsNodeInstanceObject>? = null
var name: String? = null
var packageName: String? = null
var type: String? = null
var version: String? = null
/**
*
*/
constructor() {
}
constructor(id: String?, process: DroolsProcessObject) {
this.id = id
this.name = process.name
this.packageName = process.packageName
this.type = process.type
this.version = process.version
this.process = process
nodeInstances = HashMap()
}
companion object {
fun createDroolsProcessInstanceObject(
processInstanceID: String?,
process: DroolsProcessObject
): DroolsProcessInstanceObject {
return org.chtijbug.drools.entity.DroolsProcessInstanceObject(processInstanceID, process)
}
}
fun addDroolsNodeInstanceObject(droolsNodeInstanceObject: DroolsNodeInstanceObject) {
nodeInstances!![droolsNodeInstanceObject.id] = droolsNodeInstanceObject
}
fun getDroolsNodeInstanceObjet(id: String?): DroolsNodeInstanceObject? {
return nodeInstances!![id]
}
override fun equals(obj: Any?): Boolean {
if (obj == null) {
return false
}
if (javaClass != obj.javaClass) {
return false
}
val other = obj as DroolsProcessInstanceObject
if (if (this.id == null) (other.id != null) else (this.id != other.id)) {
return false
}
if (this.process !== other.process && (this.process == null || this.process != other.process)) {
return false
}
return true
}
override fun hashCode(): Int {
var hash = 7
hash = 17 * hash + (if (this.id != null) id.hashCode() else 0)
hash = 17 * hash + (if (this.process != null) process.hashCode() else 0)
return hash
}
override fun toString(): String {
val sb = StringBuffer()
sb.append("DroolsProcessInstanceObject")
sb.append("{id='").append(id).append('\'')
sb.append(", name='").append(name).append('\'')
sb.append(", packageName='").append(packageName).append('\'')
sb.append(", type='").append(type).append('\'')
sb.append(", version='").append(version).append('\'')
sb.append(", process=").append(process)
sb.append(", nodeInstances=").append(nodeInstances)
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,84 @@
package org.chtijbug.drools.entity
class DroolsProcessObject {
val serialVersionUID: Long = 4718079763911002405L
var id: String? = null
var name: String? = null
var packageName: String? = null
var type: String? = null
var version: String? = null
var nodeLists: MutableMap<String?, DroolsNodeObject>? = null
constructor() {
}
constructor(id: String?, name: String?, packageName: String?, type: String?, version: String?) {
this.id = id
this.name = name
this.packageName = packageName
this.type = type
this.version = version
this.nodeLists = HashMap()
}
companion object {
fun createDroolsProcessObject(
id: String?,
processInstanceID: String?,
packageName: String?,
type: String?,
version: String?
): DroolsProcessObject {
return org.chtijbug.drools.entity.DroolsProcessObject(id, processInstanceID, packageName, type, version)
}
}
fun addDroolsNodeObject(droolsNodeObject: DroolsNodeObject) {
nodeLists!![droolsNodeObject.id] = droolsNodeObject
}
fun getDroolsNodeObjet(id: String?): DroolsNodeObject? {
return nodeLists!![id]
}
override fun equals(obj: Any?): Boolean {
if (obj == null) {
return false
}
if (javaClass != obj.javaClass) {
return false
}
val other = obj as DroolsProcessObject
if (if (this.id == null) (other.id != null) else (this.id != other.id)) {
return false
}
return true
}
override fun hashCode(): Int {
var hash = 3
hash = 41 * hash + (if (this.name != null) name.hashCode() else 0)
hash = 41 * hash + (if (this.packageName != null) packageName.hashCode() else 0)
return hash
}
override fun toString(): String {
val sb = StringBuffer()
sb.append("DroolsProcessObject")
sb.append("{id='").append(id).append('\'')
sb.append(", name='").append(name).append('\'')
sb.append(", packageName='").append(packageName).append('\'')
sb.append(", type='").append(type).append('\'')
sb.append(", version='").append(version).append('\'')
sb.append(", nodeLists=").append(nodeLists)
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,25 @@
package org.chtijbug.drools.entity
class DroolsRuleFlowGroupObject {
var ruleFlowInstanceID = 0
var name: String? = null
constructor() {
}
constructor(ruleFlowInstanceID: Int, name: String?) {
this.ruleFlowInstanceID = ruleFlowInstanceID
this.name = name
}
override fun toString(): String {
val sb = StringBuffer()
sb.append("DroolsRuleFlowGroupObject")
sb.append("{ruleFlowInstanceID=").append(ruleFlowInstanceID)
sb.append(", name='").append(name).append('\'')
sb.append('}')
return sb.toString()
}
}

View file

@ -0,0 +1,45 @@
package org.chtijbug.drools.entity
class DroolsRuleObject {
val serialVersionUID: Long = -716077698281963299L
var ruleName: String? = null
var rulePackageName: String? = null
var ruleFlowGroup: String? = null
companion object{
fun createDroolRuleObject(ruleName: String?, rulePackageName: String?): DroolsRuleObject {
return org.chtijbug.drools.entity.DroolsRuleObject(ruleName, rulePackageName)
}
}
/**
*
*/
constructor() {
}
/**
* @param ruleName - the rule name added to the knowledge base
* @param rulePackageName - the package of the rule
*/
protected constructor(ruleName: String?, rulePackageName: String?) {
this.ruleName = ruleName
this.rulePackageName = rulePackageName
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
override fun toString(): String {
return "Rule object with name :" + ruleName
}
}

View file

@ -0,0 +1,25 @@
package org.chtijbug.drools.entity.history
import java.util.concurrent.atomic.AtomicLong
class EventCounter {
private val nextEventId = AtomicLong(1L)
constructor() {
}
companion object{
fun newCounter(): EventCounter {
return org.chtijbug.drools.entity.history.EventCounter()
}
}
fun next(): Long {
return nextEventId.getAndIncrement()
}
fun current(): Long {
return nextEventId.get()
}
}

View file

@ -0,0 +1,43 @@
package org.chtijbug.drools.entity.history
import org.chtijbug.drools.runtime.DroolsChtijbugException
import org.chtijbug.drools.runtime.listener.HistoryListener
import java.io.Serializable
import java.util.*
class HistoryContainer: Serializable {
val serialVersionUID: Long = 5645452451089006572L
var listHistoryEvent: MutableList<HistoryEvent> = LinkedList()
var sessionID: Long? = null
var historylistener: HistoryListener? = null
constructor() {
}
/**
*
*/
constructor(sessionID: Long?, historylistener: HistoryListener?) {
this.sessionID = sessionID
this.historylistener = historylistener
}
fun addHistoryElement(ruleBaseID: Long?, sessionID: Long?, newHistoryElement: HistoryEvent) {
var error: DroolsChtijbugException? = null
newHistoryElement.ruleBaseID = ruleBaseID
newHistoryElement.sessionId = sessionID
try {
if (historylistener != null) {
historylistener!!.fireEvent(newHistoryElement)
}
} catch (e: DroolsChtijbugException) {
error = e
} finally {
if (error != null) {
newHistoryElement.droolsChtijbugException = error
}
listHistoryEvent.add(newHistoryElement)
}
}
}

View file

@ -0,0 +1,33 @@
package org.chtijbug.drools.entity.history
import org.chtijbug.drools.runtime.DroolsChtijbugException
import java.util.*
open class HistoryEvent {
val serialVersionUID: Long = -6640538290066213804L
var dateEvent: Date? = null
var typeEvent: TypeEvent? = null
var eventID: Long? = null
var ruleBaseID: Long? = null
var sessionId: Long? = null
var droolsChtijbugException: DroolsChtijbugException? = null
var knowledgeResources = ArrayList<KnowledgeResource>()
var businessClassLoader: ClassLoader? = null
/**
* Mandatory for GWT Serialization
*/
constructor() {
}
constructor(eventID: Long?, dateEvent: Date?, typeEvent: TypeEvent?) {
this.eventID = eventID
this.dateEvent = dateEvent
this.typeEvent = typeEvent
}
enum class TypeEvent {
Fact, Rule, BPMN, RuleFlowGroup, KnowledgeBaseSingleton, Session
}
}

View file

@ -0,0 +1,25 @@
package org.chtijbug.drools.jms
import org.chtijbug.drools.ReverseProxyUpdate
import org.springframework.jms.core.MessageCreator
import javax.jms.JMSException
import javax.jms.Message
import javax.jms.Session
class ReverseProxyMessageCreator : MessageCreator{
private var reverseProxyUpdate: ReverseProxyUpdate? = null
fun ReverseProxyMessageCreator(reverseProxyUpdate: ReverseProxyUpdate?) {
this.reverseProxyUpdate = reverseProxyUpdate
}
@Throws(JMSException::class)
override fun createMessage(session: Session): Message {
val objectMessage = session.createObjectMessage()
objectMessage.setObject(reverseProxyUpdate)
return objectMessage
}
}

View file

@ -0,0 +1,21 @@
package org.chtijbug.drools.logging
import java.util.*
class Fact {
var realFact: Any? = null
var objectVersion: Int? = null
var fullClassName: String? = null
var modificationDate: Date? = null
var factType: FactType? = null
var eventid: Long? = null
}

View file

@ -0,0 +1,14 @@
package org.chtijbug.drools.logging
enum class FactType {
WHEN, INSERTED, UPDATED_OLDVALUE, UPDATED_NEWVALUE, DELETED, INPUTDATA, OUTPUTDATA;
fun getEnum(factType: String): FactType? {
for (type in entries) {
if (type.name == factType) return type
}
return null
}
}

View file

@ -0,0 +1,26 @@
package org.chtijbug.drools.logging
import java.util.*
class FireAllRulesExecution {
var startDate: Date? = null
var endDate: Date? = null
var nbreRulesFired: Long? = null
var maxNbreRulesDefinedForSession: Long? = null
var executionTime: Long? = null
var startEventID: Long? = null
var fireAllRulesExecutionStatus: FireAllRulesExecutionStatus? = null
var stopEventID: Long? = null
var maxRulesEventID: Long? = null
}

View file

@ -0,0 +1,5 @@
package org.chtijbug.drools.logging
enum class FireAllRulesExecutionStatus {
STARTED, STOPPED, CRASHED, MAXNBRULES
}

View file

@ -0,0 +1,4 @@
package org.chtijbug.drools.logging
class NodeRuntime {
}

View file

@ -0,0 +1,21 @@
package org.chtijbug.drools.logging
class Page {
var currentIndex: Int? = null
var totalCount: Long? = null
/**
* Setting a default value tha we can override
*/
var maxItemPerPage = 5
fun Page() {
/** nop */
}
fun Page(currentIndex: Int?, totalCount: Long?, maxItemPerPage: Int) {
this.currentIndex = currentIndex
this.totalCount = totalCount
this.maxItemPerPage = maxItemPerPage
}
}

View file

@ -0,0 +1,5 @@
package org.chtijbug.drools.logging
enum class PlatformRuntimeEnvironment {
DEV, INT, PROD
}

View file

@ -0,0 +1,14 @@
package org.chtijbug.drools.logging
import java.util.*
class PlatformRuntimeFilter {
var packageName: String? = null
var status: String? = null
var hostname: String? = null
var startDate: Date? = null
var endDate: Date? = null
var onlyRunningInstances: String? = null
var page: Page? = null
}

View file

@ -0,0 +1,12 @@
package org.chtijbug.drools.logging
enum class PlatformRuntimeInstanceStatus {
INITMODE, STARTED, NOT_JOINGNABLE, STOPPED, CRASHED;
fun getEnum(assetStatus: String): PlatformRuntimeInstanceStatus? {
for (status in entries) {
if (status.name == assetStatus) return status
}
return null
}
}

View file

@ -0,0 +1,5 @@
package org.chtijbug.drools.logging
enum class PlatformRuntimeMode {
Debug, platformRuntimeMode, Info
}

View file

@ -0,0 +1,34 @@
package org.chtijbug.drools.logging
import java.util.*
class ProcessExecution {
var processName: String? = null
var startDate: Date? = null
var endDate: Date? = null
var processExecutionStatus: ProcessExecutionStatus? = null
var startEventID: Long? = null
var stopEventID: Long? = null
var ProcessInstanceId: String? = null
var processPackageName: String? = null
var processVersion: String? = null
var processType: String? = null
var processId: String? = null
var ruleflowGroups = LinkedList<RuleflowGroup>()
}

View file

@ -0,0 +1,5 @@
package org.chtijbug.drools.logging
enum class ProcessExecutionStatus {
SESSIONSTARTED, JBPMSTARTED, JBPMSTOPPED, CRASHED
}

View file

@ -0,0 +1,20 @@
package org.chtijbug.drools.logging
import java.util.*
class RuleExecution {
var ruleName: String? = null
var packageName: String? = null
var startDate: Date? = null
var endDate: Date? = null
var startEventID: Long? = null
var stopEventID: Long? = null
var whenFacts: List<Fact> = ArrayList()
var thenFacts: List<Fact> = ArrayList()
}

View file

@ -0,0 +1,24 @@
package org.chtijbug.drools.logging
import java.util.*
class RuleflowGroup {
var ruleflowGroup: String? = null
var ruleExecutionList = LinkedList<RuleExecution>()
var startDate: Date? = null
var endDate: Date? = null
var startEventID: Long? = null
var stopEventID: Long? = null
var ruleflowGroupStatus: RuleflowGroupStatus? = null
}

View file

@ -0,0 +1,5 @@
package org.chtijbug.drools.logging
enum class RuleflowGroupStatus {
STARTED, STOPPED, CRASHED
}

View file

@ -0,0 +1,28 @@
package org.chtijbug.drools.logging
import java.util.*
class SessionExecution {
var id: Long? = null
var sessionId: Long? = null
var startDate: Date? = null
var endDate: Date? = null
var startEventID: Long? = null
var stopEventID: Long? = null
var platformRuntimeMode = PlatformRuntimeMode.Debug
var sessionExecutionStatus: SessionExecutionStatus? = null
var ruleExecutions: List<RuleExecution> = ArrayList()
var processExecutions: List<ProcessExecution> = ArrayList()
var fireAllRulesExecutions: List<FireAllRulesExecution> = ArrayList()
var facts: List<Fact> = ArrayList()
var processingStartDate: Date? = null
var processingStopDate: Date? = null
}

View file

@ -0,0 +1,6 @@
package org.chtijbug.drools.logging
enum class SessionExecutionStatus {
STARTED, DISPOSED, CRASHED
}

View file

@ -0,0 +1,36 @@
package org.chtijbug.drools.runtime
import java.io.Serializable
class DroolsChtijbugException : Exception, Serializable {
companion object{
val insertByReflection: String = "insertByReflection"
val MaxNumberRuleExecutionReached: String = "MaxNumberRuleExecutionReached"
val fireAllRules: String = "fireAllRules"
val KbaseAcquire: String = "KbaseAcquire"
val KbaseNotInitialised: String = "KbaseNotInitialised"
val ErrorToLoadAgent: String = "ErrorToLoadAgent"
val UnknowFileExtension: String = "UnknowFileExtension"
val ErrorRegisteringMBeans: String = ""
val RessourceAlreadyAdded: String = "RessourceAlreadyAdded"
val RessourceDoesNotExist: String = "RessourceNotExisting"
}
var key: String? = null
var Description: String? = null
var originException: java.lang.Exception? = null
constructor() {
}
constructor(key: String, description: String, originException: java.lang.Exception?) : super(
key + description,
originException
) {
this.key = key
Description = description
this.originException = originException
}
}

View file

@ -0,0 +1,14 @@
package org.chtijbug.drools.runtime.listener
import org.chtijbug.drools.entity.history.HistoryEvent
import org.chtijbug.drools.runtime.DroolsChtijbugException
import java.io.Serializable
interface HistoryListener : Serializable {
@Throws(DroolsChtijbugException::class)
open fun fireEvent(newHistoryEvent: HistoryEvent?)
open fun withDetails(): Boolean
open fun setDetails(details: Boolean?)
}

View file

@ -0,0 +1,12 @@
package org.chtijbug.drools.runtimeevent
import com.rits.cloning.Cloner
import org.chtijbug.drools.SessionContext
import org.chtijbug.drools.entity.history.HistoryEvent
interface AbstractMemoryEventHandlerStrategy {
abstract fun handleMessageInternally(historyEvent: HistoryEvent?, sessionContext: SessionContext?, cloner: Cloner?)
abstract fun isEventSupported(historyEvent: HistoryEvent?): Boolean
}

View file

@ -0,0 +1,92 @@
package org.chtijbug.drools.runtimeevent
import com.rits.cloning.Cloner
import com.rits.cloning.ObjenesisInstantiationStrategy
import org.chtijbug.drools.SessionContext
import org.chtijbug.drools.entity.history.HistoryEvent
import org.chtijbug.drools.runtimeevent.impl.fact.*
import org.chtijbug.drools.runtimeevent.impl.knowledgeSession.*
import org.chtijbug.drools.runtimeevent.impl.process.*
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleFiredEventStrategy
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleflowGroupActivatedEventStrategy
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleflowGroupDeactivatedEventStrategy
import org.chtijbug.drools.runtimeevent.impl.rule.BeforeRuleFiredEventStrategy
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import javax.annotation.Resource
class MessageHandlerResolver {
val logger: Logger = LoggerFactory.getLogger(MessageHandlerResolver::class.java)
@Resource
private val allMemoryStrategies: MutableList<AbstractMemoryEventHandlerStrategy> = ArrayList()
private var classLoader: ClassLoader? = null
fun MessageHandlerResolver() {
allMemoryStrategies.add(DeleteFactEventStrategy())
allMemoryStrategies.add(InsertedByRelectionFactEndEventStrategy())
allMemoryStrategies.add(InsertedByRelectionFactStartEventStrategy())
allMemoryStrategies.add(InsertedFactEventStrategy())
allMemoryStrategies.add(UpdatedFactEventStrategy())
allMemoryStrategies.add(KnowledgeSessionCreateEventStrategy())
allMemoryStrategies.add(KnowledgeSessionDisposeEventStrategy())
allMemoryStrategies.add(KnowledgeSessionFireAllRulesAndStartProcessEventStrategy())
allMemoryStrategies.add(KnowledgeSessionFireAllRulesBeginEventStrategy())
allMemoryStrategies.add(KnowledgeSessionFireAllRulesEndEventStrategy())
allMemoryStrategies.add(KnowledgeSessionFireAllRulesMaxRulesEventStrategy())
allMemoryStrategies.add(KnowledgeSessionProcessBeginEventStrategy())
allMemoryStrategies.add(KnowledgeSessionProcessEndEventStrategy())
allMemoryStrategies.add(AfterNodeInstanceTriggeredEventStrategy())
allMemoryStrategies.add(AfterNodeLeftEventStrategy())
allMemoryStrategies.add(AfterProcessEndHistoryEventStrategy())
allMemoryStrategies.add(AfterProcessStartEventStrategy())
allMemoryStrategies.add(AfterVariableChangeEventStrategy())
allMemoryStrategies.add(BeforeNodeInstanceTriggeredEventStrategy())
allMemoryStrategies.add(BeforeNodeLeftEventStrategy())
allMemoryStrategies.add(BeforeProcessEndEventStrategy())
allMemoryStrategies.add(BeforeProcessStartEventStrategy())
allMemoryStrategies.add(BeforeVariableChangeEventStrategy())
allMemoryStrategies.add(AfterRuleFiredEventStrategy())
allMemoryStrategies.add(AfterRuleflowGroupActivatedEventStrategy())
allMemoryStrategies.add(AfterRuleflowGroupDeactivatedEventStrategy())
allMemoryStrategies.add(BeforeRuleFiredEventStrategy())
}
fun getSessionFromHistoryEvent(historyEvents: List<HistoryEvent>): SessionContext {
val currentThread = Thread.currentThread()
val old = currentThread.contextClassLoader
currentThread.contextClassLoader = classLoader
val sessionContext = SessionContext()
val cloner = Cloner(ObjenesisInstantiationStrategy())
for (historyEvent in historyEvents) {
val strategy = this.resolveMessageHandlerMemory(historyEvent)
if (strategy != null) {
try {
strategy.handleMessageInternally(historyEvent, sessionContext, cloner)
} catch (e: Exception) {
logger.error("MessageHandle for class" + historyEvent.javaClass.toString(), historyEvent, e)
}
}
}
sessionContext.ruleflowGroups.clear();
currentThread.contextClassLoader = old
return sessionContext
}
fun resolveMessageHandlerMemory(historyEvent: HistoryEvent?): AbstractMemoryEventHandlerStrategy? {
for (strategy in allMemoryStrategies) {
if (strategy.isEventSupported(historyEvent)) return strategy
}
return null
}
fun setClassLoader(classLoader: ClassLoader?) {
this.classLoader = classLoader
}
}