Permalink
Browse files

DROOLS-494: implementing execution server

  • Loading branch information...
etirelli committed May 13, 2014
1 parent 607ceec commit 49e1a61bf58185149d9879447180e9c5c2790111
Showing with 2,688 additions and 0 deletions.
  1. +31 −0 kie-server/.gitignore
  2. +31 −0 kie-server/kie-server-api/.gitignore
  3. +75 −0 kie-server/kie-server-api/pom.xml
  4. +1 −0 kie-server/kie-server-api/src/main/filtered-resources/kie.server.properties
  5. +55 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/KieServerEnvironment.java
  6. +73 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/Version.java
  7. +53 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/commands/CallContainerCommand.java
  8. +84 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/commands/CommandScript.java
  9. +66 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/commands/CreateContainerCommand.java
  10. +34 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/commands/DisposeContainerCommand.java
  11. +18 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/commands/ListContainersCommand.java
  12. +124 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieContainerResource.java
  13. +35 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieContainerResourceList.java
  14. +5 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieContainerStatus.java
  15. +75 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieScannerResource.java
  16. +8 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieScannerStatus.java
  17. +10 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieServerCommand.java
  18. +32 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/KieServerInfo.java
  19. +74 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/ReleaseId.java
  20. +73 −0 kie-server/kie-server-api/src/main/java/org/kie/server/api/model/ServiceResponse.java
  21. +31 −0 kie-server/kie-server-client/.gitignore
  22. +40 −0 kie-server/kie-server-client/pom.xml
  23. +172 −0 kie-server/kie-server-client/src/main/java/org/kie/server/client/KieServicesClient.java
  24. +31 −0 kie-server/kie-server-services/.gitignore
  25. +152 −0 kie-server/kie-server-services/pom.xml
  26. +34 −0 kie-server/kie-server-services/src/main/java/org/kie/server/services/KieServerApplication.java
  27. +68 −0 kie-server/kie-server-services/src/main/java/org/kie/server/services/api/KieServer.java
  28. +74 −0 kie-server/kie-server-services/src/main/java/org/kie/server/services/impl/KieContainerInstance.java
  29. +36 −0 kie-server/kie-server-services/src/main/java/org/kie/server/services/impl/KieContainersRegistry.java
  30. +485 −0 kie-server/kie-server-services/src/main/java/org/kie/server/services/impl/KieServerImpl.java
  31. +133 −0 kie-server/kie-server-services/src/main/java/org/kie/server/services/impl/XStreamXml.java
  32. +21 −0 ...-server-services/src/main/java/org/kie/server/services/impl/adapters/ExecutionResultsAdapter.java
  33. +17 −0 kie-server/kie-server-services/src/main/resources/applicationContext.xml
  34. +32 −0 kie-server/kie-server-services/src/main/webapp/WEB-INF/web.xml
  35. +351 −0 kie-server/kie-server-services/src/test/java/org/kie/server/impl/KieServerTest.java
  36. +54 −0 kie-server/pom.xml
