[jbpm-commits] JBoss JBPM SVN: r4904 - in jbpm4/trunk: modules/distro and 16 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue May 26 14:11:12 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-05-26 14:11:12 -0400 (Tue, 26 May 2009)
New Revision: 4904

Added:
   jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/
   jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml
   jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.jboss.idm.cfg.xml
Removed:
   jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.mail.templates.cfg.xml
Modified:
   jbpm4/trunk/modules/distro/pom.xml
   jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
   jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
   jbpm4/trunk/modules/enterprise/pom.xml
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml
   jbpm4/trunk/modules/pvm/pom.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionResource.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JbpmIdentityStore.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java
   jbpm4/trunk/pom.xml
   jbpm4/trunk/qa/build.xml
Log:
JBPM-2172 integrate jboss identity component, fixed JTA transaction wiring problem and fixed mail templates

Modified: jbpm4/trunk/modules/distro/pom.xml
===================================================================
--- jbpm4/trunk/modules/distro/pom.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/distro/pom.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -121,9 +121,13 @@
     </dependency>
 
     <dependency>
-      <groupId>org.jboss.identity</groupId>
-      <artifactId>idm</artifactId>
+      <groupId>org.jboss.identity.idm</groupId>
+      <artifactId>idm-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.identity.idm</groupId>
+      <artifactId>idm-hibernate</artifactId>
+    </dependency>
 
     <!-- Please sort by groupid -->
     <dependency>

Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -7,6 +7,7 @@
 
   <!-- DEFAULT PROPERTY VALUES -->
   <property name="database" value="hsqldb" />
+  <property name="identity.component" value="jbpm-built-in" />
   <property name="jbpm.version" value="4.0.0-SNAPSHOT" />
   <property name="jbpm.parent.dir" value="../.." />
   <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
@@ -20,6 +21,11 @@
   <property name="jboss.distro.path" value="${jboss.distro.dir}/${jboss.filename}" />
   <property name="jboss.server.configuration" value="default" />
   <property name="jboss.server.config.dir" value="${jboss.home}/server/${jboss.server.configuration}" />
+  
+  <property name="jbossidm.version" value="1.0.0.Alpha7" />
+  <property name="jbossidm.home" value="${jboss.parent.dir}/jbossidm-${jbossidm.version}" />
+  <property name="jbossidm.distro.url" value="http://repository.jboss.com/maven2/org/jboss/identity/idm/idm-assembly/${jbossidm.version}/idm-assembly-${jbossidm.version}.zip" />
+  <property name="jbossidm.distro.path" value="${jboss.distro.dir}/idm-assembly-${jbossidm.version}.zip" />
 
   <!-- JDBC PROPERTIES -->
   <property file="${user.home}/.jbpm4/jdbc/${database}.properties" />
@@ -28,6 +34,7 @@
   <!-- ### LOG PROPERTIES ################################################# -->
   <target name="log.properties">
     <echo message="database.................... ${database}" />
+    <echo message="identity.component.......... ${identity.component}" />
     <echo message="jbpm.home................... ${jbpm.home}" />
     <echo message="jboss.version............... ${jboss.version}" />
     <echo message="jboss.filename.............. ${jboss.filename}" />
@@ -46,6 +53,10 @@
       <equals arg1="${jboss.version}" arg2="5.1.0.CR1" />
     </or>
   </condition>
+	
+  <condition property="jbpm.identity.idm">
+  	<equals arg1="${identity.component}" arg2="jboss.idm"/>
+  </condition>
 
   <!-- ### DEMO SETUP ##################################################### -->
   <target name="demo.setup" 
@@ -95,6 +106,17 @@
   	<mkdir dir="${jboss.distro.dir}" />
     <get src="${jboss.distro.url}" dest="${jboss.distro.path}" />
   </target>
+	
+  <!-- ### GET JBOSS IDM ###################################################### -->
+  <condition property="is.jbossidm.distro.available">
+    <available file="${jbossidm.distro.path}" />
+  </condition>
+  <target name="get.jbossidm" 
+  	      unless="is.jbossidm.distro.available"
+  	      description="downloads jboss idm into ${jbossidm.distro.path}">
+  	<mkdir dir="${jboss.distro.dir}" />
+    <get src="${jbossidm.distro.url}" dest="${jbossidm.distro.path}" />
+  </target>
 
   <!-- ### MAIN TARGET TO INSTALL JBPM INTO JBOSS ######################### -->
   <target name="install.jbpm.into.jboss" 
@@ -102,6 +124,8 @@
   	      description="installs jbpm into jboss">
     <antcall target="internal.install.jbpm.into.jboss.common" />
     <antcall target="internal.install.jbpm.into.jboss.500specifics" />
+  	<antcall target="internal.install.idm.into.jboss" />
+  	<antcall target="internal.install.jbpm.into.jboss.identity" />
     <antcall target="internal.install.jbpm.into.jboss.db.${database}" />
   </target>
 
@@ -185,17 +209,40 @@
       </fileset>
     </copy>
   </target>
+
+  <target name="internal.install.idm.into.jboss" depends="get.jbossidm" if="jbpm.identity.idm">
+  	<unzip src="${jbossidm.distro.path}" dest="${jbossidm.home}/.." />
+  	<ant antfile="${jbossidm.home}/jboss/build.xml" target="install.jbossidm.into.jboss">
+  		<property name="jboss.home" value="${jboss.home}" />
+  		<property name="jboss.server.configuration" value="${jboss.server.configuration}" />
+  		<property name="database" value="${database}" />
+  		<property name="jbossidm.home" value="${jbossidm.home}" />
+  	</ant>
+  </target>
 	
+  <target name="internal.install.jbpm.into.jboss.identity" if="jbpm.identity.idm">
+    <copy file="${jbpm.home}/jboss/jbpm.cfg.idm/jbpm.cfg.xml"
+          tofile="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml"
+          overwrite="true" />
+  </target>
+	
   <!-- ### THE JBOSS INTEGRATION TEST SPECIFICS ####################### -->
   <target name="internal.install.jbpm.into.jboss.integrationtestspecifics">
     <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
        <fileset dir="${jbpm.home}/jboss/jbpm.cfg.integration.tests" />
     </copy>
