[jbpm-commits] JBoss JBPM SVN: r5480 - in projects/jopr-integration/trunk: src/main/java/org and 6 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Aug 14 06:04:18 EDT 2009


Author: jim.ma
Date: 2009-08-14 06:04:17 -0400 (Fri, 14 Aug 2009)
New Revision: 5480

Added:
   projects/jopr-integration/trunk/src/main/java/org/rhq/
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ExceptionJobDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/InstanceJobDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/JobComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/MessageDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/TimerDiscoveryComponent.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnection.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnector.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/LocalJBPMEngineConnector.java
   projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/RemoteJBPMEngineConnector.java
Removed:
   projects/jopr-integration/trunk/src/main/java/org/jbosson/plugins/jbpm/
Modified:
   projects/jopr-integration/trunk/pom.xml
   projects/jopr-integration/trunk/src/main/resources/META-INF/rhq-plugin.xml
Log:
Initial commit for local jopr plugin (embeded jopr);it provides the functions to mintor the processEngine, deployment, process definition,process instance and jobs

Modified: projects/jopr-integration/trunk/pom.xml
===================================================================
--- projects/jopr-integration/trunk/pom.xml	2009-08-14 05:01:17 UTC (rev 5479)
+++ projects/jopr-integration/trunk/pom.xml	2009-08-14 10:04:17 UTC (rev 5480)
@@ -1,229 +1,332 @@
-<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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
 
-   <modelVersion>4.0.0</modelVersion>
+	<modelVersion>4.0.0</modelVersion>
 
-   <parent>
-      <groupId>org.jboss.on</groupId>
-      <artifactId>jon-parent</artifactId>
-      <version>2.1.2.GA</version>
-   </parent>
+	<parent>
+		<groupId>org.jboss.on</groupId>
+		<!--
+			Bypass the jopr-plugins-parent which can not have children. It must
+			build after the plugins in order to execute integration tests on
+			them.
+		-->
+		<artifactId>jopr-modules-parent</artifactId>
+		<version>2.3.0-SNAPSHOT</version>
+	</parent>
 
-   <groupId>org.jboss.on</groupId>
-   <artifactId>jopr-jbpm-plugin</artifactId>
-   <packaging>jar</packaging>
+	<groupId>org.jboss.on</groupId>
+	<artifactId>jopr-jbpm4-plugin</artifactId>
+	<packaging>jar</packaging>
 
-   <name>Jopr jbpm Plugin</name>
-   <description>A plugin for managing jbpm</description>
+	<name>Jopr jbpm4 Plugin</name>
+	<description>A plugin for managing jbpm</description>
 
-   <scm>
-      <connection>scm:svn:https://svn.jboss.org/repos/jbpm/projects/jopr-integration</connection>
-      <developerConnection>scm:svn:https://svn.jboss.org/repos/jbpm/projects/jopr-integration</developerConnection>
-   </scm>
+	<scm>
+		<connection>
+			scm:svn:https://svn.jboss.org/repos/jbpm/projects/jopr-integration
+		</connection>
+		<developerConnection>
+			scm:svn:https://svn.jboss.org/repos/jbpm/projects/jopr-integration
+		</developerConnection>
+	</scm>
 
-   <properties>
-      <scm.module.path>.</scm.module.path>
-   </properties>
+	<properties>
+		<scm.module.path>.</scm.module.path>
+	</properties>
 
-   <dependencies>
-      <dependency>
-         <groupId>org.jboss.on</groupId>
-         <artifactId>rhq-jbossas-plugin</artifactId>
-         <version>2.1.2.GA</version>
-         <scope>provided</scope>
-       </dependency>
-       
-   <!--enable copy the dependecies to the package, it does not need this dependency  -->       
-       <dependency>
-         <groupId>org.jbpm.jbpm3</groupId>
-         <artifactId>jbpm-jpdl</artifactId>
-         <version>3.2.5.GA</version>
-         <scope>runtime</scope>
-       </dependency>  
-   </dependencies>
+	<dependencies>
+
+		<dependency>
+			<groupId>org.jboss.on</groupId>
+			<artifactId>jopr-jboss-as-5-plugin</artifactId>
+			<version>2.3.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+
+
+		<dependency>
+			<groupId>${rhq.groupId}</groupId>
+			<artifactId>rhq-jmx-plugin</artifactId>
+			<version>${rhq.version}</version>
+			<scope>provided</scope>
+		</dependency>
 
+		<dependency>
+			<groupId>org.jbpm.jbpm4</groupId>
+			<artifactId>jbpm-pvm</artifactId>
+			<version>4.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
 
+		<dependency>
+			<groupId>org.jbpm.jbpm4</groupId>
+			<artifactId>jbpm-jpdl</artifactId>
+			<version>4.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-dependency-plugin
+				</artifactId>
+				<version>2.0</version>
+				<executions>
+					<execution>
+						<id>copy-dependencies</id>
+						<phase>process-resources</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.outputDirectory}/lib
+							</outputDirectory>
+							<includeScope>runtime</includeScope>
+							<excludeGroupIds>
+							</excludeGroupIds>
+							<excludeArtifactIds>
+
+							</excludeArtifactIds>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
 
+			<plugin>
+				<artifactId>maven-resources-plugin
+				</artifactId>
+				<version>2.3</version>
+				<executions>
+					<execution>
+						<id>copy-resources2</id>
+						<phase>test</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.outputDirectory}/lib
+							</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/main/resources/META-INF
+									</directory>
+									<includes>
+										<include>jbpm.*.xml</include>
+									</includes>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+	<profiles>
+		<profile>
+			<id>integration-tests</id>
+			<activation>
+				<property>
+					<name>maven.test.skip</name>
+					<value>!true</value>
+				</property>
+			</activation>
 
-   <build>
-      <plugins>
-        <plugin>
-            <artifactId>maven-dependency-plugin</artifactId>
-            <version>2.0</version>
-            <executions>
-               <execution>
-                  <id>copy-dependencies</id>
-                  <phase>process-resources</phase>
-                  <goals>
-                     <goal>copy-dependencies</goal>
-                  </goals>
-                  <configuration>
-                     <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
-                     <includeScope>runtime</includeScope>
-                     <excludeGroupIds>org.apache.jackrabbit</excludeGroupIds>
-                     <excludeArtifactIds>xml-apis,xercesImpl,tm-extractors,poi,pdfbox,nekohtml,lucene-core,junit,jta,i18nlog,hibernate,derby,ehcache</excludeArtifactIds>
-                  </configuration>
-               </execution>
-            </executions>
-         </plugin>
-      </plugins>
-   </build>
-   <profiles>
-      <profile>
-         <id>integration-tests</id>
-         <activation>
-            <property>
-               <name>maven.test.skip</name>
-               <value>!true</value>
-            </property>
-         </activation>
+			<build>
+				<plugins>
 
