Initial COMMIT

This commit is contained in:
Nicolas Héron 2018-08-24 18:00:03 +02:00
commit 2fd8b2f53d
254 changed files with 26776 additions and 0 deletions

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.10.0" level="project" />
</component>
</module>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pymma-jbpm-platform-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-common</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,52 @@
/*
* 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.common.date;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 04/06/13
* Time: 16:38
* To change this template use File | Settings | File Templates.
*/
public class DateHelper {
public static String sFormat = "yyyy-MM-dd";
public static Date getDate(String sDate) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
return sdf.parse(sDate);
}
public static Date getDate(String sDate, String anotherFormat)
throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(anotherFormat);
return sdf.parse(sDate);
}
public static String getDate(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
String formatedDate = sdf.format(date);
return formatedDate;
}
public static String getDate(Date date, String anotherFormat) {
SimpleDateFormat sdf = new SimpleDateFormat(anotherFormat);
String formatedDate = sdf.format(date);
return formatedDate;
}
}

View file

@ -0,0 +1,36 @@
/*
* 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.common.jaxb;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.StringWriter;
public final class JAXBContextUtils {
public static <T> String marshallObjectAsString(Class<T> clazz, T object) throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
// output pretty printed
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter writer = new StringWriter();
jaxbMarshaller.marshal(object, writer);
return writer.toString();
}
}

View file

@ -0,0 +1,46 @@
/*
* 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.common.reflection;
import java.lang.reflect.Method;
/**
* Created with IntelliJ IDEA.
* User: samuel
* Date: 26/09/12
* Time: 15:45
*/
public class ReflectionUtils {
/**
* Returns <code>true</code> if the method is a getter meaning :
* <ul>
* <li>method name start with 'get' </li>
* <li>no parameters expected from the method</li>
* <li>the return type of the method is not void</li>
* </ul>
* Otherwise, it will return <code>false</code>
*
* @param method Method
* @return true if the method is a getter. false otherwise.
*/
public static boolean IsGetter(Method method) {
if (!method.getName().startsWith("get")) return false;
if (method.getParameterTypes().length != 0) return false;
if (void.class.equals(method.getReturnType())) return false;
return true;
}
}

View file

@ -0,0 +1,26 @@
package org.chtijbug.drools.common.rest;
public class InputElement {
private String jsonInput;
private String className;
public String getJsonInput() {
return jsonInput;
}
public void setJsonInput(String jsonInput) {
this.jsonInput = jsonInput;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
}

View file

@ -0,0 +1,16 @@
package org.chtijbug.drools.common.rest;
import java.util.List;
public class MultipleInputs {
private List<InputElement> inputElementList;
public List<InputElement> getInputElementList() {
return inputElementList;
}
public void setInputElementList(List<InputElement> inputElementList) {
this.inputElementList = inputElementList;
}
}

View file

@ -0,0 +1,41 @@
/*
* 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.common.jaxb;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class JAXBContextUtilsTest {
@Test
public void testMarshallObjectAsString() throws Exception {
ToTestClass toTestClass = new ToTestClass();
toTestClass.setAttr1("attr1");
toTestClass.setAttr2("attr2");
String toEvaluate = JAXBContextUtils.marshallObjectAsString(ToTestClass.class, toTestClass);
assertThat(toEvaluate).isNotNull();
assertThat(toEvaluate).isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
"<toTestClass>\n" +
" <attr1>attr1</attr1>\n" +
" <attr2>attr2</attr2>\n" +
"</toTestClass>\n");
}
}

View file

@ -0,0 +1,49 @@
/*
* 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.common.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder = {"attr1", "attr2"})
public class ToTestClass {
private String attr1;
private String attr2;
public ToTestClass() {
}
public String getAttr1() {
return attr1;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
}

View file

@ -0,0 +1,64 @@
/*
* 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.common.reflection;
import org.junit.Test;
import java.lang.reflect.Method;
import static org.junit.Assert.*;
/**
* Created with IntelliJ IDEA.
* User: samuel
* Date: 01/10/12
* Time: 09:42
*/
public class ReflectionUtilsTestCase {
@Test
public void runIsGetter() {
try {
Method methodToEval = TestClass.class.getMethod("getProperty");
assertTrue(ReflectionUtils.IsGetter(methodToEval));
methodToEval = TestClass.class.getMethod("execute");
assertFalse(ReflectionUtils.IsGetter(methodToEval));
} catch (NoSuchMethodException e) {
e.printStackTrace();
fail();
}
}
private class TestClass {
private String property;
public String getProperty() {
return property;
}
public void execute() {
}
}
}

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.jboss.resteasy:resteasy-client:3.0.10.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jboss.resteasy:resteasy-jaxrs:3.0.10.Final" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jboss.resteasy:jaxrs-api:3.0.10.Final" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:1.0.1.Final" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: javax.activation:activation:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpclient:4.3.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpcore:4.3.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.6" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.jcip:jcip-annotations:1.0" level="project" />
<orderEntry type="module" module-name="drools-framework-common" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0" level="project" />
</component>
</module>

View file

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-kie-server-client-connector</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--Exclude Local test cases-->
<excludes>
<exclude>**/*LocalTestCase*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.10.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.10.Final</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.jboss.resteasy/resteasy-client -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,74 @@
/*
* 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.generic.restclient;
import org.chtijbug.drools.generic.restclient.rest.GenericlRestAPI;
import org.chtijbug.drools.generic.restclient.rest.UsedRestAPI;
import org.jboss.resteasy.client.jaxrs.BasicAuthentication;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
/**
* Created with IntelliJ IDEA.
* User: samuel
* Date: 09/10/12
* Time: 09:05
*/
public class GenericConnexionConfiguration {
private static ResteasyClient client = null;
private static ResteasyWebTarget target = null;
private String baseUrl;
private String userName;
private String password;
private GenericlRestAPI genericlRestAPI;
public GenericConnexionConfiguration(String baseUrl, String userName, String password) {
this.baseUrl = baseUrl;
this.userName = userName;
this.password = password;
}
public UsedRestAPI getGenericRestAPI() {
GenericlRestAPI restAPI = this.getRealGenericRestAPI();
UsedRestAPI reponse = new GenericRestAPIImpl(restAPI);
return reponse;
}
private GenericlRestAPI getRealGenericRestAPI() {
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target(this.baseUrl);
target.register(new BasicAuthentication(this.userName, this.password));
genericlRestAPI = target.proxy(GenericlRestAPI.class);
return genericlRestAPI;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("SwimmingPoolConnexionConfiguration{");
sb.append("baseUrl='").append(baseUrl).append('\'');
sb.append(", userName='").append(userName).append('\'');
sb.append(", password='").append(password).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,56 @@
package org.chtijbug.drools.generic.restclient;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.chtijbug.drools.generic.restclient.rest.GenericlRestAPI;
import org.chtijbug.drools.generic.restclient.rest.UsedRestAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
* Created by nheron on 12/12/2016.
*/
public class GenericRestAPIImpl implements UsedRestAPI {
private static final Logger logger = LoggerFactory.getLogger(GenericRestAPIImpl.class);
private GenericlRestAPI genericlRestAPI;
private ObjectMapper mapper = new ObjectMapper();
public GenericRestAPIImpl(GenericlRestAPI genericlRestAPI) {
this.genericlRestAPI = genericlRestAPI;
}
@Override
public Object runSession(String id, String processID, String className, Object objectRequest) {
Object response= null;
String responseJson = this.genericlRestAPI.runSession(id, processID, className, objectRequest);
try {
response = mapper.readValue(responseJson, objectRequest.getClass() );
} catch (IOException e) {
logger.error("GenericRestAPIImpl.runSession.readValue", e);
}
return response;
}
@Override
public Object runSessionSessionName(String id, String processID, String className, String sessionName, Object objectRequest) {
Object response = null;
String responseJson = this.genericlRestAPI.runSessionWithName(id, processID, className, sessionName, objectRequest);
try {
response = mapper.readValue(responseJson, objectRequest.getClass());
} catch (IOException e) {
logger.error("GenericRestAPIImpl.runSession.readValue", e);
}
return response;
}
}

View file

@ -0,0 +1,28 @@
package org.chtijbug.drools.generic.restclient.rest;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
public interface GenericlRestAPI {
@POST
@Path("/services/rest/server/containers/instances/generic/run/{id}/{processId}/{className}")
@Produces("application/json")
@Consumes(value = MediaType.APPLICATION_JSON)
String runSession(@PathParam("id") String id,
@PathParam("processId") String processID,
@PathParam("className") String className,
Object objectRequest);
@POST
@Path("/services/rest/server/containers/instances/generic/runSessionName/{id}/{processId}/{className}/{sessionName}")
@Produces("application/json")
@Consumes(value = MediaType.APPLICATION_JSON)
String runSessionWithName(@PathParam("id") String id,
@PathParam("processId") String processID,
@PathParam("className") String className,
@PathParam("sessionName") String sessionName,
Object objectRequest);
}

View file

@ -0,0 +1,17 @@
package org.chtijbug.drools.generic.restclient.rest;
/**
* Created by nheron on 12/12/2016.
*/
public interface UsedRestAPI {
Object runSession(String id,
String processID,
String className,
Object objectRequest);
Object runSessionSessionName(String id,
String processID,
String className,
String sessionName,
Object objectRequest);
}

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.2" level="project" />
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="module" module-name="drools-framework-common" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.4.0" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.10.0.Final" level="project" />
</component>
</module>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-kie-server-extension-interface</artifactId>
<dependencies>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-runtime-entity</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,36 @@
package org.chtijbug.drools.kieserver.extension;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class KieServerAddOnElement {
private List<KieServerGlobalVariableDefinition> kieServerGlobalVariableDefinitions = null;
private List<KieServerLoggingDefinition> kieServerLoggingDefinitions = null;
private List<KieServerListenerDefinition> kieServerListenerDefinitions = null;
private Map<String, Object> globals = new HashMap<>();
public KieServerAddOnElement(List<KieServerGlobalVariableDefinition> kieServerGlobalVariableDefinitions, List<KieServerLoggingDefinition> kieServerLoggingDefinitions, List<KieServerListenerDefinition> kieServerListenerDefinitions) {
this.kieServerGlobalVariableDefinitions = kieServerGlobalVariableDefinitions;
this.kieServerLoggingDefinitions = kieServerLoggingDefinitions;
this.kieServerListenerDefinitions = kieServerListenerDefinitions;
}
public List<KieServerGlobalVariableDefinition> getKieServerGlobalVariableDefinitions() {
return kieServerGlobalVariableDefinitions;
}
public List<KieServerLoggingDefinition> getKieServerLoggingDefinitions() {
return kieServerLoggingDefinitions;
}
public List<KieServerListenerDefinition> getKieServerListenerDefinitions() {
return kieServerListenerDefinitions;
}
public Map<String, Object> getGlobals() {
return globals;
}
}

View file

@ -0,0 +1,9 @@
package org.chtijbug.drools.kieserver.extension;
import java.util.Map;
public interface KieServerGlobalVariableDefinition {
void OnCreateKieBase(Map<String, Object> globals);
void OnDisposeKieBase();
}

View file

@ -0,0 +1,13 @@
package org.chtijbug.drools.kieserver.extension;
import org.kie.api.runtime.KieSession;
public interface KieServerListenerDefinition {
void OnCreateKieBase();
void OnCreateKieSession(KieSession kieSession);
void OnDisposeKieBase();
}

View file

@ -0,0 +1,14 @@
package org.chtijbug.drools.kieserver.extension;
import org.chtijbug.drools.SessionContext;
public interface KieServerLoggingDefinition {
void OnCreateKieBase();
void OnFireAllrulesStart(String groupID, String artifactId, String version, Object inputDataObject);
void OnFireAllrulesEnd(String groupID, String artifactId, String version, Object outputDataObject, SessionContext sessionLogging);
void OnDisposeKieBase();
}

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/src/main/webc-resources/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/src/main/webc-resources" relative="/" />
</webroots>
</configuration>
</facet>
<facet type="web" name="Web2">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/src/main/shared-ee6-ee7-resources/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/src/main/shared-ee6-ee7-resources" relative="/" />
</webroots>
</configuration>
</facet>
<facet type="web" name="Web3">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/target/kie-server/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/target/kie-server" relative="/" />
</webroots>
</configuration>
</facet>
<facet type="ejb" name="EJB">
<configuration>
<descriptors>
<deploymentDescriptor name="ejb-jar.xml" url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/target/kie-server/WEB-INF/ejb-jar.xml" />
</descriptors>
<ejbRoots />
</configuration>
</facet>
<facet type="ejb" name="EJB2">
<configuration>
<descriptors>
<deploymentDescriptor name="ejb-jar.xml" url="file://$MODULE_DIR$/drools-framework-kie-server-webapp/src/main/shared-ee6-ee7-resources/WEB-INF/ejb-jar.xml" />
</descriptors>
<ejbRoots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.4.0" level="project" />
<orderEntry type="module" module-name="drools-framework-kie-server-services-drools" />
<orderEntry type="module" module-name="drools-framework-runtime-base" />
<orderEntry type="library" name="Maven: org.codehaus.jettison:jettison:1.3.1" level="project" />
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
<orderEntry type="module" module-name="kie-server-client" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:1.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="module" module-name="drools-framework-common" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.3" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-feel:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr4-runtime:4.5.3" level="project" />
<orderEntry type="library" name="Maven: org.drools:drlx-parser:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-core:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-backend:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-canonical-model:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-model-compiler:7.10.0.Final" level="project" />
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
<orderEntry type="library" name="Maven: org.kie:kie-ci:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-integration:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-core:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.21" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model-builder:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-builder-support:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings-builder:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-compat:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-aether-provider:3.3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-provider-api:3.0.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.3" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-classworlds:2.5.2" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:3.0.22" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-api:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-util:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-impl:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-connector-basic:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-spi:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-transport-wagon:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-transport-file:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.aether:aether-transport-http:1.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.2" level="project" />
<orderEntry type="library" name="Maven: javax.enterprise:cdi-api:1.0" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:jsr250-api:1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.sisu:org.eclipse.sisu.inject:0.3.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant:1.8.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant-launcher:1.8.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-http:3.0.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-http-shared:3.0.0" level="project" />
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.7.2" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-cipher:1.7" level="project" />
<orderEntry type="library" name="Maven: com.google.inject:guice:no_aop:4.0" level="project" />
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.10" level="project" />
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="module" module-name="kie-server-api" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-commons:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-core:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.4.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-project-datamodel-commons:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-core:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-persistence-xstream:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-persistence-common:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-persistence-jaxb:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:1.0.4.Final" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.2.11" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.11" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1.1" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-model:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.8.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
<orderEntry type="module" module-name="kie-server-services-common" />
<orderEntry type="module" module-name="kie-server-controller-api" />
<orderEntry type="module" module-name="kie-server-common" />
<orderEntry type="library" name="Maven: org.drools:drools-compiler:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:4.4.2" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:2.6.0" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-decisiontables:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-templates:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
<orderEntry type="library" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-bpmn2:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.5_spec:1.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:1.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.6" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.resteasy:resteasy-jaxrs:3.0.24.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:1.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:1.0.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.resteasy:resteasy-jaxb-provider:3.0.24.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.resteasy:resteasy-jackson-provider:3.0.24.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.9" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.13" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.jackson:jackson-jaxrs:1.9.13" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.jackson:jackson-xc:1.9.13" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="module" module-name="kie-server-services-drools" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-project-datamodel-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-workbench-models-commons:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.uberfire:uberfire-commons:2.7.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-jms-client:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-core-client:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.jgroups:jgroups:3.6.13.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-commons:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-json_1.0_spec:1.0-alpha-1" level="project" />
<orderEntry type="library" name="Maven: org.apache.johnzon:johnzon-core:0.9.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-selector:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-marshalling:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-common:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.jsinterop:jsinterop-annotations:1.0.1" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai.reflections:reflections:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: de.benediktmeurer.gwt-slf4j:gwt-slf4j:0.0.2" level="project" />
<orderEntry type="library" name="Maven: com.google.elemental2:elemental2-dom:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: com.google.jsinterop:base:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: com.google.elemental2:elemental2-core:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: com.google.elemental2:elemental2-promise:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-config:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-codegen:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-codegen-gwt:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-epoll:linux-x86_64:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-kqueue:osx-x86_64:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-http:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-workbench-models-datamodel-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-workbench-models-guided-dtable:7.10.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.drools:drools-workbench-models-guided-dtree:7.10.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.drools:drools-workbench-models-guided-scorecard:7.10.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.drools:kie-pmml:7.10.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.drools:drools-scorecards:7.10.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.drools:drools-workbench-models-guided-template:7.10.0.Final" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.drools:drools-workbench-models-test-scenarios:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="kie-server-rest-common" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.15" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.2" level="project" />
<orderEntry type="module" module-name="drools-framework-kie-server-extension-interface" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
</component>
</module>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-kie-server-rest-drools</artifactId>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-services-drools</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<!--dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-runtime-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-runtime-entity</artifactId>
<version>${project.version}</version>
</dependency-->
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-api</artifactId>
<exclusions>
<exclusion>
<artifactId>jackson-core-asl</artifactId>
<groupId>org.codehaus.jackson</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-mapper-asl</artifactId>
<groupId>org.codehaus.jackson</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-services-common</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-services-drools</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-rest-common</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-extension-interface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,44 @@
package org.chtijbug.drools.kieserver.drools.rest;
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
import org.kie.server.services.api.KieServerApplicationComponentsService;
import org.kie.server.services.api.KieServerRegistry;
import org.kie.server.services.api.SupportedTransports;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class GenericKieServerApplicationComponentsService implements KieServerApplicationComponentsService {
private static final String OWNER_EXTENSION = "DroolsFramework";
public Collection<Object> getAppComponents(String extension, SupportedTransports type, Object... services) {
// skip calls from other than owning extension
if (!OWNER_EXTENSION.equals(extension)) {
return Collections.emptyList();
}
DroolsChtijbugRulesExecutionService rulesExecutionService = null;
KieServerRegistry context = null;
for (Object object : services) {
if (DroolsChtijbugRulesExecutionService.class.isAssignableFrom(object.getClass())) {
DroolsChtijbugRulesExecutionService droolsFrameworkRulesExecutionService = (DroolsChtijbugRulesExecutionService) object;
context = droolsFrameworkRulesExecutionService.getContext();
rulesExecutionService = droolsFrameworkRulesExecutionService;
continue;
}
}
List<Object> components = new ArrayList<Object>(1);
if (SupportedTransports.REST.equals(type)) {
components.add(new GenericResource(rulesExecutionService, context));
}
return components;
}
}

View file

@ -0,0 +1,259 @@
package org.chtijbug.drools.kieserver.drools.rest;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.FileUtils;
import org.chtijbug.drools.common.rest.InputElement;
import org.chtijbug.drools.common.rest.MultipleInputs;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
import org.kie.server.services.api.KieContainerInstance;
import org.kie.server.services.api.KieServerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@Path("server/containers/instances/generic/")
public class GenericResource {
private static final Logger logger = LoggerFactory.getLogger(GenericResource.class);
private DroolsChtijbugRulesExecutionService rulesExecutionService;
private KieServerRegistry registry;
private ObjectMapper mapper = new ObjectMapper();
public GenericResource() {
}
public GenericResource(DroolsChtijbugRulesExecutionService rulesExecutionService, KieServerRegistry registry) {
this.rulesExecutionService = rulesExecutionService;
this.registry = registry;
}
private Class getClassFromName(Set<Class<?>> classes, String name) {
Class result = null;
for (Class c : classes) {
if (c.getCanonicalName() != null
&& c.getCanonicalName().equals(name)) {
result = c;
break;
}
}
return result;
}
@POST
@Path("/runMultiple/{id}/{processId}/{className}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Object runSessionMaps(@PathParam("id") String id,
@PathParam("processId") String processID,
MultipleInputs objectRequest) {
ClassLoader localClassLoader = null;
Object response = null;
try {
localClassLoader = Thread.currentThread()
.getContextClassLoader();
} catch (ClassCastException e) {
logger.info("GenericResource.runSession", e);
}
try {
Map<String, Object> newInput = new HashMap<>();
KieContainerInstance kci = registry.getContainer(id);
Set<Class<?>> classes = kci.getExtraClasses();
for (InputElement element : objectRequest.getInputElementList()) {
Class foundClass = this.getClassFromName(classes, element.getClassName());
if (foundClass != null) {
ClassLoader classLoader = foundClass.getClassLoader();
Object input = mapper.readValue(element.getJsonInput(), classLoader.loadClass(element.getClassName()));
newInput.put(element.getClassName(), input);
}
}
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
chtijbugObjectRequest.setObjectRequest(newInput);
KieServerAddOnElement kieServerAddOnElement = rulesExecutionService.getKieServerAddOnElement();
if (kieServerAddOnElement != null) {
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnFireAllrulesStart(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), newInput);
}
}
ChtijbugObjectRequest chtijbutObjectResponse = rulesExecutionService.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID);
/**
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
*/
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
sessionExecution.getFacts().clear();
if (kieServerAddOnElement != null) {
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnFireAllrulesEnd(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), chtijbutObjectResponse.getObjectRequest(), chtijbutObjectResponse.getSessionLogging());
}
}
response = chtijbutObjectResponse.getObjectRequest();
//response.setSessionLogging(jsonInString);
logger.debug("Returning OK response with content '{}'", response);
return response;
} catch (Exception e) {
// in case marshalling failed return the FireAllRulesAndStartProcess container response to keep backward compatibility
String responseMessage = "Execution failed with error : " + e.getMessage();
logger.debug("Returning Failure response with content '{}'", responseMessage);
return objectRequest;
} finally {
if (localClassLoader != null) {
Thread.currentThread().setContextClassLoader(localClassLoader);
}
}
}
/**
@POST
@Path("/run/{id}/{sessionId}/{processId}/{className}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Object runSessionStatefull(@PathParam("id") String id,
@PathParam("sessionId") String sessionID,
@PathParam("processId") String processId,
@PathParam("className") String className,
String objectRequest) {
}
@POST
@Path("/run/{id}/{sessionId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Object deleteSessionStatefull(@PathParam("id") String id,
@PathParam("sessionId") String sessionID) {
}
**/
@POST
@Path("/run/{id}/{processId}/{className}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Object runSession(@PathParam("id") String id,
@PathParam("processId") String processID,
@PathParam("className") String className,
String objectRequest) {
ClassLoader localClassLoader = null;
Object response = null;
try {
localClassLoader = Thread.currentThread()
.getContextClassLoader();
} catch (ClassCastException e) {
logger.info("GenericResource.runSession", e);
}
try {
KieContainerInstance kci = registry.getContainer(id);
Set<Class<?>> classes = kci.getExtraClasses();
Class foundClass = this.getClassFromName(classes, className);
if (foundClass != null) {
ClassLoader classLoader = foundClass.getClassLoader();
Object input = mapper.readValue(objectRequest, classLoader.loadClass(className));
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
chtijbugObjectRequest.setObjectRequest(input);
KieServerAddOnElement kieServerAddOnElement = rulesExecutionService.getKieServerAddOnElement();
if (kieServerAddOnElement != null) {
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnFireAllrulesStart(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), input);
}
}
ChtijbugObjectRequest chtijbutObjectResponse = rulesExecutionService.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID);
/**
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
*/
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
sessionExecution.getFacts().clear();
if (kieServerAddOnElement != null) {
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnFireAllrulesEnd(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), chtijbutObjectResponse.getObjectRequest(), chtijbutObjectResponse.getSessionLogging());
}
}
String fileTemp = System.getProperty("org.chtijbug.server.tracedir");
if (fileTemp != null) {
String jsonInString = mapper.writeValueAsString(chtijbutObjectResponse.getSessionLogging());
File traceFile = new File(fileTemp + "/" + UUID.randomUUID().toString());
FileUtils.writeStringToFile(traceFile, jsonInString);
}
response = chtijbutObjectResponse.getObjectRequest();
}
//response.setSessionLogging(jsonInString);
logger.debug("Returning OK response with content '{}'", response);
return response;
} catch (Exception e) {
// in case marshalling failed return the FireAllRulesAndStartProcess container response to keep backward compatibility
String responseMessage = "Execution failed with error : " + e.getMessage();
logger.debug("Returning Failure response with content '{}'", responseMessage);
return objectRequest;
} finally {
if (localClassLoader != null) {
Thread.currentThread().setContextClassLoader(localClassLoader);
}
}
}
@POST
@Path("/runSessionName/{id}/{processId}/{className}/{sessionName}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Object runSessionWithName(@PathParam("id") String id,
@PathParam("processId") String processID,
@PathParam("className") String className,
@PathParam("sessionName") String sessionName,
String objectRequest) {
ClassLoader localClassLoader = null;
Object response = null;
try {
localClassLoader = Thread.currentThread()
.getContextClassLoader();
} catch (ClassCastException e) {
logger.info("GenericResource.runSessionWithName", e);
}
try {
KieContainerInstance kci = registry.getContainer(id);
Set<Class<?>> classes = kci.getExtraClasses();
Class foundClass = this.getClassFromName(classes, className);
if (foundClass != null) {
ClassLoader classLoader = foundClass.getClassLoader();
Object input = mapper.readValue(objectRequest, classLoader.loadClass(className));
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
chtijbugObjectRequest.setObjectRequest(input);
ChtijbugObjectRequest chtijbutObjectResponse = rulesExecutionService.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, sessionName);
ObjectMapper mapper = new ObjectMapper();
//String jsonInString = mapper.writeValueAsString(chtijbutObjectResponse.getSessionLogging());
response = chtijbutObjectResponse.getObjectRequest();
}
//response.setSessionLogging(jsonInString);
logger.debug("Returning OK response with content '{}'", objectRequest);
return response;
} catch (Exception e) {
// in case marshalling failed return the FireAllRulesAndStartProcess container response to keep backward compatibility
String responseMessage = "Execution failed with error : " + e.getMessage();
logger.debug("Returning Failure response with content '{}'", responseMessage);
return objectRequest;
} finally {
if (localClassLoader != null) {
Thread.currentThread().setContextClassLoader(localClassLoader);
}
}
}
}

View file

@ -0,0 +1 @@
org.chtijbug.drools.kieserver.drools.rest.GenericKieServerApplicationComponentsService

View file