View
@@ -0,0 +1,31 @@
/target
/local
# Eclipse, Netbeans and IntelliJ files
/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml
# Repository wide ignore mac DS_Store files
.DS_Store
# Original jbpm ignores
bin/
*~
*.tlog
# Test info
/settings*.xml
/lib-jdbc/
bitronix-default-config.properties
*.db
# modules that don't exist in this branch
/jbpm-human-task-war/
# files used for external db testing
jdbc_driver.jar
db-settings.xml
@@ -0,0 +1,31 @@
/target
/local
# Eclipse, Netbeans and IntelliJ files
/.*
!.gitignore
/nbproject
/*.ipr
/*.iws
/*.iml
# Repository wide ignore mac DS_Store files
.DS_Store
# Original jbpm ignores
bin/
*~
*.tlog
# Test info
/settings*.xml
/lib-jdbc/
bitronix-default-config.properties
*.db
# modules that don't exist in this branch
/jbpm-human-task-war/
# files used for external db testing
jdbc_driver.jar
db-settings.xml
@@ -0,0 +1,75 @@
<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>
<groupId>org.kie</groupId>
<artifactId>kie-server</artifactId>
<version>6.2.0-SNAPSHOT</version>
</parent>
<artifactId>kie-server-api</artifactId>
<packaging>jar</packaging>
<name>KIE :: Execution Server :: API</name>
<description>KIE Execution Server API</description>
<dependencies>
<!-- core dependencies -->
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<!-- scope>provided</scope -->
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/filtered-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<additionalBuildcommands>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<LaunchConfigHandle>&lt;project&gt;/.externalToolBuilders/mvn-resources.launch</LaunchConfigHandle>
</arguments>
</buildCommand>
</additionalBuildcommands>
<additionalConfig>
<file>
<name>.externalToolBuilders/mvn-resources.launch</name>
<content>
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="true"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="&#36;{working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;launchConfigurationWorkingSet editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot; factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; label=&quot;workingSet&quot; name=&quot;workingSet&quot;&gt;&#13;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/${project.artifactId}/src/main/resources&quot; type=&quot;2&quot;/&gt;&#13;&#10;&lt;/launchConfigurationWorkingSet&gt;}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:MAVEN_HOME}/bin/mvn"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="resources:resources"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="&#36;{workspace_loc:/${artifactId}}"/>
</launchConfiguration>]]>
</content>
</file>
</additionalConfig>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1 @@
kie.server.version=${project.version}
@@ -0,0 +1,55 @@
package org.kie.server.api;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class KieServerEnvironment {
private static final Pattern VERSION_PAT = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)([\\.-].*)?");
private static Version version;
static {
String kieServerString = KieServerEnvironment.class.getPackage().getImplementationVersion();
if (kieServerString == null) {
InputStream is = null;
try {
is = KieServerEnvironment.class.getClassLoader().getResourceAsStream("kie.server.properties");
Properties properties = new Properties();
properties.load(is);
kieServerString = properties.get("kie.server.version").toString();
is.close();
} catch ( IOException e ) {
throw new RuntimeException(e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
Matcher m = VERSION_PAT.matcher(kieServerString);
if( m.matches() ) {
try {
version = new Version( Integer.parseInt(m.group(1)),
Integer.parseInt(m.group(2)),
Integer.parseInt(m.group(3)),
m.group(4) );
} catch (NumberFormatException e) {
version = new Version(0,0,0,null);
}
}
}
public static Version getVersion() {
return version;
}
}
@@ -0,0 +1,73 @@
package org.kie.server.api;
public class Version {
private final int major;
private final int minor;
private final int revision;
private final String classifier;
public Version(int major, int minor, int revision, String classifier) {
super();
this.major = major;
this.minor = minor;
this.revision = revision;
this.classifier = classifier;
}
public int getMajor() {
return major;
}
public int getMinor() {
return minor;
}
public int getRevision() {
return revision;
}
public String getClassifier() {
return classifier;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((classifier == null) ? 0 : classifier.hashCode());
result = prime * result + major;
result = prime * result + minor;
result = prime * result + revision;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Version other = (Version) obj;
if (classifier == null) {
if (other.classifier != null)
return false;
} else if (!classifier.equals(other.classifier))
return false;
if (major != other.major)
return false;
if (minor != other.minor)
return false;
if (revision != other.revision)
return false;
return true;
}
@Override
public String toString() {
return major + "." + minor + "." + revision + (classifier != null ? classifier : "");
}
}
@@ -0,0 +1,53 @@
package org.kie.server.api.commands;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.kie.server.api.model.KieServerCommand;
@XmlRootElement(name = "call-container")
@XmlAccessorType(XmlAccessType.NONE)
public class CallContainerCommand implements KieServerCommand {
private static final long serialVersionUID = -1803374525440238478L;
@XmlAttribute(name = "container-id")
private String containerId;
@XmlElement(name = "payload")
private String payload;
public CallContainerCommand() {
super();
}
public CallContainerCommand(String containerId, String cmdPayload) {
this.containerId = containerId;
this.payload = cmdPayload;
}
public String getContainerId() {
return containerId;
}
public void setContainerId(String containerId) {
this.containerId = containerId;
}
public String getPayload() {
return payload;
}
public void setPayload(String payload) {
this.payload = payload;
}
@Override
public String toString() {
return "CallContainerCommand [containerId=" + containerId + ", payload=" + payload + "]";
}
}
Oops, something went wrong.

0 comments on commit 49e1a61

Please sign in to comment.