-         <build>
-            <plugins>
-               <!-- Integration testing voodoo to load and test this plugin with its plugin dependencies -->
-               <plugin>
-                  <artifactId>maven-antrun-plugin</artifactId>
-                  <executions>
-                     <execution>
-                        <phase>pre-integration-test</phase>
-                        <configuration>
-                           <tasks>
-                              <echo>Setting up plugin dependencies for ${project.artifactId}-${project.version}.jar...</echo>
-                              <property name="settings.localRepository" location="${user.home}/.m2/repository" />
-                              <mkdir dir="target/itest" />
-                              <mkdir dir="target/itest/plugins" />
-                              <mkdir dir="target/itest/lib" />
-                              <copy toDir="target/itest/plugins" flatten="true">
-                                 <fileset dir="${settings.localRepository}/">
-                                    <include name="org/rhq/rhq-platform-plugin/${rhq.version}/rhq-platform-plugin-${rhq.version}.jar" />
-                                    <include name="org/rhq/rhq-jmx-plugin/${rhq.version}/rhq-jmx-plugin-${rhq.version}.jar" />
-                                    <include name="org/jboss/on/rhq-tomcat-plugin/${project.version}/rhq-tomcat-plugin-${project.version}.jar" />
-                                    <include name="org/jboss/on/rhq-jbossas-plugin/${project.version}/rhq-jbossas-plugin-${project.version}.jar" />
-                                 </fileset>
-                                 <fileset dir="${project.build.directory}">
-                                    <include name="${project.artifactId}-${project.version}.jar" />
-                                 </fileset>
-                              </copy>
-                              <unzip dest="target/itest/lib">
-                                 <fileset dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}" includes="*.zip" />
-                                 <patternset>
-                                    <include name="**/lib/sigar.jar" />
-                                    <include name="**/lib/bcel*.jar" />
-                                    <include name="**/lib/*.so" />
-                                    <include name="**/lib/*.sl" />
-                                    <include name="**/lib/*.dll" />
-                                    <include name="**/lib/*.dylib" />
-                                 </patternset>
-                              </unzip>
-                              <move todir="target/itest/lib" flatten="true">
-                                 <fileset dir="target/itest/lib">
-                                    <include name="**/lib/*" />
-                                 </fileset>
-                              </move>
-                              <delete dir="target/itest/lib/hyperic-sigar-${sigar.version}" />
-                           </tasks>
-                        </configuration>
-                        <goals>
-                           <goal>run</goal>
-                        </goals>
-                     </execution>
-                  </executions>
-               </plugin>
+					<!--
+						Integration testing voodoo to load and test this plugin with its
+						plugin dependencies
+					-->
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<executions>
+							<execution>
+								<phase>pre-integration-test</phase>
+								<configuration>
+									<tasks>
+										<echo>Setting up plugin dependencies for
+											${project.artifactId}-${project.version}.jar...</echo>
+										<property name="settings.localRepository" location="${user.home}/.m2/repository" />
+										<mkdir dir="target/itest" />
+										<mkdir dir="target/itest/plugins" />
+										<mkdir dir="target/itest/lib" />
+										<copy toDir="target/itest/plugins" flatten="true">
+											<fileset dir="${settings.localRepository}/">
+												<include
+													name="org/rhq/rhq-platform-plugin/${rhq.version}/rhq-platform-plugin-${rhq.version}.jar" />
+												<include
+													name="org/rhq/rhq-jmx-plugin/${rhq.version}/rhq-jmx-plugin-${rhq.version}.jar" />
+												<include
+													name="org/jboss/on/jopr-tomcat-plugin/${project.version}/jopr-tomcat-plugin-${project.version}.jar" />
+												<include
+													name="org/jboss/on/jopr-jboss-as-plugin/${project.version}/jopr-jboss-as-plugin-${project.version}.jar" />
+											</fileset>
+											<fileset dir="${project.build.directory}">
+												<include name="${project.artifactId}-${project.version}.jar" />
+											</fileset>
+										</copy>
+										<unzip dest="target/itest/lib">
+											<fileset
+												dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}"
+												includes="*.zip" />
+											<patternset>
+												<include name="**/lib/sigar.jar" />
+												<include name="**/lib/bcel*.jar" />
+												<include name="**/lib/*.so" />
+												<include name="**/lib/*.sl" />
+												<include name="**/lib/*.dll" />
+												<include name="**/lib/*.dylib" />
+											</patternset>
+										</unzip>
+										<move todir="target/itest/lib" flatten="true">
+											<fileset dir="target/itest/lib">
+												<include name="**/lib/*" />
+											</fileset>
+										</move>
+										<delete dir="target/itest/lib/hyperic-sigar-${sigar.version}" />
+									</tasks>
+								</configuration>
+								<goals>
+									<goal>run</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
 
-               <plugin>
-                  <artifactId>maven-surefire-plugin</artifactId>
-                  <configuration>
-                     <skip>true</skip>
-                  </configuration>
-                  <executions>
-                     <execution>
-                        <id>surefire-it</id>
-                        <phase>integration-test</phase>
-                        <goals>
-                           <goal>test</goal>
-                        </goals>
-                        <configuration>
-                           <skip>${maven.test.skip}</skip>
-                           <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
-                           <useSystemClassLoader>false</useSystemClassLoader>
-                           <argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib</argLine>
-                           <!--<argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>-->
-                           <systemProperties>
-                              <property>
-                                 <name>project.artifactId</name>
-                                 <value>${project.artifactId}</value>
-                              </property>
-                              <property>
-                                 <name>project.version</name>
-                                 <value>${project.version}</value>
-                              </property>
-                           </systemProperties>
-                        </configuration>
-                     </execution>
-                  </executions>
-               </plugin>
+					<plugin>
+						<artifactId>maven-surefire-plugin
+						</artifactId>
+						<configuration>
+							<skip>true</skip>
+						</configuration>
+						<executions>
+							<execution>
+								<id>surefire-it</id>
+								<phase>integration-test</phase>
+								<goals>
+									<goal>test</goal>
+								</goals>
+								<configuration>
+									<skip>${maven.test.skip}</skip>
+									<excludedGroups>${rhq.testng.excludedGroups}
+									</excludedGroups>
+									<useSystemClassLoader>false</useSystemClassLoader>
+									<argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib
+									</argLine>
+									<!--
+										<argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib
+										-Xdebug -Xnoagent -Djava.compiler=NONE
+										-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+									-->
+									<systemProperties>
+										<property>
+											<name>project.artifactId</name>
+											<value>${project.artifactId}</value>
+										</property>
+										<property>
+											<name>project.version</name>
+											<value>${project.version}</value>
+										</property>
+									</systemProperties>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
 
 
-            </plugins>
-         </build>
-      </profile>
+				</plugins>
+			</build>
+		</profile>
 
-      <profile>
-         <id>dev</id>
-         <activation>
-               <activeByDefault>false</activeByDefault>
-         </activation>     
-         <properties>
-            <rhq.rootDir>../../..</rhq.rootDir>
-            <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
-            <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir>
-         </properties>
+		<profile>
+			<id>dev</id>
 