+  	<antcall target="internal.install.idm.into.jboss.integrationtestspecifics" />
     <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
   	<mkdir dir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
     <copy file="${jbpm.home}/examples/target/examples.jar"
     	    todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
 	</target>
+	
+	<target name="internal.install.idm.into.jboss.integrationtestspecifics" if="jbpm.identity.idm">
+	    <copy file="${jbpm.home}/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml"
+	          tofile="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml"
+	          overwrite="true" />
+    </target>
 
   <!-- ### THE HSQLDB SPECIFIC PART ####################################### -->
   <target name="internal.install.jbpm.into.jboss.db.hsqldb" />

Copied: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm (from rev 4758, jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.idm)

Deleted: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml	2009-05-07 10:14:21 UTC (rev 4758)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration>
-
-  <import resource="jbpm.default.cfg.xml" />
-  <import resource="jbpm.tx.jta.cfg.xml" />
-  <import resource="jbpm.jpdl.cfg.xml" />
-  <import resource="jbpm.jboss.idm.cfg.xml" />
-
-  <!-- Job executor is excluded for running the example test cases.
-       To enable timers and messages in production use, this should be included.
-  import resource="jbpm.jobexecutor.cfg.xml" / -->
-
-  <process-engine-context>
-
-    <mail-template name="MemoTemplate">
-      <to addresses='dilbert at office, alice at work, dogbert at house' />
-      <subject>bureaucracy</subject>
-      <text>Order http://example.com/order/#{orderId} is stalled.</text>
-    </mail-template>
-
-  </process-engine-context>
-
-</jbpm-configuration>

Copied: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml (from rev 4758, jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.tx.jta.cfg.xml" />
+  <import resource="jbpm.jpdl.cfg.xml" />
+  <import resource="jbpm.jboss.idm.cfg.xml" />
+
+  <!-- Job executor is excluded for running the example test cases.
+       To enable timers and messages in production use, this should be included.
+  import resource="jbpm.jobexecutor.cfg.xml" / -->
+
+  <process-engine-context>
+
+    <mail-template name="MemoTemplate">
+      <to addresses='dilbert at office, alice at work, dogbert at house' />
+      <subject>bureaucracy</subject>
+      <text>Order http://example.com/order/#{orderId} is stalled.</text>
+    </mail-template>
+
+  </process-engine-context>
+
+</jbpm-configuration>

Copied: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml (from rev 4897, jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml)
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.tx.jta.cfg.xml" />
+  <import resource="jbpm.jpdl.cfg.xml" />
+  <import resource="jbpm.jboss.idm.cfg.xml" />
+
+  <import resource="jbpm.mail.templates.examples.xml" />
+
+  <!-- Job executor is excluded for running the example test cases.
+       To enable timers and messages in production use, this should be included.
+  import resource="jbpm.jobexecutor.cfg.xml" / -->
+
+</jbpm-configuration>

Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -6,7 +6,6 @@
   <import resource="jbpm.tx.jta.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
-  <import resource="jbpm.mail.templates.cfg.xml" />
 
   <import resource="jbpm.mail.templates.examples.xml" />
 

Modified: jbpm4/trunk/modules/enterprise/pom.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/pom.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/enterprise/pom.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -43,39 +43,25 @@
       <artifactId>jbpm-test-base</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.jboss.bpm</groupId>
-      <artifactId>gwt-console-server-integration</artifactId>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
       <groupId>jboss</groupId>
       <artifactId>jboss-j2ee</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-core</artifactId>
     </dependency>
 
-
-    <!-- Test Dependencies -->
     <dependency>
       <groupId>cactus</groupId>
       <artifactId>cactus</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.jboss.jbossas</groupId>
-      <artifactId>jboss-as-client</artifactId>
-      <type>pom</type>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.javaee</groupId>
-      <artifactId>jboss-javaee</artifactId>
-      <scope>runtime</scope>
-    </dependency>
 
   </dependencies>
 

Copied: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity (from rev 4897, jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/identity)

Deleted: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java
===================================================================
--- jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java	2009-05-26 12:57:40 UTC (rev 4897)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.jbpm.examples.identity;
-
-import java.util.List;
-
-import org.jbpm.api.identity.Group;
-import org.jbpm.api.identity.User;
-import org.jbpm.test.JbpmTestCase;
-
-/**
- * @author Tom Baeyens
- * @author Jeff Yu
- */
-public class IdentityTest extends JbpmTestCase {
-  
-  private String johndoe = "johndoe";
-  private String redhatGroupId ;
-	
-  public void setUp() throws Exception {
-	super.setUp();
-	
-	identityService.createUser("johndoe", "John", "Doe");
-	redhatGroupId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
-	identityService.createMembership(johndoe, redhatGroupId, "Developer");
-  }
-  
-  
-  public void tearDown() throws Exception {
-	super.tearDown();
-	
-	identityService.deleteUser(johndoe);
-	identityService.deleteGroup(redhatGroupId);
-  }
-	
-	
-  public void testSingleUser() throws Exception {   
-    User user = identityService.findUserById(johndoe);
-    
-    assertEquals("johndoe", user.getId());
-    assertEquals("John", user.getGivenName());
-    assertEquals("Doe", user.getFamilyName());
-    
-  }
-  
-  
-  public void testCreateGroup() throws Exception {
-	  String testGroupId = identityService.createGroup("testGroup", Group.TYPE_UNIT, null);	  
-	  Group group = identityService.findGroupById(testGroupId);
-	  assertEquals("testGroup", group.getName());
-	  assertEquals(Group.TYPE_UNIT, group.getType());
-	  
-	  identityService.deleteGroup(testGroupId);
-  }
-  
-  public void testFindGroupsByUser() throws Exception {
-	  
-	  identityService.createUser("jeffyu", "Jeff", "Yu");
-	  identityService.createMembership("jeffyu", redhatGroupId);
-	  
-	  List<Group> groups = identityService.findGroupsByUser("jeffyu");
-	  assertTrue(groups.size() > 0);
-	  
-	  for (Group group : groups) {
-		  if (redhatGroupId.equals(group.getId())) {
-			  assertTrue(true);
-			  return;
-		  }
-	  }
-	  
-	  identityService.deleteUser("jeffyu");
-	  
-	  fail("Can't find the group by userid: " + johndoe);
-  }
-  
-  public void testFindGroupByUserAndGroupType() throws Exception {
-	  List<Group> groups = identityService.findGroupsByUserAndGroupType(johndoe, Group.TYPE_UNIT);
-	  assertTrue(groups.size() > 0);
-	  
-	  for (Group group : groups) {
-		  if (redhatGroupId.equals(group.getId())) {
-			  assertTrue(true);
-			  return;
-		  }
-	  }
-	  fail("Can't find the groups by userid " + johndoe + " and group type :" + Group.TYPE_UNIT);
-  }
-
-  public void testSingleGroup() throws Exception {
-    
-	identityService.createUser("joesmoe", "Joe", "Smoe");
-    identityService.createUser("jackblack", "Jack", "Black");
-    
-    String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT, redhatGroupId);
-    String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT, jbossId);
-    
-    identityService.createMembership("joesmoe", jbpmId, "developer");
-    identityService.createMembership("jackblack", jbossId, "manager");
-    
-    List<Group> groups = identityService.findGroupsByUserAndGroupType("johndoe", Group.TYPE_UNIT);
-
-     assertEquals(1, groups.size());
-     Group group = groups.get(0);
-     System.out.println(group.getName());
-     
-     identityService.deleteGroup(jbpmId);
-     identityService.deleteGroup(jbossId);
-     
-     identityService.deleteUser("joesmoe");
-     identityService.deleteUser("jackblack");
-  }
-}