@ -0,0 +1,195 @@
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id origin-repository.jboss.org @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id chtijbug-release @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id chtijbug-snapshot @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id maven-central @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id origin-repository.jboss.org @ /Users/nheron/.m2/settings.xml
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] ---< com.pymmasoftware.jbpm:drools-framework-kie-server-rest-drools >---
[INFO] Building drools-framework-kie-server-rest-drools 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ drools-framework-kie-server-rest-drools ---
[INFO] com.pymmasoftware.jbpm:drools-framework-kie-server-rest-drools:jar:1.0-SNAPSHOT
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.0:compile
[INFO] +- com.pymmasoftware.jbpm:drools-framework-kie-server-services-drools:jar:1.0-SNAPSHOT:compile
[INFO] | \- org.kie:kie-ci:jar:7.10.0.Final:compile
[INFO] | +- org.kie.soup:kie-soup-maven-integration:jar:7.10.0.Final:compile
[INFO] | +- org.apache.maven:maven-artifact:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-core:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-repository-metadata:jar:3.3.9:compile
[INFO] | | +- org.codehaus.plexus:plexus-interpolation:jar:1.21:compile
[INFO] | | \- org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
[INFO] | +- org.apache.maven:maven-model:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-model-builder:jar:3.3.9:compile
[INFO] | | \- org.apache.maven:maven-builder-support:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-plugin-api:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-settings:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-settings-builder:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-compat:jar:3.3.9:compile
[INFO] | +- org.apache.maven:maven-aether-provider:jar:3.3.9:compile
[INFO] | +- org.apache.maven.wagon:wagon-provider-api:jar:3.0.0:compile
[INFO] | +- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[INFO] | +- org.codehaus.plexus:plexus-classworlds:jar:2.5.2:compile
[INFO] | +- org.codehaus.plexus:plexus-utils:jar:3.0.22:compile
[INFO] | +- org.eclipse.aether:aether-api:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-util:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-impl:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-connector-basic:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-spi:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-transport-wagon:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-transport-file:jar:1.1.0:compile
[INFO] | +- org.eclipse.aether:aether-transport-http:jar:1.1.0:compile
[INFO] | +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.2:compile
[INFO] | | +- javax.enterprise:cdi-api:jar:1.0:compile
[INFO] | | | \- javax.annotation:jsr250-api:jar:1.0:compile
[INFO] | | \- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.2:compile
[INFO] | +- org.apache.ant:ant:jar:1.8.4:compile
[INFO] | | \- org.apache.ant:ant-launcher:jar:1.8.4:compile
[INFO] | +- org.apache.maven.wagon:wagon-http:jar:3.0.0:compile
[INFO] | | \- org.apache.maven.wagon:wagon-http-shared:jar:3.0.0:compile
[INFO] | | \- org.jsoup:jsoup:jar:1.7.2:compile
[INFO] | +- org.sonatype.plexus:plexus-cipher:jar:1.7:compile
[INFO] | \- com.google.inject:guice:jar:no_aop:4.0:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- com.pymmasoftware.jbpm:drools-framework-runtime-base:jar:1.0-SNAPSHOT:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.3.1:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | +- org.jbpm:jbpm-bpmn2:jar:7.10.0.Final:compile
[INFO] | | \- org.jbpm:jbpm-flow-builder:jar:7.10.0.Final:compile
[INFO] | +- org.kie.server:kie-server-client:jar:7.10.0.Final:compile
[INFO] | | +- org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar:1.0.1.Final:compile
[INFO] | | +- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] | | \- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
[INFO] | +- org.jbpm:jbpm-flow:jar:7.10.0.Final:compile
[INFO] | | +- org.kie:kie-dmn-feel:jar:7.10.0.Final:compile
[INFO] | | | +- org.antlr:antlr4-runtime:jar:4.5.3:compile
[INFO] | | | \- org.drools:drlx-parser:jar:7.10.0.Final:compile
[INFO] | | \- org.kie:kie-dmn-core:jar:7.10.0.Final:compile
[INFO] | | +- org.kie:kie-dmn-backend:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-canonical-model:jar:7.10.0.Final:compile
[INFO] | | \- org.drools:drools-model-compiler:jar:7.10.0.Final:compile
[INFO] | +- org.drools:drools-workbench-models-guided-dtable:jar:7.10.0.Final:compile
[INFO] | | \- org.uberfire:uberfire-commons:jar:2.7.0.Final:compile
[INFO] | | +- org.apache.activemq:artemis-jms-client:jar:2.3.0:compile
[INFO] | | | +- org.apache.activemq:artemis-core-client:jar:2.3.0:compile
[INFO] | | | | +- org.jgroups:jgroups:jar:3.6.13.Final:compile
[INFO] | | | | +- org.apache.activemq:artemis-commons:jar:2.3.0:compile
[INFO] | | | | +- org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:compile
[INFO] | | | | \- org.apache.johnzon:johnzon-core:jar:0.9.5:compile
[INFO] | | | \- org.apache.activemq:artemis-selector:jar:2.3.0:compile
[INFO] | | +- org.jboss.errai:errai-marshalling:jar:4.3.2.Final:compile
[INFO] | | | +- org.jboss.errai:errai-common:jar:4.3.2.Final:compile
[INFO] | | | | +- com.google.jsinterop:jsinterop-annotations:jar:1.0.1:compile
[INFO] | | | | +- org.jboss.errai.reflections:reflections:jar:4.3.2.Final:compile
[INFO] | | | | +- de.benediktmeurer.gwt-slf4j:gwt-slf4j:jar:0.0.2:compile
[INFO] | | | | \- com.google.elemental2:elemental2-dom:jar:1.0.0-beta-1:compile
[INFO] | | | | +- com.google.jsinterop:base:jar:1.0.0-beta-1:compile
[INFO] | | | | +- com.google.elemental2:elemental2-core:jar:1.0.0-beta-1:compile
[INFO] | | | | \- com.google.elemental2:elemental2-promise:jar:1.0.0-beta-1:compile
[INFO] | | | +- org.jboss.errai:errai-config:jar:4.3.2.Final:compile
[INFO] | | | +- org.jboss.errai:errai-codegen:jar:4.3.2.Final:compile
[INFO] | | | \- org.jboss.errai:errai-codegen-gwt:jar:4.3.2.Final:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.1.16.Final:compile
[INFO] | | | \- io.netty:netty-common:jar:4.1.16.Final:compile
[INFO] | | +- io.netty:netty-transport:jar:4.1.16.Final:compile
[INFO] | | | \- io.netty:netty-resolver:jar:4.1.16.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.16.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.16.Final:compile
[INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.16.Final:compile
[INFO] | | | \- io.netty:netty-transport-native-unix-common:jar:4.1.16.Final:compile
[INFO] | | +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.16.Final:compile
[INFO] | | \- io.netty:netty-codec-http:jar:4.1.16.Final:compile
[INFO] | +- com.google.guava:guava:jar:13.0.1:compile
[INFO] | \- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] +- com.pymmasoftware.jbpm:drools-framework-common:jar:1.0-SNAPSHOT:compile
[INFO] | \- junit:junit:jar:4.12:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- com.pymmasoftware.jbpm:drools-framework-runtime-entity:jar:1.0-SNAPSHOT:compile
[INFO] +- com.thoughtworks.xstream:xstream:jar:1.4.10:compile
[INFO] | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- org.kie:kie-api:jar:7.10.0.Final:compile
[INFO] | \- org.kie.soup:kie-soup-maven-support:jar:7.10.0.Final:compile
[INFO] +- org.kie:kie-internal:jar:7.10.0.Final:compile
[INFO] +- commons-io:commons-io:jar:2.1:compile
[INFO] +- org.kie.server:kie-server-api:jar:7.10.0.Final:compile
[INFO] | +- org.kie.soup:kie-soup-commons:jar:7.10.0.Final:compile
[INFO] | +- org.optaplanner:optaplanner-core:jar:7.10.0.Final:compile
[INFO] | | \- org.apache.commons:commons-math3:jar:3.4.1:compile
[INFO] | +- org.optaplanner:optaplanner-persistence-xstream:jar:7.10.0.Final:compile
[INFO] | | \- org.optaplanner:optaplanner-persistence-common:jar:7.10.0.Final:compile
[INFO] | +- org.optaplanner:optaplanner-persistence-jaxb:jar:7.10.0.Final:compile
[INFO] | | +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.4.Final:compile
[INFO] | | \- javax.activation:activation:jar:1.1.1:compile
[INFO] | +- org.kie:kie-dmn-api:jar:7.10.0.Final:compile
[INFO] | | \- org.kie:kie-dmn-model:jar:7.10.0.Final:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.9:compile
[INFO] | \- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] +- org.kie.server:kie-server-services-common:jar:7.10.0.Final:compile
[INFO] | +- org.kie.server:kie-server-controller-api:jar:7.10.0.Final:compile
[INFO] | +- org.kie.server:kie-server-common:jar:7.10.0.Final:compile
[INFO] | +- org.drools:drools-decisiontables:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-templates:jar:7.10.0.Final:compile
[INFO] | | +- org.apache.poi:poi-ooxml:jar:3.15:compile
[INFO] | | | +- org.apache.poi:poi-ooxml-schemas:jar:3.15:compile
[INFO] | | | | \- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] | | | \- com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | \- org.apache.poi:poi:jar:3.15:compile
[INFO] | | \- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] | +- org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.5_spec:jar:1.0.1.Final:compile
[INFO] | | \- org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar:1.0.0.Final:compile
[INFO] | +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.24.Final:runtime
[INFO] | | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:runtime
[INFO] | | \- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar:1.0.0.Final:compile
[INFO] | +- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0.24.Final:runtime
[INFO] | +- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.24.Final:runtime
[INFO] | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.9:runtime
[INFO] | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:runtime
[INFO] | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.13:runtime
[INFO] | | \- org.codehaus.jackson:jackson-xc:jar:1.9.13:runtime
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] +- org.kie.server:kie-server-services-drools:jar:7.10.0.Final:compile
[INFO] | +- org.kie.soup:kie-soup-project-datamodel-api:jar:7.10.0.Final:compile
[INFO] | +- org.drools:drools-workbench-models-commons:jar:7.10.0.Final:compile
[INFO] | +- org.drools:drools-workbench-models-datamodel-api:jar:7.10.0.Final:compile
[INFO] | +- org.drools:drools-workbench-models-guided-dtree:jar:7.10.0.Final:runtime
[INFO] | +- org.drools:drools-workbench-models-guided-scorecard:jar:7.10.0.Final:runtime
[INFO] | | +- org.drools:kie-pmml:jar:7.10.0.Final:runtime
[INFO] | | \- org.drools:drools-scorecards:jar:7.10.0.Final:runtime
[INFO] | +- org.drools:drools-workbench-models-guided-template:jar:7.10.0.Final:runtime
[INFO] | \- org.drools:drools-workbench-models-test-scenarios:jar:7.10.0.Final:runtime
[INFO] +- org.kie.server:kie-server-rest-common:jar:7.10.0.Final:compile
[INFO] | \- io.swagger:swagger-annotations:jar:1.5.15:compile
[INFO] +- org.drools:drools-core:jar:7.10.0.Final:compile
[INFO] | +- org.mvel:mvel2:jar:2.4.0.Final:compile
[INFO] | +- org.kie.soup:kie-soup-project-datamodel-commons:jar:7.10.0.Final:compile
[INFO] | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.drools:drools-compiler:jar:7.10.0.Final:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.5.2:compile
[INFO] | +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] | \- com.google.protobuf:protobuf-java:jar:2.6.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] +- com.pymmasoftware.jbpm:drools-framework-kie-server-extension-interface:jar:1.0-SNAPSHOT:compile
[INFO] \- org.reflections:reflections:jar:0.9.11:compile
[INFO] \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.813 s
[INFO] Finished at: 2018-08-21T10:30:15+02:00
[INFO] ------------------------------------------------------------------------

View file

@ -0,0 +1,10 @@
/target
/local
# Eclipse, Netbeans and IntelliJ files
/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-kie-server-services-drools</artifactId>
<name>KIE :: Execution Server :: Services :: Drools Framework Extension</name>
<description>KIE Drools FrameworkExecution Server Extension</description>
<dependencies>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-runtime-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-runtime-entity</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-services-common</artifactId>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-extension-interface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,26 @@
package org.chtijbug.kieserver.services.drools;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by nheron on 07/07/2016.
*/
public class ChtijbugHistoryListener implements HistoryListener {
private List<HistoryEvent> historyEventLinkedList = new ArrayList<>();
public List<HistoryEvent> getHistoryEventLinkedList() {
return historyEventLinkedList;
}
@Override
public void fireEvent(HistoryEvent newHistoryEvent) throws DroolsChtijbugException {
historyEventLinkedList.add(newHistoryEvent);
}
}

View file

@ -0,0 +1,29 @@
package org.chtijbug.kieserver.services.drools;
import org.chtijbug.drools.SessionContext;
/**
* Created by nheron on 07/07/2016.
*/
public class ChtijbugObjectRequest {
private Object objectRequest;
private SessionContext sessionLogging;
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;
}
}

View file

@ -0,0 +1,250 @@
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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.kieserver.services.drools;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
import org.kie.api.remote.Remotable;
import org.kie.scanner.KieModuleMetaData;
import org.kie.server.api.KieServerConstants;
import org.kie.server.services.api.*;
import org.kie.server.services.impl.KieServerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.lang.annotation.Annotation;
import java.util.*;
public class DroolsChtijbugKieServerExtension implements KieServerExtension {
public static final String EXTENSION_NAME = "DroolsFramework";
private static final Logger logger = LoggerFactory.getLogger(DroolsChtijbugKieServerExtension.class);
private static final Boolean disabled = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_SERVER_EXT_DISABLED, "false"));
private static final Boolean filterRemoteable = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_FILTER_REMOTEABLE_CLASSES, "false"));
private DroolsChtijbugRulesExecutionService rulesExecutionService;
private KieServerRegistry registry;
private List<Object> services = new ArrayList<Object>();
private KieServerAddOnElement kieServerAddOnElement = null;
@Override
public boolean isInitialized() {
return true;
}
@Override
public boolean isActive() {
return disabled == false;
}
@Override
public void init(KieServerImpl kieServer, KieServerRegistry registry) {
initExtensionsList();
this.rulesExecutionService = new DroolsChtijbugRulesExecutionService(registry, this.kieServerAddOnElement);
this.registry = registry;
services.add(rulesExecutionService);
}
private void initExtensionsList() {
List<KieServerGlobalVariableDefinition> kieServerGlobalVariableDefinitions = new ArrayList<>();
ServiceLoader<KieServerGlobalVariableDefinition> serverExtensions1 = ServiceLoader.load(KieServerGlobalVariableDefinition.class);
for (KieServerGlobalVariableDefinition loadedImpl : serverExtensions1) {
kieServerGlobalVariableDefinitions.add(loadedImpl);
}
List<KieServerLoggingDefinition> kieServerLoggingDefinitions = new ArrayList<>();
ServiceLoader<KieServerLoggingDefinition> serverExtensions2 = ServiceLoader.load(KieServerLoggingDefinition.class);
for (KieServerLoggingDefinition loadedImpl : serverExtensions2) {
kieServerLoggingDefinitions.add(loadedImpl);
}
List<KieServerListenerDefinition> kieServerListenerDefinitions = new ArrayList<>();
ServiceLoader<KieServerListenerDefinition> serverExtensions3 = ServiceLoader.load(KieServerListenerDefinition.class);
for (KieServerListenerDefinition loadedImpl : serverExtensions3) {
kieServerListenerDefinitions.add(loadedImpl);
}
this.kieServerAddOnElement = new KieServerAddOnElement(kieServerGlobalVariableDefinitions, kieServerLoggingDefinitions, kieServerListenerDefinitions);
}
@Override
public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
// no-op?
}
@Override
public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
// do any other bootstrapping rule service requires
Set<Class<?>> extraClasses = new HashSet<Class<?>>();
// create kbases so declared types can be created
Collection<String> kbases = kieContainerInstance.getKieContainer().getKieBaseNames();
for (String kbase : kbases) {
kieContainerInstance.getKieContainer().getKieBase(kbase);
}
KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA);
Collection<String> packages = metaData.getPackages();
for (String p : packages) {
Collection<String> classes = metaData.getClasses(p);
for (String c : classes) {
String type = p + "." + c;
try {
logger.debug("Adding {} type into extra jaxb classes set", type);
Class<?> clazz = Class.forName(type, true, kieContainerInstance.getKieContainer().getClassLoader());
addExtraClass(extraClasses, clazz, filterRemoteable);
logger.debug("Added {} type into extra jaxb classes set", type);
} catch (ClassNotFoundException e) {
logger.warn("Unable to create instance of type {} due to {}", type, e.getMessage());
logger.debug("Complete stack trace for exception while creating type {}", type, e);
} catch (Throwable e) {
logger.warn("Unexpected error while create instance of type {} due to {}", type, e.getMessage());
logger.debug("Complete stack trace for unknown error while creating type {}", type, e);
}
}
}
kieContainerInstance.addExtraClasses(extraClasses);
}
@Override
public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
this.disposeContainer(id,kieContainerInstance,map);
this.createContainer(id,kieContainerInstance,map);
}
@Override
public boolean isUpdateContainerAllowed(String s, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
System.out.println("isUpdateContainerAllowed");
return true;
}
@Override
public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
System.out.println("disposeContainer");
if (kieServerAddOnElement != null) {
for (KieServerGlobalVariableDefinition kieServerGlobalVariableDefinition : kieServerAddOnElement.getKieServerGlobalVariableDefinitions()) {
kieServerGlobalVariableDefinition.OnDisposeKieBase();
}
for (KieServerListenerDefinition kieServerListenerDefinition : kieServerAddOnElement.getKieServerListenerDefinitions()) {
kieServerListenerDefinition.OnDisposeKieBase();
}
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnDisposeKieBase();
}
}
}
@Override
public List<Object> getAppComponents(SupportedTransports type) {
ServiceLoader<KieServerApplicationComponentsService> appComponentsServices
= ServiceLoader.load(KieServerApplicationComponentsService.class);
List<Object> appComponentsList = new ArrayList<Object>();
Object[] services = {
rulesExecutionService,
registry
};
for (KieServerApplicationComponentsService appComponentsService : appComponentsServices) {
appComponentsList.addAll(appComponentsService.getAppComponents(EXTENSION_NAME, type, services));
}
return appComponentsList;
}
@Override
public <T> T getAppComponents(Class<T> serviceType) {
if (serviceType.isAssignableFrom(rulesExecutionService.getClass())) {
return (T) rulesExecutionService;
}
return null;
}
@Override
public String getImplementedCapability() {
return KieServerConstants.CAPABILITY_BRM;
}
@Override
public List<Object> getServices() {
return services;
}
@Override
public String getExtensionName() {
return EXTENSION_NAME;
}
@Override
public Integer getStartOrder() {
return 0;
}
@Override
public String toString() {
return EXTENSION_NAME + " KIE Server extension";
}
protected void addExtraClass(Set<Class<?>> extraClasses, Class classToAdd, boolean filtered) {
if (classToAdd.isInterface()
|| classToAdd.isAnnotation()
|| classToAdd.isLocalClass()
|| classToAdd.isMemberClass()) {
return;
}
if (filtered) {
boolean jaxbClass = false;
boolean remoteableClass = false;
// @XmlRootElement and @XmlType may be used with inheritance
for (Annotation anno : classToAdd.getAnnotations()) {
if (XmlRootElement.class.equals(anno.annotationType())) {
jaxbClass = true;
break;
}
if (XmlType.class.equals(anno.annotationType())) {
jaxbClass = true;
break;
}
}
// @Remotable is not inheritable, and may not be used as such
for (Annotation anno : classToAdd.getDeclaredAnnotations()) {
if (Remotable.class.equals(anno.annotationType())) {
remoteableClass = true;
break;
}
}
if (jaxbClass || remoteableClass) {
extraClasses.add(classToAdd);
}
} else {
extraClasses.add(classToAdd);
}
}
}

View file

@ -0,0 +1,126 @@
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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.kieserver.services.drools;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBasePackage;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.drools.runtime.impl.RuleBaseSingleton;
import org.chtijbug.drools.runtimeevent.MessageHandlerResolver;
import org.kie.api.runtime.KieContainer;
import org.kie.server.services.api.KieContainerInstance;
import org.kie.server.services.api.KieServerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Direct rules execution service that allow use of typed objects instead of string only
*/
public class DroolsChtijbugRulesExecutionService {
private static final Logger logger = LoggerFactory.getLogger(DroolsChtijbugRulesExecutionService.class);
private KieServerRegistry context;
private RuleBasePackage ruleBasePackage = null;
private MessageHandlerResolver messageHandlerResolver;
private int MaxNumberRulesToExecute = 20000;
private KieServerAddOnElement kieServerAddOnElement = null;
public DroolsChtijbugRulesExecutionService(KieServerRegistry context, KieServerAddOnElement kieServerAddOnElement) {
this.context = context;
this.messageHandlerResolver = new MessageHandlerResolver();
this.kieServerAddOnElement = kieServerAddOnElement;
}
public KieServerRegistry getContext() {
return context;
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID, int sessionMaxNumberRulesToExecute) {
return this.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, null, sessionMaxNumberRulesToExecute);
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID) {
return this.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, null);
}
public KieServerAddOnElement getKieServerAddOnElement() {
return kieServerAddOnElement;
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID, String sessionName, int sessionMaxNumberRulesToExecute) {
Object result = null;
try {
if (kci != null
&& kci.getKieContainer() != null
&& ruleBasePackage == null) {
KieContainer kieContainer = kci.getKieContainer();
ruleBasePackage = new RuleBaseSingleton(kieContainer, sessionMaxNumberRulesToExecute, kieServerAddOnElement);
if (kieServerAddOnElement != null) {
for (KieServerGlobalVariableDefinition kieServerGlobalVariableDefinition : kieServerAddOnElement.getKieServerGlobalVariableDefinitions()) {
kieServerGlobalVariableDefinition.OnCreateKieBase(kieServerAddOnElement.getGlobals());
}
for (KieServerListenerDefinition kieServerListenerDefinition : kieServerAddOnElement.getKieServerListenerDefinitions()) {
kieServerListenerDefinition.OnCreateKieBase();
}
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnCreateKieBase();
}
}
}
ChtijbugHistoryListener chtijbugHistoryListener = new ChtijbugHistoryListener();
RuleBaseSession session = ruleBasePackage.createRuleBaseSession(sessionMaxNumberRulesToExecute, chtijbugHistoryListener, sessionName);
if (kieServerAddOnElement != null) {
for (KieServerListenerDefinition kieServerListenerDefinition : kieServerAddOnElement.getKieServerListenerDefinitions()) {
kieServerListenerDefinition.OnCreateKieSession(session.getKnowledgeSession());
}
for (String globalVariableName : kieServerAddOnElement.getGlobals().keySet()) {
session.setGlobal(globalVariableName, kieServerAddOnElement.getGlobals().get(globalVariableName));
}
}
result = session.fireAllRulesAndStartProcess(chtijbugObjectRequest.getObjectRequest(), processID);
SessionContext sessionContext = this.messageHandlerResolver.getSessionFromHistoryEvent(chtijbugHistoryListener.getHistoryEventLinkedList());
chtijbugObjectRequest.setSessionLogging(sessionContext);
chtijbugObjectRequest.setObjectRequest(result);
logger.debug("Returning OK response with content '{}'", chtijbugObjectRequest.getObjectRequest());
session.dispose();
return chtijbugObjectRequest;
} catch (DroolsChtijbugException e) {
e.printStackTrace();
}
throw new IllegalStateException("Unable to execute command " + chtijbugObjectRequest.getObjectRequest());
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID, String sessionName) {
return this.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, sessionName, this.MaxNumberRulesToExecute);
}
}

View file

@ -0,0 +1 @@
org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension

View file

@ -0,0 +1,11 @@
/target
/local
# Eclipse, Netbeans and IntelliJ files
/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml

View file

@ -0,0 +1,218 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>drools-framework-kie-server-webapp</artifactId>
<packaging>pom</packaging>
<name>KIE :: chtijbug Execution Server</name>
<description>KIE Execution Server Distribution Wars. Name of the module is just 'kie-server' so that the final WARs
have nicer names.
</description>
<dependencies>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-rest-drools</artifactId>
<version>${project.version}</version>
</dependency>
<!--dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-services-drools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-services-common</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.security.jacc</groupId>
<artifactId>jboss-jacc-api_1.4_spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-rest-common</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-services-ejb-timer</artifactId>
</dependency-->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.jms</groupId>
<artifactId>jboss-jms-api_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</dependency>
<!-- Timer dependencies -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- kie ci dependency to avoid linkage errors on EAP/Wildfly -->
<dependency>
<groupId>org.sonatype.sisu.inject</groupId>
<artifactId>guice-servlet</artifactId>
</dependency>
</dependencies>
<build>
<finalName>kie-server</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<!--descriptor>src/main/assembly/assembly-ee6-container.xml</descriptor-->
<descriptor>src/main/assembly/assembly-ee7-container.xml</descriptor>
<!--descriptor>src/main/assembly/assembly-servlet-container.xml</descriptor-->
</descriptors>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<!-- special manifest entries to allow usage of CXF on WebSphere -->
<manifestEntries>
<Ignore-Scanning-Archives>
cxf-api-${version.org.apache.cxf}.jar,cxf-rt-bindings-soap-${version.org.apache.cxf}.jar,cxf-rt-bindings-xml-${version.org.apache.cxf}.jar,cxf-rt-core-${version.org.apache.cxf}.jar,cxf-rt-databinding-jaxb-${version.org.apache.cxf}.jar,cxf-rt-frontend-jaxws-${version.org.apache.cxf}.jar,cxf-rt-frontend-simple-${version.org.apache.cxf}.jar,cxf-rt-transports-http-${version.org.apache.cxf}.jar,cxf-rt-ws-addr-${version.org.apache.cxf}.jar,cxf-rt-ws-policy-${version.org.apache.cxf}.jar
</Ignore-Scanning-Archives>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.projectodd.jrapidoc</groupId>
<artifactId>jrapidoc-rest-plugin</artifactId>
<version>0.5.0.Final</version>
<executions>
<execution>
<id>run</id>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<modelTarget>${project.build.directory}/rest-api-doc</modelTarget>
<groups>
<group>
<baseUrl>REMOTE-URL/services/rest</baseUrl>
<description>KIE Server REST API</description>
<includes>
<include>org.kie.server</include>
<include>org.chtijbug.kieserver</include>
</includes>
</group>
</groups>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2012 Red Hat, Inc. and/or its affiliates
~
~ 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.
-->
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<!-- including a . in the id will modify the *classifier* of the artifact, instead of the name/id of the artifact -->
<id>ee7</id>
<formats>
<format>war</format>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/shared-ee6-ee7-resources</directory>
<outputDirectory>.</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/ee7-resources</directory>
<outputDirectory>.</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/docs</directory>
<outputDirectory>docs</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.directory}/rest-api-doc</directory>
<outputDirectory>docs</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<includes>
<include>com.pymmasoftware.jbpm:drools-framework-kie-server-rest-drools</include>
<!--
<include>org.chtijbug.drools:swimming-pool-kie-server</include>
<include>org.chtijbug.drools:insurance-car-kie-server</include>
<include>org.chtijbug.drools:loyalty-kie-server</include>
-->
<include>com.pymmasoftware.jbpm:drools-framework-kie-server-services-drools</include>
<include>org.drools:drools-core</include>
<include>org.drools:drools-compiler</include>
<include>org.eclipse.jdt.core.compiler:ecj</include>
<include>org.kie:kie-api</include>
<include>org.jbpm:jbpm-bpmn2</include>
<include>org.kie.server:kie-server-api</include>
<include>org.kie:kie-internal</include>
<include>org.kie.server:kie-server-services-common</include>
<include>org.kie.server:kie-server-services-drools</include>
<include>org.kie.server:kie-server-services-jbpm</include>
<include>org.kie.server:kie-server-services-jbpm-ui</include>
<include>org.kie.server:kie-server-services-optaplanner</include>
<include>org.kie.server:kie-server-jms</include>
<include>org.kie.server:kie-server-rest-common</include>
<include>org.kie.server:kie-server-rest-drools</include>
<include>org.kie.server:kie-server-rest-jbpm</include>
<include>org.kie.server:kie-server-rest-jbpm-ui</include>
<include>org.kie.server:kie-server-rest-optaplanner</include>
<include>org.kie:jbpm-process-svg</include>
<include>org.jbpm:jbpm-services-ejb-timer</include>
<include>org.hibernate.common:hibernate-commons-annotations</include>
<include>org.hibernate:hibernate-entitymanager</include>
<include>org.hibernate:hibernate-core</include>
<include>org.hibernate:hibernate-validator</include>
<include>dom4j:dom4j</include>
<include>org.quartz-scheduler:quartz</include>
<include>org.sonatype.sisu.inject:guice-servlet</include>
<include>com.thoughtworks.xstream:xstream:jar:1.14.10</include>
</includes>
<excludes>
<exclude>org.jboss.resteasy:*</exclude>
<exclude>org.jboss.spec.javax.annotation:*</exclude>
<exclude>org.jboss.spec.javax.ejb:*</exclude>
<exclude>org.jboss.spec.javax.interceptor:*</exclude>
<exclude>javax.enterprise:cdi-api</exclude>
<exclude>javax.inject:javax.inject</exclude>
<exclude>javax.validation:validation-api</exclude>
<exclude>stax:stax-api</exclude>
<exclude>javax.activation:activation</exclude>
<exclude>org.hibernate.javax.persistence:hibernate-jpa-2.0-api</exclude>
<exclude>xml-apis:xml-apis</exclude>
</excludes>
<outputDirectory>WEB-INF/lib</outputDirectory>
<useTransitiveFiltering>true</useTransitiveFiltering>
</dependencySet>
</dependencySets>
</assembly>

View file