-         <build>
-            <plugins>
+			<properties>
+				<rhq.rootDir>../../..</rhq.rootDir>
+				<rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}
+				</rhq.containerDir>
+				<rhq.deploymentDir>
+					${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-downloads/rhq-plugins
+				</rhq.deploymentDir>
+			</properties>
 
-               <plugin>
-                 <artifactId>maven-antrun-plugin</artifactId>
-                 <version>1.1</version>
-                 <executions>
+			<build>
+				<plugins>
 
-                     <execution>
-                        <id>deploy</id>
-                        <phase>compile</phase>
-                        <configuration>
-                          <tasks>
-                            <mkdir dir="${rhq.deploymentDir}" />
-                            <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
-                            <echo>*** Updating ${deployment.file}...</echo>
-                            <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
-                          </tasks>
-                        </configuration>
-                        <goals>
-                          <goal>run</goal>
-                        </goals>
-                     </execution>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<version>1.1</version>
+						<executions>
 
-                     <execution>
-                        <id>undeploy</id>
-                        <phase>clean</phase>
-                        <configuration>
-                          <tasks>
-                            <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
-                            <echo>*** Deleting ${deployment.file}...</echo>
-                            <delete file="${deployment.file}" />
-                          </tasks>
-                        </configuration>
-                        <goals>
-                          <goal>run</goal>
-                        </goals>
-                     </execution>
+							<execution>
+								<id>deploy</id>
+								<phase>compile</phase>
+								<configuration>
+									<tasks>
+										<mkdir dir="${rhq.deploymentDir}" />
+										<property name="deployment.file"
+											location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+										<echo>*** Updating ${deployment.file}...</echo>
+										<jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+									</tasks>
+								</configuration>
+								<goals>
+									<goal>run</goal>
+								</goals>
+							</execution>
 
-                   </executions>
-               </plugin>
+							<execution>
+								<id>deploy-jar-meta-inf</id>
+								<phase>package</phase>
+								<configuration>
+									<tasks>
+										<property name="deployment.file"
+											location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+										<echo>*** Updating META-INF dir in ${deployment.file}...
+										</echo>
+										<unjar
+											src="${project.build.directory}/${project.build.finalName}.jar"
+											dest="${project.build.outputDirectory}">
+											<patternset>
+												<include name="META-INF/**" />
+											</patternset>
+										</unjar>
+										<jar destfile="${deployment.file}"
+											manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+											update="true">
+										</jar>
+									</tasks>
+								</configuration>
+								<goals>
+									<goal>run</goal>
+								</goals>
+							</execution>
 
-            </plugins>
-         </build>
-      </profile>
+							<execution>
+								<id>undeploy</id>
+								<phase>clean</phase>
+								<configuration>
+									<tasks>
+										<property name="deployment.file"
+											location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+										<echo>*** Deleting ${deployment.file}...</echo>
+										<delete file="${deployment.file}" />
+									</tasks>
+								</configuration>
+								<goals>
+									<goal>run</goal>
+								</goals>
+							</execution>
 
-   </profiles>
+						</executions>
+					</plugin>
 
+				</plugins>
+			</build>
+		</profile>
+
+	</profiles>
+
 </project>

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ExceptionJobDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ExceptionJobDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ExceptionJobDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.job.Job;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ExceptionJobDiscoveryComponent implements ResourceDiscoveryComponent<ProcessEngineComponent> {
+    private final Log log = LogFactory.getLog(this.getClass());
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ProcessEngineComponent> context) {
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+		JBPMEngineConnection jbpmConnection = context.getParentResourceComponent().getJBPMConnection();
+		List<Job> jobs = jbpmConnection.queryJob(false, false, true, null);
+		log.debug("Discovering " + jobs.size() + " exceptional jobs....");
+		for (Job job : jobs) {
+			 DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(job.getId()), job.getId(), null, job.getId(), null, null);
+			 jbpmDefs.add(details);
+	    }		
+		return jbpmDefs;
+	}
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/InstanceJobDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/InstanceJobDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/InstanceJobDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.job.Job;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class InstanceJobDiscoveryComponent implements ResourceDiscoveryComponent<ProcessInstanceComponent> {
+    private final Log log = LogFactory.getLog(this.getClass());
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ProcessInstanceComponent> context) {
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+		ProcessInstanceComponent jbpmInstance = context.getParentResourceComponent();
+		JBPMEngineConnection jbpmConnection = jbpmInstance.getJBPMConnection();
+		List<Job> jobs = jbpmConnection.queryJob(false, true, false, context.getParentResourceContext().getResourceKey());
+		log.debug("Discovering " + jobs.size() + " instance jobs....");
+		for (Job job : jobs) {
+			 DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(job.getId()), job.getId(), null, job.getId(), null, null);
+			 jbpmDefs.add(details);
+	    }		
+		return jbpmDefs;
+	}
+
+}
\ No newline at end of file

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/JobComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/JobComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/JobComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.job.Job;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class JobComponent implements ResourceComponent , MeasurementFacet {
+	private ResourceContext resourceContext;
+	private Log log = LogFactory.getLog(this.getClass());
+	private Job job = null;
+    private JBPMEngineConnection jbpmConnection = null;
+	public void start(ResourceContext resourceContext) {
+		this.resourceContext = resourceContext;
+		if (resourceContext.getParentResourceComponent() instanceof ProcessEngineComponent) {
+		   jbpmConnection = ((ProcessEngineComponent)resourceContext.getParentResourceComponent()).getJBPMConnection();
+		}
+		
+		if (resourceContext.getParentResourceComponent() instanceof ProcessInstanceComponent) {
+			   jbpmConnection = ((ProcessInstanceComponent)resourceContext.getParentResourceComponent()).getJBPMConnection();
+		}
+		
+		job = jbpmConnection.getJob(resourceContext.getResourceKey());
+	}
+
+	public void stop() {
+	}
+
+	public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
+		for (MeasurementScheduleRequest request : metrics) {
+			
+		    if (request.getName().equals("id")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(job.getId()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("duedate")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,String.valueOf(job.getDueDate() == null ? "--" : job.getDueDate()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("lockExpirationTime")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,String.valueOf(job.getLockExpirationTime() == null ? "--" : job.getLockExpirationTime()));
+				report.addData(value);
+			}
+			if (request.getName().equals("lockOwner")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,String.valueOf(job.getLockOwner() == null ? "--" : job.getLockOwner()));
+				report.addData(value);
+			}
+			if (request.getName().equals("isExclusive")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,String.valueOf(job.isExclusive()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("exception")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request, job.getException() == null ? "" : job.getException());
+				report.addData(value);
+			}
+			
+		}
+
+	}
+	
+	
+	public AvailabilityType getAvailability() {	
+		if (job.getException() == null) {
+			return AvailabilityType.UP;
+		}
+		return AvailabilityType.DOWN;	   
+	}
+
+
+
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/MessageDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/MessageDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/MessageDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.job.Job;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+
+public class MessageDiscoveryComponent implements ResourceDiscoveryComponent<ProcessEngineComponent> {
+    private final Log log = LogFactory.getLog(this.getClass());
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ProcessEngineComponent> context) {
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+		JBPMEngineConnection jbpmConnection = context.getParentResourceComponent().getJBPMConnection();
+		List<Job> jobs = jbpmConnection.queryJob(false, true, false, null);
+		log.debug("Discovering " + jobs.size() + " messeage jobs....");
+		for (Job job : jobs) {
+			 DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(job.getId()), job.getId(), null, job.getId(), null, null);
+			 jbpmDefs.add(details);
+	    }		
+		return jbpmDefs;
+	}
+}
+

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessInstance;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessDefComponent implements ResourceComponent<ProcessEngineComponent> , MeasurementFacet, CreateChildResourceFacet {
+	private ResourceContext<ProcessEngineComponent> resourceContext;
+	private Log log = LogFactory.getLog(this.getClass());
+	ProcessDefinition processDef = null;
+    private JBPMEngineConnection jbpmConnection = null;
+	public void start(ResourceContext<ProcessEngineComponent> resourceContext) {
+		this.resourceContext = resourceContext;
+		jbpmConnection = resourceContext.getParentResourceComponent().getJBPMConnection();
+		processDef = jbpmConnection.getProcessDefById(resourceContext.getResourceKey());
+	}
+
+	public void stop() {
+	}
+
+	public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
+		for (MeasurementScheduleRequest request : metrics) {
+		if (request.getName().equals("version")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(processDef.getVersion()));
+				report.addData(value);
+			}
+			if (request.getName().equals("id")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(processDef.getId()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("description")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,processDef.getDescription());
+				report.addData(value);
+			}
+			
+		}
+
+	}
+	
+	
+	public AvailabilityType getAvailability() {
+		ProcessDefinition processDef = jbpmConnection.getProcessDefById(resourceContext.getResourceKey());
+		if (processDef != null) {
+			return AvailabilityType.UP;
+		}
+		return AvailabilityType.DOWN;	   
+	}
+
+	public JBPMEngineConnection getJBPMConnection() {
+		return resourceContext.getParentResourceComponent().getJBPMConnection();
+	}	
+	
+    //---------------CreateChildResourceFacet implementation -----------------// 
+	public CreateResourceReport createResource(CreateResourceReport report) {
+		String resourceTypeName = report.getResourceType().getName();
+		report.setResourceKey(resourceTypeName);
+		report.setResourceName(resourceTypeName);
+		ProcessInstance instance = jbpmConnection.startProcessInstance(this.resourceContext.getResourceKey());
+		if (instance == null) {
+			report.setStatus(CreateResourceStatus.FAILURE);
+			report.setErrorMessage("Failed to start process instance");
+		} else {
+			report.setStatus(CreateResourceStatus.SUCCESS);
+		}
+		return report;
+	}
+	
+	
+	
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDefDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.ProcessDefinition;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessDefDiscoveryComponent implements ResourceDiscoveryComponent<ProcessEngineComponent> {
+    private final Log log = LogFactory.getLog(this.getClass());
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ProcessEngineComponent> context) {
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+		JBPMEngineConnection jbpmConnection = context.getParentResourceComponent().getJBPMConnection();
+		List<ProcessDefinition> defList = (List<ProcessDefinition>)jbpmConnection.getProcessDefs();
+		log.debug("Discovering " + defList.size() + " process definition....");
+		for (ProcessDefinition def : defList) {
+			 DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(def.getId()), def.getId(), String.valueOf(def.getVersion()), def.getId(), null, null);
+			 jbpmDefs.add(details);
+	    }		
+		return jbpmDefs;
+	}
+}
\ No newline at end of file

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.Deployment;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessDeploymentComponent implements ResourceComponent<ProcessEngineComponent> , MeasurementFacet, ContentFacet{
+	private ResourceContext<ProcessEngineComponent> resourceContext;
+	private Log log = LogFactory.getLog(this.getClass());
+	private Deployment deployment = null;
+    private JBPMEngineConnection jbpmConnection = null;
+	public void start(ResourceContext<ProcessEngineComponent> resourceContext) {
+		this.resourceContext = resourceContext;
+		jbpmConnection = resourceContext.getParentResourceComponent().getJBPMConnection();
+		deployment = jbpmConnection.getDeployment(resourceContext.getResourceKey());
+	}
+
+	public void stop() {
+	}
+
+	public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
+		for (MeasurementScheduleRequest request : metrics) {
+			
+		    if (request.getName().equals("id")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(deployment.getId()));
+				report.addData(value);
+			}
+			if (request.getName().equals("name")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(deployment.getName()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("timestamp")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,String.valueOf(deployment.getTimestamp()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("state")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,String.valueOf(deployment.getState()));
+				report.addData(value);
+			}
+			
+		}
+
+	}
+	
+	public AvailabilityType getAvailability() {
+		Deployment deployment = jbpmConnection.getDeployment(resourceContext.getResourceKey());
+		if (deployment != null) {
+			return AvailabilityType.UP;
+		}
+		return AvailabilityType.DOWN;	   
+	}
+	
+	
+	   // ------------ ContentFacet implementation -------------
+
+    public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+        return null;
+    }
+
+    public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType packageType) {
+       
+        String fileName = deployment.getName();
+        PackageDetailsKey key = new PackageDetailsKey(fileName, "1.0", "Process Deployments", "noarch");
+        ResourcePackageDetails packageDetails = new ResourcePackageDetails(key);
+        packageDetails.setFileName(fileName);
+        packageDetails.setLocation(fileName);
+        packageDetails.setFileCreatedDate(null); // TODO: get created date via SIGAR
+        Set<ResourcePackageDetails> packages = new HashSet<ResourcePackageDetails>();
+        packages.add(packageDetails);
+
+        return packages;
+    }
+
+   
+    
+    public RemovePackagesResponse removePackages(Set<ResourcePackageDetails> packages) {
+        throw new UnsupportedOperationException("Cannot remove the package backing an EAR/WAR resource.");
+    }
+
+    public List<DeployPackageStep> generateInstallationSteps(ResourcePackageDetails packageDetails) {
+        // Intentional - there are no steps involved in installing an EAR or WAR.
+        return null;
+    }
+
+    public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails> packages, ContentServices contentServices) {
+            //TODO: enable deploy it
+    	    DeployPackagesResponse response = new DeployPackagesResponse(ContentResponseResult.FAILURE);
+            response .setOverallRequestErrorMessage("Unsupported jbpm deployment update");
+            return response;
+        }
+
+
+
+
+
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessDeploymentDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.Deployment;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessDeploymentDiscoveryComponent implements ResourceDiscoveryComponent<ProcessEngineComponent> {
+    private final Log log = LogFactory.getLog(this.getClass());
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ProcessEngineComponent> context) {
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+		JBPMEngineConnection jbpmConnection = context.getParentResourceComponent().getJBPMConnection();
+		List<Deployment> deploymentList = (List<Deployment>)jbpmConnection.getDeployments();
+		log.debug("Discovering " + deploymentList.size() + " jbpm development ....");
+		for (Deployment deployment : deploymentList) {
+			 DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(deployment.getId()), deployment.getName(), String.valueOf(deployment.getTimestamp()), deployment.getName(), null, null);
+			 jbpmDefs.add(details);
+	    }		
+		return jbpmDefs;
+	}
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,176 @@
+package org.rhq.plugins.jbpm4;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.Set;
+
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.pluginapi.content.ContentContext;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.jbossas5.ApplicationServerComponent;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnector;
+import org.rhq.plugins.jbpm4.connector.LocalJBPMEngineConnector;
+import org.rhq.plugins.jbpm4.connector.RemoteJBPMEngineConnector;
+import org.rhq.plugins.jmx.MBeanResourceComponent;
+
+public class ProcessEngineComponent extends MBeanResourceComponent implements CreateChildResourceFacet{
+    private static final String NAMING_URL = "namingURL";
+    private static final String PRINCIPAL = "principal";
+    private static final String CREDENTIALS = "credentials";
+    private static final String RESOURCE_TYPE_JBPM_DEVELOPMENT ="Process Developments";
+   
+	private ContentContext contentContext = null;
+	private ResourceContext resourceContext = null;
+	private JBPMEngineConnection jbpmConnection = null;
+	private JBPMEngineConnector processEngineConnector = null;
+	public void start(ResourceContext context) {
+		super.start(context);
+		resourceContext = context;
+		if (runningEmbedded()) {
+			processEngineConnector = new LocalJBPMEngineConnector();
+		}else {
+			Configuration pluginConfiguration = getAS5ServerPluginConfiguration();
+			String namingURL = pluginConfiguration.getSimpleValue(NAMING_URL, null);
+			//validateNamingURL(namingURL);
+			String principal = pluginConfiguration.getSimpleValue(PRINCIPAL, null);
+			String credentials = pluginConfiguration.getSimpleValue(CREDENTIALS,null);
+			processEngineConnector =  new RemoteJBPMEngineConnector(namingURL, principal, credentials); 
+		}
+		jbpmConnection =  processEngineConnector.connect();
+	}
+
+	@Override
+	public AvailabilityType getAvailability() {
+		AvailabilityType av = super.getAvailability();			
+	    return av;
+	}
+
+	/* implement the DeleteResourceFacet */
+	public void deleteResource() throws Exception {
+		//TODO: implement it
+	}
+
+	public void getValues(MeasurementReport report, Set requests) {
+		super.getValues(report, requests);
+		Set<MeasurementScheduleRequest> metricRequests =  (Set<MeasurementScheduleRequest>)requests;
+		for (MeasurementScheduleRequest request : metricRequests) {
+		    if (request.getName().equals("deployedProcessNumber")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(this.jbpmConnection.getProcessDefs().size()));
+				report.addData(value);
+			}
+			if (request.getName().equals("processInstancNumber")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(this.jbpmConnection.getAllProcessInstance().size()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("jobsNumber")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(this.jbpmConnection.queryJob(false, false, false, null).size()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("exceptionalJobsNumber")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(this.jbpmConnection.queryJob(false, false, true, null).size()));
+				report.addData(value);
+			}
+		}
+
+	}
+	
+	
+	public CreateResourceReport createResource(CreateResourceReport report) {
+		String resourceTypeName = report.getResourceType().getName();
+		try {
+			if (resourceTypeName.equals(RESOURCE_TYPE_JBPM_DEVELOPMENT)) {
+				jbpmProcessCreate(report);
+			} else {
+				throw new UnsupportedOperationException("Unknown Resource type: " + resourceTypeName);
+			}
+		} catch (Exception e) {
+			report.setErrorMessage(e.getMessage());
+			report.setException(e);
+		}
+		return report;
+	}
+
+	public void jbpmProcessCreate(CreateResourceReport report) {
+		ResourcePackageDetails details = report.getPackageDetails();
+		PackageDetailsKey key = details.getKey();
+        String resourceTypeName = report.getResourceType().getName();
+		String archiveName = key.getName();
+        
+		report.setResourceName(archiveName);
+		report.setResourceKey(archiveName);
+		
+	    int lastPeriod = archiveName.lastIndexOf(".");
+		String extension = archiveName.substring(lastPeriod + 1);
+		
+		if (!archiveName.endsWith("xml") && !archiveName.endsWith("ar") && lastPeriod > -1) {
+			report.setErrorMessage("unsupported extension: "+ archiveName +"  Only .xml files and .*ar archives are supported");
+			report.setStatus(CreateResourceStatus.FAILURE);
+			return;
+		}
+         
+
+		File tempDir = resourceContext.getTemporaryDirectory();
+		File archiveFile = new File(archiveName);
+		String filename = archiveFile.getName();
+		File tempFile = new File(tempDir.getAbsolutePath(), filename);
+		try {
+			OutputStream osForTempDir = new BufferedOutputStream(
+					new FileOutputStream(tempFile));
+
+			ContentContext contentContext = resourceContext.getContentContext();
+            ContentServices contentServices = contentContext.getContentServices();
+			contentServices.downloadPackageBitsForChildResource(contentContext,
+					resourceTypeName, key, osForTempDir);
+
+			osForTempDir.close();		
+			this.jbpmConnection.deployProcess(tempFile);
+			report.setStatus(CreateResourceStatus.SUCCESS);
+		} catch (Exception e) {
+			report.setErrorMessage("Failed to deploy [" + archiveName + "]");
+			report.setException(e);
+			report.setStatus(CreateResourceStatus.FAILURE);
+		}
+	}
+
+	
+	public JBPMEngineConnection getJBPMConnection() {
+		return this.jbpmConnection;
+	}
+
+    public boolean runningEmbedded() {  	
+    	Configuration pluginConfiguration = this.getAS5ServerPluginConfiguration();
+        String namingUrl = pluginConfiguration.getSimpleValue(NAMING_URL, null);
+        return namingUrl == null;
+    }
+    
+    private Configuration getAS5ServerPluginConfiguration() {
+    	ApplicationServerComponent as5Server = (ApplicationServerComponent)resourceContext.getParentResourceComponent();
+    	Configuration pluginConfiguration = as5Server.getResourceContext().getPluginConfiguration();
+    	return pluginConfiguration;
+    }
+    
+    
+}
\ No newline at end of file

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessEngineDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.pluginapi.inventory.ClassLoaderFacet;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbossas5.ApplicationServerComponent;
+import org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent;
+
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessEngineDiscoveryComponent extends MBeanResourceDiscoveryComponent implements ClassLoaderFacet {
+    private static final String SERVER_HOME_DIR = "serverHomeDir";
+    private static final String HOME_DIR="homeDir";
+    
+    private final Log log = LogFactory.getLog(this.getClass());
+
+    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext discoveryContext)
+    {
+    	Set<DiscoveredResourceDetails> resources = new HashSet<DiscoveredResourceDetails>();
+        resources = super.discoverResources(discoveryContext);
+        log.trace("Discovered " + resources.size() + " " + discoveryContext.getResourceType() + " Resources.");
+        return resources;
+    }
+    
+    
+    @SuppressWarnings("unchecked")
+    public List<URL> getAdditionalClasspathUrls(ResourceDiscoveryContext context, DiscoveredResourceDetails details) throws Exception {
+        Configuration pluginConfig = context.getParentResourceContext().getPluginConfiguration();
+        String serverHome = pluginConfig.getSimple(SERVER_HOME_DIR).getStringValue();
+
+        List<URL> clientJars = new ArrayList<URL>();
+        //TODO:Review it and removed the jars not needed
+        String[] jarFileNames = { "lib/jbpm.jar",
+                                  "deploy/jbpm/jbpm-service.sar/freemarker.jar",
+                                  "deploy/jbpm/jbpm-service.sar/jbpm-spi.jar",
+                                  "deploy/jbpm/jbpm-service.sar/juel.jar",
+                                  "deploy/jbpm/jbpm-service.sar/juel-engine.jar",
+                                  "deploy/jbpm/jbpm-service.sar/juel-impl.jar",
+                                  "deploy/jbpm/jbpm-service.sar/livetribe-jsr223.jar",
+                                };
+        for (String jarFileName : jarFileNames) {
+            File clientJar = new File(serverHome, jarFileName);
+            if (!clientJar.exists()) {
+                throw new FileNotFoundException("Cannot find [" + clientJar + "]");
+            }
+            if (!clientJar.canRead()) {
+                throw new IOException("Cannot read [" + clientJar + "]");
+            }
+            clientJars.add(clientJar.toURI().toURL());
+        }
+        
+        
+        //This is for remote JNDI connection
+        //TODO: review it to see what can be removed
+        String homeDir = pluginConfig.getSimple(HOME_DIR).getStringValue();
+
+        String[] jbossJarFiles = { "client/jbossall-client.jar",
+                                  "common/lib/jboss-security-aspects.jar",
+                                  "lib/jboss-managed.jar",
+                                  "lib/jboss-metatype.jar",
+                                  "lib/jboss-dependency.jar",
+                                  "lib/jboss-kernel.jar"
+                                };
+        for (String jarFileName : jbossJarFiles) {
+            File clientJar = new File(homeDir, jarFileName);
+            if (!clientJar.exists()) {
+                throw new FileNotFoundException("Cannot find [" + clientJar + "]");
+            }
+            if (!clientJar.canRead()) {
+                throw new IOException("Cannot read [" + clientJar + "]");
+            }
+            clientJars.add(clientJar.toURI().toURL());
+        }
+
+        
+
+        return clientJars;
+    }
+
+}
\ No newline at end of file

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessInstanceComponent implements ResourceComponent<ProcessDefComponent>, MeasurementFacet, DeleteResourceFacet {
+	private Log log = LogFactory.getLog(this.getClass());
+	private JBPMEngineConnection jbpmConnection = null;
+    private ProcessInstance instance = null;
+    private String instanceId;
+	public void start(ResourceContext<ProcessDefComponent> resourceContext) {
+		instanceId = resourceContext.getResourceKey();
+		jbpmConnection = resourceContext.getParentResourceComponent().getJBPMConnection();
+		instance = jbpmConnection.getProcessInstance(instanceId);
+		
+	}
+
+	public void stop() {
+	}
+
+	public AvailabilityType getAvailability() {
+		if (instance.getState().equals(Execution.STATE_ENDED)) {
+			return AvailabilityType.DOWN;
+		}
+		return AvailabilityType.UP;
+	}
+
+	public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
+		for (MeasurementScheduleRequest request : metrics) {
+			if (request.getName().equals("id")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(instance.getId()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("key")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(instance.getKey() == null ? "--" : instance.getKey()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("name")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(instance.getName() == null ?  "--" : instance.getName()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("priority")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(instance.getPriority()));
+				report.addData(value);
+			}
+			
+			if (request.getName().equals("definitionId")) {
+
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(instance.getProcessDefinitionId()));
+				report.addData(value);
+			}
+			
+			
+			if (request.getName().equals("status")) {
+				MeasurementDataTrait value = new MeasurementDataTrait(request,
+						String.valueOf(instance.getState()));
+				report.addData(value);
+			}			
+		}
+	}
+	
+	public JBPMEngineConnection getJBPMConnection() {
+		return this.jbpmConnection;
+	}
+	
+	/* implement the DeleteResourceFacet */
+	public void deleteResource() throws Exception {
+		this.jbpmConnection.deleteProcessInstance(instanceId);
+	}
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/ProcessInstanceDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.ProcessInstance;
+
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class ProcessInstanceDiscoveryComponent implements ResourceDiscoveryComponent<ProcessDefComponent> {
+	public Set<DiscoveredResourceDetails> discoverResources(
+			ResourceDiscoveryContext<ProcessDefComponent> context) {
+
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+        ProcessDefComponent defComponent = context.getParentResourceComponent();
+        List<ProcessInstance> instances = defComponent.getJBPMConnection().getProcessInstances(context.getParentResourceContext().getResourceKey());
+		for (ProcessInstance instance: instances) {
+			DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(instance.getId()), instance.getId(), null, instance.getId(), null, null);
+			jbpmDefs.add(details);
+		}
+		return jbpmDefs;
+	}
+
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/TimerDiscoveryComponent.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/TimerDiscoveryComponent.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/TimerDiscoveryComponent.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.job.Job;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jbpm4.connector.JBPMEngineConnection;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class TimerDiscoveryComponent implements ResourceDiscoveryComponent<ProcessEngineComponent> {
+    private final Log log = LogFactory.getLog(this.getClass());
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ProcessEngineComponent> context) {
+		Set<DiscoveredResourceDetails> jbpmDefs = new java.util.HashSet<DiscoveredResourceDetails>();
+		JBPMEngineConnection jbpmConnection = context.getParentResourceComponent().getJBPMConnection();
+		List<Job> jobs = jbpmConnection.queryJob(true, false, false, null);
+		log.debug("Discovering " + jobs.size() + " messeage jobs....");
+		for (Job job : jobs) {
+			 DiscoveredResourceDetails details = new DiscoveredResourceDetails(context.getResourceType(), String.valueOf(job.getId()), job.getId(), null, job.getId(), null, null);
+			 jbpmDefs.add(details);
+	    }		
+		return jbpmDefs;
+	}
+}
\ No newline at end of file

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnection.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnection.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnection.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4.connector;
+
+import java.io.File;
+import java.util.List;
+
+import org.jbpm.api.Deployment;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public interface JBPMEngineConnection {
+	List<ProcessDefinition> getProcessDefs();
+	ProcessDefinition getProcessDefById(String id);
+	String deployProcess(File processFile) throws Exception;
+	List<ProcessInstance> getAllProcessInstance();
+	List<ProcessInstance> getProcessInstances(String defId);
+	ProcessInstance getProcessInstance(String instanceId);
+	void deleteProcessInstance(String instanceId);
+	ProcessInstance startProcessInstance(String defId);
+	List<Deployment> getDeployments();
+	Deployment getDeployment(String deploymentId);
+	public List<Job> queryJob(boolean timerOnly , boolean messageOnly, boolean exception, String processInstanceId);
+	Job getJob(String jobId);
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnector.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnector.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/JBPMEngineConnector.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4.connector;
+
+/**
+ * @author ema at redhat.com
+ *
+ */
+public interface JBPMEngineConnector {
+	JBPMEngineConnection connect();
+	boolean isConnected();
+	void disconnect();
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/LocalJBPMEngineConnector.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/LocalJBPMEngineConnector.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/LocalJBPMEngineConnector.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4.connector;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import java.util.List;
+import java.util.zip.ZipInputStream;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.api.Deployment;
+import org.jbpm.api.JobQuery;
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class LocalJBPMEngineConnector implements JBPMEngineConnector, JBPMEngineConnection {
+	private final Log log = LogFactory.getLog(this.getClass());
+	private final String PROCESSENGINE__JNDI_NAME = "java:/ProcessEngine";
+	private InitialContext initialContext = null;
+	private ProcessEngine processEngine = null;
+	public JBPMEngineConnection connect() {
+        log.debug("Connecting to local ProcessEngine...");
+        try {
+            initialContext = new InitialContext(null);
+            processEngine = (ProcessEngine)initialContext.lookup(this.PROCESSENGINE__JNDI_NAME);           
+        } catch (NamingException e) {
+            throw new RuntimeException("Failed to create JNDI InitialContext.", e);
+        }
+        return this;
+	}
+	
+	public void disconnect(){ 
+		
+	}
+	
+	public List<ProcessDefinition> getProcessDefs() {
+		List<ProcessDefinition> defs = processEngine.getRepositoryService().createProcessDefinitionQuery().list();		
+		return defs;
+	}
+	
+	public ProcessDefinition getProcessDefById(String id) {	
+		return processEngine.getRepositoryService().createProcessDefinitionQuery().processDefinitionId(id).uniqueResult();
+	}
+	
+	public List<ProcessInstance> getAllProcessInstance() {
+		return processEngine.getExecutionService().createProcessInstanceQuery().list();
+	}
+	
+	public List<Deployment> getDeployments() {
+		return processEngine.getRepositoryService().createDeploymentQuery().list();
+	}
+	
+	public Deployment getDeployment(String deploymentId) {
+		
+		return processEngine.getRepositoryService().createDeploymentQuery().deploymentDbid(Long.valueOf(deploymentId)).uniqueResult();
+	
+	}
+	
+	public List<Job> queryJob(boolean timerOnly , boolean messageOnly, boolean exception, String processInstanceId) {
+		JobQuery jobQuery = processEngine.getManagementService().createJobQuery();
+		if (processInstanceId != null) {
+		    jobQuery.processInstanceId(processInstanceId);
+		}
+		
+		if (exception) {
+			jobQuery.exception(true);
+		}
+		
+		if (timerOnly) {
+			jobQuery = jobQuery.timers();
+		} else if (messageOnly) {
+			jobQuery = jobQuery.messages();
+		} 
+		return jobQuery.list();
+	}
+	
+	public Job getJob(String jobId) {
+		//TODO: there is proper API to query the job by jobId.Ask Joram to add it...
+		List<Job> jobs = processEngine.getManagementService().createJobQuery().list();
+		for (Job job : jobs) {
+			if (job.getId().equals(jobId)) {
+				return job;
+			}
+		}
+		return null;
+	}
+	
+	
+	
+	
+	public String deployProcess(URL url) {
+		return processEngine.getRepositoryService().createDeployment().addResourceFromUrl(url).deploy();
+	}
+	
+	public boolean isConnected() {
+		return processEngine == null;
+	}
+	
+	public String deployProcess(File processFile) throws Exception {
+		NewDeployment deployment = this.processEngine.getRepositoryService().createDeployment();
+		deployment.setName(processFile.getName());
+		deployment.setTimestamp(System.currentTimeMillis());
+		if (processFile.getName().endsWith(".xml")) {
+			log.debug("deploying process file " + processFile.getName());
+			deployment.addResourceFromFile(processFile);
+
+		} else if (processFile.getName().endsWith("ar")) {
+			log.debug("deploying business archive " + processFile.getName());
+			FileInputStream fileInputStream;
+			try {
+				fileInputStream = new FileInputStream(processFile);
+			} catch (FileNotFoundException e) {
+				throw e;
+			}
+			ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
+			deployment.addResourcesFromZipInputStream(zipInputStream);
+		}
+		return deployment.deploy();
+	}
+	
+	public List<ProcessInstance> getProcessInstances(String defId) {
+		return processEngine.getExecutionService().createProcessInstanceQuery().processDefinitionId(defId).list();
+	}
+	public ProcessInstance getProcessInstance(String instanceId) {
+		return processEngine.getExecutionService().createProcessInstanceQuery().processInstanceId(instanceId).uniqueResult();		
+	}
+	
+	public void deleteProcessInstance(String instanceId) {
+		processEngine.getExecutionService().deleteProcessInstance(instanceId);		
+	}
+	public ProcessInstance startProcessInstance(String defId) {
+		return processEngine.getExecutionService().startProcessInstanceById(defId);	
+	}
+
+}

Added: projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/RemoteJBPMEngineConnector.java
===================================================================
--- projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/RemoteJBPMEngineConnector.java	                        (rev 0)
+++ projects/jopr-integration/trunk/src/main/java/org/rhq/plugins/jbpm4/connector/RemoteJBPMEngineConnector.java	2009-08-14 10:04:17 UTC (rev 5480)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.rhq.plugins.jbpm4.connector;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+/**
+ * @author ema at redhat.com
+ *
+ */
+public class RemoteJBPMEngineConnector implements JBPMEngineConnector {
+
+	private static final String NAMING_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
+	private static final String JNP_TIMEOUT_JNP_INIT_PROP = "jnp.timeout";
+	private static final String JNP_SOTIMEOUT_JNP_INIT_PROP = "jnp.sotimeout";
+	private static final String JNP_DISABLE_DISCOVERY_JNP_INIT_PROP = "jnp.disableDiscovery";
+	private static final int JNP_TIMEOUT = 60 * 1000; // 60 seconds
+	private static final int JNP_SO_TIMEOUT = 60 * 1000; // 60 seconds
+	private static final boolean JNP_DISABLE_DISCOVERY = true;
+	
+	//TODO: ProcessEngine can not be serialized. What is the instead ?
+	private final String  XXX__JNDI_NAME = "ProcessEngine";
+	private final Log log = LogFactory.getLog(this.getClass());
+	
+	private String providerURL;
+	private String principal;
+	private String credentials;
+	private InitialContext initialContext;
+
+	public RemoteJBPMEngineConnector(String providerURL, String principal, String credentials) {
+        this.providerURL = providerURL;
+        this.principal = principal;
+        this.credentials = credentials;
+	}
+
+	public JBPMEngineConnection connect() {
+		Properties env = new Properties();		
+        env.setProperty(Context.PROVIDER_URL, providerURL);
+        env.setProperty(Context.INITIAL_CONTEXT_FACTORY, NAMING_CONTEXT_FACTORY);
+        env.setProperty(JNP_TIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_TIMEOUT));
+        env.setProperty(JNP_SOTIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_SO_TIMEOUT));
+        env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, String.valueOf(JNP_DISABLE_DISCOVERY));
+        env.setProperty(Context.SECURITY_CREDENTIALS, this.credentials);
+        env.setProperty(Context.SECURITY_PRINCIPAL, this.principal);
+        /*ProcessEngine processEngine = null; 
+        log.debug("Connecting to ProcessEngine via remote JNDI using env [" + env + "]...");
+        try {
+            initialContext = new InitialContext(env);
+            processEngine = (ProcessEngine)initialContext.lookup(this.PROCESSENGINE__JNDI_NAME);           
+        } catch (NamingException e) {
+            throw new RuntimeException("Failed to create JNDI InitialContext.", e);
+        }*/
+        return null;
+	}
+	
+	public void disconnect() {
+		
+	}
+	
+	public boolean isConnected() {
+		return false;
+	}
+}	
+	