Copied: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java (from rev 4897, jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java)
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/identity/IdentityTest.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.examples.identity;
+
+import java.util.List;
+
+import org.jbpm.api.identity.Group;
+import org.jbpm.api.identity.User;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ * @author Jeff Yu
+ */
+public class IdentityTest extends JbpmTestCase {
+  
+  private String redhatGroupId;
+	
+  public void setUp() throws Exception {
+	super.setUp();
+	
+	identityService.createUser("johndoe", "John", "Doe");
+	redhatGroupId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
+	identityService.createMembership("johndoe", redhatGroupId, "Developer");
+  }
+  
+  
+  public void tearDown() throws Exception {
+    identityService.deleteUser("johndoe");
+    identityService.deleteGroup(redhatGroupId);
+
+    super.tearDown();
+  }
+	
+	
+  public void testSingleUser() throws Exception {   
+    User user = identityService.findUserById("johndoe");
+    
+    assertEquals("johndoe", user.getId());
+    assertEquals("John", user.getGivenName());
+    assertEquals("Doe", user.getFamilyName());
+    
+  }
+  
+  
+  public void testCreateGroup() throws Exception {
+	  String testGroupId = identityService.createGroup("testGroup", Group.TYPE_UNIT, null);	  
+	  Group group = identityService.findGroupById(testGroupId);
+	  assertEquals("testGroup", group.getName());
+	  assertEquals(Group.TYPE_UNIT, group.getType());
+	  
+	  identityService.deleteGroup(testGroupId);
+  }
+  
+  public void testFindGroupsByUser() throws Exception {
+	  
+	  identityService.createUser("jeffyu", "Jeff", "Yu");
+	  identityService.createMembership("jeffyu", redhatGroupId);
+	  
+	  List<Group> groups = identityService.findGroupsByUser("jeffyu");
+	  assertTrue(groups.size() > 0);
+	  
+	  for (Group group : groups) {
+		  if (redhatGroupId.equals(group.getId())) {
+			  assertTrue(true);
+			  return;
+		  }
+	  }
+	  
+	  identityService.deleteUser("jeffyu");
+	  
+	  fail("Can't find the group by userid: johndoe");
+  }
+  
+  public void testFindGroupByUserAndGroupType() throws Exception {
+	  List<Group> groups = identityService.findGroupsByUserAndGroupType("johndoe", Group.TYPE_UNIT);
+	  assertTrue(groups.size() > 0);
+	  
+	  for (Group group : groups) {
+		  if (redhatGroupId.equals(group.getId())) {
+			  assertTrue(true);
+			  return;
+		  }
+	  }
+	  fail("Can't find the groups by userid johndoe and group type :" + Group.TYPE_UNIT);
+  }
+
+  public void testSingleGroup() throws Exception {
+    
+	identityService.createUser("joesmoe", "Joe", "Smoe");
+    identityService.createUser("jackblack", "Jack", "Black");
+    
+    String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT, redhatGroupId);
+    String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT, jbossId);
+    
+    identityService.createMembership("joesmoe", jbpmId, "developer");
+    identityService.createMembership("jackblack", jbossId, "manager");
+    
+    List<Group> groups = identityService.findGroupsByUserAndGroupType("johndoe", Group.TYPE_UNIT);
+
+     assertEquals(1, groups.size());
+     Group group = groups.get(0);
+     System.out.println(group.getName());
+     
+     identityService.deleteGroup(jbpmId);
+     identityService.deleteGroup(jbossId);
+     
+     identityService.deleteUser("joesmoe");
+     identityService.deleteUser("jackblack");
+  }
+}

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -6,7 +6,6 @@
   <import resource="jbpm.tx.hibernate.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
-  <import resource="jbpm.mail.templates.cfg.xml" />
 
   <!-- Job executor is excluded for running the example test cases. -->
   <!-- To enable timers and messages in production use, this should be included. -->

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -14,4 +14,4 @@
 
   </process-engine-context>
 