@ -0,0 +1,976 @@
/*!
* Bootstrap Responsive v2.0.3
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
.hide-text {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 28px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.hidden {
/*display: none;*/
visibility: hidden;
}
.visible-phone {
display: none !important;
}
.visible-tablet {
display: none !important;
}
.hidden-desktop {
display: none !important;
}
@media (max-width: 767px) {
.visible-phone {
display: inherit !important;
}
.hidden-phone {
display: none !important;
}
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 979px) {
.visible-tablet {
display: inherit !important;
}
.hidden-tablet {
display: none !important;
}
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important;
}
}
@media (max-width: 480px) {
.nav-collapse {
-webkit-transform: translate3d(0, 0, 0);
}
.page-header h1 small {
display: block;
line-height: 18px;
}
input[type="checkbox"],
input[type="radio"] {
border: 1px solid #ccc;
}
.form-horizontal .control-group > label {
float: none;
width: auto;
padding-top: 0;
text-align: left;
}
.form-horizontal .controls {
margin-left: 0;
}
.form-horizontal .control-list {
padding-top: 0;
}
.form-horizontal .form-actions {
padding-right: 10px;
padding-left: 10px;
}
.modal {
position: absolute;
top: 10px;
right: 10px;
left: 10px;
width: auto;
margin: 0;
}
.modal.fade.in {
top: auto;
}
.modal-header .close {
padding: 10px;
margin: -10px;
}
.carousel-caption {
position: static;
}
}
@media (max-width: 767px) {
body {
padding-right: 20px;
padding-left: 20px;
}
.navbar-fixed-top,
.navbar-fixed-bottom {
margin-right: -20px;
margin-left: -20px;
}
.container-fluid {
padding: 0;
}
.dl-horizontal dt {
float: none;
width: auto;
clear: none;
text-align: left;
}
.dl-horizontal dd {
margin-left: 0;
}
.container {
width: auto;
}
.row-fluid {
width: 100%;
}
.row,
.thumbnails {
margin-left: 0;
}
[class*="span"],
.row-fluid [class*="span"] {
display: block;
float: none;
width: auto;
margin-left: 0;
}
.input-large,
.input-xlarge,
.input-xxlarge,
input[class*="span"],
select[class*="span"],
textarea[class*="span"],
.uneditable-input {
display: block;
width: 100%;
min-height: 28px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.input-prepend input,
.input-append input,
.input-prepend input[class*="span"],
.input-append input[class*="span"] {
display: inline-block;
width: auto;
}
}
@media (min-width: 768px) and (max-width: 979px) {
.row {
margin-left: -20px;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
content: "";
}
.row:after {
clear: both;
}
[class*="span"] {
float: left;
margin-left: 20px;
}
.container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 724px;
}
.span12 {
width: 724px;
}
.span11 {
width: 662px;
}
.span10 {
width: 600px;
}
.span9 {
width: 538px;
}
.span8 {
width: 476px;
}
.span7 {
width: 414px;
}
.span6 {
width: 352px;
}
.span5 {
width: 290px;
}
.span4 {
width: 228px;
}
.span3 {
width: 166px;
}
.span2 {
width: 104px;
}
.span1 {
width: 42px;
}
.offset12 {
margin-left: 764px;
}
.offset11 {
margin-left: 702px;
}
.offset10 {
margin-left: 640px;
}
.offset9 {
margin-left: 578px;
}
.offset8 {
margin-left: 516px;
}
.offset7 {
margin-left: 454px;
}
.offset6 {
margin-left: 392px;
}
.offset5 {
margin-left: 330px;
}
.offset4 {
margin-left: 268px;
}
.offset3 {
margin-left: 206px;
}
.offset2 {
margin-left: 144px;
}
.offset1 {
margin-left: 82px;
}
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before,
.row-fluid:after {
display: table;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 28px;
margin-left: 2.762430939%;
*margin-left: 2.709239449638298%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .span12 {
width: 99.999999993%;
*width: 99.9468085036383%;
}
.row-fluid .span11 {
width: 91.436464082%;
*width: 91.38327259263829%;
}
.row-fluid .span10 {
width: 82.87292817100001%;
*width: 82.8197366816383%;
}
.row-fluid .span9 {
width: 74.30939226%;
*width: 74.25620077063829%;
}
.row-fluid .span8 {
width: 65.74585634900001%;
*width: 65.6926648596383%;
}
.row-fluid .span7 {
width: 57.182320438000005%;
*width: 57.129128948638304%;
}
.row-fluid .span6 {
width: 48.618784527%;
*width: 48.5655930376383%;
}
.row-fluid .span5 {
width: 40.055248616%;
*width: 40.0020571266383%;
}
.row-fluid .span4 {
width: 31.491712705%;
*width: 31.4385212156383%;
}
.row-fluid .span3 {
width: 22.928176794%;
*width: 22.874985304638297%;
}
.row-fluid .span2 {
width: 14.364640883%;
*width: 14.311449393638298%;
}
.row-fluid .span1 {
width: 5.801104972%;
*width: 5.747913482638298%;
}
input,
textarea,
.uneditable-input {
margin-left: 0;
}
input.span12,
textarea.span12,
.uneditable-input.span12 {
width: 714px;
}
input.span11,
textarea.span11,
.uneditable-input.span11 {
width: 652px;
}
input.span10,
textarea.span10,
.uneditable-input.span10 {
width: 590px;
}
input.span9,
textarea.span9,
.uneditable-input.span9 {
width: 528px;
}
input.span8,
textarea.span8,
.uneditable-input.span8 {
width: 466px;
}
input.span7,
textarea.span7,
.uneditable-input.span7 {
width: 404px;
}
input.span6,
textarea.span6,
.uneditable-input.span6 {
width: 342px;
}
input.span5,
textarea.span5,
.uneditable-input.span5 {
width: 280px;
}
input.span4,
textarea.span4,
.uneditable-input.span4 {
width: 218px;
}
input.span3,
textarea.span3,
.uneditable-input.span3 {
width: 156px;
}
input.span2,
textarea.span2,
.uneditable-input.span2 {
width: 94px;
}
input.span1,
textarea.span1,
.uneditable-input.span1 {
width: 32px;
}
}
@media (min-width: 1200px) {
.row {
margin-left: -30px;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
content: "";
}
.row:after {
clear: both;
}
[class*="span"] {
float: left;
margin-left: 30px;
}
.container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 1170px;
}
.span12 {
width: 1170px;
}
.span11 {
width: 1070px;
}
.span10 {
width: 970px;
}
.span9 {
width: 870px;
}
.span8 {
width: 770px;
}
.span7 {
width: 670px;
}
.span6 {
width: 570px;
}
.span5 {
width: 470px;
}
.span4 {
width: 370px;
}
.span3 {
width: 270px;
}
.span2 {
width: 170px;
}
.span1 {
width: 70px;
}
.offset12 {
margin-left: 1230px;
}
.offset11 {
margin-left: 1130px;
}
.offset10 {
margin-left: 1030px;
}
.offset9 {
margin-left: 930px;
}
.offset8 {
margin-left: 830px;
}
.offset7 {
margin-left: 730px;
}
.offset6 {
margin-left: 630px;
}
.offset5 {
margin-left: 530px;
}
.offset4 {
margin-left: 430px;
}
.offset3 {
margin-left: 330px;
}
.offset2 {
margin-left: 230px;
}
.offset1 {
margin-left: 130px;
}
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before,
.row-fluid:after {
display: table;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 28px;
margin-left: 2.564102564%;
*margin-left: 2.510911074638298%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
}
.row-fluid .span11 {
width: 91.45299145300001%;
*width: 91.3997999636383%;
}
.row-fluid .span10 {
width: 82.905982906%;
*width: 82.8527914166383%;
}
.row-fluid .span9 {
width: 74.358974359%;
*width: 74.30578286963829%;
}
.row-fluid .span8 {
width: 65.81196581200001%;
*width: 65.7587743226383%;
}
.row-fluid .span7 {
width: 57.264957265%;
*width: 57.2117657756383%;
}
.row-fluid .span6 {
width: 48.717948718%;
*width: 48.6647572286383%;
}
.row-fluid .span5 {
width: 40.170940171000005%;
*width: 40.117748681638304%;
}
.row-fluid .span4 {
width: 31.623931624%;
*width: 31.5707401346383%;
}
.row-fluid .span3 {
width: 23.076923077%;
*width: 23.0237315876383%;
}
.row-fluid .span2 {
width: 14.529914530000001%;
*width: 14.4767230406383%;
}
.row-fluid .span1 {
width: 5.982905983%;
*width: 5.929714493638298%;
}
input,
textarea,
.uneditable-input {
margin-left: 0;
}
input.span12,
textarea.span12,
.uneditable-input.span12 {
width: 1160px;
}
input.span11,
textarea.span11,
.uneditable-input.span11 {
width: 1060px;
}
input.span10,
textarea.span10,
.uneditable-input.span10 {
width: 960px;
}
input.span9,
textarea.span9,
.uneditable-input.span9 {
width: 860px;
}
input.span8,
textarea.span8,
.uneditable-input.span8 {
width: 760px;
}
input.span7,
textarea.span7,
.uneditable-input.span7 {
width: 660px;
}
input.span6,
textarea.span6,
.uneditable-input.span6 {
width: 560px;
}
input.span5,
textarea.span5,
.uneditable-input.span5 {
width: 460px;
}
input.span4,
textarea.span4,
.uneditable-input.span4 {
width: 360px;
}
input.span3,
textarea.span3,
.uneditable-input.span3 {
width: 260px;
}
input.span2,
textarea.span2,
.uneditable-input.span2 {
width: 160px;
}
input.span1,
textarea.span1,
.uneditable-input.span1 {
width: 60px;
}
.thumbnails {
margin-left: -30px;
}
.thumbnails > li {
margin-left: 30px;
}
.row-fluid .thumbnails {
margin-left: 0;
}
}
@media (max-width: 979px) {
body {
padding-top: 0;
}
.navbar-fixed-top {
position: static;
margin-bottom: 18px;
}
.navbar-fixed-top .navbar-inner {
padding: 5px;
}
.navbar .container {
width: auto;
padding: 0;
}
.navbar .brand {
padding-right: 10px;
padding-left: 10px;
margin: 0 0 0 -5px;
}
.nav-collapse {
clear: both;
}
.nav-collapse .nav {
float: none;
margin: 0 0 9px;
}
.nav-collapse .nav > li {
float: none;
}
.nav-collapse .nav > li > a {
margin-bottom: 2px;
}
.nav-collapse .nav > .divider-vertical {
display: none;
}
.nav-collapse .nav .nav-header {
color: #999999;
text-shadow: none;
}
.nav-collapse .nav > li > a,
.nav-collapse .dropdown-menu a {
padding: 6px 15px;
font-weight: bold;
color: #999999;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.nav-collapse .btn {
padding: 4px 10px 4px;
font-weight: normal;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.nav-collapse .dropdown-menu li + li a {
margin-bottom: 2px;
}
.nav-collapse .nav > li > a:hover,
.nav-collapse .dropdown-menu a:hover {
background-color: #222222;
}
.nav-collapse.in .btn-group {
padding: 0;
margin-top: 5px;
}
.nav-collapse .dropdown-menu {
position: static;
top: auto;
left: auto;
display: block;
float: none;
max-width: none;
padding: 0;
margin: 0 15px;
background-color: transparent;
border: none;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.nav-collapse .dropdown-menu:before,
.nav-collapse .dropdown-menu:after {
display: none;
}
.nav-collapse .dropdown-menu .divider {
display: none;
}
.nav-collapse .navbar-form,
.nav-collapse .navbar-search {
float: none;
padding: 9px 15px;
margin: 9px 0;
border-top: 1px solid #222222;
border-bottom: 1px solid #222222;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar .nav-collapse .nav.pull-right {
float: none;
margin-left: 0;
}
.nav-collapse,
.nav-collapse.collapse {
height: 0;
overflow: hidden;
}
.navbar .btn-navbar {
display: block;
}
.navbar-static .navbar-inner {
padding-right: 10px;
padding-left: 10px;
}
}
@media (min-width: 980px) {
.nav-collapse.collapse {
height: auto !important;
overflow: visible !important;
}
}

View file

@ -0,0 +1,233 @@
#page {
min-height: 600px;
}
.package {
margin-left: 10px;
padding: 10px 0px 0px 10px;
/*border-radius: 2px;*/
margin-top: 2px;
}
.header {
cursor: pointer;
}
.name {
color: #333;
font-family: "Open Sans", sans-serif;
}
.value {
font-size: 10pt;
}
.array {
background-color: #FFFFFF;
border: thin solid #FFB780;
}
.object {
/*background-color: #E7F1FE;*/
/*border: thin solid #7DA2CE;*/
}
.string {
color: red;
}
.number {
color: blue;
}
.function {
color: green;
}
.open .children {
display: block;
}
.closed > .children {
display: none;
/*display: block;*/
}
.arrow {
background-image: url("../img/d.png");
background-repeat: no-repeat;
background-color: transparent;
height: 15px;
width: 15px;
display: inline-block;
}
.open .arrow {
background-position: -20px 0;
/*background-position: 0 0;*/
}
.closed .arrow {
background-position: 0 0;
/*background-position: -20px 0;*/
}
.type {
color: gray;
font-size: 8pt;
float: right;
}
.hide {
display: none;
}
#main {
width: 100%;
height: 500px;
overflow-y: scroll;
}
h1 {
text-align: center;
}
h2 {
text-align: center;
}
.footer {
margin-top: 10px;
text-align: center;
}
.inline {
display: inline;
}
.info {
background-color: #f8f8f8;
}
.serviceGroups {
background-color: #f8f8f8;
}
.types {
background-color: #f8f8f8;
}
.info > .header > .name,
.serviceGroups > .header > .name,
.services > .header > .name,
.methods > .header > .name,
.types > .header > .name {
text-transform: uppercase;
font-weight: bold;
}
.httpParameters > .children > div > .header > .name,
.attributes > .children > div > .header > .name {
font-weight: bold;
}
.serviceGroups > .children > .package.open.object:nth-child(even) {
background: #e5e3e3;
}
.serviceGroups > .children > .package.open.object:nth-child(odd) {
background: #dddbdb;
}
.services > .children > .package.open.object:nth-child(even) {
background: #e7e5e5;
}
.services > .children > .package.open.object:nth-child(odd) {
background: #edebeb;
}
.methods > .children > .package.open.object:nth-child(even) {
background: #DDDBDB;
}
.methods > .children > .package.open.object:nth-child(odd) {
background: #e6e4e4;
}
.httpParameters > .children > .package.open.object:nth-child(even) {
background: #e6ebeb;
}
.httpParameters > .children > .package.open.object:nth-child(odd) {
background: #f0f5f5;
}
.parameters > .children > .package.open.object:nth-child(even) {
background: #e6ebeb;
}
.parameters > .children > .package.open.object:nth-child(odd) {
background: #f0f5f5
}
.soapInputHeaders > .children > .package.open.object:nth-child(even) {
background: #e6ebeb;
}
.soapInputHeaders > .children > .package.open.object:nth-child(odd) {
background: #f0f5f5
}
.soapOutputHeaders > .children > .package.open.object:nth-child(even) {
background: #e6ebeb;
}
.soapOutputHeaders > .children > .package.open.object:nth-child(odd) {
background: #f0f5f5
}
.returnOptions > .children > .package.open.object:nth-child(even) {
background: #eceaea;
}
.returnOptions > .children > .package.open.object:nth-child(odd) {
background: #e5e3e3;
}
.returnOptions > .children > div > .header,
.returnTypes > .children > div > .header,
.parameters > .children > div > .header,
.soapInputHeaders > .children > div > .header,
.soapOutputHeaders > .children > div > .header {
visibility: hidden;
}
.types > .children > .package.open.object:nth-child(even) {
background: #DDDBDB;
}
.types > .children > .package.open.object:nth-child(odd) {
background: #f0eeee
}
.types > .children > div > .header {
font-style: italic;
}
h1 {
font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif;
color: black;
}
.align-right {
text-align: right;
}
#modelUrl {
width: 60%;
}
.button-same-width {
width: 10%;
}

View file

@ -0,0 +1,200 @@
html {
background-color: #f8f8f8;
background-image: -moz-linear-gradient(center top, #5e8ec6, #E4E4E4);
}
body {
/*background-color: transparent;*/
background-color: #f8f8f8;
/*font-family: "Helvetica Neue",Arial,sans-serif;*/
font-family: "Droid Sans Mono", monospace;
font-size: 12pt;
/*padding: 1px 100px 30px;*/
padding-bottom: 100px;
}
#page {
background-color: #f8f8f8;
border-radius: 5px 5px 5px 5px;
box-shadow: 0 0 5px #000000;
clear: left;
padding: 10px 0 0;
margin-top: 50px;
}
#header, #page, #footer {
margin: 0 auto;
position: relative;
width: 1200px;
}
#header {
margin-top: 15px;
z-index: 100;
}
#logo {
display: block;
height: 120px;
overflow: hidden;
text-indent: -9999px;
width: 120px;
margin-left: -80px;
margin-bottom: -50px;
float: left;
}
#logo-header {
margin-top: 5px;
}
a {
background: none repeat scroll 0 0 transparent;
border: 0 none;
font-size: 100%;
margin: 0;
padding: 0;
vertical-align: baseline;
}
#site-nav, #site-nav ul {
float: right;
}
#site-nav {
font-family: Helvetica, Arial, sans-serif;
font-size: 1.4em;
font-weight: bold;
}
.nav ul {
list-style: none outside none;
}
#site-nav li.alpha, #site-nav li.alpha a {
border-radius: 4px 0 0 4px;
}
#site-nav li {
background-color: #8BD92F;
background-image: -moz-linear-gradient(center top, #f4cecf, #fb9ca0);
float: left;
}
#site-nav li.alpha, #site-nav li.alpha a {
border-radius: 4px 0 0 4px;
}
#site-nav li.omega, #site-nav li.omega a {
border-radius: 0 4px 4px 0;
}
#site-nav {
font-family: Helvetica, Arial, sans-serif;
font-size: 1.4em;
font-weight: bold;
}
#site-nav a {
border-left: 1px solid rgba(255, 255, 255, 0.3);
border-right: 1px solid rgba(0, 0, 0, 0.1);
color: #FFFFFF;
display: block;
float: left;
height: 34px;
line-height: 34px;
padding: 0 13px;
text-decoration: none;
text-shadow: 0 -1px 0 #456B22;
}
#site-nav a:hover {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.1);
}
#page .divider {
border-top: 1px dotted #AAAAAA;
margin-top: 25px;
padding-top: 30px;
}
#page article {
margin: 0 43px;
padding: 0px 0 20px;
}
#page article h3 {
color: #000000;
font-size: 15pt;
font-weight: bold;
margin: 15px 0 10px;
}
#page #page-header h2, #page #page-header p {
width: 500px;
}
#page #page-header h2 {
color: #807f7f;
font-size: 20pt;
font-weight: bold;
line-height: 1.3em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
";
}
#page #page-header h3 {
font-size: 10pt;
font-weight: bold;
}
#page #page-header {
background-color: #EEEEEE;
background-image: -moz-linear-gradient(center top, #FFFFFF, #E4E4E4);
border-bottom: 5px solid #298f00;
position: relative;
text-shadow: 0 1px 0 #FFFFFF;
}
blue {
color: #688dad;
font-weight: bold;
}
red {
color: red;
font-weight: bold;
}
#releaseNotes {
list-style: none;
}
.inner-content {
padding: 30px 30px 10px;
}
#page p {
color: #4D4D4D;
line-height: 1.5em;
margin: 0 0 10px;
}
.hide {
display: none;
}
div.demo {
width: 100%;
text-align: center;
font-weight: bold;
color: #b7b7b7;
margin-top: -38px;
}
pre.demo {
height: 60px;
border-color: #cdcbcb;
background-color: white;
}

View file

@ -0,0 +1,109 @@
.pln {
color: #000
}
@media screen {
.str {
color: #080
}
.kwd {
color: #008
}
.com {
color: #800
}
.typ {
color: #606
}
.lit {
color: #066
}
.pun, .opn, .clo {
color: #660
}
.tag {
color: #008
}
.atn {
color: #606
}
.atv {
color: #080
}
.dec, .var {
color: #606
}
.fun {
color: red
}
}
@media print, projection {
.str {
color: #060
}
.kwd {
color: #006;
font-weight: bold
}
.com {
color: #600;
font-style: italic
}
.typ {
color: #404;
font-weight: bold
}
.lit {
color: #044
}
.pun, .opn, .clo {
color: #440
}
.tag {
color: #006;
font-weight: bold
}
.atn {
color: #404
}
.atv {
color: #060
}
}
pre.prettyprint {
padding: 2px;
border: 1px solid #888
}
ol.linenums {
margin-top: 0;
margin-bottom: 0
}
li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 {
list-style-type: none
}
li.L1, li.L3, li.L5, li.L7, li.L9 {
background: #eee
}

View file

@ -0,0 +1,26 @@
.progress-background {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: whitesmoke;
opacity: 0.8;
}
.progress-active {
width: 20%;
position: absolute;
top: 200px;
left: 40%;
z-index: 1;
text-align: center;
}
.progress-active > div {
}
#progress {
/*display: block;*/
display: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<meta charset='UTF-8'/>
<title>KIE Server - Remote API Reference Documentation</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/notify.min.js"></script>
<script src='js/json2html.js' type='text/javascript'></script>
<script src='js/jquery.json2html.js' type='text/javascript'></script>
<script src="js/utils/Properties.js"></script>
<script src="js/utils/Exceptions.js"></script>
<script src="js/utils/Logger.js"></script>
<script src="js/model/Apimodel.js"></script>
<script src="js/view/Graphics.js"></script>
<script src="js/controller/Initializer.js"></script>
<script src="js/controller/Listeners.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/view/ProgressBar.js"></script>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/prettify.css" rel="stylesheet">
<link href='css/layout.css' media='all' type='text/css' rel='stylesheet'/>
<link href='css/progress.css' media='all' type='text/css' rel='stylesheet'/>
<link href="css/jrapidoc-default.css" media="all" type="text/css" rel="stylesheet"/>
<script type='text/javascript'>
var windowloaded = function () {
new Initializer().initialize();
};
window.addEventListener("load", windowloaded);
</script>
</head>
<body>
<section id="page">
<h1>KIE Server - Remote API Reference Documentation</h1>
<article>
<div style=";margin-top:20px;">
<div class="align-right" style="display:none">
<label class="inline" for="modelUrl">URI: </label>
<input id="modelUrl" type="text" size="100">
<input id="loadModel" type="button" value="Load model">
<input id="primaryLoad" type="button">
<input id="secondaryLoad" type="button">
</div>
<div id="top"></div>
</div>
</article>
</section>
<div id="progress">
<div id="background" class="progress-background"></div>
<div id="progressbar" class="progress-active">
<div>Loading data...</div>
<progress></progress>
</div>
</div>
<footer class="footer">
<span>See project home on <a href="https://github.com/projectodd/jrapidoc">GitHub</a></span> |
<span>JRAPIDoc is under Apache License, Version 2.0</span> |
<span>2015</span>
</footer>
</body>
</html>

View file

@ -0,0 +1,54 @@
json2html core
=========
Readme First!
--------------
Looks like you've found the json2html core library repository. This repository is used for making changes to the core json2html library. While you're free to use this core json2html library we recommend that you use the following wrappers instead:
+ <a href='https://github.com/moappi/jquery.json2html'>jQuery wrapper</a> for extended client side functionality
+ <a href='https://github.com/moappi/node-json2html'>node.js wrapper</a> for server side functionality
What is json2html?
------------------
json2html is a simple but powerful javascript HTML templating library used to transform JSON objects into HTML.
Why json2html?
--------------
Instead of writing HTML templates json2html relies on JSON transforms to convert a source JSON objects to html. The benefit of using a JSON transform is that they are already readable by the browser/server and DO NOT require any compilation before use. In addition, json2html allows the following:
+ One template (we call transform) that can be used on either a client OR server
+ Short hand notation for mapping data objects to markup ${name}
+ Event binding to DOM objects (with the jquery plugin)
+ Use of inline functions to allow for complex logic during transformation
Example
--------------
Transform (template)
```javascript
var transform =
{"tag": "li", "id":"${id}", children:[
{"tag": "span", "html": "${name} (${year})"}
]};
```
Plus JSON Data
```javascript
var data =
{"id": 1123, "name": "Jack and Jill", "year":2001};
```
Will render the following html
```html
<li id="1123">
<span>Jack and Jill (2001)</span>
</li>
```
Need more Information?
--------------
Check out our website <a href='http://www.json2html.com'>www.json2html.com</a> for more information including detailed usage notes, interactive examples and more!

View file