Modified: projects/jopr-integration/trunk/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- projects/jopr-integration/trunk/src/main/resources/META-INF/rhq-plugin.xml	2009-08-14 05:01:17 UTC (rev 5479)
+++ projects/jopr-integration/trunk/src/main/resources/META-INF/rhq-plugin.xml	2009-08-14 10:04:17 UTC (rev 5480)
@@ -1,122 +1,188 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
-<plugin name="JBPM-Plugin" displayName="JBPM-Plugin"
-	package="org.jbosson.plugins.jbpm"
-	description="Provides monitoring of JBoss JBPM" version="2.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<plugin name="JBPM4-Plugin" displayName="JBPM4-Plugin"
+	package="org.rhq.plugins.jbpm4" description="Provides monitoring of JBoss JBPM"
+	version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xmlns="urn:xmlns:rhq-plugin" xmlns:c="urn:xmlns:rhq-configuration">
 
 	<depends plugin="JMX" />
-	<depends plugin="JBossAS" useClasses="true" />
-	<service name="JBPM Service"
-		discovery="org.jbosson.plugins.jbpm.JbpmServiceDiscoveryComponent"
-		class="org.jbosson.plugins.jbpm.JbpmServiceComponent"
-		description="JBPM Service" singleton="true">
+	<depends plugin="JBossAS5" useClasses="true" />
+	<service name="JBPM4 Engine"
+		discovery="ProcessEngineDiscoveryComponent"
+		class="ProcessEngineComponent"
+		description="JBPM4" singleton="true">
 		<runs-inside>
 			<parent-resource-type name="JBossAS Server"
