Skip to content

Commit

Permalink
DROOLS-494: implementing execution server
Browse files Browse the repository at this point in the history
  • Loading branch information
etirelli committed Jul 11, 2014
1 parent 607ceec commit 49e1a61
Show file tree
Hide file tree
Showing 36 changed files with 2,688 additions and 0 deletions.
31 changes: 31 additions & 0 deletions kie-server/.gitignore
@@ -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
31 changes: 31 additions & 0 deletions kie-server/kie-server-api/.gitignore
@@ -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
75 changes: 75 additions & 0 deletions kie-server/kie-server-api/pom.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 + "]";
}

}

0 comments on commit 49e1a61

Please sign in to comment.