-</jbpm-configuration>
\ No newline at end of file
+</jbpm-configuration>

Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/pom.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -85,8 +85,12 @@
       <artifactId>slf4j-jdk14</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.jboss.identity</groupId>
-      <artifactId>idm</artifactId>
+      <groupId>org.jboss.identity.idm</groupId>
+      <artifactId>idm-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.identity.idm</groupId>
+      <artifactId>idm-hibernate</artifactId>
       <exclusions>
         <exclusion>
           <groupId>javax.persistence</groupId>
@@ -209,4 +213,4 @@
     </profile>
   </profiles>
   
-</project>
\ No newline at end of file
+</project>

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -71,41 +71,34 @@
           .execute();
         
         parse.addProblems(importParse.getProblems());
-        JbpmConfiguration importedConfiguration = (JbpmConfiguration) importParse.getDocumentObject();
-
-        WireDefinition importedProcessEngineWireDefinition = importedConfiguration.getProcessEngineWireContext().getWireDefinition();
-        jbpmConfiguration.addProcessEngineWireDefinition(importedProcessEngineWireDefinition);
-
-        WireDefinition importedTransactionWireDefinition = importedConfiguration.getTransactionWireDefinition();
-        jbpmConfiguration.addTransactionWireDefinition(importedTransactionWireDefinition);
       }
     }
 
-    WireDefinition processEngineWireDefinition = getProcessEngineWireDefinition(documentElement, parse);
-    jbpmConfiguration.addProcessEngineWireDefinition(processEngineWireDefinition);
-
-    WireDefinition transactionWireDefinition = getTransactionWireDefinition(documentElement, parse);
-    jbpmConfiguration.addTransactionWireDefinition(transactionWireDefinition);
-
-    parse.setDocumentObject(jbpmConfiguration);
-    
-    return jbpmConfiguration;
-  }
-
-  WireDefinition getProcessEngineWireDefinition(Element documentElement, Parse parse) {
     Element processEngineElement = XmlUtil.element(documentElement, "process-engine-context");
     if (processEngineElement != null) {
-      return (WireDefinition) processEngineContextParser.parseDocumentElement(processEngineElement, parse);
+      WireDefinition processEngineContextDefinition = jbpmConfiguration.getProcessEngineWireContext().getWireDefinition();
+      parse.pushObject(processEngineContextDefinition);
+      try {
+        processEngineContextParser.parseDocumentElement(processEngineElement, parse);
+      } finally {
+        parse.popObject();
+      }
     }
-    return null;
-  }
 
-  WireDefinition getTransactionWireDefinition(Element documentElement, Parse parse) {
     Element txCtxElement = XmlUtil.element(documentElement, "transaction-context");
     if (txCtxElement != null) {
-      return (WireDefinition) transactionContextParser.parseDocumentElement(txCtxElement, parse);
+      WireDefinition transactionContextDefinition = jbpmConfiguration.getTransactionWireDefinition();
+      parse.pushObject(transactionContextDefinition);
+      try {
+        transactionContextParser.parseDocumentElement(txCtxElement, parse);
+      } finally {
+        parse.popObject();
+      }
     }
-    return null;
+
+    parse.setDocumentObject(jbpmConfiguration);
+    
+    return jbpmConfiguration;
   }
 
   public Parser getProcessEngineContextParser() {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionResource.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionResource.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionResource.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -23,7 +23,7 @@
 
 import org.jboss.identity.idm.api.IdentitySession;
 import org.jboss.identity.idm.api.Transaction;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
 import org.jbpm.api.JbpmException;
 import org.jbpm.pvm.internal.tx.StandardResource;
 

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -23,21 +23,16 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 import org.jboss.identity.idm.api.Attribute;
 import org.jboss.identity.idm.api.AttributesManager;
-import org.jboss.identity.idm.api.GroupType;
-import org.jboss.identity.idm.api.Identity;
-import org.jboss.identity.idm.api.IdentitySearchControl;
+import org.jboss.identity.idm.api.IdentitySearchCriteria;
 import org.jboss.identity.idm.api.IdentitySession;
 import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.impl.api.NameFilterSearchControl;
+import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.common.p3p.P3PConstants;
 import org.jboss.identity.idm.impl.api.SimpleAttribute;
-import org.jboss.identity.idm.impl.api.model.SimpleGroupType;
-import org.jboss.identity.idm.p3p.P3PConstants;
 import org.jbpm.api.JbpmException;
 import org.jbpm.api.env.Environment;
 import org.jbpm.api.identity.Group;
@@ -46,6 +41,7 @@
 
 /**
  * @author Tom Baeyens
+ * @author Jeff Yu
  */
 public class JBossIdmIdentitySessionImpl implements org.jbpm.pvm.internal.identity.spi.IdentitySession {
 
@@ -61,37 +57,41 @@
 
   public String createUser(String userName, String givenName, String familyName, String businessEmail) {
     try {
-      Identity identity = identitySession.getPersistenceManager().createIdentity(userName);
+    	
+      org.jboss.identity.idm.api.User idUser= identitySession.getPersistenceManager().createUser(userName);
       
-      // TODO add the password
-      // identitySession.getAttributesManager().updateCredential(identity, new PasswordCredential(password));
-
-      Attribute[] attributes = new Attribute[] { 
-        new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, givenName),
-        new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, familyName), 
-        new SimpleAttribute(P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, businessEmail)
-      };
-      identitySession.getAttributesManager().addAttributes(identity, attributes);
+      List<Attribute> attrs = new ArrayList<Attribute>();
+      if (givenName != null) {
+    	  attrs.add(new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, givenName));
+      }
+      if (familyName != null) {
+    	  attrs.add(new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, familyName));
+      }
+      if (businessEmail != null) {
+    	  attrs.add(new SimpleAttribute(P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, businessEmail));
+      }
+      
+      
+      identitySession.getAttributesManager().addAttributes(idUser, attrs.toArray(new Attribute[attrs.size()]));
+      return idUser.getId();
+      
     } catch (IdentityException e) {
       throw new JbpmException("couldn't create user "+userName, e);
     }
 