-				plugin="JBossAS" />
+				plugin="JBossAS5" />
 		</runs-inside>
+       <subcategories>
+            <subcategory name="Jobs"
+                description="The jbos without exception">
+            </subcategory>
+        </subcategories>
 
 		<plugin-configuration>
-			<c:simple-property name="objectName" readOnly="true"
-				default="jboss.esb:service=JbpmService" />
-			<c:simple-property name="nameTemplate"
-				default="JBPM Service" />
+			<c:simple-property name="objectName" readOnly="true" default="org.jbpm:service=ServerConfig" />
+			<c:simple-property name="nameTemplate" default="JBPM4 Engine"/>
 			<c:simple-property name="DescriptionTemplate"
-				default="JBoss Service." />
-			<!--c:simple-property name="additionalClassPathEntries" default="/x1/jbossON/jbpm-lib/*.jar"/-->
+				default="JBPM4 Engine"/>
 		</plugin-configuration>
-		<operation name="start" displayName="Start JBPM Service"
-			description="Start the JBPM Service" />
-		<operation name="stop" displayName="Stop JBPM Service"
-			description="Stop the JBPM Service" />
-		<metric property="Name" displayName="Service Name"
-			dataType="trait" displayType="summary" defaultOn="true"
-			description="JBPM ServiceName" />
-		<metric property="StateString" displayName="jbpm State String"
-			dataType="trait" displayType="summary" defaultOn="true"
-			description="Current state of JBPM Service" />
-		<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>
+		
+		<metric property="deployedProcessNumber" dataType="measurement" displayType="summary" defaultOn="true"
+				description="Deployed process number" />
+		<metric property="processInstancNumber" dataType="measurement" displayType="summary" defaultOn="true"
+				description="Process instances number includes started and suspended" />
 
