Author: jim.ma
Date: 2009-07-16 22:33:31 -0400 (Thu, 16 Jul 2009)
New Revision: 5315
Modified:
projects/jopr-integration/branch/3.x/jopr/pom.xml
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceComponent.java
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceDiscoveryComponent.java
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefComponent.java
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefDiscoveryComponent.java
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmServiceComponent.java
projects/jopr-integration/branch/3.x/jopr/src/main/resources/META-INF/rhq-plugin.xml
Log:
Refactored the code
Modified: projects/jopr-integration/branch/3.x/jopr/pom.xml
===================================================================
--- projects/jopr-integration/branch/3.x/jopr/pom.xml 2009-07-17 00:13:45 UTC (rev 5314)
+++ projects/jopr-integration/branch/3.x/jopr/pom.xml 2009-07-17 02:33:31 UTC (rev 5315)
@@ -24,7 +24,15 @@
<scm.module.path>.</scm.module.path>
</properties>
- <dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.11.0.GA</version>
+ </dependency>
+
+
+
<dependency>
<groupId>org.jboss.on</groupId>
<artifactId>rhq-jbossas-plugin</artifactId>
Modified:
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceComponent.java
===================================================================
---
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceComponent.java 2009-07-17
00:13:45 UTC (rev 5314)
+++
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceComponent.java 2009-07-17
02:33:31 UTC (rev 5315)
@@ -21,7 +21,7 @@
import org.rhq.core.pluginapi.operation.OperationResult;
public class JbpmInstanceComponent implements
ResourceComponent<JbpmProcessDefComponent>, MeasurementFacet,
DeleteResourceFacet,OperationFacet {
- public static final String JBPM_SERVICE = "jboss.esb:service=JbpmService";
+
private ResourceContext<JbpmProcessDefComponent> resourceContext;
private Log log = LogFactory.getLog(JbpmProcessDefComponent.class);
private EmsConnection newConnection = null;
@@ -33,7 +33,7 @@
this.resourceContext = resourceContext;
instanceId = resourceContext.getResourceKey();
newConnection = resourceContext.getParentResourceComponent().getNewConnection();
- EmsBean bean = newConnection.getBean(JBPM_SERVICE);
+ EmsBean bean = newConnection.getBean(JbpmServiceComponent.JBPM_SERVICE);
getInsOperation = bean.getOperation("getProcessInstance");
try {
processInsClass =
newConnection.getClass().getClassLoader().loadClass("org.jbpm.graph.exe.ProcessInstance");
@@ -111,35 +111,27 @@
}
public String suspendInstance() {
- EmsConnection connection = getNewConnection();
- EmsBean bean = connection.getBean(this.JBPM_SERVICE);
- EmsOperation operation = bean.getOperation("suspendProcessInstance");
+ EmsOperation operation =
getServiceBean().getOperation("suspendProcessInstance");
operation.invoke(Long.parseLong(resourceContext.getResourceKey()));
return "Sucess";
}
public String endInstance() {
- EmsConnection connection = getNewConnection();
- EmsBean bean = connection.getBean(this.JBPM_SERVICE);
- EmsOperation operation = bean.getOperation("endProcessInstance");
+ EmsOperation operation =
getServiceBean().getOperation("endProcessInstance");
operation.invoke(Long.parseLong(resourceContext.getResourceKey()));
return "Sucess";
}
- public String resumeInstance() {
- EmsConnection connection = getNewConnection();
- EmsBean bean = connection.getBean(this.JBPM_SERVICE);
- EmsOperation operation = bean.getOperation("resumeProcessInstance");
+ public String resumeInstance() {
+ EmsOperation operation =
getServiceBean().getOperation("resumeProcessInstance");
operation.invoke(Long.parseLong(resourceContext.getResourceKey()));
return "Sucess";
}
/* implement the DeleteResourceFacet */
- public void deleteResource() throws Exception {
- EmsConnection connection = getNewConnection();
- EmsBean bean = connection.getBean(this.JBPM_SERVICE);
- EmsOperation operation = bean.getOperation("deleteProcessInstance");
+ public void deleteResource() throws Exception {
+ EmsOperation operation =
getServiceBean().getOperation("deleteProcessInstance");
operation.invoke(Long.parseLong(resourceContext.getResourceKey()));
}
@@ -167,6 +159,13 @@
}
+ private EmsBean getServiceBean() {
+ EmsConnection connection = getNewConnection();
+ EmsBean bean = connection.getBean(JbpmServiceComponent.JBPM_SERVICE);
+ return bean;
+ }
+
+
public EmsConnection getNewConnection() {
return newConnection;
}
Modified:
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceDiscoveryComponent.java
===================================================================
---
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceDiscoveryComponent.java 2009-07-17
00:13:45 UTC (rev 5314)
+++
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmInstanceDiscoveryComponent.java 2009-07-17
02:33:31 UTC (rev 5315)
@@ -13,7 +13,7 @@
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
public class JbpmInstanceDiscoveryComponent implements
ResourceDiscoveryComponent<JbpmProcessDefComponent> {
- public static final String JBPM_SERVICE = "jboss.esb:service=JbpmService";
+ public static final String JBPM_SERVICE = "jboss.jbpm:service=JbpmService";
EmsConnection newConnection = null;
public Set<DiscoveredResourceDetails> discoverResources(
Modified:
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefComponent.java
===================================================================
---
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefComponent.java 2009-07-17
00:13:45 UTC (rev 5314)
+++
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefComponent.java 2009-07-17
02:33:31 UTC (rev 5315)
@@ -29,7 +29,6 @@
public class JbpmProcessDefComponent implements
ResourceComponent<JbpmServiceComponent>, MeasurementFacet, DeleteResourceFacet,
OperationFacet, CreateChildResourceFacet {
- public static final String JBPM_SERVICE = "jboss.esb:service=JbpmService";
private ResourceContext<JbpmServiceComponent> resourceContext;
private Log log = LogFactory.getLog(JbpmProcessDefComponent.class);
private EmsConnection newConnection = null;
@@ -41,7 +40,7 @@
this.resourceContext = resourceContext;
newConnection = resourceContext.getParentResourceComponent()
.getRebuildConnection();
- EmsBean bean = newConnection.getBean(JBPM_SERVICE);
+ EmsBean bean = newConnection.getBean(JbpmServiceComponent.JBPM_SERVICE);
Object obj = bean.getAttribute("DeployedProcessDefinitions").refresh();
id = resourceContext.getResourceKey();
//TODO: Check if we should refresh the jbpmProcessDef when collect metric value
@@ -93,7 +92,7 @@
/* implement the DeleteResourceFacet */
public void deleteResource() throws Exception {
EmsConnection connection = this.getNewConnection();
- EmsBean bean = connection.getBean(JBPM_SERVICE);
+ EmsBean bean = connection.getBean(JbpmServiceComponent.JBPM_SERVICE);
EmsOperation emsOp = bean.getOperation("deleteProcess");
emsOp.invoke(parseLong(id));
}
@@ -104,7 +103,7 @@
report.setResourceName(resourceTypeName);
try {
EmsConnection connection = this.getNewConnection();
- EmsBean bean = connection.getBean(JBPM_SERVICE);
+ EmsBean bean = connection.getBean(JbpmServiceComponent.JBPM_SERVICE);
EmsOperation emsOp = bean.getOperation("startProcessInstance");
emsOp.invoke(parseLong(id));
} catch (Exception e) {
@@ -121,7 +120,7 @@
public OperationResult invokeOperation(String name, Configuration configuration) throws
InterruptedException {
if ("startinstance".equals(name.toLowerCase())) {
EmsConnection connection = this.getNewConnection();
- EmsBean bean = connection.getBean(JBPM_SERVICE);
+ EmsBean bean = connection.getBean(JbpmServiceComponent.JBPM_SERVICE);
EmsOperation emsOp = bean.getOperation("startProcessInstance");
emsOp.invoke(parseLong(id));
}
Modified:
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefDiscoveryComponent.java
===================================================================
---
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefDiscoveryComponent.java 2009-07-17
00:13:45 UTC (rev 5314)
+++
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmProcessDefDiscoveryComponent.java 2009-07-17
02:33:31 UTC (rev 5315)
@@ -17,7 +17,6 @@
*/
public class JbpmProcessDefDiscoveryComponent implements
ResourceDiscoveryComponent<JbpmServiceComponent> {
- public static final String JBPM_SERVICE = "jboss.esb:service=JbpmService";
EmsConnection newConnection = null;
public Set<DiscoveredResourceDetails> discoverResources(
@@ -26,7 +25,7 @@
try {
newConnection = context.getParentResourceComponent().getRebuildConnection();
- EmsBean bean = newConnection.getBean(JBPM_SERVICE);
+ EmsBean bean = newConnection.getBean(JbpmServiceComponent.JBPM_SERVICE);
Object obj = bean.getAttribute("DeployedProcessDefinitions").refresh();
Class processDefClass =
newConnection.getClass().getClassLoader().loadClass("org.jbpm.graph.def.ProcessDefinition");
@@ -54,4 +53,4 @@
}
return jbpmDefs;
}
-}
\ No newline at end of file
+}
Modified:
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmServiceComponent.java
===================================================================
---
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmServiceComponent.java 2009-07-17
00:13:45 UTC (rev 5314)
+++
projects/jopr-integration/branch/3.x/jopr/src/main/java/org/jbosson/plugins/jbpm/JbpmServiceComponent.java 2009-07-17
02:33:31 UTC (rev 5315)
@@ -17,6 +17,7 @@
import org.mc4j.ems.connection.bean.operation.EmsOperation;
import org.mc4j.ems.connection.settings.ConnectionSettings;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
@@ -31,9 +32,12 @@
public class JbpmServiceComponent extends MBeanResourceComponent implements
CreateChildResourceFacet {
- public static final String JBPM_SERVICE = "jboss.esb:service=JbpmService";
+
+ public static String JBPM_SERVICE = "jboss.jbpm:service=JbpmService";
+
private static final String RESOURCE_TYPE_JBPM_PROCESS = "Process
Definitions";
private static final String RESOURCE_TYPE_PAR = "par";
+
EmsConnection newConnection = null;
ContentContext contentContext = null;
@@ -55,6 +59,7 @@
public void start(ResourceContext context) {
super.start(context);
contentContext = context.getContentContext();
+ JBPM_SERVICE = this.getServiceBeanName();
}
private void addAdditionalJarsToConnectionSettings(
@@ -217,4 +222,9 @@
EmsOperation operation = bean.getOperation("deploy");
operation.invoke(url);
}
+
+ private String getServiceBeanName() {
+ PropertySimple propertySimple =
resourceContext.getPluginConfiguration().getSimple("objectName");
+ return propertySimple.getStringValue();
+ }
}
Modified:
projects/jopr-integration/branch/3.x/jopr/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
---
projects/jopr-integration/branch/3.x/jopr/src/main/resources/META-INF/rhq-plugin.xml 2009-07-17
00:13:45 UTC (rev 5314)
+++
projects/jopr-integration/branch/3.x/jopr/src/main/resources/META-INF/rhq-plugin.xml 2009-07-17
02:33:31 UTC (rev 5315)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<plugin name="JBPM-Plugin" displayName="JBPM-Plugin"
+<plugin name="JBPM" displayName="JBPM"
package="org.jbosson.plugins.jbpm"
description="Provides monitoring of JBoss JBPM" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -19,7 +19,7 @@
<plugin-configuration>
<c:simple-property name="objectName" readOnly="true"
- default="jboss.esb:service=JbpmService" />
+ default="jboss.jbpm:service=JbpmService" />
<c:simple-property name="nameTemplate"
default="JBPM Service" />
<c:simple-property name="DescriptionTemplate"
@@ -39,11 +39,6 @@
<metric property="State" displayName="jbpm State"
dataType="trait" displayType="summary" defaultOn="true"
description="Numeric value of the state of the jbpm service" />
- <help>
- <![CDATA[
- JBoss JBPM Service
- ]]>
- </help>
<service name="Process Definitions"
discovery="org.jbosson.plugins.jbpm.JbpmProcessDefDiscoveryComponent"
@@ -51,8 +46,8 @@
creationDataType="content"
createDeletePolicy="both"
description="JBPM Process Definitions">
+ <operation name="startInstance"
displayName="StartProcessInstance" description="Create a process
instance"/>
-
<metric property="version" displayName="Version"
dataType="trait" displayType="summary"
defaultOn="true"
description="Process definition version" />
@@ -74,11 +69,10 @@
<service name="Process Instances"
discovery="org.jbosson.plugins.jbpm.JbpmInstanceDiscoveryComponent"
class="org.jbosson.plugins.jbpm.JbpmInstanceComponent"
- createDeletePolicy="both"
+ createDeletePolicy="delete-only"
creationDataType="configuration"
description="Process Instances">
-
-
+
<operation name="suspend" displayName="suspend"
description="Suspend this process instance"/>
@@ -108,13 +102,6 @@
dataType="trait" displayType="summary"
defaultOn="true"
description="Process Instance EndData" />
- <help>
- <![CDATA[
- JBoss Process Instances
- ]]>
- </help>
-
-
</service>
</service>