-    throw new RuntimeException("Not yet implemented");
-    // TODO: create and return user
   }
   
 
   public List<User> findUsers() {
     try {
-      Collection<Identity> identities = identitySession
-          .getPersistenceManager()
-          .findIdentity((IdentitySearchControl[])null);
-    
+      Collection<org.jboss.identity.idm.api.User> idUsers = 
+    	  identitySession.getPersistenceManager().findUser((IdentitySearchCriteria)null);    
+      
       List<User> users = new ArrayList<User>();
-      for (Identity identity : identities) {
-        String name = identity.getName();
-        String givenName = getAttributeString(identity, null, P3PConstants.INFO_USER_NAME_GIVEN);
-        String familyName = getAttributeString(identity, P3PConstants.INFO_USER_NAME_FAMILY);
+      for (org.jboss.identity.idm.api.User idUser : idUsers) {
+    	String name = idUser.getId();
+        String givenName = getAttributeString(idUser, P3PConstants.INFO_USER_NAME_GIVEN);
+        String familyName = getAttributeString(idUser, P3PConstants.INFO_USER_NAME_FAMILY);
         
         UserImpl user = new UserImpl(name, givenName, familyName);
         users.add(user);
@@ -105,43 +105,66 @@
   }
 
   public User findUserById(String userId) {
-    throw new UnsupportedOperationException("please implement me");
+	  try {
+		org.jboss.identity.idm.api.User idUser = identitySession.getPersistenceManager().findUser(userId);
+		if (idUser != null) {
+	    	String name = idUser.getId();
+	        String givenName = getAttributeString(idUser, P3PConstants.INFO_USER_NAME_GIVEN);
+	        String familyName = getAttributeString(idUser, P3PConstants.INFO_USER_NAME_FAMILY);			
+			
+			User user = new UserImpl(name, givenName, familyName);
+			return user;
+		}
+		return null;
+	} catch (IdentityException e) {
+		throw new JbpmException("couldn't get user from id of " + userId, e);
+	}
   }
 
   public List<User> findUsersById(String... userIds) {
-    // TODO Auto-generated method stub
-    return null;
+    List<User> users = new ArrayList<User>();
+	for (String userId : userIds){
+		User user = findUserById(userId);
+		if (user != null) {
+			users.add(user);
+		}
+	}
+	  
+    return users;
   }
 
   public List<User> findUsersByGroup(String groupId) {
-  	// TODO Auto-generated method stub
-  	return null;
+	try {
+		org.jboss.identity.idm.api.Group idGroup = findIdmGroupById(groupId);
+		Collection<org.jboss.identity.idm.api.User> idusers = 
+				identitySession.getRelationshipManager().findAssociatedUsers(idGroup, false);
+		List<User> users = new ArrayList<User>();
+		
+		for (org.jboss.identity.idm.api.User iduser : idusers) {
+			users.add(findUserById(iduser.getId()));
+		}
+		
+		return users;
+	} catch (IdentityException e) {
+		throw new JbpmException("couldn't find users by groupid: " + groupId, e);
+	}
+	  
   }
 
   public void deleteUser(String userName) {
-    try {
-      org.jboss.identity.idm.api.Identity identity = findIdentity(userName);
-      
-      if (identity==null) {
-        return;
-      }
-      
-      identitySession
-          .getPersistenceManager()
-          .removeIdentity(identity, true);
-    
+    try {    	
+      identitySession.getPersistenceManager().removeUser(userName, true);    
     } catch (IdentityException e) {
-      throw new JbpmException("couldn't delete group "+userName, e);
+      throw new JbpmException("couldn't delete user ["+userName + "]", e);
     }
   }
 
   public String createGroup(String groupName, String groupType, String parentGroupId) {
-    String groupId = null;
     
     try {
-      GroupType simpleGroupType = new SimpleGroupType(groupType);
-      org.jboss.identity.idm.api.Group group = identitySession.getPersistenceManager().createGroup(groupName, simpleGroupType);
-      groupId = group.getId();
+            	
+      org.jboss.identity.idm.api.Group group = identitySession.getPersistenceManager().createGroup(groupName, groupType);
+      String groupId = group.getId();
       
       if (parentGroupId!=null) {
         org.jboss.identity.idm.api.Group parentGroup = findIdmGroupById(parentGroupId);
@@ -150,66 +173,88 @@
         }
         identitySession.getRelationshipManager().associateGroups(parentGroup, group);
       }
-      
+     return groupId;
+     
     } catch (IdentityException e) {
       throw new JbpmException("couldn't create group "+groupName, e);
     }
     
-    return groupId;
   }
   
   public Group findGroupById(String groupId) {
-    throw new UnsupportedOperationException("please implement me");
+	try {
+		org.jboss.identity.idm.api.Group idGroup = findIdmGroupById(groupId);
+		GroupImpl group = new GroupImpl();
+		group.setId(idGroup.getId());
+		group.setType(idGroup.getGroupType());
+		group.setName(idGroup.getName());
+		
+		Collection<org.jboss.identity.idm.api.Group> idParentGroups = 
+			identitySession.getRelationshipManager().findAssociatedGroups(idGroup, null, false, false);
+		
+		if (idParentGroups.size() > 0) {
+			org.jboss.identity.idm.api.Group idParent = idParentGroups.iterator().next();
+			GroupImpl parentGroup = new GroupImpl();
+			parentGroup.setId(idParent.getId());
+			parentGroup.setType(idParent.getGroupType());
+			parentGroup.setName(idParent.getName());
+			
+			group.setParent(parentGroup);
+		}
+		
+		return group;
+		
+	} catch (IdentityException e) {
+		throw new JbpmException("couldn't find group by id [" + groupId + "]", e);
+	}  
   }
 
   public List<Group> findGroupsByGroupType(String groupType) {
     try {
-      GroupType simpleGroupType = new SimpleGroupType(groupType);
-      Collection<org.jboss.identity.idm.api.Group> idGroups = identitySession
-          .getPersistenceManager()
-          .findGroup(simpleGroupType);
+     Collection<org.jboss.identity.idm.api.Group> idGroups = identitySession.getPersistenceManager().
+     															findGroup(groupType);	
     
       List<Group> groups = new ArrayList<Group>();
       for (org.jboss.identity.idm.api.Group idGroup: idGroups) {
-        String groupName = idGroup.getName();
-
-        GroupImpl group = new GroupImpl(groupName);
-        groups.add(group);
+        groups.add(findGroupById(idGroup.getId()));
       }
       
       return groups;
       
     } catch (IdentityException e) {
-      throw new JbpmException("couldn't get users from identity component", e);
+      throw new JbpmException("couldn't get groups from identity component, groupType [" + groupType + "]", e);
     }
   }
   
   public List<Group> findGroupsByUser(String userId) {
-    throw new UnsupportedOperationException("please implement me");
+	  
+    try {
+		Collection<org.jboss.identity.idm.api.Group> idGroups = identitySession.getRelationshipManager().
+																	findAssociatedGroups(userId, null);
+		
+		List<Group> groups = new ArrayList<Group>();
+		for (org.jboss.identity.idm.api.Group idGroup : idGroups) {
+			groups.add(findGroupById(idGroup.getId()));
+		}
+		return groups;
+	} catch (IdentityException e) {
+		throw new JbpmException("Couldn't get Groups by userId [" + userId + "]", e);
+		
+	}
   }
 
   public List<Group> findGroupsByUserAndGroupType(String userName, String groupType) {
     try {
-      org.jboss.identity.idm.api.Identity identity = findIdentity(userName);
-      if (identity==null) {
-        return Collections.emptyList();
-      }
+      org.jboss.identity.idm.api.User idUser = identitySession.getPersistenceManager().findUser(userName);
       
+      Collection<org.jboss.identity.idm.api.Group> idGroups = identitySession.getRoleManager()
+      														.findGroupsWithRelatedRole(idUser, groupType, null);
       List<Group> groups = new ArrayList<Group>();
-  
-      GroupType identityGroupType = new SimpleGroupType(groupType);
-      Collection<org.jboss.identity.idm.api.Group> identityGroups = identitySession
-        .getRoleManager()
-        .findGroupsWithRelatedRole(identity, identityGroupType, null);
       
-      for (org.jboss.identity.idm.api.Group identityGroup: identityGroups) {
-        String groupName = identityGroup.getName();
-        GroupImpl group = new GroupImpl(groupName);
-        groups.add(group);
+      for (org.jboss.identity.idm.api.Group idGroup : idGroups) {
+    	  groups.add(findGroupById(idGroup.getId()));
       }
-  
       return groups;
-  
     } catch (Exception e) {
       throw new JbpmException("couldn't get groups for user "+userName+" and groupType "+groupType, e);
     }
@@ -223,9 +268,7 @@
         return;
       }
 
-      identitySession
-          .getPersistenceManager()
-          .removeGroup(group, true);
+      identitySession.getPersistenceManager().removeGroup(group, true);
     
     } catch (IdentityException e) {
       throw new JbpmException("couldn't delete group "+groupId, e);
@@ -239,8 +282,8 @@
         throw new JbpmException("group "+groupId+" doesn't exist");
       }
   
-      org.jboss.identity.idm.api.Identity identity = findIdentity(userId);
-      if (identity==null) {
+      org.jboss.identity.idm.api.User idUser = identitySession.getPersistenceManager().findUser(userId);
+      if (idUser==null) {
         throw new JbpmException("user "+userId+" doesn't exist");
       }
       
@@ -251,10 +294,10 @@
           roleType = identitySession.getRoleManager().createRoleType(role);
         }
         
-        identitySession.getRoleManager().createRole(roleType, identity, group);
+        identitySession.getRoleManager().createRole(roleType, idUser, group);
         
       } else {
-        identitySession.getRelationshipManager().associateIdentities(group, identity);
+        identitySession.getRelationshipManager().associateUser(group, idUser);
       }
       
     } catch (Exception e) {
@@ -263,40 +306,42 @@
   }
   
   public void deleteMembership(String userId, String groupId, String role) {
-    throw new UnsupportedOperationException("please implement me");
+	try {
+		RoleType rtype = identitySession.getRoleManager().getRoleType(role);
+		identitySession.getRoleManager().removeRole(rtype.getName(), userId, groupId);
+	} catch (Exception e) {
+		throw new JbpmException("couldn't delete the membership [" + userId + "," + groupId + "," + role + "]", e);
+	}  
+	
   }
-  
-  protected org.jboss.identity.idm.api.Identity findIdentity(String userName) throws IdentityException {
-    Collection<org.jboss.identity.idm.api.Identity> identities = identitySession
-      .getPersistenceManager()
-      .findIdentity(new IdentitySearchControl[]{
-              new NameFilterSearchControl(userName)
-      } );
-    
-    if ( (identities==null) || (identities.size()==0) ) {
-      return null;
-    }
-    
-    return identities.iterator().next();
-  }
 
   protected org.jboss.identity.idm.api.Group findIdmGroupById(String groupId) {
-    throw new UnsupportedOperationException("please implement me");
+	try {
+		Collection<org.jboss.identity.idm.api.Group> groups = identitySession.getPersistenceManager().findGroup(Group.TYPE_UNIT);
+		for (org.jboss.identity.idm.api.Group group : groups) {
+			if (groupId.equals(group.getId())) {
+				return group;
+			}
+		}
+		return null;
+	} catch (IdentityException e) {
+		throw new JbpmException("couldn't find the group by groupId: " + groupId, e);
+	}  
   }
 
-  protected String getAttributeString(Identity identity, String attributeName) throws IdentityException {
-    return getAttributeString(identity, null, attributeName);
+  protected String getAttributeString(org.jboss.identity.idm.api.User idUser, String attributeName) throws IdentityException {
+    return getAttributeString(idUser, null, attributeName);
   }
 
   protected String getAttributeString(org.jboss.identity.idm.api.Group idGroup, String attributeName) throws IdentityException {
     return getAttributeString(null, idGroup, attributeName);
   }
 
-  protected String getAttributeString(Identity identity, org.jboss.identity.idm.api.Group idGroup, String attributeName) throws IdentityException {
+  protected String getAttributeString(org.jboss.identity.idm.api.User idUser, org.jboss.identity.idm.api.Group idGroup, String attributeName) throws IdentityException {
     AttributesManager attributesManager = identitySession.getAttributesManager();
     Attribute attribute = null;
-    if (identity!=null) {
-      attribute = attributesManager.getAttribute(identity, attributeName);
+    if (idUser !=null) {
+      attribute = attributesManager.getAttribute(idUser, attributeName);
     } else {
       attribute = attributesManager.getAttribute(idGroup, attributeName);
     }
@@ -316,5 +361,4 @@
   }
 
 
-
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JbpmIdentityStore.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JbpmIdentityStore.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JbpmIdentityStore.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -22,7 +22,7 @@
 package org.jbpm.pvm.internal.identity.impl;
 
 import org.hibernate.ejb.HibernateEntityManager;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
 import org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl;
 import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
 import org.jbpm.api.env.Environment;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -52,13 +52,12 @@
     MailTemplateRegistry templateRegistry;
 
     WireDefinition wireDefinition = parse.findObject(WireDefinition.class);
-    String templateRegistryDescriptorName = wireDefinition != null ? wireDefinition.getDescriptorName(MailTemplateRegistry.class)
-        : null;
+    String templateRegistryDescriptorName = (wireDefinition != null ? wireDefinition.getDescriptorName(MailTemplateRegistry.class) : null);
+    
     if (templateRegistryDescriptorName != null) {
       templateRegistryDescriptor = (ProvidedObjectDescriptor) wireDefinition.getDescriptor(templateRegistryDescriptorName);
       templateRegistry = (MailTemplateRegistry) templateRegistryDescriptor.getProvidedObject();
-    }
-    else {
+    } else {
       templateRegistry = new MailTemplateRegistry();
       templateRegistryDescriptor = new ProvidedObjectDescriptor(templateRegistry, true);
     }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -22,6 +22,8 @@
 package org.jbpm.pvm.internal.wire.descriptor;
 
 import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jbpm.api.JbpmException;
 import org.jbpm.api.env.Environment;
 import org.jbpm.pvm.internal.identity.impl.JBossIdmIdentitySessionImpl;
 import org.jbpm.pvm.internal.wire.WireContext;
@@ -39,7 +41,11 @@
 
   public Object construct(WireContext wireContext) {
     IdentitySessionFactory identitySessionFactory = Environment.getFromCurrent(IdentitySessionFactory.class);
-    return new JBossIdmIdentitySessionImpl(identitySessionFactory.createIdentitySession(realmName));
+    try {
+		return new JBossIdmIdentitySessionImpl(identitySessionFactory.createIdentitySession(realmName));
+	} catch (IdentityException e) {
+		throw new JbpmException("couldn't create the identity session for realm [" + realmName + "]");
+	}
   }
 
   public Class< ? > getType(WireDefinition wireDefinition) {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionFactoryDescriptor.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -24,7 +24,7 @@
 import javax.naming.InitialContext;
 
 import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
 import org.jbpm.api.JbpmException;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.WireDefinition;
@@ -32,6 +32,7 @@
 
 /**
  * @author Tom Baeyens
+ * @author Jeff Yu
  */
 public class JbossIdmIdentitySessionFactoryDescriptor extends AbstractDescriptor {
 
@@ -52,7 +53,7 @@
     }
     
     try {
-      return new IdentitySessionFactoryImpl(resource);
+      return new IdentityConfigurationImpl().configure(resource).buildIdentitySessionFactory();
     } catch (Exception e) {
       throw new JbpmException("couldn't instanatiate identity session factory: "+e.getMessage(), e);
     }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/WireParser.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -188,13 +188,24 @@
   public Object parseDocumentElement(Element documentElement, Parse parse) {
     List<Element> elements = XmlUtil.elements(documentElement);
 
-    WireDefinition wireDefinition = new WireDefinition();
+    
+    WireDefinition wireDefinition = parse.findObject(WireDefinition.class);
+    if (wireDefinition==null) {
+      wireDefinition = new WireDefinition();
+    }
     wireDefinition.setClassLoader(classLoader);
     
     parse.pushObject(wireDefinition);
     try {
       for (Element descriptorElement: elements) {
-        parseElement(descriptorElement, parse, CATEGORY_DESCRIPTOR);
+        Descriptor descriptor = (Descriptor) parseElement(descriptorElement, parse, CATEGORY_DESCRIPTOR);
+        
+        // add the descriptor
+        if ( (wireDefinition!=null)
+             && (descriptor!=null)
+           ) {
+          wireDefinition.addDescriptor(descriptor);
+        }
       }
     } finally {
       parse.popObject();
@@ -247,12 +258,6 @@
           }
         }
       }
-      
-      // add the descriptor
-      WireDefinition wireDefinition = parse.findObject(WireDefinition.class);
-      if (wireDefinition!=null) {
-        wireDefinition.addDescriptor(descriptor);
-      }
     }
     return object;
   }

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -41,11 +41,28 @@
       <holiday period="01/07/2008 - 31/08/2008"/>
     </business-calendar>
     
-    <!--mail-template name="TaskNotification"
-    -->
-    <!--mail-template name="TaskReminder"
-    -->
+    <mail-template name='task-notification'>
+      <to users="${task.assignee}"/>
+      <subject>${task.name}</subject>
+      <text><![CDATA[Hi ${task.assignee},
+Task "${task.name}" has been assigned to you.
+${task.description}
+
+Sent by JBoss jBPM
+]]></text>
+    </mail-template>
   
+    <mail-template name='task-reminder'>
+      <to users="${task.assignee}"/>
+      <subject>${task.name}</subject>
+      <text><![CDATA[Hey ${task.assignee},
+Do not forget about task "${task.name}".
+${task.description}
+
+Sent by JBoss jBPM
+]]></text>
+    </mail-template>
+  
   </process-engine-context>
 
   <transaction-context>

Copied: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.jboss.idm.cfg.xml (from rev 4758, jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.jboss.idm.cfg.xml)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.jboss.idm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.jboss.idm.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <process-engine-context>
+    <jboss-idm-identity-session-factory jndi="java:/IdentitySessionFactory" />
+  </process-engine-context>
+
+  <transaction-context>
+    <jboss-idm-identity-session realm="realm://JBossIdentity" />
+  </transaction-context>
+
+</jbpm-configuration>

Deleted: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.mail.templates.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.mail.templates.cfg.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.mail.templates.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration>
-
-  <process-engine-context>
-
-    <mail-template name='task-notification'>
-      <to users="${task.assignee}"/>
-      <subject>${task.name}</subject>
-      <text><![CDATA[Hi ${task.assignee},
-Task "${task.name}" has been assigned to you.
-${task.description}
-
-Sent by JBoss jBPM
-]]></text>
-    </mail-template>
-  
-    <mail-template name='task-reminder'>
-      <to users="${task.assignee}"/>
-      <subject>${task.name}</subject>
-      <text><![CDATA[Hey ${task.assignee},
-Do not forget about task "${task.name}".
-${task.description}
-
-Sent by JBoss jBPM
-]]></text>
-    </mail-template>
-
-  </process-engine-context>
-
-</jbpm-configuration>

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -4,9 +4,8 @@
 
   <process-engine-context>
     <command-service>
-      <retry-interceptor />
-      <environment-interceptor />
       <jta-transaction-interceptor />
+      <environment-interceptor />
     </command-service>
   </process-engine-context>
 

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ContextBlockSubscriptionTest.java	2009-05-26 18:11:12 UTC (rev 4904)
@@ -454,7 +454,7 @@
 
     Environment environment = environmentFactory.openEnvironment();
     try {
-      WireContext contextBlockContext = (WireContext) environment.getContext(Context.CONTEXTNAME_TRANSACTION);
+      WireContext transactionContext = (WireContext) environment.getContext(Context.CONTEXTNAME_TRANSACTION);
       assertNotNull(environment.get("a"));
 
       // The recorder object will be subscribed to the environment WireContext
@@ -473,15 +473,10 @@
       assertEquals("a", ((WireObjectEventInfo)events.get(2).info).getObjectName());
       assertEquals("set", events.get(3).eventName);
       assertEquals("a", ((WireObjectEventInfo)events.get(3).info).getObjectName());
-      contextBlockContext.fire("interestingevent", null);
+      transactionContext.fire("interestingevent", null);
       assertEquals(events.toString(), 5, events.size());
       assertEquals("interestingevent", events.get(4).eventName);
 
-      Descriptor descriptor = contextBlockContext.getWireDefinition().getDescriptor("recorder");
-      // this event is fired directly on the descriptor and should therefore not be received
-      descriptor.fire("descriptorEvent", null);
-      assertEquals(events.toString(), 5, events.size());
-
     } finally {
       environment.close();
     }
@@ -548,11 +543,6 @@
       assertEquals(events.toString(), 7, events.size());
       assertEquals("interestingevent", events.get(6).eventName);
 
-      Descriptor descriptor = contextBlockContext.getWireDefinition().getDescriptor("recorder");
-      // this event is fired directly on the descriptor and should therefore not be received
-      descriptor.fire("descriptorEvent", null);
-      assertEquals(events.toString(), 7, events.size());
-
     } finally {
       environment.close();
     }

Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/pom.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -53,7 +53,7 @@
     <slf4j.version>1.5.2</slf4j.version>
     <hsqldb.version>1.8.0.7</hsqldb.version>
     <izpack.version>4.2.1</izpack.version>
-    <jboss.identity.version>1.0.0.Alpha2</jboss.identity.version>
+    <jboss.identity.version>1.0.0.Alpha7</jboss.identity.version>
     <jboss.j2ee.version>4.2.2.GA</jboss.j2ee.version>
     <jbossesb.version>4.4.0.GA</jbossesb.version>
     <jboss.client.version>5.0.1.GA</jboss.client.version>
@@ -223,11 +223,16 @@
         <version>${slf4j.version}</version>
       </dependency>
       <dependency>
-        <groupId>org.jboss.identity</groupId>
-        <artifactId>idm</artifactId>
+        <groupId>org.jboss.identity.idm</groupId>
+        <artifactId>idm-core</artifactId>
         <version>${jboss.identity.version}</version>
       </dependency>
       <dependency>
+        <groupId>org.jboss.identity.idm</groupId>
+        <artifactId>idm-hibernate</artifactId>
+        <version>${jboss.identity.version}</version>
+      </dependency>
+      <dependency>
         <groupId>hsqldb</groupId>
         <artifactId>hsqldb</artifactId>
         <version>${hsqldb.version}</version>

Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml	2009-05-26 15:38:21 UTC (rev 4903)
+++ jbpm4/trunk/qa/build.xml	2009-05-26 18:11:12 UTC (rev 4904)
@@ -58,7 +58,7 @@
     <ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" />
 	</target>
 
-  <target name="enable.jboss.debug" unless="jbpm.debug">
+  <target name="enable.jboss.debug" if="jbpm.debug">
     <replace file="${jboss.home}/bin/run.bat" 
     	       token="rem set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y" 
     	       value="set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>




More information about the jbpm-commits mailing list