-		<service name="Process Definitions"
-			discovery="org.jbosson.plugins.jbpm.JbpmProcessDefDiscoveryComponent"
-			class="org.jbosson.plugins.jbpm.JbpmProcessDefComponent"
-			creationDataType="content"
-			createDeletePolicy="both"
-			description="JBPM Process Definitions">
-
-
-			<metric property="version" displayName="Version"
-				dataType="trait" displayType="summary" defaultOn="true"
+		<metric property="jobsNumber" dataType="measurement" displayType="summary" defaultOn="true"
+				description="the number of normal jobs" />
+		<metric property="exceptionalJobsNumber" dataType="measurement" displayType="summary" defaultOn="true"
+				description="the number of exceptional jobs" />
+						
+		
+	     <service name="Timer"
+		  discovery="TimerDiscoveryComponent"
+		  class="JobComponent"
+		  subCategory="Jobs"
+		  description="JBPM timers jobs">
+		  <metric property="id" displayName="id" dataType="trait" displayType="summary" defaultOn="true"
+				description="job id" />
+		  <metric property="duedate" displayName="duedate" dataType="trait" displayType="summary" defaultOn="true"
+				description="job duedate" />
+		  <metric property="lockExpirationTime" displayName="lockExpirationTime" dataType="trait" displayType="summary" defaultOn="true"
+				description="job lockExpirationTime" />	
+		  <metric property="lockOwner" displayName="lockOwner" dataType="trait" displayType="summary" defaultOn="true"
+				description="job lockOwner" />
+		  <metric property="isExclusive" displayName="isExclusive" dataType="trait" displayType="summary" defaultOn="true"
+				description="job isExclusive" />	
+		  <metric property="exception" displayName="exception" dataType="trait" displayType="summary" defaultOn="true"
+				description="job exception" />					
+		</service>
+		
+	     <service name="Message"
+		  discovery="MessageDiscoveryComponent"
+		  class="JobComponent"
+		  subCategory="Jobs"
+		  description="JBPM message jobs">
+		  <metric property="id" displayName="id" dataType="trait" displayType="summary" defaultOn="true"
+				description="job id" />
+		  <metric property="duedate" displayName="duedate" dataType="trait" displayType="summary" defaultOn="true"
+				description="job duedate" />
+		  <metric property="lockExpirationTime" displayName="lockExpirationTime" dataType="trait" displayType="summary" defaultOn="true"
+				description="job lockExpirationTime" />	
+		  <metric property="lockOwner" displayName="lockOwner" dataType="trait" displayType="summary" defaultOn="true"
+				description="job lockOwner" />
+		  <metric property="isExclusive" displayName="isExclusive" dataType="trait" displayType="summary" defaultOn="true"
+				description="job isExclusive" />	
+		  <metric property="exception" displayName="exception" dataType="trait" displayType="summary" defaultOn="true"
+				description="job exception" />					
+		</service>
+		
+       <service name="Exceptional Jobs"
+		  discovery="ExceptionJobDiscoveryComponent"
+		  class="JobComponent"
+		  subCategory="Jobs"
+		  description="JBPM exceptional jobs">
+		  <metric property="id" displayName="id" dataType="trait" displayType="summary" defaultOn="true"
+				description="job id" />
+		  <metric property="duedate" displayName="duedate" dataType="trait" displayType="summary" defaultOn="true"
+				description="job duedate" />
+		  <metric property="lockExpirationTime" displayName="lockExpirationTime" dataType="trait" displayType="summary" defaultOn="true"
+				description="job lockExpirationTime" />	
+		  <metric property="lockOwner" displayName="lockOwner" dataType="trait" displayType="summary" defaultOn="true"
+				description="job lockOwner" />
+		  <metric property="isExclusive" displayName="isExclusive" dataType="trait" displayType="summary" defaultOn="true"
+				description="job isExclusive" />	
+		  <metric property="exception" displayName="exception" dataType="trait" displayType="summary" defaultOn="true"
+				description="job exception" />					
+		</service>
+		
+		
+		
+		
+		
+		<service name="Process Deployments"
+		  discovery="ProcessDeploymentDiscoveryComponent"
+		  class="ProcessDeploymentComponent"
+          createDeletePolicy="create-only"
+          creationDataType="content"
+		  description="JBPM Process Deployment">
+		  <metric property="id" displayName="id" dataType="trait" displayType="summary" defaultOn="true"
+				description="deployment id" />
+		  <metric property="name" displayName="name" dataType="trait" displayType="summary" defaultOn="true"
+				description="deployment name" />
+		  <metric property="timestamp" displayName="timestamp" dataType="trait" displayType="summary" defaultOn="true"
+				description="deployment timestamp" />	
+		  <metric property="state" displayName="state" dataType="trait" displayType="summary" defaultOn="true"
+				description="deployment state" />
+	     
+		  <content name="file" displayName="jBPM Process File"
+				category="deployable" isCreationType="true">
+		  </content>
+		</service>
+	    <service name="Process Definitions"
+		  discovery="ProcessDefDiscoveryComponent"
+		  class="ProcessDefComponent"
+		  description="JBPM Process Definitions">
+		  <metric property="version" displayName="version" dataType="trait" displayType="summary" defaultOn="true"
 				description="Process definition version" />