@ -0,0 +1,575 @@
/*!
* Bootstrap.js by @fat & @mdo
* Copyright 2012 Twitter, Inc.
* http://www.apache.org/licenses/LICENSE-2.0.txt
*/
!function (a) {
a(function () {
"use strict", a.support.transition = function () {
var a = function () {
var a = document.createElement("bootstrap"), b = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "oTransitionEnd",
msTransition: "MSTransitionEnd",
transition: "transitionend"
}, c;
for (c in b)if (a.style[c] !== undefined)return b[c]
}();
return a && {end: a}
}()
})
}(window.jQuery), !function (a) {
"use strict";
var b = '[data-dismiss="alert"]', c = function (c) {
a(c).on("click", b, this.close)
};
c.prototype.close = function (b) {
function f() {
e.trigger("closed").remove()
}
var c = a(this), d = c.attr("data-target"), e;
d || (d = c.attr("href"), d = d && d.replace(/.*(?=#[^\s]*$)/, "")), e = a(d), b && b.preventDefault(), e.length || (e = c.hasClass("alert") ? c : c.parent()), e.trigger(b = a.Event("close"));
if (b.isDefaultPrevented())return;
e.removeClass("in"), a.support.transition && e.hasClass("fade") ? e.on(a.support.transition.end, f) : f()
}, a.fn.alert = function (b) {
return this.each(function () {
var d = a(this), e = d.data("alert");
e || d.data("alert", e = new c(this)), typeof b == "string" && e[b].call(d)
})
}, a.fn.alert.Constructor = c, a(function () {
a("body").on("click.alert.data-api", b, c.prototype.close)
})
}(window.jQuery), !function (a) {
"use strict";
var b = function (b, c) {
this.$element = a(b), this.options = a.extend({}, a.fn.button.defaults, c)
};
b.prototype.setState = function (a) {
var b = "disabled", c = this.$element, d = c.data(), e = c.is("input") ? "val" : "html";
a += "Text", d.resetText || c.data("resetText", c[e]()), c[e](d[a] || this.options[a]), setTimeout(function () {
a == "loadingText" ? c.addClass(b).attr(b, b) : c.removeClass(b).removeAttr(b)
}, 0)
}, b.prototype.toggle = function () {
var a = this.$element.parent('[data-toggle="buttons-radio"]');
a && a.find(".active").removeClass("active"), this.$element.toggleClass("active")
}, a.fn.button = function (c) {
return this.each(function () {
var d = a(this), e = d.data("button"), f = typeof c == "object" && c;
e || d.data("button", e = new b(this, f)), c == "toggle" ? e.toggle() : c && e.setState(c)
})
}, a.fn.button.defaults = {loadingText: "loading..."}, a.fn.button.Constructor = b, a(function () {
a("body").on("click.button.data-api", "[data-toggle^=button]", function (b) {
var c = a(b.target);
c.hasClass("btn") || (c = c.closest(".btn")), c.button("toggle")
})
})
}(window.jQuery), !function (a) {
"use strict";
var b = function (b, c) {
this.$element = a(b), this.options = c, this.options.slide && this.slide(this.options.slide), this.options.pause == "hover" && this.$element.on("mouseenter", a.proxy(this.pause, this)).on("mouseleave", a.proxy(this.cycle, this))
};
b.prototype = {
cycle: function (b) {
return b || (this.paused = !1), this.options.interval && !this.paused && (this.interval = setInterval(a.proxy(this.next, this), this.options.interval)), this
}, to: function (b) {
var c = this.$element.find(".active"), d = c.parent().children(), e = d.index(c), f = this;
if (b > d.length - 1 || b < 0)return;
return this.sliding ? this.$element.one("slid", function () {
f.to(b)
}) : e == b ? this.pause().cycle() : this.slide(b > e ? "next" : "prev", a(d[b]))
}, pause: function (a) {
return a || (this.paused = !0), clearInterval(this.interval), this.interval = null, this
}, next: function () {
if (this.sliding)return;
return this.slide("next")
}, prev: function () {
if (this.sliding)return;
return this.slide("prev")
}, slide: function (b, c) {
var d = this.$element.find(".active"), e = c || d[b](), f = this.interval, g = b == "next" ? "left" : "right", h = b == "next" ? "first" : "last", i = this, j = a.Event("slide");
this.sliding = !0, f && this.pause(), e = e.length ? e : this.$element.find(".item")[h]();
if (e.hasClass("active"))return;
if (a.support.transition && this.$element.hasClass("slide")) {
this.$element.trigger(j);
if (j.isDefaultPrevented())return;
e.addClass(b), e[0].offsetWidth, d.addClass(g), e.addClass(g), this.$element.one(a.support.transition.end, function () {
e.removeClass([b, g].join(" ")).addClass("active"), d.removeClass(["active", g].join(" ")), i.sliding = !1, setTimeout(function () {
i.$element.trigger("slid")
}, 0)
})
} else {
this.$element.trigger(j);
if (j.isDefaultPrevented())return;
d.removeClass("active"), e.addClass("active"), this.sliding = !1, this.$element.trigger("slid")
}
return f && this.cycle(), this
}
}, a.fn.carousel = function (c) {
return this.each(function () {
var d = a(this), e = d.data("carousel"), f = a.extend({}, a.fn.carousel.defaults, typeof c == "object" && c);
e || d.data("carousel", e = new b(this, f)), typeof c == "number" ? e.to(c) : typeof c == "string" || (c = f.slide) ? e[c]() : f.interval && e.cycle()
})
}, a.fn.carousel.defaults = {interval: 5e3, pause: "hover"}, a.fn.carousel.Constructor = b, a(function () {
a("body").on("click.carousel.data-api", "[data-slide]", function (b) {
var c = a(this), d, e = a(c.attr("data-target") || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, "")), f = !e.data("modal") && a.extend({}, e.data(), c.data());
e.carousel(f), b.preventDefault()
})
})
}(window.jQuery), !function (a) {
"use strict";
var b = function (b, c) {
this.$element = a(b), this.options = a.extend({}, a.fn.collapse.defaults, c), this.options.parent && (this.$parent = a(this.options.parent)), this.options.toggle && this.toggle()
};
b.prototype = {
constructor: b, dimension: function () {
var a = this.$element.hasClass("width");
return a ? "width" : "height"
}, show: function () {
var b, c, d, e;
if (this.transitioning)return;
b = this.dimension(), c = a.camelCase(["scroll", b].join("-")), d = this.$parent && this.$parent.find("> .accordion-group > .in");
if (d && d.length) {
e = d.data("collapse");
if (e && e.transitioning)return;
d.collapse("hide"), e || d.data("collapse", null)
}
this.$element[b](0), this.transition("addClass", a.Event("show"), "shown"), this.$element[b](this.$element[0][c])
}, hide: function () {
var b;
if (this.transitioning)return;
b = this.dimension(), this.reset(this.$element[b]()), this.transition("removeClass", a.Event("hide"), "hidden"), this.$element[b](0)
}, reset: function (a) {
var b = this.dimension();
return this.$element.removeClass("collapse")[b](a || "auto")[0].offsetWidth, this.$element[a !== null ? "addClass" : "removeClass"]("collapse"), this
}, transition: function (b, c, d) {
var e = this, f = function () {
c.type == "show" && e.reset(), e.transitioning = 0, e.$element.trigger(d)
};
this.$element.trigger(c);
if (c.isDefaultPrevented())return;
this.transitioning = 1, this.$element[b]("in"), a.support.transition && this.$element.hasClass("collapse") ? this.$element.one(a.support.transition.end, f) : f()
}, toggle: function () {
this[this.$element.hasClass("in") ? "hide" : "show"]()
}
}, a.fn.collapse = function (c) {
return this.each(function () {
var d = a(this), e = d.data("collapse"), f = typeof c == "object" && c;
e || d.data("collapse", e = new b(this, f)), typeof c == "string" && e[c]()
})
}, a.fn.collapse.defaults = {toggle: !0}, a.fn.collapse.Constructor = b, a(function () {
a("body").on("click.collapse.data-api", "[data-toggle=collapse]", function (b) {
var c = a(this), d, e = c.attr("data-target") || b.preventDefault() || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, ""), f = a(e).data("collapse") ? "toggle" : c.data();
a(e).collapse(f)
})
})
}(window.jQuery), !function (a) {
function d() {
a(b).parent().removeClass("open")
}
"use strict";
var b = '[data-toggle="dropdown"]', c = function (b) {
var c = a(b).on("click.dropdown.data-api", this.toggle);
a("html").on("click.dropdown.data-api", function () {
c.parent().removeClass("open")
})
};
c.prototype = {
constructor: c, toggle: function (b) {
var c = a(this), e, f, g;
if (c.is(".disabled, :disabled"))return;
return f = c.attr("data-target"), f || (f = c.attr("href"), f = f && f.replace(/.*(?=#[^\s]*$)/, "")), e = a(f), e.length || (e = c.parent()), g = e.hasClass("open"), d(), g || e.toggleClass("open"), !1
}
}, a.fn.dropdown = function (b) {
return this.each(function () {
var d = a(this), e = d.data("dropdown");
e || d.data("dropdown", e = new c(this)), typeof b == "string" && e[b].call(d)
})
}, a.fn.dropdown.Constructor = c, a(function () {
a("html").on("click.dropdown.data-api", d), a("body").on("click.dropdown", ".dropdown form", function (a) {
a.stopPropagation()
}).on("click.dropdown.data-api", b, c.prototype.toggle)
})
}(window.jQuery), !function (a) {
function c() {
var b = this, c = setTimeout(function () {
b.$element.off(a.support.transition.end), d.call(b)
}, 500);
this.$element.one(a.support.transition.end, function () {
clearTimeout(c), d.call(b)
})
}
function d(a) {
this.$element.hide().trigger("hidden"), e.call(this)
}
function e(b) {
var c = this, d = this.$element.hasClass("fade") ? "fade" : "";
if (this.isShown && this.options.backdrop) {
var e = a.support.transition && d;
this.$backdrop = a('<div class="modal-backdrop ' + d + '" />').appendTo(document.body), this.options.backdrop != "static" && this.$backdrop.click(a.proxy(this.hide, this)), e && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in"), e ? this.$backdrop.one(a.support.transition.end, b) : b()
} else!this.isShown && this.$backdrop ? (this.$backdrop.removeClass("in"), a.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one(a.support.transition.end, a.proxy(f, this)) : f.call(this)) : b && b()
}
function f() {
this.$backdrop.remove(), this.$backdrop = null
}
function g() {
var b = this;
this.isShown && this.options.keyboard ? a(document).on("keyup.dismiss.modal", function (a) {
a.which == 27 && b.hide()
}) : this.isShown || a(document).off("keyup.dismiss.modal")
}
"use strict";
var b = function (b, c) {
this.options = c, this.$element = a(b).delegate('[data-dismiss="modal"]', "click.dismiss.modal", a.proxy(this.hide, this))
};
b.prototype = {
constructor: b, toggle: function () {
return this[this.isShown ? "hide" : "show"]()
}, show: function () {
var b = this, c = a.Event("show");
this.$element.trigger(c);
if (this.isShown || c.isDefaultPrevented())return;
a("body").addClass("modal-open"), this.isShown = !0, g.call(this), e.call(this, function () {
var c = a.support.transition && b.$element.hasClass("fade");
b.$element.parent().length || b.$element.appendTo(document.body), b.$element.show(), c && b.$element[0].offsetWidth, b.$element.addClass("in"), c ? b.$element.one(a.support.transition.end, function () {
b.$element.trigger("shown")
}) : b.$element.trigger("shown")
})
}, hide: function (b) {
b && b.preventDefault();
var e = this;
b = a.Event("hide"), this.$element.trigger(b);
if (!this.isShown || b.isDefaultPrevented())return;
this.isShown = !1, a("body").removeClass("modal-open"), g.call(this), this.$element.removeClass("in"), a.support.transition && this.$element.hasClass("fade") ? c.call(this) : d.call(this)
}
}, a.fn.modal = function (c) {
return this.each(function () {
var d = a(this), e = d.data("modal"), f = a.extend({}, a.fn.modal.defaults, d.data(), typeof c == "object" && c);
e || d.data("modal", e = new b(this, f)), typeof c == "string" ? e[c]() : f.show && e.show()
})
}, a.fn.modal.defaults = {backdrop: !0, keyboard: !0, show: !0}, a.fn.modal.Constructor = b, a(function () {
a("body").on("click.modal.data-api", '[data-toggle="modal"]', function (b) {
var c = a(this), d, e = a(c.attr("data-target") || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, "")), f = e.data("modal") ? "toggle" : a.extend({}, e.data(), c.data());
b.preventDefault(), e.modal(f)
})
})
}(window.jQuery), !function (a) {
"use strict";
var b = function (a, b) {
this.init("tooltip", a, b)
};
b.prototype = {
constructor: b, init: function (b, c, d) {
var e, f;
this.type = b, this.$element = a(c), this.options = this.getOptions(d), this.enabled = !0, this.options.trigger != "manual" && (e = this.options.trigger == "hover" ? "mouseenter" : "focus", f = this.options.trigger == "hover" ? "mouseleave" : "blur", this.$element.on(e, this.options.selector, a.proxy(this.enter, this)), this.$element.on(f, this.options.selector, a.proxy(this.leave, this))), this.options.selector ? this._options = a.extend({}, this.options, {
trigger: "manual",
selector: ""
}) : this.fixTitle()
}, getOptions: function (b) {
return b = a.extend({}, a.fn[this.type].defaults, b, this.$element.data()), b.delay && typeof b.delay == "number" && (b.delay = {
show: b.delay,
hide: b.delay
}), b
}, enter: function (b) {
var c = a(b.currentTarget)[this.type](this._options).data(this.type);
if (!c.options.delay || !c.options.delay.show)return c.show();
clearTimeout(this.timeout), c.hoverState = "in", this.timeout = setTimeout(function () {
c.hoverState == "in" && c.show()
}, c.options.delay.show)
}, leave: function (b) {
var c = a(b.currentTarget)[this.type](this._options).data(this.type);
if (!c.options.delay || !c.options.delay.hide)return c.hide();
clearTimeout(this.timeout), c.hoverState = "out", this.timeout = setTimeout(function () {
c.hoverState == "out" && c.hide()
}, c.options.delay.hide)
}, show: function () {
var a, b, c, d, e, f, g;
if (this.hasContent() && this.enabled) {
a = this.tip(), this.setContent(), this.options.animation && a.addClass("fade"), f = typeof this.options.placement == "function" ? this.options.placement.call(this, a[0], this.$element[0]) : this.options.placement, b = /in/.test(f), a.remove().css({
top: 0,
left: 0,
display: "block"
}).appendTo(b ? this.$element : document.body), c = this.getPosition(b), d = a[0].offsetWidth, e = a[0].offsetHeight;
switch (b ? f.split(" ")[1] : f) {
case"bottom":
g = {top: c.top + c.height, left: c.left + c.width / 2 - d / 2};
break;
case"top":
g = {top: c.top - e, left: c.left + c.width / 2 - d / 2};
break;
case"left":
g = {top: c.top + c.height / 2 - e / 2, left: c.left - d};
break;
case"right":
g = {top: c.top + c.height / 2 - e / 2, left: c.left + c.width}
}
a.css(g).addClass(f).addClass("in")
}
}, isHTML: function (a) {
return typeof a != "string" || a.charAt(0) === "<" && a.charAt(a.length - 1) === ">" && a.length >= 3 || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)
}, setContent: function () {
var a = this.tip(), b = this.getTitle();
a.find(".tooltip-inner")[this.isHTML(b) ? "html" : "text"](b), a.removeClass("fade in top bottom left right")
}, hide: function () {
function d() {
var b = setTimeout(function () {
c.off(a.support.transition.end).remove()
}, 500);
c.one(a.support.transition.end, function () {
clearTimeout(b), c.remove()
})
}
var b = this, c = this.tip();
c.removeClass("in"), a.support.transition && this.$tip.hasClass("fade") ? d() : c.remove()
}, fixTitle: function () {
var a = this.$element;
(a.attr("title") || typeof a.attr("data-original-title") != "string") && a.attr("data-original-title", a.attr("title") || "").removeAttr("title")
}, hasContent: function () {
return this.getTitle()
}, getPosition: function (b) {
return a.extend({}, b ? {top: 0, left: 0} : this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
})
}, getTitle: function () {
var a, b = this.$element, c = this.options;
return a = b.attr("data-original-title") || (typeof c.title == "function" ? c.title.call(b[0]) : c.title), a
}, tip: function () {
return this.$tip = this.$tip || a(this.options.template)
}, validate: function () {
this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null)
}, enable: function () {
this.enabled = !0
}, disable: function () {
this.enabled = !1
}, toggleEnabled: function () {
this.enabled = !this.enabled
}, toggle: function () {
this[this.tip().hasClass("in") ? "hide" : "show"]()
}
}, a.fn.tooltip = function (c) {
return this.each(function () {
var d = a(this), e = d.data("tooltip"), f = typeof c == "object" && c;
e || d.data("tooltip", e = new b(this, f)), typeof c == "string" && e[c]()
})
}, a.fn.tooltip.Constructor = b, a.fn.tooltip.defaults = {
animation: !0,
placement: "top",
selector: !1,
template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: "hover",
title: "",
delay: 0
}
}(window.jQuery), !function (a) {
"use strict";
var b = function (a, b) {
this.init("popover", a, b)
};
b.prototype = a.extend({}, a.fn.tooltip.Constructor.prototype, {
constructor: b, setContent: function () {
var a = this.tip(), b = this.getTitle(), c = this.getContent();
a.find(".popover-title")[this.isHTML(b) ? "html" : "text"](b), a.find(".popover-content > *")[this.isHTML(c) ? "html" : "text"](c), a.removeClass("fade top bottom left right in")
}, hasContent: function () {
return this.getTitle() || this.getContent()
}, getContent: function () {
var a, b = this.$element, c = this.options;
return a = b.attr("data-content") || (typeof c.content == "function" ? c.content.call(b[0]) : c.content), a
}, tip: function () {
return this.$tip || (this.$tip = a(this.options.template)), this.$tip
}
}), a.fn.popover = function (c) {
return this.each(function () {
var d = a(this), e = d.data("popover"), f = typeof c == "object" && c;
e || d.data("popover", e = new b(this, f)), typeof c == "string" && e[c]()
})
}, a.fn.popover.Constructor = b, a.fn.popover.defaults = a.extend({}, a.fn.tooltip.defaults, {
placement: "right",
content: "",
template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
})
}(window.jQuery), !function (a) {
function b(b, c) {
var d = a.proxy(this.process, this), e = a(b).is("body") ? a(window) : a(b), f;
this.options = a.extend({}, a.fn.scrollspy.defaults, c), this.$scrollElement = e.on("scroll.scroll.data-api", d), this.selector = (this.options.target || (f = a(b).attr("href")) && f.replace(/.*(?=#[^\s]+$)/, "") || "") + " .nav li > a", this.$body = a("body"), this.refresh(), this.process()
}
"use strict", b.prototype = {
constructor: b, refresh: function () {
var b = this, c;
this.offsets = a([]), this.targets = a([]), c = this.$body.find(this.selector).map(function () {
var b = a(this), c = b.data("target") || b.attr("href"), d = /^#\w/.test(c) && a(c);
return d && c.length && [[d.position().top, c]] || null
}).sort(function (a, b) {
return a[0] - b[0]
}).each(function () {
b.offsets.push(this[0]), b.targets.push(this[1])
})
}, process: function () {
var a = this.$scrollElement.scrollTop() + this.options.offset, b = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight, c = b - this.$scrollElement.height(), d = this.offsets, e = this.targets, f = this.activeTarget, g;
if (a >= c)return f != (g = e.last()[0]) && this.activate(g);
for (g = d.length; g--;)f != e[g] && a >= d[g] && (!d[g + 1] || a <= d[g + 1]) && this.activate(e[g])
}, activate: function (b) {
var c, d;
this.activeTarget = b, a(this.selector).parent(".active").removeClass("active"), d = this.selector + '[data-target="' + b + '"],' + this.selector + '[href="' + b + '"]', c = a(d).parent("li").addClass("active"), c.parent(".dropdown-menu") && (c = c.closest("li.dropdown").addClass("active")), c.trigger("activate")
}
}, a.fn.scrollspy = function (c) {
return this.each(function () {
var d = a(this), e = d.data("scrollspy"), f = typeof c == "object" && c;
e || d.data("scrollspy", e = new b(this, f)), typeof c == "string" && e[c]()
})
}, a.fn.scrollspy.Constructor = b, a.fn.scrollspy.defaults = {offset: 10}, a(function () {
a('[data-spy="scroll"]').each(function () {
var b = a(this);
b.scrollspy(b.data())
})
})
}(window.jQuery), !function (a) {
"use strict";
var b = function (b) {
this.element = a(b)
};
b.prototype = {
constructor: b, show: function () {
var b = this.element, c = b.closest("ul:not(.dropdown-menu)"), d = b.attr("data-target"), e, f, g;
d || (d = b.attr("href"), d = d && d.replace(/.*(?=#[^\s]*$)/, ""));
if (b.parent("li").hasClass("active"))return;
e = c.find(".active a").last()[0], g = a.Event("show", {relatedTarget: e}), b.trigger(g);
if (g.isDefaultPrevented())return;
f = a(d), this.activate(b.parent("li"), c), this.activate(f, f.parent(), function () {
b.trigger({type: "shown", relatedTarget: e})
})
}, activate: function (b, c, d) {
function g() {
e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"), b.addClass("active"), f ? (b[0].offsetWidth, b.addClass("in")) : b.removeClass("fade"), b.parent(".dropdown-menu") && b.closest("li.dropdown").addClass("active"), d && d()
}
var e = c.find("> .active"), f = d && a.support.transition && e.hasClass("fade");
f ? e.one(a.support.transition.end, g) : g(), e.removeClass("in")
}
}, a.fn.tab = function (c) {
return this.each(function () {
var d = a(this), e = d.data("tab");
e || d.data("tab", e = new b(this)), typeof c == "string" && e[c]()
})
}, a.fn.tab.Constructor = b, a(function () {
a("body").on("click.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function (b) {
b.preventDefault(), a(this).tab("show")
})
})
}(window.jQuery), !function (a) {
"use strict";
var b = function (b, c) {
this.$element = a(b), this.options = a.extend({}, a.fn.typeahead.defaults, c), this.matcher = this.options.matcher || this.matcher, this.sorter = this.options.sorter || this.sorter, this.highlighter = this.options.highlighter || this.highlighter, this.updater = this.options.updater || this.updater, this.$menu = a(this.options.menu).appendTo("body"), this.source = this.options.source, this.shown = !1, this.listen()
};
b.prototype = {
constructor: b, select: function () {
var a = this.$menu.find(".active").attr("data-value");
return this.$element.val(this.updater(a)).change(), this.hide()
}, updater: function (a) {
return a
}, show: function () {
var b = a.extend({}, this.$element.offset(), {height: this.$element[0].offsetHeight});
return this.$menu.css({top: b.top + b.height, left: b.left}), this.$menu.show(), this.shown = !0, this
}, hide: function () {
return this.$menu.hide(), this.shown = !1, this
}, lookup: function (b) {
var c = this, d, e;
return this.query = this.$element.val(), this.query ? (d = a.grep(this.source, function (a) {
return c.matcher(a)
}), d = this.sorter(d), d.length ? this.render(d.slice(0, this.options.items)).show() : this.shown ? this.hide() : this) : this.shown ? this.hide() : this
}, matcher: function (a) {
return ~a.toLowerCase().indexOf(this.query.toLowerCase())
}, sorter: function (a) {
var b = [], c = [], d = [], e;
while (e = a.shift())e.toLowerCase().indexOf(this.query.toLowerCase()) ? ~e.indexOf(this.query) ? c.push(e) : d.push(e) : b.push(e);
return b.concat(c, d)
}, highlighter: function (a) {
var b = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
return a.replace(new RegExp("(" + b + ")", "ig"), function (a, b) {
return "<strong>" + b + "</strong>"
})
}, render: function (b) {
var c = this;
return b = a(b).map(function (b, d) {
return b = a(c.options.item).attr("data-value", d), b.find("a").html(c.highlighter(d)), b[0]
}), b.first().addClass("active"), this.$menu.html(b), this
}, next: function (b) {
var c = this.$menu.find(".active").removeClass("active"), d = c.next();
d.length || (d = a(this.$menu.find("li")[0])), d.addClass("active")
}, prev: function (a) {
var b = this.$menu.find(".active").removeClass("active"), c = b.prev();
c.length || (c = this.$menu.find("li").last()), c.addClass("active")
}, listen: function () {
this.$element.on("blur", a.proxy(this.blur, this)).on("keypress", a.proxy(this.keypress, this)).on("keyup", a.proxy(this.keyup, this)), (a.browser.webkit || a.browser.msie) && this.$element.on("keydown", a.proxy(this.keypress, this)), this.$menu.on("click", a.proxy(this.click, this)).on("mouseenter", "li", a.proxy(this.mouseenter, this))
}, keyup: function (a) {
switch (a.keyCode) {
case 40:
case 38:
break;
case 9:
case 13:
if (!this.shown)return;
this.select();
break;
case 27:
if (!this.shown)return;
this.hide();
break;
default:
this.lookup()
}
a.stopPropagation(), a.preventDefault()
}, keypress: function (a) {
if (!this.shown)return;
switch (a.keyCode) {
case 9:
case 13:
case 27:
a.preventDefault();
break;
case 38:
if (a.type != "keydown")break;
a.preventDefault(), this.prev();
break;
case 40:
if (a.type != "keydown")break;
a.preventDefault(), this.next()
}
a.stopPropagation()
}, blur: function (a) {
var b = this;
setTimeout(function () {
b.hide()
}, 150)
}, click: function (a) {
a.stopPropagation(), a.preventDefault(), this.select()
}, mouseenter: function (b) {
this.$menu.find(".active").removeClass("active"), a(b.currentTarget).addClass("active")
}
}, a.fn.typeahead = function (c) {
return this.each(function () {
var d = a(this), e = d.data("typeahead"), f = typeof c == "object" && c;
e || d.data("typeahead", e = new b(this, f)), typeof c == "string" && e[c]()
})
}, a.fn.typeahead.defaults = {
source: [],
items: 8,
menu: '<ul class="typeahead dropdown-menu"></ul>',
item: '<li><a href="#"></a></li>'
}, a.fn.typeahead.Constructor = b, a(function () {
a("body").on("focus.typeahead.data-api", '[data-provide="typeahead"]', function (b) {
var c = a(this);
if (c.data("typeahead"))return;
b.preventDefault(), c.typeahead(c.data())
})
})
}(window.jQuery);

View file

@ -0,0 +1,26 @@
var Initializer = function () {
};
Initializer.prototype.initialize = function () {
try {
ProgressBar.showProgressBar();
window.apiModel = new ApiModel();
window.listener = new Listeners();
window.listener.init();
window.graphics = new Graphics();
window.graphics.init();
window.apiModel.loadModel(Properties.primaryModelPath);
window.graphics.show(window.apiModel.modelJSON);
window.graphics.closeMethodElement();
window.graphics.createAnchorsToTypes();
} catch (e) {
if (e instanceof CaughtException) {
Logger.error(e.getMsg());
} else {
Logger.error("Unexpected error occured :-(\n" + e);
}
} finally {
ProgressBar.hideProgressBar();
}
};

View file

@ -0,0 +1,81 @@
var Listeners = function () {
};
Listeners.prototype.init = function () {
this.regEvents();
this.loadListener();
this.primaryLoadListener();
this.secondaryLoadListener();
};
Listeners.prototype.loadModelEvent = function (e) {
var modelPath = document.querySelector("#modelUrl").value;
this.loadModel(modelPath);
};
Listeners.prototype.loadPrimaryModelEvent = function (e) {
this.loadModel(Properties.primaryModelPath);
};
Listeners.prototype.loadSecondaryModelEvent = function (e) {
this.loadModel(Properties.secondaryModelPath);
};
Listeners.prototype.loadModel = function (modelPath) {
try {
ProgressBar.showProgressBar();
window.apiModel.loadModel(modelPath);
window.graphics.show(window.apiModel.modelJSON);
window.graphics.closeMethodElement();
window.graphics.createAnchorsToTypes();
} catch (e) {
if (e instanceof CaughtException) {
Logger.error(e.getMsg());
} else {
Logger.error("Unexpected error during retrieving model");
}
} finally {
ProgressBar.hideProgressBar();
}
};
Listeners.prototype.loadListener = function () {
var button = document.querySelector("#loadModel");
button.addEventListener("click", this.loadModelEvent.bind(this));
};
Listeners.prototype.primaryLoadListener = function () {
var button = document.querySelector("#primaryLoad");
button.addEventListener("click", this.loadPrimaryModelEvent.bind(this));
};
Listeners.prototype.secondaryLoadListener = function () {
var button = document.querySelector("#secondaryLoad");
button.addEventListener("click", this.loadSecondaryModelEvent.bind(this));
};
Listeners.prototype.regEvents = function () {
$('.header').click(function () {
var parent = $(this).parent();
if (parent.hasClass('closed')) {
parent.children(".children").slideToggle("slow");
parent.children(".children").promise().done(
function (onFired) {
parent.removeClass('closed');
parent.addClass('open');
}
);
} else {
parent.children(".children").slideToggle("slow");
parent.children(".children").promise().done(
function (onFired) {
parent.removeClass('open');
parent.addClass('closed');
}
);
}
});
};

View file

@ -0,0 +1,74 @@
//Copyright (c) 2013 Crystalline Technologies
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(function ($) {
//Main method
$.fn.json2html = function (json, transform, _options) {
//Make sure we have the json2html base loaded
if (typeof json2html === 'undefined') return (undefined);
//Default Options
var options = {
'append': true,
'replace': false,
'prepend': false,
'eventData': {}
};
//Extend the options (with defaults)
if (_options !== undefined) $.extend(options, _options);
//Insure that we have the events turned (Required)
options.events = true;
//Make sure to take care of any chaining
return this.each(function () {
//let json2html core do it's magic
var result = json2html.transform(json, transform, options);
//Attach the html(string) result to the DOM
var dom = $(document.createElement('i')).html(result.html);
//Determine if we have events
for (var i = 0; i < result.events.length; i++) {
var event = result.events[i];
//find the associated DOM object with this event
var obj = $(dom).find("[json2html-event-id-" + event.type + "='" + event.id + "']");
//Check to see if we found this element or not
if (obj.length === 0) throw 'jquery.json2html was unable to attach event ' + event.id + ' to DOM';
//remove the attribute
$(obj).removeAttr('json2html-event-id-' + event.type);
//attach the event
$(obj).on(event.type, event.data, function (e) {
//attach the jquery event
e.data.event = e;
//call the appropriate method
e.data.action.call($(this), e.data);
});
}
//Append it to the appropriate element
if (options.replace) $.fn.replaceWith.call($(this), $(dom).children());
else if (options.prepend) $.fn.prepend.call($(this), $(dom).children());
else $.fn.append.call($(this), $(dom).children());
});
};
})(jQuery);

View file

@ -0,0 +1,366 @@
//Copyright (c) 2013 Crystalline Technologies
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var json2html = {
/* ---------------------------------------- Public Methods ------------------------------------------------ */
'transform': function (json, transform, _options) {
//create the default output
var out = {'events': [], 'html': ''};
//default options (by default we don't allow events)
var options = {
'events': false
};
//extend the options
options = json2html._extend(options, _options);
//Make sure we have a transform & json object
if (transform !== undefined || json !== undefined) {
//Normalize strings to JSON objects if necessary
var obj = typeof json === 'string' ? JSON.parse(json) : json;
//Transform the object (using the options)
out = json2html._transform(obj, transform, options);
}
//determine if we need the events
// otherwise return just the html string
if (options.events) return (out);
else return ( out.html );
},
/* ---------------------------------------- Private Methods ------------------------------------------------ */
//Extend options
'_extend': function (obj1, obj2) {
var obj3 = {};
for (var attrname in obj1) {
obj3[attrname] = obj1[attrname];
}
for (var attrname in obj2) {
obj3[attrname] = obj2[attrname];
}
return obj3;
},
//Append results
'_append': function (obj1, obj2) {
var out = {'html': '', 'event': []};
if (typeof obj1 !== 'undefined' && typeof obj2 !== 'undefined') {
out.html = obj1.html + obj2.html;
out.events = obj1.events.concat(obj2.events);
}
return (out);
},
//isArray (fix for IE prior to 9)
'_isArray': function (obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
},
//Transform object
'_transform': function (json, transform, options) {
var elements = {'events': [], 'html': ''};
//Determine the type of this object
if (json2html._isArray(json)) {
//Itterrate through the array and add it to the elements array
var len = json.length;
for (var j = 0; j < len; ++j) {
//Apply the transform to this object and append it to the results
elements = json2html._append(elements, json2html._apply(json[j], transform, j, options));
}
} else if (typeof json === 'object') {
//Apply the transform to this object and append it to the results
elements = json2html._append(elements, json2html._apply(json, transform, undefined, options));
}
//Return the resulting elements
return (elements);
},
//Apply the transform at the second level
'_apply': function (obj, transform, index, options) {
var element = {'events': [], 'html': ''};
//Itterate through the transform and create html as needed
if (json2html._isArray(transform)) {
var t_len = transform.length;
for (var t = 0; t < t_len; ++t) {
//transform the object and append it to the output
element = json2html._append(element, json2html._apply(obj, transform[t], index, options));
}
} else if (typeof transform === 'object') {
//Get the tag element of this transform
if (transform.tag !== undefined) {
var tag = json2html._getValue(obj, transform, 'tag', index);
//Create a new element
element.html += '<' + tag;
//Create a new object for the children
var children = {'events': [], 'html': ''};
//innerHTML
var html;
//Look into the properties of this transform
for (var key in transform) {
switch (key) {
case 'tag':
//Do nothing as we have already created the element from the tag
break;
case 'children':
//Add the children
if (json2html._isArray(transform.children)) {
//Apply the transform to the children
children = json2html._append(children, json2html._apply(obj, transform.children, index, options));
} else if (typeof transform.children === 'function') {
//Get the result from the function
var temp = transform.children.call(obj, obj, index);
//Make sure we have an object result with the props
// html (string), events (array)
// OR a string (then just append it to the children
if (typeof temp === 'object') {
//make sure this object is a valid json2html response object
if (temp.html !== undefined && temp.events !== undefined) children = json2html._append(children, temp);
} else if (typeof temp === 'string') {
//append the result directly to the html of the children
children.html += temp;
}
}
break;
case 'html':
//Create the html attribute for this element
html = json2html._getValue(obj, transform, 'html', index);
break;
default:
//Add the property as a attribute if it's not a key one
var isEvent = false;
//Check if the first two characters are 'on' then this is an event
if (key.length > 2)
if (key.substring(0, 2).toLowerCase() == 'on') {
//Determine if we should add events
if (options.events) {
//if so then setup the event data
var data = {
'action': transform[key],
'obj': obj,
'data': options.eventData,
'index': index
};
//create a new id for this event
var id = json2html._guid();
//append the new event to this elements events
element.events[element.events.length] = {
'id': id,
'type': key.substring(2),
'data': data
};
//Insert temporary event property (json2html-event-id) into the element
element.html += " json2html-event-id-" + key.substring(2) + "='" + id + "'";
}
//this is an event
isEvent = true;
}
//If this wasn't an event AND we actually have a value then add it as a property
if (!isEvent) {
//Get the value
var val = json2html._getValue(obj, transform, key, index);
//Make sure we have a value
if (val !== undefined) {
var out;
//Determine the output type of this value (wrap with quotes)
if (typeof val === 'string') out = '"' + val.replace(/"/g, '&quot;') + '"';
else out = val;
//creat the name value pair
element.html += ' ' + key + '=' + out;
}
}
break;
}
}
//close the opening tag
element.html += '>';
//add the innerHTML (if we have any)
if (html) element.html += html;
//add the children (if we have any)
element = json2html._append(element, children);
//add the closing tag
element.html += '</' + tag + '>';
}
}
//Return the output object
return (element);
},
//Get a new GUID (used by events)
'_guid': function () {
var S4 = function () {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return (S4() + S4() + "-" + S4() + S4() + "-" + S4() + S4());
},
//Get the html value of the object
'_getValue': function (obj, transform, key, index) {
var out = '';
var val = transform[key];
var type = typeof val;
if (type === 'function') {
return (val.call(obj, obj, index));
} else if (type === 'string') {
var _tokenizer = new json2html._tokenizer([
/\$\{([^\}\{]+)\}/
], function (src, real, re) {
return real ? src.replace(re, function (all, name) {
//Split the string into it's seperate components
var components = name.split('.');
//Set the object we use to query for this name to be the original object
var useObj = obj;
//Output value
var outVal = '';
//Parse the object components
var c_len = components.length;
for (var i = 0; i < c_len; ++i) {
if (components[i].length > 0) {
var newObj = useObj[components[i]];
useObj = newObj;
if (useObj === null || useObj === undefined) break;
}
}
//As long as we have an object to use then set the out
if (useObj !== null && useObj !== undefined) outVal = useObj;
return (outVal);
}) : src;
});
out = _tokenizer.parse(val).join('');
} else {
out = val;
}
return (out);
},
//Tokenizer
'_tokenizer': function (tokenizers, doBuild) {
if (!(this instanceof json2html._tokenizer ))
return new json2html._tokenizer(tokenizers, doBuild);
this.tokenizers = tokenizers.splice ? tokenizers : [tokenizers];
if (doBuild)
this.doBuild = doBuild;
this.parse = function (src) {
this.src = src;
this.ended = false;
this.tokens = [];
do {
this.next();
} while (!this.ended);
return this.tokens;
};
this.build = function (src, real) {
if (src)
this.tokens.push(
!this.doBuild ? src :
this.doBuild(src, real, this.tkn)
);
};
this.next = function () {
var self = this,
plain;
self.findMin();
plain = self.src.slice(0, self.min);
self.build(plain, false);
self.src = self.src.slice(self.min).replace(self.tkn, function (all) {
self.build(all, true);
return '';
});
if (!self.src)
self.ended = true;
};
this.findMin = function () {
var self = this, i = 0, tkn, idx;
self.min = -1;
self.tkn = '';
while (( tkn = self.tokenizers[i++]) !== undefined) {
idx = self.src[tkn.test ? 'search' : 'indexOf'](tkn);
if (idx != -1 && (self.min == -1 || idx < self.min )) {
self.tkn = tkn;
self.min = idx;
}
}
if (self.min == -1)
self.min = self.src.length;
};
}
};

View file

@ -0,0 +1,75 @@
var ApiModel = function () {
this.modelJSON;
};
/**
* Stores the model in JSON format in modelJSON property
* @param modelUrl URL where model can be retrieved
*/
ApiModel.prototype.loadModel = function (modelUrl) {
var stateChanged = function (caller) {
if (this.readyState === 4) {
if (this.status == 200) {
// Logger.success("Retrieving model finished with http status: OK " + this.status);
} else {
// Logger.error("Retrieving model finished with http status: " + this.status);
throw new CaughtException("Retrieving model finished with http status: " + this.status);
}
var modelJSON = caller.checkAndGetModel(this.responseText);
caller.setModelJSON(modelJSON);
}
};
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', modelUrl, false);
var oldThis = this;
var callback = stateChanged.bind(xmlhttp);
xmlhttp.addEventListener('readystatechange', function () {
callback(oldThis)
});
try {
xmlhttp.send();
} catch (e) {
throw new CaughtException(e + "\nwith model URI " + modelUrl);
}
if (xmlhttp.status != 200) {
throw new CaughtException("Retrieving model finished with http status: " + xmlhttp.status + "\nwith model URI " + modelUrl);
}
};
/**
* Checks model in string format and retrieves model in JSON. When problem during checking, exception is thrown.
* @param givenModel model in string format
* @returns {*} model in JSON format
*/
ApiModel.prototype.checkAndGetModel = function (givenModel) {
try {
givenModel = givenModel.replace(/[<]/g, "&lt;").replace(/[>]/g, "&gt;");
var modelJSON = JSON.parse(givenModel);
this.replacePropertyNames(modelJSON);
return modelJSON;
} catch (e) {
Logger.error("Given model could not be parsed as JSON");
throw new CaughtException("Given model could not be parsed as JSON");
}
};
ApiModel.prototype.replacePropertyNames = function (modelJSON) {
for (var key in modelJSON) {
var value = modelJSON[key];
if (typeof value !== "string") {
this.replacePropertyNames(modelJSON[key]);
}
var newKey = Properties.keys[key];
delete modelJSON[key];
if (newKey != null) {
modelJSON[newKey] = value;
} else {
modelJSON[key] = value;
}
}
};
ApiModel.prototype.setModelJSON = function (modelJSON) {
this.modelJSON = modelJSON;
};

View file

@ -0,0 +1,213 @@
/** Notify.js - v0.3.1 - 2014/02/06
* http://notifyjs.com/
* Copyright (c) 2014 Jaime Pillora - MIT
*/
(function (t, i, n, e) {
"use strict";
var o, r, s, a, l, h, c, p, u, d, f, A, m, w, g, y, b, v, x, C, S, E, M, k, H, D, F, T = [].indexOf || function (t) {
for (var i = 0, n = this.length; n > i; i++)if (i in this && this[i] === t)return i;
return -1
};
S = "notify", C = S + "js", s = S + "!blank", M = {
t: "top",
m: "middle",
b: "bottom",
l: "left",
c: "center",
r: "right"
}, m = ["l", "c", "r"], F = ["t", "m", "b"], b = ["t", "b", "l", "r"], v = {
t: "b",
m: null,
b: "t",
l: "r",
c: null,
r: "l"
}, x = function (t) {
var i;
return i = [], n.each(t.split(/\W+/), function (t, n) {
var o;
return o = n.toLowerCase().charAt(0), M[o] ? i.push(o) : e
}), i
}, D = {}, a = {
name: "core",
html: '<div class="' + C + '-wrapper">\n <div class="' + C + '-arrow"></div>\n <div class="' + C + '-container"></div>\n</div>',
css: "." + C + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + C + "-corner ." + C + "-wrapper,\n." + C + "-corner ." + C + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + C + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + C + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n position: relative;\n}\n\n." + C + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
}, H = {"border-radius": ["-webkit-", "-moz-"]}, f = function (t) {
return D[t]
}, r = function (i, e) {
var o, r, s, a;
if (!i)throw"Missing Style name";
if (!e)throw"Missing Style definition";
if (!e.html)throw"Missing Style HTML";
return (null != (a = D[i]) ? a.cssElem : void 0) && (t.console && console.warn("" + S + ": overwriting style '" + i + "'"), D[i].cssElem.remove()), e.name = i, D[i] = e, o = "", e.classes && n.each(e.classes, function (t, i) {
return o += "." + C + "-" + e.name + "-" + t + " {\n", n.each(i, function (t, i) {
return H[t] && n.each(H[t], function (n, e) {
return o += " " + e + t + ": " + i + ";\n"
}), o += " " + t + ": " + i + ";\n"
}), o += "}\n"
}), e.css && (o += "/* styles for " + e.name + " */\n" + e.css), o && (e.cssElem = y(o), e.cssElem.attr("id", "notify-" + e.name)), s = {}, r = n(e.html), u("html", r, s), u("text", r, s), e.fields = s
}, y = function (t) {
var i;
i = l("style"), i.attr("type", "text/css"), n("head").append(i);
try {
i.html(t)
} catch (e) {
i[0].styleSheet.cssText = t
}
return i
}, u = function (t, i, e) {
var o;
return "html" !== t && (t = "text"), o = "data-notify-" + t, p(i, "[" + o + "]").each(function () {
var i;
return i = n(this).attr(o), i || (i = s), e[i] = t
})
}, p = function (t, i) {
return t.is(i) ? t : t.find(i)
}, E = {
clickToHide: !0,
autoHide: !0,
autoHideDelay: 5e3,
arrowShow: !0,
arrowSize: 5,
breakNewLines: !0,
elementPosition: "bottom",
globalPosition: "top right",
style: "bootstrap",
className: "error",
showAnimation: "slideDown",
showDuration: 400,
hideAnimation: "slideUp",
hideDuration: 200,
gap: 5
}, g = function (t, i) {
var e;
return e = function () {
}, e.prototype = t, n.extend(!0, new e, i)
}, h = function (t) {
return n.extend(E, t)
}, l = function (t) {
return n("<" + t + "></" + t + ">")
}, A = {}, d = function (t) {
var i;
return t.is("[type=radio]") && (i = t.parents("form:first").find("[type=radio]").filter(function (i, e) {
return n(e).attr("name") === t.attr("name")
}), t = i.first()), t
}, w = function (t, i, n) {
var o, r;
if ("string" == typeof n)n = parseInt(n, 10); else if ("number" != typeof n)return;
if (!isNaN(n))return o = M[v[i.charAt(0)]], r = i, t[o] !== e && (i = M[o.charAt(0)], n = -n), t[i] === e ? t[i] = n : t[i] += n, null
}, k = function (t, i, n) {
if ("l" === t || "t" === t)return 0;
if ("c" === t || "m" === t)return n / 2 - i / 2;
if ("r" === t || "b" === t)return n - i;
throw"Invalid alignment"
}, c = function (t) {
return c.e = c.e || l("div"), c.e.text(t).html()
}, o = function () {
function t(t, i, e) {
"string" == typeof e && (e = {className: e}), this.options = g(E, n.isPlainObject(e) ? e : {}), this.loadHTML(), this.wrapper = n(a.html), this.wrapper.data(C, this), this.arrow = this.wrapper.find("." + C + "-arrow"), this.container = this.wrapper.find("." + C + "-container"), this.container.append(this.userContainer), t && t.length && (this.elementType = t.attr("type"), this.originalElement = t, this.elem = d(t), this.elem.data(C, this), this.elem.before(this.wrapper)), this.container.hide(), this.run(i)
}
return t.prototype.loadHTML = function () {
var t;
return t = this.getStyle(), this.userContainer = n(t.html), this.userFields = t.fields
}, t.prototype.show = function (t, i) {
var n, o, r, s, a, l = this;
if (o = function () {
return t || l.elem || l.destroy(), i ? i() : e
}, a = this.container.parent().parents(":hidden").length > 0, r = this.container.add(this.arrow), n = [], a && t)s = "show"; else if (a && !t)s = "hide"; else if (!a && t)s = this.options.showAnimation, n.push(this.options.showDuration); else {
if (a || t)return o();
s = this.options.hideAnimation, n.push(this.options.hideDuration)
}
return n.push(o), r[s].apply(r, n)
}, t.prototype.setGlobalPosition = function () {
var t, i, e, o, r, s, a, h;
return h = this.getPosition(), a = h[0], s = h[1], r = M[a], t = M[s], o = a + "|" + s, i = A[o], i || (i = A[o] = l("div"), e = {}, e[r] = 0, "middle" === t ? e.top = "45%" : "center" === t ? e.left = "45%" : e[t] = 0, i.css(e).addClass("" + C + "-corner"), n("body").append(i)), i.prepend(this.wrapper)
}, t.prototype.setElementPosition = function () {
var t, i, o, r, s, a, l, h, c, p, u, d, f, A, g, y, x, C, S, E, H, D, z, Q, B, R, N, P, U;
for (z = this.getPosition(), E = z[0], C = z[1], S = z[2], u = this.elem.position(), h = this.elem.outerHeight(), d = this.elem.outerWidth(), c = this.elem.innerHeight(), p = this.elem.innerWidth(), Q = this.wrapper.position(), s = this.container.height(), a = this.container.width(), A = M[E], y = v[E], x = M[y], l = {}, l[x] = "b" === E ? h : "r" === E ? d : 0, w(l, "top", u.top - Q.top), w(l, "left", u.left - Q.left), U = ["top", "left"], B = 0, N = U.length; N > B; B++)H = U[B], g = parseInt(this.elem.css("margin-" + H), 10), g && w(l, H, g);
if (f = Math.max(0, this.options.gap - (this.options.arrowShow ? o : 0)), w(l, x, f), this.options.arrowShow) {
for (o = this.options.arrowSize, i = n.extend({}, l), t = this.userContainer.css("border-color") || this.userContainer.css("background-color") || "white", R = 0, P = b.length; P > R; R++)H = b[R], D = M[H], H !== y && (r = D === A ? t : "transparent", i["border-" + D] = "" + o + "px solid " + r);
w(l, M[y], o), T.call(b, C) >= 0 && w(i, M[C], 2 * o)
} else this.arrow.hide();
return T.call(F, E) >= 0 ? (w(l, "left", k(C, a, d)), i && w(i, "left", k(C, o, p))) : T.call(m, E) >= 0 && (w(l, "top", k(C, s, h)), i && w(i, "top", k(C, o, c))), this.container.is(":visible") && (l.display = "block"), this.container.removeAttr("style").css(l), i ? this.arrow.removeAttr("style").css(i) : e
}, t.prototype.getPosition = function () {
var t, i, n, e, o, r, s, a;
if (i = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), t = x(i), 0 === t.length && (t[0] = "b"), n = t[0], 0 > T.call(b, n))throw"Must be one of [" + b + "]";
return (1 === t.length || (e = t[0], T.call(F, e) >= 0 && (o = t[1], 0 > T.call(m, o))) || (r = t[0], T.call(m, r) >= 0 && (s = t[1], 0 > T.call(F, s)))) && (t[1] = (a = t[0], T.call(m, a) >= 0 ? "m" : "l")), 2 === t.length && (t[2] = t[1]), t
}, t.prototype.getStyle = function (t) {
var i;
if (t || (t = this.options.style), t || (t = "default"), i = D[t], !i)throw"Missing style: " + t;
return i
}, t.prototype.updateClasses = function () {
var t, i;
return t = ["base"], n.isArray(this.options.className) ? t = t.concat(this.options.className) : this.options.className && t.push(this.options.className), i = this.getStyle(), t = n.map(t, function (t) {
return "" + C + "-" + i.name + "-" + t
}).join(" "), this.userContainer.attr("class", t)
}, t.prototype.run = function (t, i) {
var o, r, a, l, h, u = this;
if (n.isPlainObject(i) ? n.extend(this.options, i) : "string" === n.type(i) && (this.options.className = i), this.container && !t)return this.show(!1), e;
if (this.container || t) {
r = {}, n.isPlainObject(t) ? r = t : r[s] = t;
for (a in r)o = r[a], l = this.userFields[a], l && ("text" === l && (o = c(o), this.options.breakNewLines && (o = o.replace(/\n/g, "<br/>"))), h = a === s ? "" : "=" + a, p(this.userContainer, "[data-notify-" + l + h + "]").html(o));
return this.updateClasses(), this.elem ? this.setElementPosition() : this.setGlobalPosition(), this.show(!0), this.options.autoHide ? (clearTimeout(this.autohideTimer), this.autohideTimer = setTimeout(function () {
return u.show(!1)
}, this.options.autoHideDelay)) : e
}
}, t.prototype.destroy = function () {
return this.wrapper.remove()
}, t
}(), n[S] = function (t, i, e) {
return t && t.nodeName || t.jquery ? n(t)[S](i, e) : (e = i, i = t, new o(null, i, e)), t
}, n.fn[S] = function (t, i) {
return n(this).each(function () {
var e;
return e = d(n(this)).data(C), e ? e.run(t, i) : new o(n(this), t, i)
}), this
}, n.extend(n[S], {defaults: h, addStyle: r, pluginOptions: E, getStyle: f, insertCSS: y}), n(function () {
return y(a.css).attr("id", "core-notify"), n(i).on("click notify-hide", "." + C + "-wrapper", function (t) {
var i;
return i = n(this).data(C), i && (i.options.clickToHide || "notify-hide" === t.type) ? i.show(!1) : e
})
})
})(window, document, jQuery), $.notify.addStyle("bootstrap", {
html: "<div>\n<span data-notify-text></span>\n</div>",
classes: {
base: {
"font-weight": "bold",
padding: "8px 15px 8px 14px",
"text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
"background-color": "#fcf8e3",
border: "1px solid #fbeed5",
"border-radius": "4px",
"white-space": "nowrap",
"padding-left": "25px",
"background-repeat": "no-repeat",
"background-position": "3px 7px"
},
error: {
color: "#B94A48",
"background-color": "#F2DEDE",
"border-color": "#EED3D7",
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
},
success: {
color: "#468847",
"background-color": "#DFF0D8",
"border-color": "#D6E9C6",
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
},
info: {
color: "#3A87AD",
"background-color": "#D9EDF7",
"border-color": "#BCE8F1",
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
},
warn: {
color: "#C09853",
"background-color": "#FCF8E3",
"border-color": "#FBEED5",
"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
}
}
});

View file

@ -0,0 +1,7 @@
var CaughtException = function (msg) {
this.msg = msg;
};
CaughtException.prototype.getMsg = function () {
return this.msg;
};

View file

@ -0,0 +1,13 @@
var Logger = function () {
};
Logger.error = function (msg) {
msg = "Error occured! \n" + msg;
$.notify(msg, "error");
console.log(msg);
};
Logger.success = function (msg) {
$.notify(msg, "success");
console.log(msg);
};

View file

@ -0,0 +1,59 @@
var Properties = function () {
};
Properties.primaryModelPath = "jrapidoc.rest.model.json";
Properties.primaryButtonName = "Load REST";
Properties.secondaryModelPath = "jrapidoc.soap.model.json";
Properties.secondaryButtonName = "Load SOAP";
Properties.modelRootName = "Remote API Documentation";
Properties.keys = {
customInfo: "General Information",
appVersion: "Application Version",
"jrapidoc-rest-plugin": "Kie Server Version",
"jrapidoc-soap-plugin": "JRAPIDoc Plugin Version",
serviceGroups: "Available endpoints",
types: "Data types used in API",
baseUrl: "Base URL",
methodDescription: "Method Description",
returnDescription: "Return Description",
serviceDescription: "Service Description",
serviceGroupDescription: "Service Group Description",
typeDescription: "Type Description",
attributeDescription: "Attribute Description",
parameterDescription: "Parameter Description",
services: "Services",
path: "Path",
methods: "Methods",
httpMethodType: "HTTP Method Type",
asynchronous: "Asynchronous",
headerParams: "Header Parameters",
cookieParams: "Cookie Parameters",
formParams: "Form Parameters",
matrixParams: "Matrix Parameters",
pathParams: "Path Parameters",
queryParams: "Query Parameters",
returnOptions: "Possible Return Options",
httpStatus: "HTTP Status",
returnTypes: "Return Types",
type: "Type",
typeRef: "Type Reference",
includeTypeRef: "Included Type Reference",
keyTypeRef: "Key Type Reference",
valueTypeRef: "Value Type Reference",
attributes: "Attributes",
required: "Required",
pathExample: "Path Example",
operationName: "Operation Name",
serviceName: "Service Name",
attributeName: "Attribute Name",
parameterName: "Parameter Name",
options: "Possible Options",
parameters: "Parameters",
soapBinding: "SOAP Binding",
style: "Style",
use: "Use",
parameterStyle: "Parameter Style",
soapInputHeaders: "SOAP Input Headers",
soapOutputHeaders: "SOAP Output Headers"
};

View file

@ -0,0 +1,43 @@
function Utils(object) {
};
Utils.isEmpty = function (object) {
if (object == undefined) {
return true;
}
if (object == null) {
return true;
}
if (object == "") {
return true;
}
if (!(object instanceof HTMLElement) && Object.keys(object).length == 0) {
return true;
}
return false;
};
Utils.isNotEmpty = function (object) {
return !Utils.isEmpty(object);
};
Utils.subs = function (object) {
var fromProperties = Properties[object];
if (Utils.isEmpty(fromProperties)) {
return object;
} else {
return fromProperties;
}
};
String.prototype.trimSlash = function () {
var string = this.trim();
if (string.charAt(0) == "/") {
string = string.substring(1);
}
if (string.charAt(string.length - 1) == "/") {
string = string.substring(0, string.length - 1);
}
return string;
};

View file

@ -0,0 +1,267 @@
var Graphics = function () {
this.baseUrl = null;
};
Graphics.prototype.init = function () {
var input = document.querySelector("#modelUrl");
input.value = Properties.primaryModelPath;
var primaryLoadButton = document.querySelector("#primaryLoad");
primaryLoadButton.value = Properties.primaryButtonName;
var secondaryLoadButton = document.querySelector("#secondaryLoad");
secondaryLoadButton.value = Properties.secondaryButtonName;
};
Graphics.prototype.setCSSClass = function (obj) {
var classes = "package open object ";
if (Properties.keys.customInfo == obj.name) {
return classes + "hide";
} else if (Properties.keys.types == obj.name) {
return classes + "types";
} else if (Properties.keys.serviceGroups == obj.name) {
return classes + "serviceGroups";
} else if (Properties.keys.services == obj.name) {
return classes + "services";
} else if (Properties.keys.methods == obj.name) {
return classes + "methods";
} else if (obj.name == Properties.keys.cookieParams ||
obj.name == Properties.keys.formParams ||
obj.name == Properties.keys.headerParams ||
obj.name == Properties.keys.matrixParams ||
obj.name == Properties.keys.pathParams ||
obj.name == Properties.keys.queryParams) {
return classes + "httpParameters";
} else if (Properties.keys.parameters == obj.name) {
return classes + "parameters";
} else if (Properties.keys.returnOptions == obj.name) {
return classes + "returnOptions";
} else if (Properties.keys.soapInputHeaders == obj.name) {
return classes + "soapInputHeaders";
} else if (Properties.keys.soapOutputHeaders == obj.name) {
return classes + "soapOutputHeaders";
} else if (Properties.keys.attributes == obj.name) {
return classes + "attributes";
} else if (Properties.keys.returnTypes == obj.name) {
return classes + "returnTypes";
}
return classes;
};
Graphics.prototype.transformsParent = {
'object': {
'tag': 'div',
'class': function (obj) {
return Graphics.prototype.setCSSClass(obj)
},
'children': [
{
'tag': 'div',
'class': 'children',
'children': [
{
'tag': 'div',
'class': 'arrow hide'
},
{
'tag': 'span',
'class': 'name',
'html': ''
},
{
'tag': 'span',
'class': 'value',
'html': ''
}
]
},
{
'tag': 'div',
'class': 'children',
'children': function (obj) {
return (Graphics.prototype.children(obj.name, obj.value));
}
}
]
}
};
Graphics.prototype.transformsChildren = {
'object': {
'tag': 'div',
'class': function (obj) {
return Graphics.prototype.setCSSClass(obj)
},
'children': [
{
'tag': 'div',
'class': 'header',
'children': [
{
'tag': 'div',
'class': function (obj) {
if (Graphics.prototype.getValue(obj.value) !== undefined) return ('arrow hide');
else return ('arrow');
}
},
{
'tag': 'span',
'class': 'name',
'html': '${name}'
},
{
'tag': 'span',
'class': 'value',
'html': function (obj) {
var value = Graphics.prototype.getValue(obj.value);
if (value !== undefined) return (" : " + Graphics.prototype.anchorLink(obj));
else return ('');
}
}
]
},
{
'tag': 'div',
'class': 'children',
'children': function (obj) {
return (Graphics.prototype.children(obj.name, obj.value));
}
}
]
}
};
Graphics.prototype.anchorLink = function (obj) {
if (obj.name == Properties.keys.typeRef || obj.name == Properties.keys.includeTypeRef || obj.name == Properties.keys.keyTypeRef || obj.name == Properties.keys.valueTypeRef) {
return "<a href='#" + obj.value + "'>" + obj.value + "</a>";
} else if (obj.name === "Path") {
return Graphics.prototype.baseUrl + "/" + obj.value;
} else {
return obj.value;
}
};
Graphics.prototype.anchor = function (obj) {
return "<span id='" + obj.name + "'>" + obj.name + "</span>";
};
Graphics.prototype.closeMethodElement = function () {
var methodList = $(".methods > .children > .package.open.object");
methodList.removeClass("open");
methodList.addClass("closed");
};
Graphics.prototype.createAnchorsToTypes = function () {
var top = document.querySelector("#top");
var nodesArray = top.children[0].children[1].children;
for (var i = 0; i < nodesArray[nodesArray.length - 1].children[1].children.length; i++) {
var type = nodesArray[nodesArray.length - 1].children[1].children[i];
var typeRef = type.children[0].children[1].innerHTML;
type.children[0].children[1].innerHTML = "<span id='" + typeRef + "'>" + typeRef + "</span>";
}
};
Graphics.prototype.show = function (modelJSON) {
//Visualize sample
this.visualize(modelJSON);
};
Graphics.prototype.visualize = function (json) {
$('#top').html('');
if (window.location.protocol == 'http:' || window.location.protocol == 'https:') {
var actualURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + window.location.pathname.replace('/docs/', '');
json = JSON.parse(JSON.stringify(json).replace(new RegExp('REMOTE-URL', 'g'), actualURL));
}
$('#top').json2html(this.convert(Properties.modelRootName, json, 'open'), this.transformsParent.object);
window.listener.regEvents();
};
Graphics.prototype.children = function (name, obj) {
var type = $.type(obj);
if (name === "Base URL") {
Graphics.prototype.baseUrl = obj;
}
//Determine if this object has children
switch (type) {
case 'array':
case 'object':
return (json2html.transform(obj, this.transformsChildren.object));
break;
default:
//This must be a litteral
break;
}
};
Graphics.prototype.convert = function (name, obj, show) {
var type = $.type(obj);
if (show === undefined) show = 'closed';
var children = [];
//Determine the type of this object
switch (type) {
case 'array':
//Transform array
//Iterate through the array and add it to the elements array
var len = obj.length;
for (var j = 0; j < len; ++j) {
//Concat the return elements from this objects tranformation
children[j] = this.convert(j, obj[j]);
}
break;
case 'object':
//Transform Object
var j = 0;
for (var prop in obj) {
children[j] = this.convert(prop, obj[prop]);
j++;
}
break;
default:
//This must be a literal (or function)
children = obj;
break;
}
return ({
'name': name,
'value': children,
'type': type,
'show': show
});
};
Graphics.prototype.getValue = function (obj) {
var type = $.type(obj);
//Determine if this object has children
switch (type) {
case 'array':
case 'object':
return (undefined);
break;
case 'function':
//none
return ('function');
break;
case 'string':
return ("'" + obj + "'");
break;
default:
return (obj);
break;
}
};

View file

@ -0,0 +1,11 @@
var ProgressBar = function () {
};
ProgressBar.showProgressBar = function () {
document.querySelector("#progress").style.display = "block";
};
ProgressBar.hideProgressBar = function () {
document.querySelector("#progress").style.display = "none";
};

View file

@ -0,0 +1,21 @@
<!--
JBoss, Home of Professional Open Source
Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.
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.
-->
<jboss xmlns="urn:jboss:1.0">
<weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
</jboss>

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<messaging-deployment xmlns="urn:jboss:messaging-activemq-deployment:1.0">
<server name="default">
<jms-destinations>
<!-- Kie Server REQUEST queue -->
<jms-queue name="KIE.SERVER.REQUEST">
<entry name="queue/KIE.SERVER.REQUEST" />
<entry name="java:jboss/exported/jms/queue/KIE.SERVER.REQUEST" />
</jms-queue>
<!-- Kie Server RESPONSE queue -->
<jms-queue name="KIE.SERVER.RESPONSE">
<entry name="queue/KIE.SERVER.RESPONSE" />
<entry name="java:jboss/exported/jms/queue/KIE.SERVER.RESPONSE" />
</jms-queue>
<!-- Kie Server EXECUTOR queue -->
<jms-queue name="KIE.SERVER.EXECUTOR">
<entry name="queue/KIE.SERVER.EXECUTOR" />
</jms-queue>
<!-- JMS queue for signals -->
<!-- enable when external signals are required -->
<!--
<jms-queue name="KIE.SERVER.SIGNAL.QUEUE">
<entry name="queue/KIE.SERVER.SIGNAL" />
<entry name="java:jboss/exported/jms/queue/KIE.SERVER.SIGNAL" />
</jms-queue>
-->
</jms-destinations>
</server>
</messaging-deployment>
<!-- When using WildFly 8 remove the above <messaging-deployment> config and uncomment the configuration below -->
<!--<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0">-->
<!--<hornetq-server>-->
<!--<jms-destinations>-->
<!-- Kie Server REQUEST queue -->
<!--<jms-queue name="KIE.SERVER.REQUEST">-->
<!--<entry name="queue/KIE.SERVER.REQUEST" />-->
<!--<entry name="java:jboss/exported/jms/queue/KIE.SERVER.REQUEST" />-->
<!--</jms-queue>-->
<!-- Kie Server RESPONSE queue -->
<!--<jms-queue name="KIE.SERVER.RESPONSE">-->
<!--<entry name="queue/KIE.SERVER.RESPONSE" />-->
<!--<entry name="java:jboss/exported/jms/queue/KIE.SERVER.RESPONSE" />-->
<!--</jms-queue>-->
<!-- Kie Server EXECUTOR queue -->
<!--<jms-queue name="KIE.SERVER.EXECUTOR">-->
<!--<entry name="queue/KIE.SERVER.EXECUTOR" />-->
<!--</jms-queue>-->
<!-- JMS queue for signals -->
<!-- enable when external signals are required -->
<!--
<jms-queue name="KIE.SERVER.SIGNAL.QUEUE">
<entry name="queue/KIE.SERVER.SIGNAL" />
<entry name="java:jboss/exported/jms/queue/KIE.SERVER.SIGNAL" />
</jms-queue>
-->
<!--</jms-destinations>-->
<!--</hornetq-server>-->
<!--</messaging-deployment>-->

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
debug="true">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="console"/>
</root>
</log4j:configuration>

View file

@ -0,0 +1,27 @@
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="ejb-jar_ID"
version="3.1"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<!-- enable when external signals are required and queue and connection factory is defined -->
<!--
<enterprise-beans>
<message-driven>
<ejb-name>JMSSignalReceiver</ejb-name>
<ejb-class>org.jbpm.process.workitem.jms.JMSSignalReceiver</ejb-class>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>java:/queue/KIE.SERVER.SIGNAL</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
-->
</ejb-jar>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source
~ Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
~ as indicated by the @author tags. All rights reserved.
~ See the copyright.txt in the distribution for a
~ full listing of individual contributors.
~
~ This copyrighted material is made available to anyone wishing to use,
~ modify, copy, or redistribute it subject to the terms and conditions
~ of the GNU Lesser General Public License, v. 2.1.
~ This program is distributed in the hope that it will be useful, but WITHOUT A
~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
~ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
~ You should have received a copy of the GNU Lesser General Public License,
~ v.2.1 along with this distribution; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
~ MA 02110-1301, USA.
-->
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<!-- IMPORTANT: when adding dependency (module) here, make sure it is a public one.
Do not add private modules as there is no guarantee they won't be changed or
removed in future. EAP also generates warning(s) during the deployment if
the WAR depends on private modules. -->
<!-- Keep the alphabetical order! -->
<module name="org.apache.xerces"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>other</security-domain>
</jboss-web>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
version="3.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>KieServer</display-name>
<servlet>
<servlet-name>org.kie.server.remote.rest.common.KieServerApplication</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>org.kie.server.remote.rest.common.KieServerApplication</servlet-name>
<url-pattern>/services/rest/*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>REST web resources</web-resource-name>
<url-pattern>/services/rest/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>kie-server</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>KIE Server</realm-name>
</login-config>
<security-role>
<role-name>kie-server</role-name>
</security-role>
</web-app>

View file

@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.5/weblogic-ejb-jar.xsd">
<weblogic-enterprise-bean>
<ejb-name>KieServerMDB</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>jms/KIE.SERVER.REQUEST</destination-jndi-name>
<connection-factory-jndi-name>jms/cf/KIE.SERVER.REQUEST</connection-factory-jndi-name>
</message-driven-descriptor>
<resource-description>
<res-ref-name>org.kie.server.jms.KieServerMDB/factory</res-ref-name>
<jndi-name>jms/cf/KIE.SERVER.RESPONSE</jndi-name>
</resource-description>
</weblogic-enterprise-bean>
<weblogic-enterprise-bean>
<ejb-name>KieExecutorMDB</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>jms/KIE.SERVER.EXECUTOR</destination-jndi-name>
<connection-factory-jndi-name>jms/cf/KIE.SERVER.EXECUTOR</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
<!-- enable when external signals are required and queue and connection factory is defined -->
<!--
<weblogic-enterprise-bean>
<ejb-name>JMSSignalReceiver</ejb-name>
<message-driven-descriptor>
<destination-jndi-name>jms/KIE.SIGNAL</destination-jndi-name>
<connection-factory-jndi-name>jms/cf/KIE.SIGNAL</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
-->
</weblogic-ejb-jar>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
<container-descriptor>
<prefer-application-packages>
<package-name>org.codehaus.jackson.*</package-name>
</prefer-application-packages>
</container-descriptor>
<security-role-assignment>
<role-name>kie-server</role-name>
<principal-name>kie-server</principal-name>
</security-role-assignment>
</weblogic-web-app>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Listener className="bitronix.tm.integration.tomcat55.BTMLifecycleListener"/>
<Resource name="jdbc/jbpm" uniqueName="jdbc/jbpm" auth="Container"
removeAbandoned="true" factory="bitronix.tm.resource.ResourceObjectFactory" type="javax.sql.DataSource"/>
<Resource name="TransactionSynchronizationRegistry" auth="Container"
type="javax.transaction.TransactionSynchronizationRegistry"
factory="bitronix.tm.BitronixTransactionSynchronizationRegistryObjectFactory"/>
<Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory"/>
</Context>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>KieServer</display-name>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<filter>
<filter-name>capture-request-filter</filter-name>
<filter-class>org.kie.server.services.impl.security.web.CaptureHttpRequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>capture-request-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.kie.server.remote.rest.common.KieServerApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/services/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/services/rest</param-value>
</context-param>
<security-constraint>
<web-resource-collection>
<web-resource-name>REST web resources</web-resource-name>
<url-pattern>/services/rest/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>kie-server</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>KIE Server</realm-name>
</login-config>
<security-role>
<role-name>kie-server</role-name>
</security-role>
</web-app>

View file

@ -0,0 +1,203 @@
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id origin-repository.jboss.org @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id chtijbug-release @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id chtijbug-snapshot @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id maven-central @ /Users/nheron/.m2/settings.xml
[WARNING] 'profiles.profile[pymma-declasin].repositories.repository.id' must be unique but found duplicate repository with id origin-repository.jboss.org @ /Users/nheron/.m2/settings.xml
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] -----< com.pymmasoftware.jbpm:drools-framework-kie-server-webapp >------
[INFO] Building KIE :: chtijbug Execution Server 1.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ drools-framework-kie-server-webapp ---
[INFO] com.pymmasoftware.jbpm:drools-framework-kie-server-webapp:pom:1.0-SNAPSHOT
[INFO] +- com.pymmasoftware.jbpm:drools-framework-kie-server-rest-drools:jar:1.0-SNAPSHOT:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.0:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.0:compile
[INFO] | +- com.pymmasoftware.jbpm:drools-framework-kie-server-services-drools:jar:1.0-SNAPSHOT:compile
[INFO] | | +- com.pymmasoftware.jbpm:drools-framework-runtime-base:jar:1.0-SNAPSHOT:compile
[INFO] | | | +- org.codehaus.jettison:jettison:jar:1.3.1:compile
[INFO] | | | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | | | +- org.kie.server:kie-server-client:jar:7.10.0.Final:compile
[INFO] | | | | \- org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar:1.0.1.Final:compile
[INFO] | | | +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | | | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | | | +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] | | | +- com.pymmasoftware.jbpm:drools-framework-common:jar:1.0-SNAPSHOT:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
[INFO] | | | \- org.jbpm:jbpm-flow:jar:7.10.0.Final:compile
[INFO] | | | +- org.kie:kie-dmn-feel:jar:7.10.0.Final:compile
[INFO] | | | | +- org.antlr:antlr4-runtime:jar:4.5.3:compile
[INFO] | | | | \- org.drools:drlx-parser:jar:7.10.0.Final:compile
[INFO] | | | \- org.kie:kie-dmn-core:jar:7.10.0.Final:compile
[INFO] | | | +- org.kie:kie-dmn-backend:jar:7.10.0.Final:compile
[INFO] | | | +- org.drools:drools-canonical-model:jar:7.10.0.Final:compile
[INFO] | | | \- org.drools:drools-model-compiler:jar:7.10.0.Final:compile
[INFO] | | +- com.pymmasoftware.jbpm:drools-framework-runtime-entity:jar:1.0-SNAPSHOT:compile
[INFO] | | \- org.kie:kie-ci:jar:7.10.0.Final:compile
[INFO] | | +- org.kie.soup:kie-soup-maven-integration:jar:7.10.0.Final:compile
[INFO] | | +- org.apache.maven:maven-artifact:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-core:jar:3.3.9:compile
[INFO] | | | +- org.apache.maven:maven-repository-metadata:jar:3.3.9:compile
[INFO] | | | +- org.codehaus.plexus:plexus-interpolation:jar:1.21:compile
[INFO] | | | \- org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
[INFO] | | +- org.apache.maven:maven-model:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-model-builder:jar:3.3.9:compile
[INFO] | | | \- org.apache.maven:maven-builder-support:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-plugin-api:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-settings:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-settings-builder:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-compat:jar:3.3.9:compile
[INFO] | | +- org.apache.maven:maven-aether-provider:jar:3.3.9:compile
[INFO] | | +- org.apache.maven.wagon:wagon-provider-api:jar:3.0.0:compile
[INFO] | | +- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[INFO] | | +- org.codehaus.plexus:plexus-classworlds:jar:2.5.2:compile
[INFO] | | +- org.codehaus.plexus:plexus-utils:jar:3.0.22:compile
[INFO] | | +- org.eclipse.aether:aether-api:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-util:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-impl:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-connector-basic:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-spi:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-transport-wagon:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-transport-file:jar:1.1.0:compile
[INFO] | | +- org.eclipse.aether:aether-transport-http:jar:1.1.0:compile
[INFO] | | +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.2:compile
[INFO] | | | +- javax.enterprise:cdi-api:jar:1.0:compile
[INFO] | | | | \- javax.annotation:jsr250-api:jar:1.0:compile
[INFO] | | | \- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.2:compile
[INFO] | | +- org.apache.ant:ant:jar:1.8.4:compile
[INFO] | | | \- org.apache.ant:ant-launcher:jar:1.8.4:compile
[INFO] | | +- org.apache.maven.wagon:wagon-http:jar:3.0.0:compile
[INFO] | | | \- org.apache.maven.wagon:wagon-http-shared:jar:3.0.0:compile
[INFO] | | | \- org.jsoup:jsoup:jar:1.7.2:compile
[INFO] | | +- org.sonatype.plexus:plexus-cipher:jar:1.7:compile
[INFO] | | \- com.google.inject:guice:jar:no_aop:4.0:compile
[INFO] | | +- javax.inject:javax.inject:jar:1:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.9:compile
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- org.kie:kie-api:jar:7.10.0.Final:compile
[INFO] | | \- org.kie.soup:kie-soup-maven-support:jar:7.10.0.Final:compile
[INFO] | +- org.kie:kie-internal:jar:7.10.0.Final:compile
[INFO] | +- commons-io:commons-io:jar:2.1:compile
[INFO] | +- org.kie.server:kie-server-api:jar:7.10.0.Final:compile
[INFO] | | +- org.kie.soup:kie-soup-commons:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-core:jar:7.10.0.Final:compile
[INFO] | | | +- org.mvel:mvel2:jar:2.4.0.Final:compile
[INFO] | | | +- org.kie.soup:kie-soup-project-datamodel-commons:jar:7.10.0.Final:compile
[INFO] | | | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | +- org.optaplanner:optaplanner-core:jar:7.10.0.Final:compile
[INFO] | | | \- org.apache.commons:commons-math3:jar:3.4.1:compile
[INFO] | | +- org.optaplanner:optaplanner-persistence-xstream:jar:7.10.0.Final:compile
[INFO] | | | \- org.optaplanner:optaplanner-persistence-common:jar:7.10.0.Final:compile
[INFO] | | +- org.optaplanner:optaplanner-persistence-jaxb:jar:7.10.0.Final:compile
[INFO] | | | +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.4.Final:compile
[INFO] | | | +- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] | | | +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
[INFO] | | | \- javax.activation:activation:jar:1.1.1:compile
[INFO] | | +- org.kie:kie-dmn-api:jar:7.10.0.Final:compile
[INFO] | | | \- org.kie:kie-dmn-model:jar:7.10.0.Final:compile
[INFO] | | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.9:compile
[INFO] | | \- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | +- org.kie.server:kie-server-services-common:jar:7.10.0.Final:compile
[INFO] | | +- org.kie.server:kie-server-controller-api:jar:7.10.0.Final:compile
[INFO] | | +- org.kie.server:kie-server-common:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-compiler:jar:7.10.0.Final:compile
[INFO] | | | +- org.antlr:antlr-runtime:jar:3.5.2:compile
[INFO] | | | +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] | | | \- com.google.protobuf:protobuf-java:jar:2.6.0:compile
[INFO] | | +- org.drools:drools-decisiontables:jar:7.10.0.Final:compile
[INFO] | | | +- org.drools:drools-templates:jar:7.10.0.Final:compile
[INFO] | | | +- org.apache.poi:poi-ooxml:jar:3.15:compile
[INFO] | | | | +- org.apache.poi:poi-ooxml-schemas:jar:3.15:compile
[INFO] | | | | | \- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] | | | | \- com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] | | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | | \- org.apache.poi:poi:jar:3.15:compile
[INFO] | | | \- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] | | +- org.jbpm:jbpm-bpmn2:jar:7.10.0.Final:compile
[INFO] | | | \- org.jbpm:jbpm-flow-builder:jar:7.10.0.Final:compile
[INFO] | | +- org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.5_spec:jar:1.0.1.Final:compile
[INFO] | | | \- org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar:1.0.0.Final:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] | | +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.24.Final:runtime
[INFO] | | | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final:runtime
[INFO] | | | \- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | | +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar:1.0.0.Final:compile
[INFO] | | +- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0.24.Final:runtime
[INFO] | | +- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.24.Final:runtime
[INFO] | | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.9:runtime
[INFO] | | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:runtime
[INFO] | | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.13:runtime
[INFO] | | | \- org.codehaus.jackson:jackson-xc:jar:1.9.13:runtime
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | +- org.kie.server:kie-server-services-drools:jar:7.10.0.Final:compile
[INFO] | | +- org.kie.soup:kie-soup-project-datamodel-api:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-workbench-models-commons:jar:7.10.0.Final:compile
[INFO] | | | \- org.uberfire:uberfire-commons:jar:2.7.0.Final:compile
[INFO] | | | +- org.apache.activemq:artemis-jms-client:jar:2.3.0:compile
[INFO] | | | | +- org.apache.activemq:artemis-core-client:jar:2.3.0:compile
[INFO] | | | | | +- org.jgroups:jgroups:jar:3.6.13.Final:compile
[INFO] | | | | | +- org.apache.activemq:artemis-commons:jar:2.3.0:compile
[INFO] | | | | | +- org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:compile
[INFO] | | | | | \- org.apache.johnzon:johnzon-core:jar:0.9.5:compile
[INFO] | | | | \- org.apache.activemq:artemis-selector:jar:2.3.0:compile
[INFO] | | | +- org.jboss.errai:errai-marshalling:jar:4.3.2.Final:compile
[INFO] | | | | +- org.jboss.errai:errai-common:jar:4.3.2.Final:compile
[INFO] | | | | | +- com.google.jsinterop:jsinterop-annotations:jar:1.0.1:compile
[INFO] | | | | | +- org.jboss.errai.reflections:reflections:jar:4.3.2.Final:compile
[INFO] | | | | | +- de.benediktmeurer.gwt-slf4j:gwt-slf4j:jar:0.0.2:compile
[INFO] | | | | | \- com.google.elemental2:elemental2-dom:jar:1.0.0-beta-1:compile
[INFO] | | | | | +- com.google.jsinterop:base:jar:1.0.0-beta-1:compile
[INFO] | | | | | +- com.google.elemental2:elemental2-core:jar:1.0.0-beta-1:compile
[INFO] | | | | | \- com.google.elemental2:elemental2-promise:jar:1.0.0-beta-1:compile
[INFO] | | | | +- org.jboss.errai:errai-config:jar:4.3.2.Final:compile
[INFO] | | | | +- org.jboss.errai:errai-codegen:jar:4.3.2.Final:compile
[INFO] | | | | \- org.jboss.errai:errai-codegen-gwt:jar:4.3.2.Final:compile
[INFO] | | | +- io.netty:netty-buffer:jar:4.1.16.Final:compile
[INFO] | | | | \- io.netty:netty-common:jar:4.1.16.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.16.Final:compile
[INFO] | | | | \- io.netty:netty-resolver:jar:4.1.16.Final:compile
[INFO] | | | +- io.netty:netty-handler:jar:4.1.16.Final:compile
[INFO] | | | | \- io.netty:netty-codec:jar:4.1.16.Final:compile
[INFO] | | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.16.Final:compile
[INFO] | | | | \- io.netty:netty-transport-native-unix-common:jar:4.1.16.Final:compile
[INFO] | | | +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.16.Final:compile
[INFO] | | | \- io.netty:netty-codec-http:jar:4.1.16.Final:compile
[INFO] | | +- org.drools:drools-workbench-models-datamodel-api:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-workbench-models-guided-dtable:jar:7.10.0.Final:compile
[INFO] | | +- org.drools:drools-workbench-models-guided-dtree:jar:7.10.0.Final:runtime
[INFO] | | +- org.drools:drools-workbench-models-guided-scorecard:jar:7.10.0.Final:runtime
[INFO] | | | +- org.drools:kie-pmml:jar:7.10.0.Final:runtime
[INFO] | | | \- org.drools:drools-scorecards:jar:7.10.0.Final:runtime
[INFO] | | +- org.drools:drools-workbench-models-guided-template:jar:7.10.0.Final:runtime
[INFO] | | \- org.drools:drools-workbench-models-test-scenarios:jar:7.10.0.Final:runtime
[INFO] | | \- junit:junit:jar:4.12:compile
[INFO] | | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.kie.server:kie-server-rest-common:jar:7.10.0.Final:compile
[INFO] | | \- io.swagger:swagger-annotations:jar:1.5.15:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] | +- com.pymmasoftware.jbpm:drools-framework-kie-server-extension-interface:jar:1.0-SNAPSHOT:compile
[INFO] | \- org.reflections:reflections:jar:0.9.11:compile
[INFO] | +- com.google.guava:guava:jar:13.0.1:compile
[INFO] | \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] +- org.postgresql:postgresql:jar:9.4.1212:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] +- org.quartz-scheduler:quartz:jar:1.8.5:runtime
[INFO] \- org.sonatype.sisu.inject:guice-servlet:jar:3.2.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.063 s
[INFO] Finished at: 2018-08-23T14:24:21+02:00
[INFO] ------------------------------------------------------------------------

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pymma-jbpm-platform-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>drools-framework-kie-server-parent</artifactId>
<modules>
<module>drools-framework-kie-server-services-drools</module>
<module>drools-framework-kie-server-webapp</module>
<module>drools-framework-kie-server-rest-drools</module>
<module>drools-framework-kie-server-client-connector</module>
<module>drools-framework-kie-server-extension-interface</module>
</modules>
</project>

View file

@ -0,0 +1 @@
/target

View file

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.codehaus.jettison:jettison:1.3.1" level="project" />
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.2" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-compiler:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-commons:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-project-datamodel-commons:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:4.4.2" level="project" />
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.4.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:2.6.0" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-bpmn2:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:7.10.0.Final" level="project" />
<orderEntry type="module" module-name="kie-server-client" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-core:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.4.1" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-model:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:1.0.0.Final" level="project" />
<orderEntry type="module" module-name="kie-server-common" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:1.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.2.11" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.11" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="module" module-name="kie-server-api" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-persistence-xstream:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-persistence-common:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.optaplanner:optaplanner-persistence-jaxb:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:1.0.4.Final" level="project" />
<orderEntry type="library" name="Maven: javax.activation:activation:1.1.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.9" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.8.9" level="project" />
<orderEntry type="module" module-name="drools-framework-kie-server-extension-interface" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
<orderEntry type="module" module-name="drools-framework-common" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-classic:1.0.9" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-core:1.0.9" level="project" />
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.10" level="project" />
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.3.3" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-core:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-feel:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr4-runtime:4.5.3" level="project" />
<orderEntry type="library" name="Maven: org.drools:drlx-parser:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-core:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-backend:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-canonical-model:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-model-compiler:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.10.0.Final" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-module-junit4:1.6.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-module-junit4-common:1.6.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-core:1.6.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-reflect:1.6.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-api-mockito:1.6.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-api-support:1.6.3" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-workbench-models-guided-dtable:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.uberfire:uberfire-commons:2.7.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-jms-client:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-core-client:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.jgroups:jgroups:3.6.13.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-commons:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-json_1.0_spec:1.0-alpha-1" level="project" />
<orderEntry type="library" name="Maven: org.apache.johnzon:johnzon-core:0.9.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.activemq:artemis-selector:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-marshalling:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-common:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.jsinterop:jsinterop-annotations:1.0.1" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai.reflections:reflections:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: de.benediktmeurer.gwt-slf4j:gwt-slf4j:0.0.2" level="project" />
<orderEntry type="library" name="Maven: com.google.elemental2:elemental2-dom:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: com.google.jsinterop:base:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: com.google.elemental2:elemental2-core:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: com.google.elemental2:elemental2-promise:1.0.0-beta-1" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-config:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-codegen:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.errai:errai-codegen-gwt:4.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" name="Maven: javax.enterprise:cdi-api:1.2" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-epoll:linux-x86_64:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-kqueue:osx-x86_64:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-http:4.1.16.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-project-datamodel-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-workbench-models-datamodel-api:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-workbench-models-commons:7.10.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.3.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.10.0" level="project" />
</component>
</module>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2:exec</goal>
</goals>
<properties>
<exec.args>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=20000 -Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost -classpath %classpath org.chtijbug.drools.runtime.Main
</exec.args>
<exec.executable>java</exec.executable>
<exec.classpathScope>runtime</exec.classpathScope>
</properties>
</action>
<action>
<actionName>debug</actionName>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=20000 -Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost -classpath %classpath org.chtijbug.drools.runtime.Main
</exec.args>
<exec.executable>java</exec.executable>
<exec.classpathScope>runtime</exec.classpathScope>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2:exec</goal>
</goals>
<properties>
<exec.args>${profiler.args} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=20000 -Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost -classpath %classpath org.chtijbug.drools.runtime.Main
</exec.args>
<exec.executable>${profiler.java}</exec.executable>
<profiler.action>profile</profiler.action>
</properties>
</action>
</actions>

View file

@ -0,0 +1,212 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>pymma-jbpm-platform-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>drools-framework-runtime-base</artifactId>
<name>drools-framework-runtime-base</name>
<description>runtime-base project</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<!--plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>uber-${project.artifactId}-${project.version}</finalName>
</configuration>
</plugin-->
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-client</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-extension-interface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-runtime-entity</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workbench-models-guided-dtable</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,73 @@
/*
* 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 com.google.common.base.Throwables;
import org.apache.commons.beanutils.BeanMap;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsFactObjectAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Bertrand Gressier
* @since 27 déc. 2011
*/
public class DroolsFactObjectFactory {
private static Logger logger = LoggerFactory.getLogger(DroolsFactObjectFactory.class);
protected DroolsFactObjectFactory() {
}
public static DroolsFactObject createFactObject(Object o) {
return createFactObject(o, 0);
}
public static DroolsFactObject createFactObject(Object o, int version) {
logger.debug(">> createFactObject", o, version);
DroolsFactObject createFactObject = null;
try {
if (o != null) {
createFactObject = new DroolsFactObject(o, version);
createFactObject.setFullClassName(o.getClass().getCanonicalName());
createFactObject.setHashCode(o.hashCode());
BeanMap m = new BeanMap(o);
for (Object para : m.keySet()) {
if (!para.toString().equals("class")) {
if (m.get(para) != null) {
DroolsFactObjectAttribute attribute = new DroolsFactObjectAttribute(para.toString(), m.get(para).toString(), m.get(para).getClass().getSimpleName());
createFactObject.getListfactObjectAttributes().add(attribute);
} else {
DroolsFactObjectAttribute attribute = new DroolsFactObjectAttribute(para.toString(), "null", "null");
createFactObject.getListfactObjectAttributes().add(attribute);
}
}
}
}
return createFactObject;
} catch (Exception e) {
logger.error("Not possible to introspect {} for reason {}", o, e);
throw Throwables.propagate(e);
} finally {
logger.debug("<< createFactObject", createFactObject);
}
}
}

View file

@ -0,0 +1,116 @@
/*
* 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 org.chtijbug.drools.runtime.impl.RuleBaseCommandSingleton;
import org.chtijbug.drools.runtime.impl.RuleBaseSingleton;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.chtijbug.drools.runtime.resource.FileKnowledgeResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* @author nheron
*/
public abstract class RuleBaseBuilder {
/**
* Class Logger
*/
private static Logger logger = LoggerFactory.getLogger(RuleBaseBuilder.class);
public static RuleBasePackage createRemoteStandardRestBasePackage(String containerId, String url,String username,String password) throws DroolsChtijbugException {
logger.debug(">> createWorkbenchRuleBasePackage()");
RuleBaseCommandSingleton newRuleBasePackage = new RuleBaseCommandSingleton(RuleBaseSingleton.DEFAULT_RULE_THRESHOLD,containerId,url,username,password);
try {
newRuleBasePackage.connectKBase();
//_____ Returning the result
return newRuleBasePackage;
} finally {
logger.debug("<< createWorkbenchRuleBasePackage", newRuleBasePackage);
}
}
public static RuleBasePackage createWorkbenchRuleBasePackage(Long ruleBaseId, HistoryListener historyListener, String groupId, String artifactId, String version, String workbenchUrl, String username, String password) throws DroolsChtijbugException {
logger.debug(">> createWorkbenchRuleBasePackage()");
RuleBaseSingleton newRuleBasePackage = new RuleBaseSingleton(ruleBaseId, RuleBaseSingleton.DEFAULT_RULE_THRESHOLD, historyListener, groupId, artifactId, version);
try {
newRuleBasePackage.createKBase(workbenchUrl, username, password);
//_____ Returning the result
return newRuleBasePackage;
} finally {
logger.debug("<< createWorkbenchRuleBasePackage", newRuleBasePackage);
}
}
public static RuleBasePackage createRuleBasePackage(Long ruleBaseId, String modulePackage, String moduleName, String version, String... files) throws DroolsChtijbugException {
return RuleBaseBuilder.createRuleBasePackage(ruleBaseId, null, modulePackage, moduleName, version, files);
}
public static RuleBasePackage createRuleBasePackage(Long ruleBaseId, HistoryListener historyListener, String groupId, String artifactId, String version, String... files) throws DroolsChtijbugException {
logger.debug(">>createRuleBasePackage");
List<FileKnowledgeResource> fileKnowledgeResources = new ArrayList<>();
for (String s : files) {
if (s.contains("bpmn2")) {
FileKnowledgeResource fileKnowledgeResource = FileKnowledgeResource.createBPMN2ClassPathResource(s);
fileKnowledgeResources.add(fileKnowledgeResource);
} else {
FileKnowledgeResource fileKnowledgeResource = FileKnowledgeResource.createDRLClassPathResource(s);
fileKnowledgeResources.add(fileKnowledgeResource);
}
}
RuleBaseSingleton ruleBasePackage = new RuleBaseSingleton(ruleBaseId, RuleBaseSingleton.DEFAULT_RULE_THRESHOLD, historyListener, artifactId, groupId, version);
try {
ruleBasePackage.createKBase(fileKnowledgeResources);
//_____ Returning the result
return ruleBasePackage;
} finally {
logger.debug("<<createRuleBasePackage", ruleBasePackage);
}
}
public static RuleBasePackage createRuleBasePackage(Long ruleBaseId, HistoryListener historyListener, ClassLoader... classLoader) throws DroolsChtijbugException {
logger.debug(">>createRuleBasePackage");
RuleBaseSingleton ruleBasePackage = new RuleBaseSingleton(ruleBaseId, RuleBaseSingleton.DEFAULT_RULE_THRESHOLD, historyListener);
try {
ruleBasePackage.createKBase(classLoader);
//_____ Returning the result
return ruleBasePackage;
} finally {
logger.debug("<<createRuleBasePackage", ruleBasePackage);
}
}
public static RuleBasePackage createRuleBasePackage(String rulebaseName, HistoryListener historyListener, ClassLoader... classLoader) throws DroolsChtijbugException {
logger.debug(">>createRuleBasePackage");
RuleBaseSingleton ruleBasePackage = new RuleBaseSingleton(rulebaseName, RuleBaseSingleton.DEFAULT_RULE_THRESHOLD, historyListener);
try {
ruleBasePackage.createKBase(classLoader);
//_____ Returning the result
return ruleBasePackage;
} finally {
logger.debug("<<createRuleBasePackage", ruleBasePackage);
}
}
}

View file

@ -0,0 +1,42 @@
/*
* 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 org.chtijbug.drools.runtime.listener.HistoryListener;
/**
* @author nheron
*/
public interface RuleBasePackage {
RuleBaseSession createRuleBaseSession() throws DroolsChtijbugException;
RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute) throws DroolsChtijbugException;
RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute, HistoryListener sessionHistoryListener) throws DroolsChtijbugException;
RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute, HistoryListener sessionHistoryListener, String sessionName) throws DroolsChtijbugException;
void loadKBase(String version) throws DroolsChtijbugException;
HistoryListener getHistoryListener();
Long getRuleBaseID();
void dispose();
}

View file

@ -0,0 +1,101 @@
/*
* 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 org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsRuleObject;
import org.chtijbug.drools.entity.history.HistoryContainer;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.ObjectFilter;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.process.WorkItemHandler;
import java.util.Collection;
import java.util.Map;
/**
* @author nheron
*/
public interface RuleBaseSession {
/**
* This method injects the newObject parameter into this session.
* No deep insertion(using relfection) is done
*
* @param newObject - object to insert into this session
*/
public void insertObject(Object newObject);
/**
* This method injects the newObject parameter into this session.
* No deep insertion(using relfection) is done
*
* @param newObject - object to insert into this session. all nested objects will be also inserted
* @throws org.chtijbug.drools.runtime.DroolsChtijbugException
*/
public void insertByReflection(Object newObject) throws DroolsChtijbugException;
/**
* This method helps for introducing a global object into the RuleBaseSession
*
* @param identifier - the key of the global variable to inject
* @param value - the value of the global variable to inject
*/
void setGlobal(String identifier, Object value);
void updateObject(Object updatedObject);
void retractObject(Object oldObject);
void fireAllRules() throws DroolsChtijbugException;
Object fireAllRulesAndStartProcess(Object inputObject, String processName) throws DroolsChtijbugException;
Object fireAllRulesAndStartProcessWithParam(Object inputObject, String processName) throws DroolsChtijbugException;
void startProcess(String processName);
void dispose();
HistoryContainer getHistoryContainer();
String getHistoryContainerXML();
Collection<DroolsFactObject> listLastVersionObjects();
String listLastVersionObjectsXML();
Collection<DroolsRuleObject> listRules();
int getNumberRulesExecuted();
Long getSessionId();
Long getRuleBaseID();
KieSession getKnowledgeSession();
Collection<? extends Object> getObjects(ObjectFilter objectFilter);
void completeWorkItem(long processId, Map<String, Object> vars);
void abortWorkItem(long processId);
void registerWorkItemHandler(String workItemName, WorkItemHandler workItemHandler);
ProcessInstance startProcess(String processName, Map<String, Object> vars);
}

View file

@ -0,0 +1,98 @@
package org.chtijbug.drools.runtime;
import org.chtijbug.drools.logging.*;
import java.util.ArrayList;
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;
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;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("SessionContext{");
sb.append("sessionExecution=").append(sessionExecution);
sb.append(", processExecution=").append(processExecution);
sb.append(", ruleExecution=").append(ruleExecution);
sb.append(", fireAllRulesExecution=").append(fireAllRulesExecution);
sb.append(", fact=").append(fact);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,124 @@
/*
* 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.impl;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.history.fact.DeletedFactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.FactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedFactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.UpdatedFactHistoryEvent;
import org.chtijbug.drools.runtime.DroolsFactObjectFactory;
import org.drools.core.definitions.rule.impl.RuleImpl;
import org.drools.core.event.rule.impl.RuleRuntimeEventImpl;
import org.drools.core.spi.PropagationContext;
import org.kie.api.event.rule.ObjectDeletedEvent;
import org.kie.api.event.rule.ObjectInsertedEvent;
import org.kie.api.event.rule.ObjectUpdatedEvent;
import org.kie.api.event.rule.RuleRuntimeEventListener;
import org.kie.api.runtime.rule.FactHandle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FactHandlerListener implements RuleRuntimeEventListener {
private static Logger logger = LoggerFactory.getLogger(FactHandlerListener.class);
private final RuleBaseStatefulSession ruleBaseSession;
public FactHandlerListener(RuleBaseStatefulSession ruleBaseSession) {
this.ruleBaseSession = ruleBaseSession;
}
@Override
public void objectInserted(ObjectInsertedEvent event) {
logger.debug(">>objectInserted", event);
try {
//____ Updating reference into the facts map from knowledge Session
//((RuleTerminalNode)((RuleTerminalNodeLeftTuple)((org.drools.common.DefaultFactHandle)event.getFactHandle()).getFirstLeftTuple()).getSink()).getRule().getRuleFlowGroup()
FactHandle f = event.getFactHandle();
Object newObject = event.getObject();
DroolsFactObject ff = DroolsFactObjectFactory.createFactObject(newObject);
ruleBaseSession.setData(f, newObject, ff);
//____ Adding the Insert Event from the History Container
InsertedFactHistoryEvent insertFactHistoryEvent = new InsertedFactHistoryEvent(this.ruleBaseSession.nextEventId(), ff, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
if (insertFactHistoryEvent.getRuleName() == null && event instanceof RuleRuntimeEventImpl) {
PropagationContext propagationContext = ((RuleRuntimeEventImpl) event).getPropagationContext();
this.updateRuleDetailFromPropagationContext(propagationContext, insertFactHistoryEvent);
}
this.ruleBaseSession.addHistoryElement(insertFactHistoryEvent);
} finally
{
logger.debug("<<objectInserted");
}
}
@Override
public void objectUpdated(ObjectUpdatedEvent event) {
logger.debug(">>objectUpdated", event);
try {
//____ Updating FactHandle Object reference from the knwoledge session
FactHandle f = event.getFactHandle();
Object oldValue = event.getOldObject();
Object newValue = event.getObject();
DroolsFactObject factOldValue = this.ruleBaseSession.getLastFactObjectVersion(oldValue);
DroolsFactObject factNewValue = DroolsFactObjectFactory.createFactObject(newValue, factOldValue.getNextObjectVersion());
ruleBaseSession.setData(f, newValue, factNewValue);
//____ Adding the Update Event from the History Container
UpdatedFactHistoryEvent updatedFactHistoryEvent = new UpdatedFactHistoryEvent(this.ruleBaseSession.nextEventId(), factOldValue, factNewValue, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
if (updatedFactHistoryEvent.getRuleName() == null && event instanceof RuleRuntimeEventImpl) {
PropagationContext propagationContext = ((RuleRuntimeEventImpl) event).getPropagationContext();
this.updateRuleDetailFromPropagationContext(propagationContext, updatedFactHistoryEvent);
}
this.ruleBaseSession.addHistoryElement(updatedFactHistoryEvent);
} finally {
logger.debug("<<objectUpdated");
}
}
@Override
public void objectDeleted(ObjectDeletedEvent event) {
logger.debug(">>objectRetracted", event);
try {
//____ Removing FactHandle from the KnowledgeBase
FactHandle f = event.getFactHandle();
Object newObject = event.getOldObject();
DroolsFactObject deletedFact = this.ruleBaseSession.getLastFactObjectVersion(newObject);
ruleBaseSession.unsetData(f, newObject);
//____ Adding a Delete Event from the HistoryContainer
DeletedFactHistoryEvent deleteFactEvent = new DeletedFactHistoryEvent(this.ruleBaseSession.nextEventId(), deletedFact, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
if (event instanceof RuleRuntimeEventImpl) {
PropagationContext propagationContext = ((RuleRuntimeEventImpl) event).getPropagationContext();
this.updateRuleDetailFromPropagationContext(propagationContext, deleteFactEvent);
this.ruleBaseSession.addHistoryElement(deleteFactEvent);
}
} finally {
logger.debug("<<objectRetracted");
}
}
private void updateRuleDetailFromPropagationContext(PropagationContext propagationContext, FactHistoryEvent historyEvent) {
if (propagationContext.getRuleOrigin() instanceof RuleImpl) {
RuleImpl ruleOrigin = (RuleImpl) propagationContext.getRuleOrigin();
historyEvent.setRuleName(ruleOrigin.getName());
historyEvent.setRulePackageName(ruleOrigin.getPackageName());
historyEvent.setRuleflowGroup(ruleOrigin.getRuleFlowGroup());
}
}
}

View file

@ -0,0 +1,21 @@
/*
* 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.impl;
public enum JavaDialect {
ECLIPSE, JANINO
}

View file

@ -0,0 +1,187 @@
/*
* 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.impl;
import org.chtijbug.drools.entity.DroolsJbpmVariableObject;
import org.chtijbug.drools.entity.DroolsNodeInstanceObject;
import org.chtijbug.drools.entity.DroolsProcessInstanceObject;
import org.chtijbug.drools.entity.DroolsProcessObject;
import org.chtijbug.drools.entity.history.process.*;
import org.kie.api.event.process.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author nheron
*/
public class ProcessHandlerListener implements ProcessEventListener {
/**
* Class logger
*/
private static Logger logger = LoggerFactory.getLogger(ProcessHandlerListener.class);
/**
* The knowledge session sending event
*/
private final RuleBaseStatefulSession ruleBaseSession;
public ProcessHandlerListener(RuleBaseStatefulSession ruleBaseSession) {
this.ruleBaseSession = ruleBaseSession;
}
@Override
public void beforeProcessStarted(ProcessStartedEvent event) {
logger.debug(">>beforeProcessStarted", event);
try {
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
BeforeProcessStartHistoryEvent beforeProcessStart = new BeforeProcessStartHistoryEvent(this.ruleBaseSession.nextEventId(), droolsProcessInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
ruleBaseSession.addHistoryElement(beforeProcessStart);
} finally {
logger.debug("<<beforeProcessStarted");
}
}
@Override
public void afterProcessStarted(ProcessStartedEvent event) {
logger.debug(">>afterProcessStarted", event);
try {
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
AfterProcessStartHistoryEvent afterProcessStart = new AfterProcessStartHistoryEvent(this.ruleBaseSession.nextEventId(), droolsProcessInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
ruleBaseSession.addHistoryElement(afterProcessStart);
} finally {
logger.debug("<<afterProcessStarted");
}
}
@Override
public void beforeProcessCompleted(ProcessCompletedEvent event) {
logger.debug(">>beforeProcessCompleted", event);
try {
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
BeforeProcessEndHistoryEvent beforeProcessEndHistoryEvent = new BeforeProcessEndHistoryEvent(this.ruleBaseSession.nextEventId(), droolsProcessInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
ruleBaseSession.addHistoryElement(beforeProcessEndHistoryEvent);
} finally {
logger.debug("<<beforeProcessCompleted");
}
}
@Override
public void afterProcessCompleted(ProcessCompletedEvent event) {
logger.debug(">>afterProcessCompleted", event);
try {
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
AfterProcessEndHistoryEvent AfterProcessStart = new AfterProcessEndHistoryEvent(this.ruleBaseSession.nextEventId(), droolsProcessInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
ruleBaseSession.addHistoryElement(AfterProcessStart);
} finally {
logger.debug("<<afterProcessCompleted");
}
}
@Override
public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
logger.debug(">>beforeNodeTriggered", event);
try {
DroolsNodeInstanceObject droolsNodeInstanceObject = ruleBaseSession.getDroolsNodeInstanceObject(event.getNodeInstance());
BeforeNodeInstanceTriggeredHistoryEvent beforeNodeInstanceTriggeredHistoryEvent = new BeforeNodeInstanceTriggeredHistoryEvent(this.ruleBaseSession.nextEventId(), droolsNodeInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
beforeNodeInstanceTriggeredHistoryEvent.setProcessInstance(droolsProcessInstanceObject);
ruleBaseSession.addHistoryElement(beforeNodeInstanceTriggeredHistoryEvent);
} finally {
logger.debug("<<beforeNodeTriggered");
}
}
@Override
public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
logger.debug(">>afterNodeTriggered", event);
try {
DroolsNodeInstanceObject droolsNodeInstanceObject = ruleBaseSession.getDroolsNodeInstanceObject(event.getNodeInstance());
AfterNodeInstanceTriggeredHistoryEvent afterNodeInstanceTriggeredHistoryEvent = new AfterNodeInstanceTriggeredHistoryEvent(this.ruleBaseSession.nextEventId(), droolsNodeInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
afterNodeInstanceTriggeredHistoryEvent.setProcessInstance(droolsProcessInstanceObject);
ruleBaseSession.addHistoryElement(afterNodeInstanceTriggeredHistoryEvent);
} finally {
logger.debug("<<afterNodeTriggered");
}
}
@Override
public void beforeNodeLeft(ProcessNodeLeftEvent event) {
logger.debug(">>beforeNodeLeft", event);
try {
DroolsNodeInstanceObject droolsNodeInstanceObject = ruleBaseSession.getDroolsNodeInstanceObject(event.getNodeInstance());
BeforeNodeLeftHistoryEvent afterHistoryEvent = new BeforeNodeLeftHistoryEvent(this.ruleBaseSession.nextEventId(), droolsNodeInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
afterHistoryEvent.setProcessInstance(droolsProcessInstanceObject);
ruleBaseSession.addHistoryElement(afterHistoryEvent);
} finally {
logger.debug("<<beforeNodeLeft");
}
}
@Override
public void afterNodeLeft(ProcessNodeLeftEvent event) {
logger.debug(">>afterNodeLeft", event);
try {
DroolsNodeInstanceObject droolsNodeInstanceObject = ruleBaseSession.getDroolsNodeInstanceObject(event.getNodeInstance());
AfterNodeLeftHistoryEvent afterHistoryEvent = new AfterNodeLeftHistoryEvent(this.ruleBaseSession.nextEventId(), droolsNodeInstanceObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
afterHistoryEvent.setProcessInstance(droolsProcessInstanceObject);
ruleBaseSession.addHistoryElement(afterHistoryEvent);
} finally {
logger.debug("<<afterNodeLeft");
}
}
@Override
public void beforeVariableChanged(ProcessVariableChangedEvent event) {
logger.debug(">>beforeVariableChanged", event);
try {
DroolsJbpmVariableObject oldValue = new DroolsJbpmVariableObject(event.getVariableId(), event.getVariableInstanceId(), event.getOldValue());
DroolsProcessObject droolsProcessObject = new DroolsProcessObject(String.valueOf(event.getProcessInstance().getId()), event.getProcessInstance().getProcessName(), event.getProcessInstance().getProcess().getPackageName(), event.getProcessInstance().getProcess().getType(), event.getProcessInstance().getProcess().getVersion());
BeforeVariableChangeChangedHistoryEvent beforeVariableChangeChangedHistoryEvent = new BeforeVariableChangeChangedHistoryEvent(this.ruleBaseSession.nextEventId(), droolsProcessObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId(), oldValue);
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
beforeVariableChangeChangedHistoryEvent.setProcessInstance(droolsProcessInstanceObject);
ruleBaseSession.addHistoryElement(beforeVariableChangeChangedHistoryEvent);
} finally {
logger.debug("<<beforeVariableChanged");
}
}
@Override
public void afterVariableChanged(ProcessVariableChangedEvent event) {
logger.debug(">>afterVariableChanged", event);
try {
DroolsJbpmVariableObject oldValue = new DroolsJbpmVariableObject(event.getVariableId(), event.getVariableInstanceId(), event.getOldValue());
DroolsJbpmVariableObject newValue = new DroolsJbpmVariableObject(event.getVariableId(), event.getVariableInstanceId(), event.getNewValue());
DroolsProcessObject droolsProcessObject = new DroolsProcessObject(String.valueOf(event.getProcessInstance().getId()), event.getProcessInstance().getProcessName(), event.getProcessInstance().getProcess().getPackageName(), event.getProcessInstance().getProcess().getType(), event.getProcessInstance().getProcess().getVersion());
AfterVariableChangeChangedHistoryEvent afterVariableChangeChangedHistoryEvent = new AfterVariableChangeChangedHistoryEvent(this.ruleBaseSession.nextEventId(), droolsProcessObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId(), oldValue, newValue);
DroolsProcessInstanceObject droolsProcessInstanceObject = ruleBaseSession.getDroolsProcessInstanceObject(event.getProcessInstance());
afterVariableChangeChangedHistoryEvent.setProcessInstance(droolsProcessInstanceObject);
ruleBaseSession.addHistoryElement(afterVariableChangeChangedHistoryEvent);
} finally {
logger.debug("<<afterVariableChanged");
}
}
}

View file

@ -0,0 +1,221 @@
package org.chtijbug.drools.runtime.impl;
import org.chtijbug.drools.common.reflection.ReflectionUtils;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsRuleObject;
import org.chtijbug.drools.entity.history.HistoryContainer;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.kie.api.KieServices;
import org.kie.api.command.BatchExecutionCommand;
import org.kie.api.command.Command;
import org.kie.api.command.KieCommands;
import org.kie.api.runtime.ExecutionResults;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.ObjectFilter;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.server.api.model.ServiceResponse;
import org.kie.server.client.KieServicesClient;
import org.kie.server.client.RuleServicesClient;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Created by nheron on 07/06/2016.
*/
public class RuleBaseCommandSession implements RuleBaseSession {
private List<Command<?>> commands = new ArrayList<Command<?>>();
private KieCommands commandsFactory = KieServices.Factory.get().getCommands();
private int maxNumberRuleToExecute = 2000;
private KieServicesClient kieServicesClient;
private String containerId;
public RuleBaseCommandSession(int maxNumberRuleToExecute,KieServicesClient kieServicesClient,String containerId) {
this.maxNumberRuleToExecute = maxNumberRuleToExecute;
this.kieServicesClient=kieServicesClient;
this.containerId = containerId;
}
@Override
public void insertObject(Object newObject) {
commands.add(commandsFactory.newInsert(newObject, newObject.toString()));
}
@Override
public void insertByReflection(Object newObject) throws DroolsChtijbugException {
if (newObject.getClass().getPackage().getName().startsWith("java.")) {
return;
}
//____ Then foreach getters insert item by reflection
for (Method method : newObject.getClass().getMethods()) {
//____ only manage getters
if (!ReflectionUtils.IsGetter(method)) {
continue;
}
Object getterValue;
try {
getterValue = method.invoke(newObject, (Object[]) null);
} catch (Exception e) {
throw new DroolsChtijbugException(DroolsChtijbugException.insertByReflection, "getterValue = method.invoke(newObject, (Object[]) null);", e);
}
if (getterValue == null)
continue;
//____ If returned value is not a collection, insert it in the ksession
if (!(getterValue instanceof Iterable)) {
this.insertByReflection(getterValue);
} else {
Iterable<?> iterable = (Iterable) getterValue;
for (Object item : iterable) {
this.insertByReflection(item);
}
}
}
this.insertObject(newObject);
}
@Override
public void setGlobal(String identifier, Object value) {
commands.add(commandsFactory.newSetGlobal(identifier, value));
}
@Override
public void updateObject(Object updatedObject) {
// Not Possible
}
@Override
public void retractObject(Object oldObject) {
// Not Possible
}
@Override
public void fireAllRules() throws DroolsChtijbugException {
commands.add(commandsFactory.newFireAllRules(maxNumberRuleToExecute));
}
@Override
public Object fireAllRulesAndStartProcess(Object inputObject, String processName) throws DroolsChtijbugException {
Object outputObject=null;
if (inputObject != null) {
//this.insertObject(inputObject);
this.insertByReflection(inputObject);
}
if (processName != null && processName.length() > 0) {
this.startProcess(processName);
}
this.fireAllRules();
commands.add(commandsFactory.newGetObjects(inputObject.getClass().getName()));
RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
BatchExecutionCommand batchCommand = commandsFactory.newBatchExecution(commands);
ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(this.containerId, batchCommand);
if (response.equals(ServiceResponse.ResponseType.SUCCESS)){
ExecutionResults actualData = response.getResult();
Collection<String> identifiers = actualData.getIdentifiers();
for (String id : identifiers){
outputObject=actualData.getValue(id);
}
}
return outputObject;
}
@Override
public Object fireAllRulesAndStartProcessWithParam(Object inputObject, String processName) throws DroolsChtijbugException {
//commands.add(commandsFactory.newFireAllRules(maxNumberRuleToExecute));
return this.fireAllRulesAndStartProcess(inputObject,processName);
}
@Override
public void startProcess(String processName) {
commands.add(commandsFactory.newStartProcess(processName));
}
@Override
public void dispose() {
}
@Override
public HistoryContainer getHistoryContainer() {
return null;
}
@Override
public String getHistoryContainerXML() {
return null;
}
@Override
public Collection<DroolsFactObject> listLastVersionObjects() {
return null;
}
@Override
public String listLastVersionObjectsXML() {
return null;
}
@Override
public Collection<DroolsRuleObject> listRules() {
return null;
}
@Override
public int getNumberRulesExecuted() {
return 0;
}
@Override
public Long getSessionId() {
return null;
}
@Override
public Long getRuleBaseID() {
return null;
}
@Override
public KieSession getKnowledgeSession() {
return null;
}
@Override
public Collection<? extends Object> getObjects(ObjectFilter objectFilter) {
return null;
}
@Override
public void completeWorkItem(long processId, Map<String, Object> vars) {
commands.add(commandsFactory.newCompleteWorkItem(processId, vars));
}
@Override
public void abortWorkItem(long processId) {
commands.add(commandsFactory.newAbortWorkItem(processId));
}
@Override
public void registerWorkItemHandler(String workItemName, WorkItemHandler workItemHandler) {
commands.add(commandsFactory.newRegisterWorkItemHandlerCommand(workItemHandler, workItemName));
}
@Override
public ProcessInstance startProcess(String processName, Map<String, Object> vars) {
commands.add(commandsFactory.newStartProcess(processName, vars));
return null;
}
public List<Command<?>> getCommands() {
return commands;
}
}

View file

@ -0,0 +1,127 @@
package org.chtijbug.drools.runtime.impl;
import org.chtijbug.drools.entity.history.EventCounter;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBasePackage;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.kie.server.api.marshalling.MarshallingFormat;
import org.kie.server.client.KieServicesClient;
import org.kie.server.client.KieServicesConfiguration;
import org.kie.server.client.KieServicesFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Semaphore;
/**
* Created by nheron on 07/06/2016.
*/
public class RuleBaseCommandSingleton implements RuleBasePackage {
/**
* default rule threshold
*/
public static int DEFAULT_RULE_THRESHOLD = 2000;
/**
* Class Logger
*/
private static Logger logger = LoggerFactory.getLogger(RuleBaseCommandSingleton.class);
/**
* unique ID of the RuleBase in the JVM
*/
protected EventCounter eventCounter = EventCounter.newCounter();
protected EventCounter sessionCounter = EventCounter.newCounter();
private int maxNumberRuleToExecute = DEFAULT_RULE_THRESHOLD;
/**
* Semaphore used to void concurrent access to the singleton
*/
private Semaphore lockKbase = new Semaphore(1);
/**
* History Listener
*/
private String containerId;
private String url;
private String username;
private String password;
private KieServicesClient kieServicesClient;
public RuleBaseCommandSingleton(int maxNumberRuleToExecute) {
this.maxNumberRuleToExecute = maxNumberRuleToExecute;
}
public RuleBaseCommandSingleton(int defaultRuleThreshold, String containerId,String url, String username, String password) {
this(defaultRuleThreshold);
this.containerId=containerId;
this.url=url;
this.username=username;
this.password=password;
}
@Override
public RuleBaseSession createRuleBaseSession() throws DroolsChtijbugException {
logger.debug(">>createRuleBaseSession");
try {
//____ Creating new Rule Base Session using default rule threshold
return this.createRuleBaseSession(this.maxNumberRuleToExecute);
} finally {
logger.debug("<<createRuleBaseSession");
}
}
@Override
public RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute) throws DroolsChtijbugException {
return this.createRuleBaseSession(maxNumberRulesToExecute, null);
}
@Override
public RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute, HistoryListener sessionHistoryListener) throws DroolsChtijbugException {
logger.debug(">>createRuleBaseSession", maxNumberRulesToExecute);
RuleBaseSession newRuleBaseSession = null;
try {
//_____ Wrapping the knowledge Session
newRuleBaseSession = new RuleBaseCommandSession(maxNumberRulesToExecute,this.kieServicesClient,this.containerId);
//_____ Release semaphore
lockKbase.release();
return newRuleBaseSession;
} finally {
logger.debug("<<createRuleBaseSession", newRuleBaseSession);
}
}
@Override
public RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute, HistoryListener sessionHistoryListener, String sessionName) throws DroolsChtijbugException {
return this.createRuleBaseSession(maxNumberRulesToExecute, sessionHistoryListener);
}
@Override
public void loadKBase(String version) throws DroolsChtijbugException {
//
}
@Override
public HistoryListener getHistoryListener() {
return null;
}
@Override
public Long getRuleBaseID() {
return null;
}
@Override
public void dispose() {
}
public void connectKBase() {
KieServicesConfiguration config;
config = KieServicesFactory.newRestConfiguration(url, username, password);
MarshallingFormat marshallingFormat = MarshallingFormat.XSTREAM;
config.setMarshallingFormat(marshallingFormat);
this.kieServicesClient = KieServicesFactory.newKieServicesClient(config);
}
}

View file

@ -0,0 +1,332 @@
/*
* 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.impl;
import org.chtijbug.drools.entity.history.EventCounter;
import org.chtijbug.drools.entity.history.knowledge.*;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBasePackage;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.chtijbug.drools.runtime.resource.FileKnowledgeResource;
import org.chtijbug.drools.runtime.resource.KnowledgeModule;
import org.chtijbug.drools.runtime.resource.WorkbenchClient;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Semaphore;
import static com.google.common.base.Throwables.propagate;
/**
* @author Bertrand Gressier
*/
public class RuleBaseSingleton implements RuleBasePackage {
/**
* default rule threshold
*/
public static int DEFAULT_RULE_THRESHOLD = 2000;
/**
* Class Logger
*/
private static Logger logger = LoggerFactory.getLogger(RuleBaseSingleton.class);
/**
* unique ID of the RuleBase in the JVM
*/
protected EventCounter eventCounter = EventCounter.newCounter();
protected EventCounter sessionCounter = EventCounter.newCounter();
/**
* Rule Base ID
*/
private String ruleBaseName;
private Long ruleBaseID;
private KieContainer kieContainer;
private ReleaseId releaseId;
private String groupId;
private String artifactId;
private String version;
private KnowledgeModule knowledgeModule;
/**
* Max rule to be fired threshold.
*/
private int maxNumberRuleToExecute = DEFAULT_RULE_THRESHOLD;
/**
* Semaphore used to void concurrent access to the singleton
*/
private Semaphore lockKbase = new Semaphore(1);
/**
* History Listener
*/
private HistoryListener historyListener = null;
/**
* Global Maps
*/
Map<String, Object> globals = new HashMap<>();
/**
* extensions Points
*/
private KieServerAddOnElement kieServerAddOnElement = null;
/**
* @param kieContainer
* @param maxNumberRulesToExecute
*/
public RuleBaseSingleton(KieContainer kieContainer, int maxNumberRulesToExecute) {
this.kieContainer = kieContainer;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
}
public RuleBaseSingleton(KieContainer kieContainer, int maxNumberRulesToExecute, KieServerAddOnElement kieServerAddOnElement) {
this.kieServerAddOnElement = kieServerAddOnElement;
this.kieContainer = kieContainer;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
}
public RuleBaseSingleton(KieContainer kieContainer, int maxNumberRulesToExecute, HistoryListener historyListener) {
this.kieContainer = kieContainer;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
this.historyListener = historyListener;
}
public RuleBaseSingleton(Long ruleBaseID, int maxNumberRulesToExecute, HistoryListener historyListener, String groupId, String artifactId, String version) throws DroolsChtijbugException {
this.ruleBaseID = ruleBaseID;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
this.historyListener = historyListener;
if (this.historyListener != null) {
KnowledgeBaseCreatedEvent knowledgeBaseCreatedEvent = new KnowledgeBaseCreatedEvent(eventCounter.next(), new Date(), ruleBaseID);
this.historyListener.fireEvent(knowledgeBaseCreatedEvent);
}
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.knowledgeModule = new KnowledgeModule(this.ruleBaseID, this.historyListener, groupId, artifactId, version, eventCounter);
}
public RuleBaseSingleton(String ruleBaseName, int maxNumberRulesToExecute, HistoryListener historyListener) throws DroolsChtijbugException {
this.ruleBaseName = ruleBaseName;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
this.historyListener = historyListener;
if (this.historyListener != null) {
KnowledgeBaseCreatedEvent knowledgeBaseCreatedEvent = new KnowledgeBaseCreatedEvent(eventCounter.next(), new Date(), ruleBaseID);
this.historyListener.fireEvent(knowledgeBaseCreatedEvent);
}
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.knowledgeModule = new KnowledgeModule(this.ruleBaseName, this.historyListener, eventCounter);
}
public RuleBaseSingleton(Long ruleBaseID, int maxNumberRulesToExecute, HistoryListener historyListener) throws DroolsChtijbugException {
this.ruleBaseID = ruleBaseID;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
this.historyListener = historyListener;
if (this.historyListener != null) {
KnowledgeBaseCreatedEvent knowledgeBaseCreatedEvent = new KnowledgeBaseCreatedEvent(eventCounter.next(), new Date(), ruleBaseID);
this.historyListener.fireEvent(knowledgeBaseCreatedEvent);
}
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.knowledgeModule = new KnowledgeModule(this.ruleBaseID, this.historyListener, eventCounter);
}
@Override
public RuleBaseSession createRuleBaseSession() throws DroolsChtijbugException {
logger.debug(">>createRuleBaseSession");
try {
//____ Creating new Rule Base Session using default rule threshold
return this.createRuleBaseSession(this.maxNumberRuleToExecute);
} finally {
logger.debug("<<createRuleBaseSession");
}
}
@Override
public RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute) throws DroolsChtijbugException {
return this.createRuleBaseSession(maxNumberRulesToExecute, this.historyListener);
}
@Override
public RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute, HistoryListener sessionHistoryListener) throws DroolsChtijbugException {
return this.createRuleBaseSession(maxNumberRulesToExecute, sessionHistoryListener, null);
}
@Override
public RuleBaseSession createRuleBaseSession(int maxNumberRulesToExecute, HistoryListener sessionHistoryListener, String sessionName) throws DroolsChtijbugException {
logger.debug(">>createRuleBaseSession", maxNumberRulesToExecute);
RuleBaseSession newRuleBaseSession = null;
try {
if (kieContainer != null) {
//____ Acquire semaphore
try {
lockKbase.acquire();
} catch (Exception e) {
throw new DroolsChtijbugException(DroolsChtijbugException.KbaseAcquire, "", e);
}
//_____ Now we can create a new stateful session using KnowledgeBase
//_____ Now we can create a new stateful session using KnowledgeBase
KieSession newDroolsSession = null;
if (sessionName == null) {
if (ruleBaseName != null && ruleBaseName.length() > 0) {
newDroolsSession = this.kieContainer.getKieBase(ruleBaseName).newKieSession();
} else {
newDroolsSession = this.kieContainer.getKieBase().newKieSession();
}
} else {
newDroolsSession = this.kieContainer.newKieSession(sessionName);
}
for (String globalVariableName : globals.keySet()) {
if (globals.get(globalVariableName) != null) {
newDroolsSession.setGlobal(globalVariableName, globals.get(globalVariableName));
}
}
Long sessionId = this.sessionCounter.next();
if (sessionHistoryListener != null) {
KnowledgeBaseCreateSessionEvent knowledgeBaseCreateSessionEvent = new KnowledgeBaseCreateSessionEvent(eventCounter.next(), new Date(), this.ruleBaseID);
knowledgeBaseCreateSessionEvent.setSessionId(sessionId);
sessionHistoryListener.fireEvent(knowledgeBaseCreateSessionEvent);
}
//_____ Wrapping the knowledge Session
newRuleBaseSession = new RuleBaseStatefulSession(this.ruleBaseID, sessionId, newDroolsSession, maxNumberRulesToExecute, sessionHistoryListener);
//_____ Release semaphore
lockKbase.release();
} else {
throw new DroolsChtijbugException(DroolsChtijbugException.KbaseNotInitialised, "", null);
}
//____ return the wrapped KnowledgeSession
return newRuleBaseSession;
} finally {
logger.debug("<<createRuleBaseSession", newRuleBaseSession);
}
}
public synchronized void createKBase(String workbenchUrl, String username, String password) throws DroolsChtijbugException {
if (kieContainer != null) {
if (this.historyListener != null) {
this.historyListener.fireEvent(new KnowledgeBaseReloadedEvent(eventCounter.next(), new Date(), this.ruleBaseID));
}
// TODO dispose all elements
} else {
if (this.historyListener != null) {
this.historyListener.fireEvent(new KnowledgeBaseInitialLoadEvent(eventCounter.next(), new Date(), this.ruleBaseID));
}
}
try {
//___ TODO add URI Resource
this.knowledgeModule.addWorkbenchResource(workbenchUrl, username, password);
kieContainer = this.knowledgeModule.build();
} catch (Exception e) {
logger.error("error to load Agent", e);
throw new DroolsChtijbugException(DroolsChtijbugException.ErrorToLoadAgent, "", e);
}
}
@Override
public void loadKBase(String version) throws DroolsChtijbugException {
if (this.knowledgeModule.getWorkbenchClient() != null) {
try {
WorkbenchClient client = this.knowledgeModule.getWorkbenchClient();
lockKbase.acquire();
//this.releaseId = kieServices.newReleaseId(this.releaseId.getGroupId(), this.releaseId.getArtifactId(), version);
this.version = version;
kieContainer = null;
this.knowledgeModule = null;
this.knowledgeModule = new KnowledgeModule(this.ruleBaseID, this.historyListener, groupId, artifactId, version, eventCounter);
this.createKBase(client.getWorkbenchUrl(), client.getUsername(), client.getPassword());
lockKbase.release();
if (this.historyListener != null) {
// TODO change the following event...
this.historyListener.fireEvent(new KnowledgeBaseAddResourceEvent(eventCounter.next(), new Date(), this.ruleBaseID));
}
} catch (InterruptedException e) {
throw propagate(e);
}
}
}
@Override
public HistoryListener getHistoryListener() {
return historyListener;
}
public Long getRuleBaseID() {
return ruleBaseID;
}
@Override
public void dispose() {
if (this.historyListener != null) {
try {
this.historyListener.fireEvent(new KnowledgeBaseDisposeEvent(eventCounter.next(), new Date(), this.ruleBaseID));
} catch (DroolsChtijbugException e) {
throw propagate(e);
}
}
this.kieContainer = null;
}
public void createKBase(List<FileKnowledgeResource> files) {
try {
if (this.historyListener != null) {
this.historyListener.fireEvent(new KnowledgeBaseInitialLoadEvent(eventCounter.next(), new Date(), this.ruleBaseID));
}
lockKbase.acquire();
this.knowledgeModule.addAllFiles(files);
kieContainer = this.knowledgeModule.build();
lockKbase.release();
} catch (InterruptedException | DroolsChtijbugException e) {
propagate(e);
}
}
public void createKBase(ClassLoader... classLoaders) {
try {
if (this.historyListener != null) {
this.historyListener.fireEvent(new KnowledgeBaseInitialLoadEvent(eventCounter.next(), new Date(), this.ruleBaseID));
}
lockKbase.acquire();
if (classLoaders.length == 0) {
kieContainer = this.knowledgeModule.buildFromClassPath();
} else {
kieContainer = this.knowledgeModule.buildFromClassPath(classLoaders[0]);
}
lockKbase.release();
} catch (InterruptedException | DroolsChtijbugException e) {
propagate(e);
}
}
}

View file

@ -0,0 +1,558 @@
/*
* 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.impl;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import org.chtijbug.drools.common.reflection.ReflectionUtils;
import org.chtijbug.drools.entity.*;
import org.chtijbug.drools.entity.history.EventCounter;
import org.chtijbug.drools.entity.history.HistoryContainer;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedByReflectionFactEndHistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedByReflectionFactStartHistoryEvent;
import org.chtijbug.drools.entity.history.session.*;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.DroolsFactObjectFactory;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.drools.core.definitions.rule.impl.RuleImpl;
import org.jbpm.workflow.core.node.RuleSetNode;
import org.jbpm.workflow.instance.node.*;
import org.kie.api.definition.rule.Rule;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.ObjectFilter;
import org.kie.api.runtime.process.NodeInstance;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.runtime.rule.FactHandle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
/**
* @author nheron
*/
public class RuleBaseStatefulSession implements RuleBaseSession {
/**
* Class Logger
*/
private static Logger logger = LoggerFactory.getLogger(RuleBaseStatefulSession.class);
/**
* All objects inserted into the session as fact
*/
private final Map<FactHandle, Object> listObject;
private final Map<Object, FactHandle> listFact;
private final Map<Object, List<DroolsFactObject>> listFactObjects;
private final HistoryContainer historyContainer;
/**
* All the
*/
private final Map<String, DroolsRuleObject> listRules;
private final Map<String, DroolsProcessObject> processList;
private final Map<String, DroolsProcessInstanceObject> processInstanceList;
/**
* The wrapped Drools KnowledgeSession
*/
private KieSession knowledgeSession = null;
// Listeners can be dispose ...
private FactHandlerListener factListener;
private RuleHandlerListener ruleHandlerListener;
private ProcessHandlerListener processHandlerListener;
private int maxNumberRuleToExecute;
private XStream xstream = new XStream(new JettisonMappedXmlDriver());
private Long ruleBaseID;
private Long sessionId;
private HistoryListener historyListener;
private EventCounter eventCounter = EventCounter.newCounter();
public RuleBaseStatefulSession(Long ruleBaseID, Long sessionId, KieSession knowledgeSession, int maxNumberRuleToExecute, HistoryListener historyListener) throws DroolsChtijbugException {
this.ruleBaseID = ruleBaseID;
this.sessionId = sessionId;
this.knowledgeSession = knowledgeSession;
this.maxNumberRuleToExecute = maxNumberRuleToExecute;
this.factListener = new FactHandlerListener(this);
this.ruleHandlerListener = new RuleHandlerListener(this);
this.processHandlerListener = new ProcessHandlerListener(this);
this.historyContainer = new HistoryContainer(sessionId, historyListener);
this.listFactObjects = new HashMap<>();
this.listFact = new HashMap<>();
this.listObject = new HashMap<>();
this.listRules = new HashMap<>();
this.processList = new HashMap<>();
this.processInstanceList = new HashMap<>();
knowledgeSession.addEventListener(factListener);
knowledgeSession.addEventListener(ruleHandlerListener);
knowledgeSession.addEventListener(processHandlerListener);
this.historyListener = historyListener;
if (this.historyListener != null) {
SessionCreatedEvent sessionCreatedEvent = new SessionCreatedEvent(eventCounter.next(), this.ruleBaseID, this.sessionId);
this.addHistoryElement(sessionCreatedEvent);
}
}
public int getMaxNumberRuleToExecute() {
return maxNumberRuleToExecute;
}
public DroolsProcessInstanceObject getDroolsProcessInstanceObject(ProcessInstance processInstance) {
DroolsProcessInstanceObject droolsProcessInstanceObject = processInstanceList.get(Long.toString(processInstance.getId()));
if (droolsProcessInstanceObject == null) {
DroolsProcessObject droolsProcessObject = processList.get(processInstance.getProcess().getId());
if (droolsProcessObject == null) {
droolsProcessObject = DroolsProcessObject.createDroolsProcessObject(processInstance.getProcess().getId(),
processInstance.getProcess().getName(),
processInstance.getProcess().getPackageName(), processInstance.getProcess().getType(), processInstance.getProcess().getVersion());
processList.put(processInstance.getProcess().getId(), droolsProcessObject);
}
droolsProcessInstanceObject = DroolsProcessInstanceObject.createDroolsProcessInstanceObject(String.valueOf(processInstance.getId()), droolsProcessObject);
processInstanceList.put(droolsProcessInstanceObject.getId(), droolsProcessInstanceObject);
}
return droolsProcessInstanceObject;
}
public DroolsNodeInstanceObject getDroolsNodeInstanceObject(NodeInstance nodeInstance) {
DroolsNodeType nodeType = DroolsNodeType.Other;
String ruleFlowGroupName = null;
if (nodeInstance instanceof StartNodeInstance) {
nodeType = DroolsNodeType.StartNode;
} else if (nodeInstance instanceof RuleSetNodeInstance) {
nodeType = DroolsNodeType.RuleNode;
RuleSetNode ruleSetNode = this.getRuleSetNode(nodeInstance);
if (ruleSetNode != null) {
ruleFlowGroupName = ruleSetNode.getRuleFlowGroup();
}
} else if (nodeInstance instanceof SplitInstance) {
nodeType = DroolsNodeType.SplitNode;
} else if (nodeInstance instanceof JoinInstance) {
nodeType = DroolsNodeType.JoinNode;
} else if (nodeInstance instanceof EndNodeInstance) {
nodeType = DroolsNodeType.EndNode;
}
DroolsProcessInstanceObject droolsProcessInstanceObject = processInstanceList.get(Long.toString(nodeInstance.getProcessInstance().getId()));
if (droolsProcessInstanceObject == null) {
droolsProcessInstanceObject = this.getDroolsProcessInstanceObject(nodeInstance.getProcessInstance());
}
DroolsNodeInstanceObject droolsNodeInstanceObject = droolsProcessInstanceObject.getDroolsNodeInstanceObjet(String.valueOf(nodeInstance.getId()));
if (droolsNodeInstanceObject == null) {
DroolsNodeObject droolsNodeObject = DroolsNodeObject.createDroolsNodeObject(String.valueOf(nodeInstance.getNode().getId()), nodeType);
droolsProcessInstanceObject.getProcess().addDroolsNodeObject(droolsNodeObject);
droolsNodeObject.setRuleflowGroupName(ruleFlowGroupName);
droolsNodeInstanceObject = DroolsNodeInstanceObject.createDroolsNodeInstanceObject(String.valueOf(nodeInstance.getId()), droolsNodeObject);
droolsProcessInstanceObject.addDroolsNodeInstanceObject(droolsNodeInstanceObject);
}
return droolsNodeInstanceObject;
}
public DroolsRuleObject getDroolsRuleObject(Rule rule) {
DroolsRuleObject droolsRuleObject = listRules.get(rule.toString());
RuleImpl ruleInstance = (RuleImpl) rule;
if (droolsRuleObject == null) {
droolsRuleObject = DroolsRuleObject.createDroolRuleObject(rule.getName(), rule.getPackageName());
droolsRuleObject.setRuleFlowGroup(ruleInstance.getRuleFlowGroup());
addDroolsRuleObject(droolsRuleObject);
}
return droolsRuleObject;
}
public void addDroolsRuleObject(DroolsRuleObject droolsRuleObject) {
listRules.put(droolsRuleObject.getRulePackageName() + droolsRuleObject.getRuleName(), droolsRuleObject);
}
public DroolsFactObject getLastFactObjectVersion(Object searchO) {
int lastVersion = listFactObjects.get(searchO).size() - 1;
DroolsFactObject result = getFactObjectVersion(searchO, lastVersion);
try {
result.updateRealObjectFromJSON();
} catch (ClassNotFoundException e) {
logger.error("getLastFactObjectVersion",e);
} catch (IOException e) {
logger.error("getLastFactObjectVersion",e);
}
return result;
}
public DroolsFactObject getFactObjectVersion(Object search0, int version) {
return listFactObjects.get(search0).get(version);
}
public DroolsFactObject getLastFactObjectVersionFromFactHandle(FactHandle factToFind) {
Object searchObject = this.listObject.get(factToFind);
if (searchObject == null) {
return null;
}
List<DroolsFactObject> facto = listFactObjects.get(searchObject);
if (facto == null) {
logger.error("List of FactObject can not be null for FactHandle {}", factToFind);
return null;
}
int lastVersion = facto.size() - 1;
return listFactObjects.get(searchObject).get(lastVersion);
}
@Override
public HistoryContainer getHistoryContainer() {
return historyContainer;
}
@Override
public String getHistoryContainerXML() {
String result = null;
if (historyContainer != null) {
xstream.setMode(XStream.NO_REFERENCES);
result = xstream.toXML(historyContainer);
}
return result;
}
@Override
public Collection<DroolsFactObject> listLastVersionObjects() {
Collection<DroolsFactObject> list = new ArrayList<>();
for (Object o : this.listFact.keySet()) {
FactHandle factHandle = this.listFact.get(o);
list.add(this.getLastFactObjectVersionFromFactHandle(factHandle));
}
return list;
}
@Override
public String listLastVersionObjectsXML() {
String result = null;
Collection<DroolsFactObject> list = this.listLastVersionObjects();
if (list != null) {
xstream.setMode(XStream.NO_REFERENCES);
result = xstream.toXML(list);
}
return result;
}
public void setData(FactHandle f, Object o, DroolsFactObject fObject) {
Object objectSearch = listObject.containsKey(f);
listFact.remove(objectSearch);
listObject.put(f, o);
listFact.put(o, f);
if (!listFactObjects.containsKey(o)) {
List<DroolsFactObject> newList = new LinkedList<>();
newList.add(fObject);
listFactObjects.put(o, newList);
} else {
listFactObjects.get(o).add(fObject);
}
}
public void unsetData(FactHandle f, Object o) {
listObject.remove(f);
listFact.remove(o);
}
@Override
public void dispose() {
knowledgeSession.removeEventListener(factListener);
knowledgeSession.removeEventListener(ruleHandlerListener);
knowledgeSession.removeEventListener(processHandlerListener);
for (FactHandle f : listObject.keySet()) {
knowledgeSession.delete(f);
}
factListener = null;
ruleHandlerListener = null;
processHandlerListener = null;
knowledgeSession.dispose();
knowledgeSession = null;
if (this.historyListener != null) {
try {
SessionDisposedEvent sessionDisposedEvent = new SessionDisposedEvent(eventCounter.next(), this.ruleBaseID, this.sessionId);
this.addHistoryElement(sessionDisposedEvent);
} catch (Exception e) {
logger.error("Exception in calling historyEvent", e);
}
}
}
@Override
public void insertObject(Object newObject) {
FactHandle newFactHandle = this.knowledgeSession.insert(newObject);
listFact.put(newObject, newFactHandle);
}
@Override
public void insertByReflection(Object newObject) throws DroolsChtijbugException {
// Avoid inserting java.* classes
if (newObject.getClass().getPackage().getName().startsWith("java.")) {
return;
}
if (this.historyListener != null) {
DroolsFactObject topDroolsObject = DroolsFactObjectFactory.createFactObject(newObject);
InsertedByReflectionFactStartHistoryEvent insertedByReflectionFactStartHistoryEvent = new InsertedByReflectionFactStartHistoryEvent(eventCounter.next(), topDroolsObject, this.ruleBaseID, this.sessionId);
this.addHistoryElement(insertedByReflectionFactStartHistoryEvent);
}
//____ First insert the root object
insertObject(newObject);
//____ Then foreach getters insert item by reflection
for (Method method : newObject.getClass().getMethods()) {
//____ only manage getters
if (!ReflectionUtils.IsGetter(method)) {
continue;
}
Object getterValue;
try {
getterValue = method.invoke(newObject, (Object[]) null);
} catch (Exception e) {
throw new DroolsChtijbugException(DroolsChtijbugException.insertByReflection, "getterValue = method.invoke(newObject, (Object[]) null);", e);
}
if (getterValue == null)
continue;
//____ If returned value is not a collection, insert it in the ksession
if (!(getterValue instanceof Iterable)) {
this.insertByReflection(getterValue);
} else {
Iterable<?> iterable = (Iterable) getterValue;
for (Object item : iterable) {
this.insertByReflection(item);
}
}
}
if (this.historyListener != null) {
InsertedByReflectionFactEndHistoryEvent insertedByReflectionFactEndHistoryEvent = new InsertedByReflectionFactEndHistoryEvent(eventCounter.next(), this.ruleBaseID, this.sessionId);
this.addHistoryElement(insertedByReflectionFactEndHistoryEvent);
}
}
@Override
public void setGlobal(String identifier, Object value) {
this.knowledgeSession.setGlobal(identifier, value);
}
@Override
public void updateObject(Object updatedObject) {
FactHandle factToUpdate = listFact.get(updatedObject);
this.knowledgeSession.update(factToUpdate, updatedObject);
}
@Override
public void retractObject(Object oldObject) {
FactHandle factToDelete = listFact.get(oldObject);
this.knowledgeSession.delete(factToDelete);
}
@Override
public Object fireAllRulesAndStartProcess(Object inputObject, String processName) throws DroolsChtijbugException {
DroolsFactObject inputDroolsObject = null;
DroolsFactObject outputDroolsObject = null;
if (inputObject != null) {
this.insertByReflection(inputObject);
inputDroolsObject = DroolsFactObjectFactory.createFactObject(inputObject);
}
if (processName != null && processName.length() > 0) {
this.startProcess(processName);
}
this.fireAllRules();
if (inputDroolsObject != null) {
outputDroolsObject = DroolsFactObjectFactory.createFactObject(inputObject);
}
if (this.historyListener != null) {
SessionFireAllRulesAndStartProcess sessionFireAllRulesAndStartProcess = new SessionFireAllRulesAndStartProcess(eventCounter.next(), this.ruleBaseID, this.sessionId, inputDroolsObject, outputDroolsObject);
this.addHistoryElement(sessionFireAllRulesAndStartProcess);
}
return inputObject;
}
@Override
public void fireAllRules() throws DroolsChtijbugException {
if (this.historyListener != null) {
SessionFireAllRulesBeginEvent sessionFireAllRulesBeginEvent = new SessionFireAllRulesBeginEvent(eventCounter.next(), this.ruleBaseID, this.sessionId);
this.addHistoryElement(sessionFireAllRulesBeginEvent);
}
long startTime = System.currentTimeMillis();
long beforeNumberRules = ruleHandlerListener.getNbRuleFired();
try {
this.knowledgeSession.fireAllRules();
} catch (Exception e) {
throw new DroolsChtijbugException(DroolsChtijbugException.fireAllRules, "", e);
}
long stopTime = System.currentTimeMillis();
long afterNumberRules = ruleHandlerListener.getNbRuleFired();
if (ruleHandlerListener.isMaxNumerExecutedRulesReached()) {
if (this.historyListener != null) {
SessionFireAllRulesMaxNumberReachedEvent sessionFireAllRulesMaxNumberReachedEvent = new SessionFireAllRulesMaxNumberReachedEvent(eventCounter.next(), ruleHandlerListener.getNbRuleFired(), maxNumberRuleToExecute, this.ruleBaseID, this.sessionId);
this.addHistoryElement(sessionFireAllRulesMaxNumberReachedEvent);
}
throw new DroolsChtijbugException(DroolsChtijbugException.MaxNumberRuleExecutionReached, "nbRulesExecuted" + afterNumberRules + " and MaxNumberRules for the session is set to " + maxNumberRuleToExecute, null);
}
if (this.historyListener != null) {
SessionFireAllRulesEndEvent sessionFireAllRulesEndEvent = new SessionFireAllRulesEndEvent(eventCounter.next(), this.ruleBaseID, this.sessionId, stopTime - startTime, afterNumberRules - beforeNumberRules);
this.addHistoryElement(sessionFireAllRulesEndEvent);
}
}
@Override
public void startProcess(String processName) {
if (this.historyListener != null) {
try {
SessionStartProcessBeginEvent sessionStartProcessBeginEvent = new SessionStartProcessBeginEvent(eventCounter.next(), processName, this.ruleBaseID, this.sessionId);
this.addHistoryElement(sessionStartProcessBeginEvent);
} catch (Exception e) {
logger.error("Exception in calling historyEvent", e);
}
}
ProcessInstance processInstance = this.knowledgeSession.startProcess(processName);
if (this.historyListener != null) {
try {
SessionStartProcessEndEvent sessionStartProcessEndEvent = new SessionStartProcessEndEvent(eventCounter.next(), processName, this.ruleBaseID, this.sessionId, processInstance.getProcessId());
this.addHistoryElement(sessionStartProcessEndEvent);
} catch (Exception e) {
logger.error("Exception in calling historyEvent", e);
}
}
}
@Override
public Collection<DroolsRuleObject> listRules() {
return listRules.values();
}
@Override
public int getNumberRulesExecuted() {
int result = 0;
if (this.ruleHandlerListener != null) {
result = this.ruleHandlerListener.getNbRuleFired();
}
return result;
}
public void addHistoryElement(HistoryEvent newHistoryElement) {
this.historyContainer.addHistoryElement(this.ruleBaseID, this.sessionId, newHistoryElement);
}
public Long getSessionId() {
return sessionId;
}
public Long getRuleBaseID() {
return ruleBaseID;
}
@Override
public KieSession getKnowledgeSession() {
return knowledgeSession;
}
@Override
public Collection<? extends java.lang.Object> getObjects(ObjectFilter objectFilter) {
return this.knowledgeSession.getObjects(objectFilter);
}
@Override
public void completeWorkItem(long processId, Map<String, Object> vars) {
if (this.knowledgeSession != null && this.knowledgeSession.getWorkItemManager() != null) {
this.knowledgeSession.getWorkItemManager().completeWorkItem(processId, vars);
}
}
@Override
public void abortWorkItem(long processId) {
if (this.knowledgeSession != null && this.knowledgeSession.getWorkItemManager() != null) {
this.knowledgeSession.getWorkItemManager().abortWorkItem(processId);
}
}
@Override
public void registerWorkItemHandler(String workItemName, WorkItemHandler workItemHandler) {
if (this.knowledgeSession != null && this.knowledgeSession.getWorkItemManager() != null) {
this.knowledgeSession.getWorkItemManager().registerWorkItemHandler(workItemName, workItemHandler);
}
}
@Override
public ProcessInstance startProcess(String processName, Map<String, Object> vars) {
if (this.knowledgeSession != null && this.knowledgeSession.getWorkItemManager() != null) {
return this.knowledgeSession.startProcess(processName, vars);
}
return null;
}
private RuleSetNode getRuleSetNode(NodeInstance nodeInstance) {
RuleSetNode ruleSetNode = null;
if (nodeInstance instanceof RuleSetNodeInstance) {
if (nodeInstance.getNode() instanceof RuleSetNode) {
ruleSetNode = (RuleSetNode) nodeInstance.getNode();
}
}
return ruleSetNode;
}
public Long nextEventId() {
return this.eventCounter.next();
}
@Override
public Object fireAllRulesAndStartProcessWithParam(Object inputObject, String processName) throws DroolsChtijbugException {
DroolsFactObject inputDroolsObject = null;
DroolsFactObject outputDroolsObject = null;
if (inputObject != null) {
this.insertByReflection(inputObject);
inputDroolsObject = DroolsFactObjectFactory.createFactObject(inputObject);
}
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("inputObject", inputObject);
if (processName != null && processName.length() > 0) {
this.startProcess(processName, maps);
}
this.fireAllRules();
if (inputDroolsObject != null) {
outputDroolsObject = DroolsFactObjectFactory.createFactObject(inputObject);
}
if (this.historyListener != null) {
SessionFireAllRulesAndStartProcess sessionFireAllRulesAndStartProcess = new SessionFireAllRulesAndStartProcess(eventCounter.next(), this.ruleBaseID, this.sessionId, inputDroolsObject, outputDroolsObject);
this.addHistoryElement(sessionFireAllRulesAndStartProcess);
}
return inputObject;
}
}

View file

@ -0,0 +1,180 @@
/*
* 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.impl;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsRuleFlowGroupObject;
import org.chtijbug.drools.entity.DroolsRuleObject;
import org.chtijbug.drools.entity.history.rule.AfterRuleFiredHistoryEvent;
import org.chtijbug.drools.entity.history.rule.AfterRuleFlowActivatedHistoryEvent;
import org.chtijbug.drools.entity.history.rule.AfterRuleFlowDeactivatedHistoryEvent;
import org.chtijbug.drools.entity.history.rule.BeforeRuleFiredHistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesMaxNumberReachedEvent;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.reteoo.InitialFactImpl;
import org.kie.api.event.rule.*;
import org.kie.api.runtime.KieRuntime;
import org.kie.api.runtime.rule.FactHandle;
import org.kie.api.runtime.rule.Match;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* @author nheron
*/
public class RuleHandlerListener extends DefaultAgendaEventListener {
/**
* Class logger
*/
private static Logger logger = LoggerFactory.getLogger(RuleHandlerListener.class);
/**
* The Knowledge sessions sending events
*/
private final RuleBaseStatefulSession ruleBaseSession;
/**
* The rule fired count
*/
private int nbRuleFired = 0;
/**
* the RuleFLowGroup count
*/
private int nbRuleFlowGroupUsed = 0;
/**
* The rule fire limit
*/
private int maxNumberRuleToExecute;
/**
* IfMaxNumberRulewasReached
*/
private boolean maxNumerExecutedRulesReached = false;
public RuleHandlerListener(RuleBaseStatefulSession ruleBaseSession) {
this.ruleBaseSession = ruleBaseSession;
this.maxNumberRuleToExecute = ruleBaseSession.getMaxNumberRuleToExecute();
}
public boolean isMaxNumerExecutedRulesReached() {
return maxNumerExecutedRulesReached;
}
@Override
public void beforeMatchFired(BeforeMatchFiredEvent event) {
logger.debug(">>beforeActivationFired", event);
try {
Match match = event.getMatch();
List<? extends FactHandle> listFact = match.getFactHandles();
//____ Getting the Rule object summary from the session
DroolsRuleObject droolsRuleObject = ruleBaseSession.getDroolsRuleObject(match.getRule());
//____ Creating the specific History event for history managment
BeforeRuleFiredHistoryEvent newBeforeRuleEvent = new BeforeRuleFiredHistoryEvent(this.ruleBaseSession.nextEventId(), this.nbRuleFired + 1, droolsRuleObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
//____ Adding all objects info contained in the Activation object into the history Events
for (FactHandle h : listFact) {
if (h instanceof InternalFactHandle) {
InternalFactHandle defaultFactHandle = (InternalFactHandle) h;
//System.out.println(defaultFactHandle.toString());
if (defaultFactHandle.getObject() instanceof InitialFactImpl) {
// org.drools.reteoo.InitialFactImpl initialFact = (org.drools.reteoo.InitialFactImpl)defaultFactHandle.getObject();
//TODO in case of NOT, OR, etc..
} else {
DroolsFactObject sourceFactObject = ruleBaseSession.getLastFactObjectVersionFromFactHandle(h);
newBeforeRuleEvent.getWhenObjects().add(sourceFactObject);
}
}
}
//_____ Add Event into the History Container
ruleBaseSession.addHistoryElement(newBeforeRuleEvent);
} finally {
logger.debug("<<beforeActivationFired");
}
}
@Override
public void afterMatchFired(AfterMatchFiredEvent event) {
logger.debug(">>afterActivationFired", event);
try {
//____ Increment the global rule fired count
nbRuleFired++;
Match match = event.getMatch();
//____ Getting the Rule Object Summary from the session
DroolsRuleObject droolsRuleObject = ruleBaseSession.getDroolsRuleObject(match.getRule());
//____ Creating the specific "After Rule Fired" History Event
AfterRuleFiredHistoryEvent newAfterRuleEvent = new AfterRuleFiredHistoryEvent(this.ruleBaseSession.nextEventId(), this.nbRuleFired, droolsRuleObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
ruleBaseSession.addHistoryElement(newAfterRuleEvent);
//____ If the max number rule able to be executed threshold is raised, stop the session execution
if (nbRuleFired >= maxNumberRuleToExecute) {
logger.warn(String.format("%d rules have been fired. This is the limit.", maxNumberRuleToExecute));
logger.warn("The session execution will be stop");
KieRuntime runtime = event.getKieRuntime();
this.maxNumerExecutedRulesReached = true;
//(int eventID, int sessionId, int numberOfRulesExecuted, int maxNumberOfRulesForSession)
SessionFireAllRulesMaxNumberReachedEvent sessionFireAllRulesMaxNumberReachedEvent = new SessionFireAllRulesMaxNumberReachedEvent(this.ruleBaseSession.nextEventId(), nbRuleFired, maxNumberRuleToExecute, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
ruleBaseSession.addHistoryElement(sessionFireAllRulesMaxNumberReachedEvent);
runtime.halt();
}
logger.debug("nbre RDG Fired ==> ", nbRuleFired);
} finally {
logger.debug("<<afterActivationFired");
}
}
@Override
public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent ruleFlowGroupActivatedEvent) {
logger.debug(">>afterRuleFlowGroupActivated", ruleFlowGroupActivatedEvent);
try {
String ruleFlowGroupName = null;
//____ Filling the event with the rule flow group name activated
if (ruleFlowGroupActivatedEvent.getRuleFlowGroup() != null && ruleFlowGroupActivatedEvent.getRuleFlowGroup().getName() != null) {
ruleFlowGroupName = ruleFlowGroupActivatedEvent.getRuleFlowGroup().getName();
}
DroolsRuleFlowGroupObject droolsRuleFlowGroupObject = new DroolsRuleFlowGroupObject(this.nbRuleFlowGroupUsed + 1, ruleFlowGroupName);
//____ Creating history event
AfterRuleFlowActivatedHistoryEvent afterRuleFlowActivatedHistoryEvent = new AfterRuleFlowActivatedHistoryEvent(this.ruleBaseSession.nextEventId(), droolsRuleFlowGroupObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
//____ Adding into the History container
ruleBaseSession.addHistoryElement(afterRuleFlowActivatedHistoryEvent);
} finally {
logger.debug("<<afterRuleFlowGroupActivated");
}
}
@Override
public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent ruleFlowGroupDeactivatedEvent) {
logger.debug(">>afterRuleFlowGroupDeactivated", ruleFlowGroupDeactivatedEvent);
try {
String ruleFlowGroupName = null;
if (ruleFlowGroupDeactivatedEvent.getRuleFlowGroup() != null && ruleFlowGroupDeactivatedEvent.getRuleFlowGroup().getName() != null) {
ruleFlowGroupName = ruleFlowGroupDeactivatedEvent.getRuleFlowGroup().getName();
}
this.nbRuleFlowGroupUsed++;
DroolsRuleFlowGroupObject droolsRuleFlowGroupObject = new DroolsRuleFlowGroupObject(this.nbRuleFlowGroupUsed, ruleFlowGroupName);
//____ Creating history event
AfterRuleFlowDeactivatedHistoryEvent afterRuleFlowGroupDeactivated = new AfterRuleFlowDeactivatedHistoryEvent(this.ruleBaseSession.nextEventId(), droolsRuleFlowGroupObject, this.ruleBaseSession.getRuleBaseID(), this.ruleBaseSession.getSessionId());
//_____ Adding the event to the History container
ruleBaseSession.addHistoryElement(afterRuleFlowGroupDeactivated);
} finally {
logger.debug("<<afterRuleFlowGroupDeactivated");
}
}
public int getNbRuleFired() {
return nbRuleFired;
}
}

View file

@ -0,0 +1,135 @@
/*
* 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.resource;
import com.google.common.base.Throwables;
import org.apache.commons.io.IOUtils;
import org.chtijbug.drools.entity.history.KnowledgeResource;
import org.kie.api.io.Resource;
import org.kie.internal.io.ResourceFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Created by IntelliJ IDEA.
* Date: 23/01/14
* Time: 15:40
* To change this template use File | Settings | File Templates.
*/
public class FileKnowledgeResource implements Serializable, KnowledgeResource {
private String content;
private String path;
private boolean bpmn2;
private Resource resource;
public FileKnowledgeResource(String content, String path, boolean bpmn2, Resource resource) {
this.content = content;
this.path = path;
this.bpmn2 = bpmn2;
this.resource = resource;
}
public FileKnowledgeResource(Resource resource, String path, String fileContent) {
this.content = fileContent;
this.path = path;
this.resource = resource;
this.bpmn2 = true;
}
public FileKnowledgeResource() {
}
public static FileKnowledgeResource createFileSystemPathResource(String path) {
InputStream inputStream = null;
try {
inputStream = new FileInputStream(path);
String fileContent = IOUtils.toString(inputStream);
return new FileKnowledgeResource(ResourceFactory.newFileResource(path), path, fileContent);
} catch (IOException ex) {
Logger.getLogger(FileKnowledgeResource.class.getName()).log(Level.SEVERE, null, ex);
throw Throwables.propagate(ex);
}
}
public static FileKnowledgeResource createBPMN2ClassPathResource(String path) {
FileKnowledgeResource bpmn2Resource = createDRLClassPathResource(path);
bpmn2Resource.setBpmn2(true);
return bpmn2Resource;
}
public static FileKnowledgeResource createDRLClassPathResource(String path) {
ClassLoader classLoader = Thread.currentThread()
.getContextClassLoader();
InputStream inputStream;
if (classLoader == null) {
inputStream = FileKnowledgeResource.class.getResourceAsStream("/" + path);
} else {
inputStream = classLoader.getResourceAsStream(path);
}
String fileContent = null;
try {
fileContent = IOUtils.toString(inputStream);
} catch (IOException ex) {
Logger.getLogger(FileKnowledgeResource.class.getName()).log(Level.SEVERE, null, ex);
throw Throwables.propagate(ex);
}
return new FileKnowledgeResource(ResourceFactory.newClassPathResource(path), path, fileContent);
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isBpmn2() {
return bpmn2;
}
public void setBpmn2(boolean bpmn2) {
this.bpmn2 = bpmn2;
}
public Resource getResource() {
return resource;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("DrlRessourceFile{");
sb.append("fileName='").append(path).append('\'');
sb.append(", content='").append(content).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,154 @@
package org.chtijbug.drools.runtime.resource;
import org.chtijbug.drools.entity.history.EventCounter;
import org.chtijbug.drools.entity.history.knowledge.KnowledgeBaseAddResourceEvent;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.kie.api.KieServices;
import org.kie.api.builder.*;
import org.kie.api.io.KieResources;
import org.kie.api.io.Resource;
import org.kie.api.runtime.KieContainer;
import java.util.Date;
import java.util.List;
import static com.google.common.base.Throwables.propagate;
public class KnowledgeModule {
private final String groupId;
private final String artifactId;
private final String version;
private final KieServices kieServices;
private String ruleBaseName;
private final KieResources kieResources;
private final KieFileSystem kieFileSystem;
private final KieRepository kieRepository;
private final HistoryListener historyListener;
private final EventCounter sharedCounter;
private final Long ruleBaseId;
private ReleaseId releaseId;
private boolean fileBaseModule = false;
private WorkbenchClient workbenchClient;
public KnowledgeModule(Long ruleBaseId, HistoryListener historyListener, String groupId, String artifactId, String version, EventCounter sharedCounter) {
this.ruleBaseId = ruleBaseId;
this.historyListener = historyListener;
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.kieServices = KieServices.Factory.get();
this.kieRepository = kieServices.getRepository();
this.kieResources = kieServices.getResources();
this.kieFileSystem = kieServices.newKieFileSystem();
this.sharedCounter = sharedCounter;
}
public KnowledgeModule(String ruleBaseName, HistoryListener historyListener, EventCounter sharedCounter) {
this.ruleBaseName = ruleBaseName;
this.historyListener = historyListener;
this.groupId = null;
this.artifactId = null;
this.version = null;
this.kieServices = KieServices.Factory.get();
this.kieRepository = kieServices.getRepository();
this.kieResources = kieServices.getResources();
this.kieFileSystem = kieServices.newKieFileSystem();
this.sharedCounter = sharedCounter;
this.ruleBaseId = 1L;
}
public KnowledgeModule(Long ruleBaseId, HistoryListener historyListener, EventCounter sharedCounter) {
this.ruleBaseId = ruleBaseId;
this.historyListener = historyListener;
this.groupId = null;
this.artifactId = null;
this.version = null;
this.kieServices = KieServices.Factory.get();
this.kieRepository = kieServices.getRepository();
this.kieResources = kieServices.getResources();
this.kieFileSystem = kieServices.newKieFileSystem();
this.sharedCounter = sharedCounter;
}
public void addAllFiles(List<FileKnowledgeResource> files) {
for (FileKnowledgeResource file : files) {
addRuleFile(groupId + ".rules", file);
}
}
public void addRuleFile(String packageName, FileKnowledgeResource ruleResource) {
this.fileBaseModule = true;
packageName = packageName.replace(".", "/");
String resourcePath = "src/main/resources/" + packageName + "/" + ruleResource.getPath();
kieFileSystem.write(resourcePath, ruleResource.getResource());
if (historyListener != null)
try {
historyListener.fireEvent(
new KnowledgeBaseAddResourceEvent(
sharedCounter.next(), new Date(), this.ruleBaseId, ruleResource));
} catch (DroolsChtijbugException e) {
throw propagate(e);
}
}
public KieContainer build() {
this.releaseId = kieServices.newReleaseId(groupId, artifactId, version);
if (fileBaseModule) {
this.kieFileSystem.generateAndWritePomXML(releaseId);
KieBuilder kb = kieServices.newKieBuilder(kieFileSystem);
kb.buildAll();
if (kb.getResults().hasMessages(Message.Level.ERROR)) {
throw new RuntimeException("Build Errors:\n" + kb.getResults().toString());
}
}
return this.kieServices.newKieContainer(releaseId);
}
public KieContainer buildFromClassPath(ClassLoader classLoader) {
return this.kieServices.getKieClasspathContainer(classLoader);
}
public KieContainer buildFromClassPath() {
return this.kieServices.getKieClasspathContainer();
}
public void addWorkbenchResource(String workbenchUrl, String username, String password) {
try (WorkbenchClient client = new WorkbenchClient(workbenchUrl, username, password)) {
this.workbenchClient = client;
Resource resource = kieServices.getResources().newInputStreamResource(client.getWorkbenchResource(this));
this.kieRepository.addKieModule(resource);
if (historyListener != null)
try {
WorkbenchKnowledgeResource workbenchRuleResource = new WorkbenchKnowledgeResource(workbenchUrl, this.groupId, this.artifactId, this.version);
historyListener.fireEvent(
new KnowledgeBaseAddResourceEvent(
sharedCounter.next(), new Date(), this.ruleBaseId,
workbenchRuleResource));
} catch (DroolsChtijbugException e) {
throw propagate(e);
}
}
}
public String getGroupId() {
return groupId;
}
public String getArtifactId() {
return artifactId;
}
public String getVersion() {
return version;
}
public WorkbenchClient getWorkbenchClient() {
return workbenchClient;
}
}

View file

@ -0,0 +1,75 @@
package org.chtijbug.drools.runtime.resource;
import com.google.common.base.Throwables;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import static org.apache.http.client.utils.HttpClientUtils.closeQuietly;
public class WorkbenchClient implements Closeable {
private final CloseableHttpClient httpClient;
private final String workbenchUrl;
private CloseableHttpResponse response;
private String username;
private String password;
public WorkbenchClient(String workbenchUrl, String username, String password) {
this.workbenchUrl = workbenchUrl;
this.username = username;
this.password = password;
try {
URI submittedURI = new URI(workbenchUrl);
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(submittedURI.getHost(), submittedURI.getPort()),
new UsernamePasswordCredentials(username, password)
);
this.httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
} catch (URISyntaxException e) {
throw Throwables.propagate(e);
}
}
public InputStream getWorkbenchResource(KnowledgeModule knowledgeModule) {
// Build up url
String url = workbenchUrl + "maven2/" + knowledgeModule.getGroupId().replaceAll("\\.", "/") + "/" + knowledgeModule.getArtifactId() + "/" + knowledgeModule.getVersion() + "/" + knowledgeModule.getArtifactId() + "-" + knowledgeModule.getVersion() + ".jar";
HttpGet httpget = new HttpGet(url);
this.response = null;
try {
response = httpClient.execute(httpget);
return response.getEntity().getContent();
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
@Override
public void close() {
closeQuietly(this.response);
closeQuietly(this.httpClient);
}
public String getWorkbenchUrl() {
return workbenchUrl;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}

View file

@ -0,0 +1,121 @@
/*
* 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.resource;
import org.chtijbug.drools.entity.history.KnowledgeResource;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* Date: 23/01/14
* Time: 15:40
* To change this template use File | Settings | File Templates.
*/
public class WorkbenchKnowledgeResource implements Serializable, KnowledgeResource {
private String guvnor_url;
private String groupId;
private String artifactID;
private String version;
private String userName;
private String password;
public WorkbenchKnowledgeResource(String guvnor_url, String groupId, String artifactID, String version) {
this.guvnor_url = guvnor_url;
this.groupId = groupId;
this.artifactID = artifactID;
this.version = version;
}
public WorkbenchKnowledgeResource(String guvnor_url, String groupId, String artifactId, String version, String userName, String password) {
this(guvnor_url, groupId, artifactId, version);
this.userName = userName;
this.password = password;
}
public WorkbenchKnowledgeResource() {
}
public static WorkbenchKnowledgeResource createGuvnorRessource(String guvnor_url, String groupId, String artifactID, String version) {
return new WorkbenchKnowledgeResource(guvnor_url, groupId, artifactID, version);
}
public static WorkbenchKnowledgeResource createGuvnorRessource(String guvnor_url, String groupId, String artifactID, String version, String userName, String password) {
return new WorkbenchKnowledgeResource(guvnor_url, groupId, artifactID, version, userName, password);
}
public String getGuvnor_url() {
return guvnor_url;
}
public void setGuvnor_url(String guvnor_url) {
this.guvnor_url = guvnor_url;
}
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 getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("GuvnorRessourceFile{");
sb.append("guvnor_url='").append(guvnor_url).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process processType="Private" isExecutable="true" id="P1" artifactId="Hello World" tns:groupId="org.chtijbug.drools.runtime.test" >
<!-- nodes -->
<startEvent id="_1" artifactId="StartProcess" />
<endEvent id="_3" artifactId="EndProcess" />
<businessRuleTask id="_4" artifactId="Group1" g:ruleFlowGroup="Group1" >
</businessRuleTask>
<businessRuleTask id="_5" artifactId="Group2" g:ruleFlowGroup="Group2" >
</businessRuleTask>
<!-- connections -->
<sequenceFlow id="_5-_3" sourceRef="_5" targetRef="_3" />
<sequenceFlow id="_1-_4" sourceRef="_1" targetRef="_4" />
<sequenceFlow id="_4-_5" sourceRef="_4" targetRef="_5" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="P1" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="16" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="462" y="28" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_4" >
<dc:Bounds x="161" y="64" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_5" >
<dc:Bounds x="304" y="50" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_5-_3" >
<di:waypoint x="344" y="74" />
<di:waypoint x="486" y="52" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_1-_4" >
<di:waypoint x="40" y="40" />
<di:waypoint x="201" y="88" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_4-_5" >
<di:waypoint x="201" y="88" />
<di:waypoint x="344" y="74" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:change-set="http://drools.org/drools-5.0/change-set"
elementFormDefault="qualified"
targetNamespace="http://drools.org/drools-5.0/change-set">
<xsd:import namespace="http://www.w3.org/2001/XMLSchema-instance"/>
<xsd:element artifactId="change-set">
<xsd:complexType>
<xsd:choice>
<xsd:element ref="change-set:add"/>
<xsd:element ref="change-set:remove"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element artifactId="add">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" ref="change-set:resource"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element artifactId="remove">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" ref="change-set:resource"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element artifactId="resource">
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0"/>
<xsd:element minOccurs="0" ref="change-set:decisiontable-conf"/>
</xsd:sequence>
<!-- URL to the resource, can be file based -->
<xsd:attribute artifactId="source" use="required" type="xsd:anyURI"/>
<!-- for example, DRL, or PKG -->
<xsd:attribute artifactId="type" use="required" type="xsd:string"/>
<xsd:attribute artifactId="basicAuthentication" type="xsd:string"/>
<xsd:attribute artifactId="username" type="xsd:string"/>
<xsd:attribute artifactId="password" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element artifactId="decisiontable-conf">
<xsd:complexType>
<xsd:attribute artifactId="input-type" use="required" type="xsd:NCName"/>
<xsd:attribute artifactId="worksheet-artifactId" use="required" type="xsd:NCName"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://drools.org/drools-5.0/change-set"
xsi:schemaLocation="http://drools.org/drools-5.0/change-set changeset-1.0.0.xsd">
<add>
<resource
type="PKG"
source="%s"
basicAuthentication="enabled"
username="%s"
password="%s">
</resource>
</add>
</change-set>

View file

@ -0,0 +1,49 @@
/*
* Copyright 2010 JBoss Inc
*
* 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 org.chtijbug.drools.runtime.Fibonacci;
dialect "mvel"
rule Recurse
salience 10
when
not ( Fibonacci ( sequence == 1 ) )
f : Fibonacci ( value == -1 )
then
insert( new Fibonacci( f.sequence - 1 ) );
System.out.println( "recurse for " + f.sequence );
end
rule Bootstrap
when
f : Fibonacci( sequence == 1 || == 2, value == -1 ) // this is a multi-restriction || on a single field
then
modify ( f ){ value = 1 };
System.out.println( f.sequence + " == " + f.value );
end
rule Calculate
when
f1 : Fibonacci( s1 : sequence, value != -1 ) // here we bind sequence
f2 : Fibonacci( sequence == (s1 + 1 ), value != -1 ) // here we don't, just to demonstrate the different way bindings can be used
f3 : Fibonacci( s3 : sequence == (f2.sequence + 1 ), value == -1 )
then
modify ( f3 ) { value = f1.value + f2.value };
System.out.println( s3 + " == " + f3.value ); // see how you can access pattern and field bindings
end

Some files were not shown because too many files have changed in this diff Show more