-			<metric property="id" displayName="Id" dataType="trait"
-				displayType="summary" defaultOn="true"
+		  <metric property="id" displayName="id" dataType="trait" displayType="summary" defaultOn="true"
 				description="Process definition id" />
-			<content name="file" displayName="jBPM Process"
-				category="deployable" isCreationType="true">
-				<configuration>
-					<c:group name="deployment"
-						displayName="Deployment Options">
-						<c:simple-property name="deployZipped"
-							displayName="Deploy Zipped" type="boolean" default="false"
-							required="true"
-							description="Indicates jBPM process artifacts either par file or xml file" />
-					</c:group>
-				</configuration>
-			</content>
-			<service name="Process Instances"
-				discovery="org.jbosson.plugins.jbpm.JbpmInstanceDiscoveryComponent"
-				class="org.jbosson.plugins.jbpm.JbpmInstanceComponent"
+		  <metric property="description" displayName="description" dataType="trait" displayType="summary" defaultOn="true"
+				description="Process definition id" />	
+		  
+		  <service name="Process Instances"
+				discovery="ProcessInstanceDiscoveryComponent"
+				class="ProcessInstanceComponent"
 				createDeletePolicy="both"
 				creationDataType="configuration"
-				description="Process Instances">
+				description="Process Instance">
 				
-				
-           <operation name="suspend" displayName="suspend"
-                 description="Suspend this process instance"/>
-                 
-           <operation name="resume" displayName="resume"
-                 description="Resume this process instance"/>
-                 
-           <operation name="end" displayName="end"
-                 description="End this process instance"/>
-                    
-				<metric property="version" displayName="Version"
+				<metric property="id" displayName="id"
 					dataType="trait" displayType="summary" defaultOn="true"
-					description="Process Instance version" />
+					description="Process instance id" />
 
-				<metric property="id" displayName="Id" dataType="trait"
+				<metric property="key" displayName="key" dataType="trait"
 					displayType="summary" defaultOn="true"
-					description="Process Instance Id" />
+					description="Process instance key" />
 
-				<metric property="start" displayName="StartData"
+				<metric property="name" displayName="name"
 					dataType="trait" displayType="summary" defaultOn="true"
-					description="Process Instance StartData" />
+					description="Process instance name" />
 
-				<metric property="status" displayName="Status"
+				<metric property="priority" displayName="priority"
 					dataType="trait" displayType="summary" defaultOn="true"
-					description="Process Instance Satus" />
+					description="Process instance priority" />
 
-				<metric property="end" displayName="EndData"
+				<metric property="definitionId" displayName="definitionId"
 					dataType="trait" displayType="summary" defaultOn="true"
-					description="Process Instance EndData" />
-
-				<help>
-					<![CDATA[
-	         JBoss Process Instances 
-             ]]>
-				</help>
-
-
+					description="Process definition id" />
+					
+				<metric property="status" displayName="status"
+					dataType="trait" displayType="summary" defaultOn="true"
+					description="Process instance status" />
+		            <resource-configuration>
+		               <c:simple-property name="start instance" displayName="startInstance" type="boolean" required="true"
+                              default="true">
+                       </c:simple-property>
+		            </resource-configuration>	
+		     	   <service name="Jobs"
+		  				discovery="InstanceJobDiscoveryComponent"
+		  				class="JobComponent"
+		  				description="JBPM jobs">
+		  				<metric property="id" displayName="id" dataType="trait" displayType="summary" defaultOn="true"
+							description="job id" />
+		  				<metric property="duedate" displayName="duedate" dataType="trait" displayType="summary" defaultOn="true"
+							description="job duedate" />
+		  				<metric property="lockExpirationTime" displayName="lockExpirationTime" dataType="trait" displayType="summary" defaultOn="true"
+							description="job lockExpirationTime" />	
+		  				<metric property="lockOwner" displayName="lockOwner" dataType="trait" displayType="summary" defaultOn="true"
+							description="job lockOwner" />
+		  				<metric property="isExclusive" displayName="isExclusive" dataType="trait" displayType="summary" defaultOn="true"
+							description="job isExclusive" />	
+		  				<metric property="exception" displayName="exception" dataType="trait" displayType="summary" defaultOn="true"
+							description="job exception" />					
+					</service>
 			</service>
-
-		</service>
+		</service>	
 	</service>
 </plugin>



More information about the jbpm-commits mailing list