You are viewing a plain text version of this content. The canonical link for it is here.
Posted to agila-commits@incubator.apache.org by mr...@apache.org on 2005/04/27 20:28:07 UTC

svn commit: r165042 [24/30] - in /incubator/agila/trunk: ./ config/ modules/ modules/bpel/ modules/bpel/client/ modules/bpel/client/api/ modules/bpel/client/api/src/ modules/bpel/client/api/src/conf/ modules/bpel/client/api/src/java/ modules/bpel/client/api/src/java/org/ modules/bpel/client/api/src/java/org/apache/ modules/bpel/client/api/src/java/org/apache/agila/ modules/bpel/client/api/src/java/org/apache/agila/bpel/ modules/bpel/client/api/src/java/org/apache/agila/bpel/client/ modules/bpel/client/api/src/test/ modules/bpel/client/api/src/test/junit/ modules/bpel/client/api/src/test/junit/org/ modules/bpel/client/api/src/test/junit/org/apache/ modules/bpel/client/api/src/test/junit/org/apache/agila/ modules/bpel/client/api/src/test/junit/org/apache/agila/bpel/ modules/bpel/client/api/src/test/junit/org/apache/agila/bpel/client/ modules/bpel/client/web/ modules/bpel/client/web/src/ modules/bpel/client/web/src/conf/ modules/bpel/client/web/src/java/ modules/bpel/client/web/src/java/org/ modules/bpel/client/web/src/java/org/apache/ modules/bpel/client/web/src/java/org/apache/agila/ modules/bpel/client/web/src/java/org/apache/agila/bpel/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/common/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/deployer/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/deployer/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/deployer/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/engine/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/engine/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/engine/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/global/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/global/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/security/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/security/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/security/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/user/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/user/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/user/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/util/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/worklist/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/worklist/action/ modules/bpel/client/web/src/webapp/ modules/bpel/client/web/src/webapp/META-INF/ modules/bpel/client/web/src/webapp/WEB-INF/ modules/bpel/client/web/src/webapp/WEB-INF/classes/ modules/bpel/client/web/src/webapp/images/ modules/bpel/client/web/src/webapp/images/audit/ modules/bpel/client/web/src/webapp/style/ modules/bpel/common/ modules/bpel/common/src/ modules/bpel/common/src/aspect/ modules/bpel/common/src/conf/ modules/bpel/common/src/java/ modules/bpel/common/src/java/org/ modules/bpel/common/src/java/org/apache/ modules/bpel/common/src/java/org/apache/agila/ modules/bpel/common/src/java/org/apache/agila/bpel/ modules/bpel/common/src/java/org/apache/agila/bpel/common/ modules/bpel/common/src/java/org/apache/agila/bpel/common/aspect/ modules/bpel/common/src/java/org/apache/agila/bpel/common/configuration/ modules/bpel/common/src/java/org/apache/agila/bpel/common/util/ modules/bpel/common/src/java/org/apache/agila/bpel/common/util/logger/ modules/bpel/common/src/test/ modules/bpel/common/src/test/junit/ modules/bpel/common/src/test/junit/org/ modules/bpel/common/src/test/junit/org/apache/ modules/bpel/common/src/test/junit/org/apache/agila/ modules/bpel/common/src/test/junit/org/apache/agila/bpel/ modules/bpel/common/src/test/junit/org/apache/agila/bpel/common/ modules/bpel/common/src/test/junit/org/apache/agila/bpel/common/util/ modules/bpel/dist/ modules/bpel/dist/src/ modules/bpel/dist/src/java/ modules/bpel/dist/src/java/org/ modules/bpel/dist/src/java/org/apache/ modules/bpel/dist/src/java/org/apache/agila/ modules/bpel/dist/src/java/org/apache/agila/bpel/ modules/bpel/dist/src/java/org/apache/agila/bpel/util/ modules/bpel/dist/src/script/ modules/bpel/engine/ modules/bpel/engine/common/ modules/bpel/engine/common/src/ modules/bpel/engine/common/src/aspect/ modules/bpel/engine/common/src/hibernate/ modules/bpel/engine/common/src/hibernate/org/ modules/bpel/engine/common/src/hibernate/org/apache/ modules/bpel/engine/common/src/hibernate/org/apache/agila/ modules/bpel/engine/common/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/common/src/hibernate/org/apache/agila/bpel/engine/ modules/bpel/engine/common/src/hibernate/org/apache/agila/bpel/engine/common/ modules/bpel/engine/common/src/java/ modules/bpel/engine/common/src/java/org/ modules/bpel/engine/common/src/java/org/apache/ modules/bpel/engine/common/src/java/org/apache/agila/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/aspect/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/execution/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/execution/impl/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/lifecycle/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/lifecycle/dao/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/lifecycle/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/monitoring/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/persistence/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/transaction/ modules/bpel/engine/common/src/test/ modules/bpel/engine/common/src/test/junit/ modules/bpel/engine/common/src/test/junit/org/ modules/bpel/engine/common/src/test/junit/org/apache/ modules/bpel/engine/common/src/test/junit/org/apache/agila/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/engine/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/engine/common/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/engine/common/event/ modules/bpel/engine/common/src/test/resources/ modules/bpel/engine/core/ modules/bpel/engine/core/src/ modules/bpel/engine/core/src/aspect/ modules/bpel/engine/core/src/hibernate/ modules/bpel/engine/core/src/hibernate/org/ modules/bpel/engine/core/src/hibernate/org/apache/ modules/bpel/engine/core/src/hibernate/org/apache/agila/ modules/bpel/engine/core/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/core/src/hibernate/org/apache/agila/bpel/engine/ modules/bpel/engine/core/src/java/ modules/bpel/engine/core/src/java/org/ modules/bpel/engine/core/src/java/org/apache/ modules/bpel/engine/core/src/java/org/apache/agila/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/exception/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/definition/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/definition/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/definition/impl/dao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/impl/dao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/impl/xao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/expression/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/expression/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/messaging/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/messaging/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/timer/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/timer/dao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/timer/po/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/util/ modules/bpel/engine/core/src/test/ modules/bpel/engine/core/src/test/junit/ modules/bpel/engine/core/src/test/junit/org/ modules/bpel/engine/core/src/test/junit/org/apache/ modules/bpel/engine/core/src/test/junit/org/apache/agila/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/core/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/core/definition/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/core/dynamic/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/messaging/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/tools/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/util/ modules/bpel/engine/core/src/test/resources/ modules/bpel/engine/deployer/ modules/bpel/engine/deployer/src/ modules/bpel/engine/deployer/src/aspect/ modules/bpel/engine/deployer/src/java/ modules/bpel/engine/deployer/src/java/org/ modules/bpel/engine/deployer/src/java/org/apache/ modules/bpel/engine/deployer/src/java/org/apache/agila/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/exception/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/context/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/complex/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/exclusivity/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/reference/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/unicity/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/wsdl/ modules/bpel/engine/deployer/src/test/ modules/bpel/engine/deployer/src/test/junit/ modules/bpel/engine/deployer/src/test/junit/org/ modules/bpel/engine/deployer/src/test/junit/org/apache/ modules/bpel/engine/deployer/src/test/junit/org/apache/agila/ modules/bpel/engine/deployer/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/deployer/src/test/junit/org/apache/agila/bpel/deployer/ modules/bpel/engine/deployer/src/test/resources/ modules/bpel/engine/user/ modules/bpel/engine/user/src/ modules/bpel/engine/user/src/aspect/ modules/bpel/engine/user/src/hibernate/ modules/bpel/engine/user/src/hibernate/org/ modules/bpel/engine/user/src/hibernate/org/apache/ modules/bpel/engine/user/src/hibernate/org/apache/agila/ modules/bpel/engine/user/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/user/src/hibernate/org/apache/agila/bpel/user/ modules/bpel/engine/user/src/java/ modules/bpel/engine/user/src/java/org/ modules/bpel/engine/user/src/java/org/apache/ modules/bpel/engine/user/src/java/org/apache/agila/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/exception/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/dao/ modules/bpel/engine/user/src/test/ modules/bpel/engine/user/src/test/junit/ modules/bpel/engine/user/src/test/junit/org/ modules/bpel/engine/user/src/test/junit/org/apache/ modules/bpel/engine/user/src/test/junit/org/apache/agila/ modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/ modules/bpel/engine/user/src/test/resource/ modules/bpel/engine/worklist/ modules/bpel/engine/worklist/src/ modules/bpel/engine/worklist/src/aspect/ modules/bpel/engine/worklist/src/hibernate/ modules/bpel/engine/worklist/src/hibernate/org/ modules/bpel/engine/worklist/src/hibernate/org/apache/ modules/bpel/engine/worklist/src/hibernate/org/apache/agila/ modules/bpel/engine/worklist/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/worklist/src/hibernate/org/apache/agila/bpel/worklist/ modules/bpel/engine/worklist/src/java/ modules/bpel/engine/worklist/src/java/org/ modules/bpel/engine/worklist/src/java/org/apache/ modules/bpel/engine/worklist/src/java/org/apache/agila/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/exception/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/priv/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/priv/dao/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/priv/po/ modules/bpel/engine/worklist/src/test/ modules/bpel/engine/worklist/src/test/junit/ modules/bpel/engine/worklist/src/test/junit/org/ modules/bpel/engine/worklist/src/test/junit/org/apache/ modules/bpel/engine/worklist/src/test/junit/org/apache/agila/ modules/bpel/engine/worklist/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/worklist/src/test/junit/org/apache/agila/bpel/worklist/ modules/bpel/engine/worklist/src/test/resource/ modules/bpel/engine/wsa/ modules/bpel/engine/wsa/src/ modules/bpel/engine/wsa/src/aspect/ modules/bpel/engine/wsa/src/conf/ modules/bpel/engine/wsa/src/hibernate/ modules/bpel/engine/wsa/src/java/ modules/bpel/engine/wsa/src/java/org/ modules/bpel/engine/wsa/src/java/org/apache/ modules/bpel/engine/wsa/src/java/org/apache/agila/ modules/bpel/engine/wsa/src/java/org/apache/agila/bpel/ modules/bpel/engine/wsa/src/java/org/apache/agila/bpel/wsa/ modules/bpel/engine/wsa/src/schema/ modules/bpel/engine/wsa/src/test/ modules/bpel/engine/wsa/src/test/junit/ modules/bpel/engine/wsa/src/test/junit/org/ modules/bpel/engine/wsa/src/test/junit/org/apache/ modules/bpel/engine/wsa/src/test/junit/org/apache/agila/ modules/bpel/engine/wsa/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/wsa/src/test/junit/org/apache/agila/bpel/worklist/ modules/bpel/engine/wsa/src/test/resources/ modules/bpel/engine/wsa/src/webapp/ modules/bpel/engine/wsa/src/webapp/META-INF/ modules/bpel/engine/wsa/src/webapp/WEB-INF/ modules/bpel/engine/wsa/src/webapp/WEB-INF/classes/ modules/bpel/samples/ modules/bpel/samples/src/ modules/bpel/samples/src/xml/ modules/bpel/samples/src/xml/example1/ modules/bpel/samples/src/xml/example1/messages/ modules/bpel/samples/src/xml/example2/ modules/bpel/samples/src/xml/example2/messages/ modules/bpel/samples/src/xml/example3/ modules/bpel/samples/src/xml/example3/messages/ modules/bpel/samples/src/xml/example4/ modules/bpel/samples/src/xml/example4/messages/ modules/bpm/ modules/bpm/config/ modules/bpm/src/ modules/bpm/src/java/ modules/bpm/src/resources/ modules/bpm/src/test/ modules/bpm/src/webapp/ src/

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUser.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUser.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUser.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUser.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import java.util.Collection;
+
+import org.apache.agila.bpel.engine.common.persistence.CreationException;
+import org.apache.agila.bpel.engine.common.persistence.FinderException;
+import org.apache.agila.bpel.user.exception.AgilaUserException;
+
+/**
+ * Defines service methods for user, group and role management. Mostly CRUD and finders.
+ * Any implementation of Agila's users/group service (if not using the default one) should
+ * comply to this interface.
+ */
+public interface AgilaUser {
+
+    public boolean authenticate(String username, String password) throws AgilaUserException;
+    public Role createRole(Role role) throws CreationException, AgilaUserException;
+    public Role updateRole(Role role) throws AgilaUserException;
+    public Collection findAllRoles() throws AgilaUserException;
+    public Role findRoleById(Long id) throws AgilaUserException, FinderException;
+    public Role findRoleByName(String rolename) throws AgilaUserException, FinderException;
+    public void deleteRole(Long id) throws AgilaUserException;
+
+    public Group createGroup(Group group) throws CreationException, AgilaUserException;
+    public Group updateGroup(Group group) throws AgilaUserException;
+    public Collection findAllGroups() throws AgilaUserException;
+    public Group findGroupById(Long id) throws AgilaUserException, FinderException;
+    public Group findGroupByName(String groupname) throws AgilaUserException, FinderException;
+    public void deleteGroup(Group group) throws AgilaUserException;
+    public void deleteGroup(Long id) throws AgilaUserException;
+
+    public User createUser(User user) throws CreationException,AgilaUserException;
+    public User updateUser(User user) throws AgilaUserException;
+    public Collection findAllUsers() throws AgilaUserException;
+    public User findUserById(Long id) throws AgilaUserException, FinderException;
+    public User findUserByName(String username) throws AgilaUserException, FinderException;
+    public void deleteUser(User user) throws AgilaUserException;
+    public void deleteUser(Long id) throws AgilaUserException;
+    /**
+     * @deprecated
+     * @param username
+     * @throws AgilaUserException
+     */
+    public void deleteUser(String username) throws AgilaUserException;
+
+    public boolean doesRoleExist(String rolename) throws AgilaUserException;
+
+    public Collection findUsersInGroup(String groupname) throws AgilaUserException;
+    public Collection findUsersInRole(String rolename) throws AgilaUserException;
+
+    public Collection findRolesForUser(String username) throws AgilaUserException;
+    public Collection findRolesForUser(Long userId) throws AgilaUserException;
+    public Collection findGroupsForUser(String username) throws AgilaUserException;
+    public Collection findGroupsForUser(Long userId) throws AgilaUserException;
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUserFactory.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUserFactory.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUserFactory.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/AgilaUserFactory.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import org.apache.agila.bpel.user.priv.AgilaUserImpl;
+
+/**
+ * Factory class for the Agila User Service interface.
+ */
+public class AgilaUserFactory {
+
+    public static AgilaUser getAgilaUser() {
+        return new AgilaUserImpl();
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Group.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Group.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Group.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Group.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import java.util.Set;
+
+public interface Group {
+    Long getId();
+
+    String getName();
+
+//    Set getUsers();
+
+    Set getRoles();
+
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Role.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Role.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Role.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/Role.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+
+public interface Role {
+    Long getId();
+
+    String getName();
+
+//    Set getUsers();
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/User.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/User.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/User.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/User.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import java.util.Set;
+
+public interface User {
+    Long getId();
+
+    String getName();
+
+    String getPassword();
+
+    Set getGroups();
+
+//    Set getRoles();
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/exception/AgilaUserException.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/exception/AgilaUserException.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/exception/AgilaUserException.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/exception/AgilaUserException.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.exception;
+
+public class AgilaUserException extends Exception {
+    public AgilaUserException(String message) {
+        super(message);    //To change body of overriden methods use Options | File Templates.
+    }
+
+    public AgilaUserException(Throwable cause) {
+        super(cause);    //To change body of overriden methods use Options | File Templates.
+    }
+
+    public AgilaUserException(String message, Throwable cause) {
+        super(message, cause);    //To change body of overriden methods use Options | File Templates.
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/AgilaUserImpl.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/AgilaUserImpl.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/AgilaUserImpl.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/AgilaUserImpl.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,522 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.priv;
+
+import org.apache.log4j.Logger;
+
+import org.apache.agila.bpel.engine.common.persistence.CreationException;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.common.persistence.FinderException;
+import org.apache.agila.bpel.engine.common.persistence.PersistentDataAccess;
+import org.apache.agila.bpel.engine.common.transaction.TransactionException;
+import org.apache.agila.bpel.user.Group;
+import org.apache.agila.bpel.user.Role;
+import org.apache.agila.bpel.user.AgilaUser;
+import org.apache.agila.bpel.user.User;
+import org.apache.agila.bpel.user.exception.AgilaUserException;
+import org.apache.agila.bpel.user.priv.dao.UserDAO;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class AgilaUserImpl implements AgilaUser {
+
+    private Logger log = Logger.getLogger(AgilaUserImpl.class);
+
+    public boolean authenticate(String username, String password) throws AgilaUserException {
+        User user = null;
+        try {
+            user = findUserByName(username);
+            if (user.getPassword().equals(password)) {
+                return true;
+            } else {
+                log.info("User with username " + username + " couldn't be authenticated, wrong password.");
+                return false;
+            }
+        } catch (FinderException e) {
+            log.info("User with username " + username + " couldn't be authenticated, user not found.");
+            return false;
+        }
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Role createRole(Role role) throws CreationException, AgilaUserException {
+        if (role == null || role.getName() == null || "".equals(role.getName())) {
+            log.error("Invalid Role name");
+            throw new CreationException("Invalid Role Name!");
+        }
+        if (doesRoleExist(role.getName()) == true) {
+            log.error("Role already exists !");
+            throw new CreationException("Role already exists !");
+        }
+        RoleImpl roleImpl;
+        try {
+            roleImpl = new RoleImpl();
+            roleImpl.setName(role.getName());
+            roleImpl = (RoleImpl) createOrUpdatePO(roleImpl, true);
+        } catch (Exception e) {
+            throw new CreationException(e);
+        }
+        return roleImpl;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Role updateRole(Role role) throws AgilaUserException {
+        if (role == null || role.getName() == null || "".equals(role.getName())
+                || role.getId() == null || role.getId().longValue() == 0) {
+            log.error("Invalid Role");
+            throw new AgilaUserException("Invalid Role !");
+        }
+        RoleImpl roleImpl;
+        try {
+            roleImpl = new RoleImpl();
+            roleImpl.setId(role.getId());
+            roleImpl.setName(role.getName());
+            roleImpl = (RoleImpl) createOrUpdatePO(roleImpl, false);
+        } catch (Exception e) {
+            throw new AgilaUserException(e);
+        }
+        return roleImpl;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findAllRoles() throws AgilaUserException {
+        Collection result = PersistentDataAccess.findAll(RoleImpl.class);
+        return result;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Role findRoleById(Long id) throws AgilaUserException, FinderException {
+        Role role = (Role) PersistentDataAccess.findById(id, RoleImpl.class);
+        return role;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Role findRoleByName(String rolename) throws AgilaUserException, FinderException {
+        Role role = null;
+        try {
+            role = UserDAO.findRoleByName(rolename);
+        } catch (DBSessionException e) {
+            throw  new AgilaUserException(e);
+        }
+        return role;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public void deleteRole(Long id) throws AgilaUserException {
+        try {
+            Collection groups = UserDAO.findGroupsInRole(id);
+
+            for (Iterator it = groups.iterator(); it.hasNext();) {
+                GroupImpl group = (GroupImpl) it.next();
+                Collection roles = group.getRoles();
+                for (Iterator it1 = roles.iterator(); it1.hasNext();) {
+                    RoleImpl r = (RoleImpl) it1.next();
+                    if (r.getId().equals(id)) {
+                        roles.remove(r);
+                        break;
+                    }
+                }
+                updateGroup(group);
+            }
+        } catch (DBSessionException e) {
+            throw  new AgilaUserException(e);
+        } catch (FinderException e) {
+            // it's ok
+        }
+        RoleImpl r = new RoleImpl();
+        r.setId(id);
+        PersistentDataAccess.remove(r);
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Group createGroup(Group group) throws CreationException, AgilaUserException {
+        return createOrUpdate(group, true);
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Group updateGroup(Group group) throws AgilaUserException {
+        Group g = null;
+        try {
+            g = createOrUpdate(group, false);
+        } catch (CreationException e) {// Should not be rised for update
+            throw new AgilaUserException(e);
+        }
+        return g;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findAllGroups() throws AgilaUserException {
+        Collection result = PersistentDataAccess.findAll(GroupImpl.class);
+        return result;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Group findGroupById(Long id) throws AgilaUserException, FinderException {
+        Group group = (Group) PersistentDataAccess.findById(id, GroupImpl.class);
+        return group;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+   public Group findGroupByName(String groupname) throws AgilaUserException, FinderException {
+        Group group = null;
+        try {
+            group = UserDAO.findGroupByName(groupname);
+        } catch (DBSessionException e) {
+            throw new AgilaUserException(e);
+        }
+        return group;
+    }
+
+   /**
+    * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+    */
+    public void deleteGroup(Group group) throws AgilaUserException {
+        deleteGroup(group.getId());
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+   public void deleteGroup(Long id) throws AgilaUserException {
+        GroupImpl g = new GroupImpl();
+        g.setId(id);
+        g.setRoles(new HashSet());
+        PersistentDataAccess.remove(g);
+    }
+
+   /**
+    * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+    */
+    public User createUser(User user) throws CreationException, AgilaUserException {
+        return createOrUdpate(user, true);
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public User updateUser(User user) throws AgilaUserException {
+        User u = null;
+        try {
+            u = createOrUdpate(user, false);
+        } catch (CreationException e) {// Should not be rised for update
+        }
+        return u;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findAllUsers() throws AgilaUserException {
+        Collection result = PersistentDataAccess.findAll(UserImpl.class);
+        return result;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public User findUserById(Long id) throws AgilaUserException, FinderException {
+        User user = (User) PersistentDataAccess.findById(id, UserImpl.class);
+        return user;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+   public User findUserByName(String username) throws AgilaUserException, FinderException {
+        User user = null;
+        try {
+            user = UserDAO.findUserByName(username);
+        } catch (DBSessionException e) {
+            throw new AgilaUserException(e);
+        }
+        return user;
+    }
+
+   /**
+    * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+    */
+    public void deleteUser(User user) throws AgilaUserException {
+        deleteUser(user.getId());
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public void deleteUser(String username) throws AgilaUserException {
+        UserImpl user = null;
+        try {
+            user = UserDAO.findUserByName(username);
+            PersistentDataAccess.remove(user);
+        } catch (Exception e) {
+            throw new AgilaUserException(e);
+        }
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public void deleteUser(Long id) throws AgilaUserException {
+        UserImpl u = new UserImpl();
+        u.setId(id);
+        u.setGroups(new HashSet());
+        PersistentDataAccess.remove(u);
+    }
+
+    private Group createOrUpdate(Group group, boolean create) throws CreationException, AgilaUserException {
+        validateGroup(group, create);
+
+        GroupImpl groupImpl = null;
+        try {
+            groupImpl = new GroupImpl();
+            groupImpl.setId(group.getId());
+            groupImpl.setName(group.getName());
+
+            groupImpl = (GroupImpl) fetchRoles(group.getRoles(), groupImpl);
+
+            groupImpl = (GroupImpl) createOrUpdatePO(groupImpl, create);
+
+        } catch (Exception e) {
+            throw new CreationException(e);
+        }
+        return groupImpl;
+    }
+
+    private void validateGroup(Group group, boolean create) throws CreationException, AgilaUserException {
+        if (group == null ||
+                group.getName() == null || group.getName().equals("") ||
+                group.getRoles() == null || group.getRoles().size() == 0) {
+            if (create) {
+                throw new CreationException("Group must have at least one role !");
+            } else {
+                throw new AgilaUserException("Group must have at least one role !");
+            }
+        }
+        if (doesGroupExist(group.getName()) == true && create) {
+            log.error("Group already exists !");
+            throw new CreationException("Group already exists !");
+        }
+    }
+
+    private User createOrUdpate(User user, boolean create) throws CreationException, AgilaUserException {
+        if (user.getGroups() == null || user.getGroups().size() == 0)
+            if (create)
+                throw new CreationException("User must have at least one group!");
+            else
+                throw new AgilaUserException("User must have at least one group!");
+
+        UserImpl userImpl = null;
+        try {
+            userImpl = new UserImpl();
+            userImpl.setId(user.getId());
+            userImpl.setName(user.getName());
+            userImpl.setPassword(user.getPassword());
+
+            if (create == true) {
+                userImpl = fetchGroups(user.getGroups(), userImpl);
+                userImpl = (UserImpl) createOrUpdatePO(userImpl, create);
+            } else {
+                userImpl = fetchGroups(user.getGroups(), userImpl);
+                userImpl = (UserImpl) createOrUpdatePO(userImpl, create);
+            }
+        } catch (Exception e) {
+            throw new CreationException(e);
+        }
+        return userImpl;
+    }
+
+    private UserImpl fetchGroups(Set groups, UserImpl userImpl) throws DBSessionException {
+        if (groups != null)
+            for (Iterator groupsIter = groups.iterator(); groupsIter.hasNext();) {
+                Group group = (GroupImpl) groupsIter.next();
+                try {
+                    GroupImpl groupImpl = (GroupImpl) PersistentDataAccess.findById(group.getId(), GroupImpl.class);
+                    userImpl.addGroup(groupImpl);
+                } catch (FinderException e) {// Should not happen
+                }
+            }
+        return userImpl;
+    }
+
+    private GroupImpl fetchRoles(Set roles, GroupImpl groupImpl) throws DBSessionException {
+        if (roles != null)
+            for (Iterator rolesIter = roles.iterator(); rolesIter.hasNext();) {
+                Role role = (Role) rolesIter.next();
+                try {
+                    RoleImpl roleImpl = (RoleImpl) PersistentDataAccess.findById(role.getId(), RoleImpl.class);
+                    groupImpl.addRole(roleImpl);
+                } catch (FinderException e) {// Should not happen
+                }
+            }
+        return groupImpl;
+    }
+
+    private Object createOrUpdatePO(Object o, boolean create) throws TransactionException, DBSessionException {
+        Object res;
+        if (create == true)
+            res = PersistentDataAccess.create(o);
+        else
+            res = PersistentDataAccess.update(o);
+        return res;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public boolean doesRoleExist(String rolename) throws AgilaUserException {
+        boolean result = true;
+        try {
+            result = UserDAO.doesRoleExist(rolename);
+        } catch (DBSessionException e) {
+            throw new AgilaUserException(e);
+        }
+        return result;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public boolean doesGroupExist(String groupname) throws AgilaUserException {
+        boolean result = true;
+        try {
+            result = UserDAO.doesGroupExist(groupname);
+        } catch (DBSessionException e) {
+            throw  new AgilaUserException(e);
+        }
+        return result;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findUsersInRole(String rolename) throws AgilaUserException {
+        Collection res = null;
+        try {
+            res = UserDAO.findUsersInRole(rolename);
+        } catch (DBSessionException e) {
+            throw  new AgilaUserException(e);
+        } catch (FinderException e) {
+            throw  new AgilaUserException(e);
+        }
+        return res;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findRolesForUser(String username) throws AgilaUserException {
+        User userByName = null;
+        try {
+            userByName = findUserByName(username);
+        } catch (FinderException e) {
+            throw new AgilaUserException(e);
+        }
+        Collection roles = getAllRoles(userByName);
+        return roles;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findRolesForUser(Long userId) throws AgilaUserException {
+        User userByName = null;
+        try {
+            userByName = findUserById(userId);
+        } catch (FinderException e) {
+            throw new AgilaUserException(e);
+        }
+        Collection roles = getAllRoles(userByName);
+        return roles;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    private Collection getAllRoles(User user) {
+        Set groups = user.getGroups();
+        Collection roles = new HashSet();
+        for (Iterator it = groups.iterator(); it.hasNext();) {
+            GroupImpl group = (GroupImpl) it.next();
+            roles.addAll(group.getRoles());
+        }
+        return roles;
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findGroupsForUser(String username) throws AgilaUserException {
+        User userByName = null;
+        try {
+            userByName = findUserByName(username);
+        } catch (FinderException e) {
+            throw new AgilaUserException(e);
+        }
+        return userByName.getGroups();
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findGroupsForUser(Long userId) throws AgilaUserException {
+        User userByName = null;
+        try {
+            userByName = findUserById(userId);
+        } catch (FinderException e) {
+            throw new AgilaUserException(e);
+        }
+        return userByName.getGroups();
+    }
+
+    /**
+     * @@org.apache.agila.bpel.engine.common.aspect.Transactional
+     */
+    public Collection findUsersInGroup(String groupname) throws AgilaUserException {
+        Collection res = null;
+        try {
+            res = UserDAO.findUsersInGroup(groupname);
+        } catch (DBSessionException e) {
+            throw  new AgilaUserException(e);
+        } catch (FinderException e) {
+            throw  new AgilaUserException(e);
+        }
+        return res;
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/GroupImpl.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/GroupImpl.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/GroupImpl.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/GroupImpl.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.priv;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.agila.bpel.user.Group;
+
+
+/**
+ * @hibernate.jcs-cache usage="read-write"
+ * @hibernate.class table="T_GROUP"
+ */
+public class GroupImpl implements Group {
+    private Long id;
+    private String name;
+//    private Set users = new HashSet();
+    private Set roles = new HashSet();
+
+    public GroupImpl() {
+        super();
+    }
+
+    /**
+     * @hibernate.id generator-class="hilo" type="long"
+     * @hibernate.generator-param name="table" value="T_GROUP_ID"
+     * @hibernate.generator-param name="column" value="NEXT_ID"
+     */
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * @hibernate.property
+     */
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String username) {
+        this.name = username;
+    }
+
+//    /**
+//     * @hibernate.set role="users" table="T_USER_GROUP" lazy="false"
+//     * @hibernate.collection-key column="GROUP_ID"
+//     * @hibernate.collection-many-to-many class="org.apache.agila.bpel.user.priv.UserImpl" column="USER_ID"
+//     */
+//    public Set getUsers() {
+//        return users;
+//    }
+//
+//    public void setUsers(Set users) {
+//        this.users = users;
+//    }
+//
+//    public void addUser(UserImpl user) {
+//        users.add(user);
+//    }
+    /**
+     * @hibernate.set role="roles" table="T_GROUP_ROLE"
+     * @hibernate.collection-key column="GROUP_ID"
+     * @hibernate.collection-many-to-many class="org.apache.agila.bpel.user.priv.RoleImpl" column="ROLE_ID"
+     */
+    public Set getRoles() {
+        return roles;
+    }
+
+    public void setRoles(Set roles) {
+            this.roles = roles;
+    }
+
+    public void addRole(RoleImpl role) {
+        this.roles.add(role);
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/RoleImpl.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/RoleImpl.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/RoleImpl.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/RoleImpl.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.priv;
+
+import org.apache.agila.bpel.user.Role;
+
+/**
+ * @hibernate.jcs-cache usage="read-write"
+ * @hibernate.class table="T_ROLE"
+ */
+public class RoleImpl implements Role {
+    private Long id;
+    private String name;
+//    private Set users;
+
+    public RoleImpl() {
+    }
+
+    /**
+     * @hibernate.id generator-class="hilo" type="long"
+     * @hibernate.generator-param name="table" value="T_ROLE_ID"
+     * @hibernate.generator-param name="column" value="NEXT_ID"
+     */
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * @hibernate.property
+     */
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String toString() {
+        return "Role : " + name;
+    }
+
+//    /**
+//     * @hibernate.set role="users" table="T_USER_ROLE" lazy="false"
+//     * @hibernate.collection-key column="ROLE_ID"
+//     * @hibernate.collection-many-to-many class="org.apache.agila.bpel.user.priv.UserImpl" column="USER_ID"
+//     */
+//    public Set getUsers() {
+//        return users;
+//    }
+//
+//    public void setUsers(Set users) {
+//        this.users = users;
+//    }
+//
+//    public void addUser(UserImpl user) {
+//        users.add(user);
+//    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserConverter.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserConverter.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserConverter.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserConverter.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.priv;
+
+import org.apache.agila.bpel.user.User;
+
+/**
+ *
+ */
+public class UserConverter {
+
+    public static UserImpl userVO2userPO(User user) {
+        UserImpl userImpl = new UserImpl();
+        userImpl.setId(user.getId());
+        userImpl.setName(user.getName());
+        userImpl.setPassword(user.getPassword());
+//        for (Iterator rolesIter = user.getRoles().iterator(); rolesIter.hasNext();) {
+//            Role role = (Role) rolesIter.next();
+//            RoleImpl roleImpl = roleVO2rolePO(role);
+//            userImpl.addRole(roleImpl);
+//        }
+        return userImpl;
+    }
+/*
+    public static RoleImpl roleVO2rolePO(Role role) {
+        RoleImpl roleImpl = new RoleImpl();
+        roleImpl.setId(role.getId());
+        roleImpl.setName(role.getName());
+        return roleImpl;
+    }
+
+    public static User userPO2userVO(UserImpl userImpl) {
+        User user = new User();
+        user.setUsername(userImpl.getName());
+        user.setPassword(userImpl.getPassword());
+        user.setRoles(rolePOs2roleVOs(userImpl.getRoles(), user));
+        return user;
+    }
+
+    public static Role rolePO2roleVO(RoleImpl roleImpl) {
+        Role role = new Role();
+        role.setRolename(roleImpl.getRolename());
+        role.setUser(userPO2userVO(roleImpl.getUser()));
+        return role;
+    }
+
+    public static Collection rolePOs2roleVOs(Collection rolePOs, User user) {
+        Collection res = new HashSet();
+        Iterator it = rolePOs.iterator();
+        while (it.hasNext()) {
+            RoleImpl roleImpl = (RoleImpl) it.next();
+            Role role = new Role();
+            role.setRolename(roleImpl.getRolename());
+            role.setUser(user);
+            res.add(role);
+        }
+        return res;
+    }
+
+    public static Collection roleVOs2rolePOs(Collection roleVOs, UserImpl userImpl) {
+        Collection res = new HashSet();
+        Iterator it = roleVOs.iterator();
+        while (it.hasNext()) {
+            Role role = (Role) it.next();
+            RoleImpl roleImpl = new RoleImpl();
+            roleImpl.setRolename(role.getRolename());
+            roleImpl.setUser(userImpl);
+            res.add(roleImpl);
+        }
+        return res;
+    }
+
+    public static Collection userPOs2userVOs(Collection userPOs) {
+        Collection res = new HashSet();
+        Iterator it = userPOs.iterator();
+        while (it.hasNext()) {
+            UserImpl userImpl = (UserImpl) it.next();
+            User user = new User();
+            user.setUsername(userImpl.getName());
+            user.setPassword(userImpl.getPassword());
+            Collection roles = rolePOs2roleVOs(userImpl.getRoles(), user);
+            user.setRoles(roles);
+            res.add(user);
+        }
+        return res;
+    }
+*/
+/*
+    public static Collection fetchRolesPO(Collection roles) throws FinderException, DBSessionException {
+        Iterator it = roles.iterator();
+        List roleNames = new ArrayList();
+        while (it.hasNext()) {
+            Role role = (Role) it.next();
+            roleNames.add(role.getRolename());
+        }
+        return UserDAO.findRolesByNames(roleNames);
+    }
+*/
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserImpl.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserImpl.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserImpl.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/UserImpl.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.priv;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.agila.bpel.user.Group;
+import org.apache.agila.bpel.user.User;
+
+/**
+ * @hibernate.jcs-cache usage="read-write"
+// * @hibernate.class table="T_USER" discriminator-value="U"
+ * @hibernate.class table="T_USER"
+// * @hibernate.discriminator column="TYPE" type="character" length="1"
+ */
+public class UserImpl implements User {
+
+    private Long id;
+    private String name;
+    private String password;
+//    private Set roles = new HashSet();
+    private Set groups = new HashSet();
+
+
+    public UserImpl() {
+    }
+
+    /**
+     * @hibernate.id generator-class="hilo" type="long"
+     * @hibernate.generator-param name="table" value="T_USER_ID"
+     * @hibernate.generator-param name="column" value="NEXT_ID"
+     */
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * @hibernate.property
+     */
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String username) {
+        this.name = username;
+    }
+
+    /**
+     * @hibernate.property
+     */
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * @hibernate.set role="groups" table="T_USER_GROUP"
+     * @hibernate.collection-key column="USER_ID"
+     * @hibernate.collection-many-to-many class="org.apache.agila.bpel.user.priv.GroupImpl" column="GROUP_ID"
+     */
+    public Set getGroups() {
+        return groups;
+    }
+
+    public void setGroups(Set groups) {
+            this.groups = groups;
+    }
+
+    public void addGroup(Group group) {
+        groups.add(group);
+    }
+
+//    /**
+//     * @hibernate.set role="roles" table="T_USER_ROLE"
+//     * @hibernate.collection-key column="USER_ID"
+//     * @hibernate.collection-many-to-many class="org.apache.agila.bpel.user.priv.RoleImpl" column="ROLE_ID"
+//     */
+//    public Set getRoles() {
+//        return roles;
+//    }
+//
+//    public void setRoles(Set roles) {
+//            this.roles = roles;
+//    }
+//
+//    public void addRole(Role role) {
+//        roles.add(role);
+//    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/dao/UserDAO.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/dao/UserDAO.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/dao/UserDAO.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/dao/UserDAO.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,284 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user.priv.dao;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Query;
+import net.sf.hibernate.Session;
+
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionManager;
+import org.apache.agila.bpel.engine.common.persistence.FinderException;
+import org.apache.agila.bpel.engine.common.persistence.PersistentDataAccess;
+import org.apache.agila.bpel.user.priv.GroupImpl;
+import org.apache.agila.bpel.user.priv.RoleImpl;
+import org.apache.agila.bpel.user.priv.UserImpl;
+
+public class UserDAO extends PersistentDataAccess {
+    private static String FIND_ROLES_BY_USERNAME =
+            "FROM org.apache.agila.bpel.user.priv.RoleImpl as role " +
+            "WHERE role.username = ?";
+
+    private static String FIND_ROLES_BY_ROLENAMES =
+            "FROM org.apache.agila.bpel.user.priv.RoleImpl as role " +
+            "WHERE role.rolename in (:roleNames)";
+
+    private static String FIND_ROLE_BY_ROLENAME =
+            "FROM org.apache.agila.bpel.user.priv.RoleImpl as role " +
+            "WHERE role.name = (:rolename)";
+
+    private static final String FIND_GROUP_BY_GROUPNAME =
+            "FROM org.apache.agila.bpel.user.priv.GroupImpl as g " +
+            "WHERE g.name = ?";
+
+    private static String FIND_USER_BY_NAME =
+            "FROM org.apache.agila.bpel.user.priv.UserImpl as user " +
+            "WHERE user.name = (:username)";
+
+    private static final String FIND_ALL_ROLENAMES =
+            "SELECT distinct role.rolename " +
+            "FROM org.apache.agila.bpel.user.priv.RoleImpl as role ";
+
+    private static final String FIND_USERS_IN_ROLE = "SELECT u FROM " +
+                        "org.apache.agila.bpel.user.priv.UserImpl as u " +
+                        "join u.groups as g " +
+                        "join g.roles as r " +
+                        "WHERE r.name=?";
+
+    private static final String FIND_USERS_IN_GROUP = "SELECT u FROM " +
+                        "org.apache.agila.bpel.user.priv.UserImpl as u " +
+                        "join u.groups as g " +
+                        "WHERE g.name=?";
+
+    private static final String FIND_GROUPS_IN_ROLE = "SELECT g FROM " +
+                        "org.apache.agila.bpel.user.priv.GroupImpl as g " +
+                        "join g.roles as r " +
+                        "WHERE r.id=?";
+
+
+    /**
+     * @deprecated
+     * @param username
+     * @return
+     * @throws DBSessionException
+     * @throws FinderException
+     */
+    public static UserImpl findUserByUsername(String username) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getDBReadSession();
+        List results = null;
+        try {
+            results = session.find(FIND_USER_BY_NAME, username, Hibernate.STRING);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        } finally{
+            DBSessionManager.closeDBReadSession(session);
+        }
+        if (results.size() == 0) {
+            throw new FinderException("User " + username + " doesn't exists !");
+        }
+        return (UserImpl) results.get(0);
+
+    }
+
+    public static UserImpl findUserByName(String username) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getDBReadSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_USER_BY_NAME, username, Hibernate.STRING);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        } finally{
+            DBSessionManager.closeDBReadSession(session);
+        }
+        if (results.size() == 0) {
+            throw new FinderException("User " + username + " doesn't exists !");
+        }
+        return (UserImpl) results.get(0);
+
+    }
+
+    public static Collection findRolesByNames(List names) throws DBSessionException{
+        Session session = DBSessionManager.getActiveSession();
+
+        List roles = null;
+        try {
+            Query byProperties = session.createQuery(FIND_ROLES_BY_ROLENAMES);
+
+            byProperties.setParameterList("roleNames", names);
+
+            roles = byProperties.list();
+        } catch (net.sf.hibernate.HibernateException e) {
+            throw new DBSessionException(e);
+        }
+
+        return roles;
+    }
+
+    public static Collection findRolesByUsername(String username) throws DBSessionException {
+        Session session = DBSessionManager.getActiveSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_ROLES_BY_USERNAME, username, Hibernate.STRING);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        }
+        return results;
+    }
+
+/*
+    public static List findAllUsers() throws DBSessionException {
+        return findAll(UserImpl.class);
+    }
+*/
+
+    public static List findAllRoles() throws DBSessionException {
+            Session session = DBSessionManager.getActiveSession();
+            List results = new ArrayList();
+            try {
+                List rolenames = session.find(FIND_ALL_ROLENAMES);
+                for (int i = 0; i < rolenames.size(); i++) {
+                    String rolename = (String) rolenames.get(i);
+                    RoleImpl role = new RoleImpl();
+                    role.setName(rolename);
+//                    role.setUsers(null);
+                    results.add(role);
+                }
+            } catch (HibernateException e) {
+                throw new DBSessionException(e);
+            }
+            return results;
+    }
+
+    public static RoleImpl findRoleByName(String rolename) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getActiveSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_ROLE_BY_ROLENAME, rolename, Hibernate.STRING);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        }
+        if (results.size() == 0) {
+            throw new FinderException("No role exists for rolename : " + rolename);
+        }
+        return (RoleImpl) results.get(0);
+
+    }
+
+    public static boolean doesRoleExist(String rolename) throws DBSessionException {
+
+        List results = null;
+        try {
+            Session session = DBSessionManager.getDBReadSession();
+            results = session.find(FIND_ROLE_BY_ROLENAME, rolename, Hibernate.STRING);
+            DBSessionManager.closeDBReadSession(session);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        }
+        if (results.size() == 0) {
+            return false;
+        }
+        return true;
+
+    }
+
+    public static boolean doesGroupExist(String groupname) throws DBSessionException {
+        try {
+            findGroupByName(groupname);
+        } catch (FinderException e) {
+            return false;
+        }
+        return true;
+    }
+
+    public static GroupImpl findGroupByName(String groupname) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getDBReadSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_GROUP_BY_GROUPNAME, groupname, Hibernate.STRING);
+            DBSessionManager.closeDBReadSession(session);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        }
+        if (results.size() == 0) {
+            throw new FinderException("No role exists for groupname : " + groupname);
+        }
+        return (GroupImpl) results.get(0);
+
+    }
+
+    public static Collection findUsersInRole(String rolename) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getDBReadSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_USERS_IN_ROLE, rolename, Hibernate.STRING);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        } finally {
+            DBSessionManager.closeDBReadSession(session);
+        }
+        if (results.size() == 0) {
+            throw new FinderException("No User exists for rolename : " + rolename);
+        }
+        return results;
+
+    }
+
+    public static Collection findGroupsInRole(Long id) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getDBReadSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_GROUPS_IN_ROLE, id, Hibernate.LONG);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        } finally {
+            DBSessionManager.closeDBReadSession(session);
+        }
+        if (results.size() == 0) {
+            throw new FinderException("No Groups exists for role : " + id);
+        }
+        return results;
+
+    }
+
+    public static Collection findUsersInGroup(String groupname) throws DBSessionException, FinderException {
+        Session session = DBSessionManager.getDBReadSession();
+
+        List results = null;
+        try {
+            results = session.find(FIND_USERS_IN_GROUP, groupname, Hibernate.STRING);
+        } catch (HibernateException e) {
+            throw new DBSessionException(e);
+        } finally {
+            DBSessionManager.closeDBReadSession(session);
+        }
+
+        if (results.size() == 0) {
+            throw new FinderException("No User exists for rolename : " + groupname);
+        }
+        return results;
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/HibernateUtil.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/HibernateUtil.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/HibernateUtil.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/HibernateUtil.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Session;
+import net.sf.hibernate.SessionFactory;
+import net.sf.hibernate.cfg.Configuration;
+
+public class HibernateUtil {
+
+    private static final SessionFactory sessionFactory;
+
+    static {
+        try {
+            sessionFactory = new Configuration().configure().buildSessionFactory();
+        } catch (HibernateException ex) {
+            throw new RuntimeException("Exception building SessionFactory: " + ex.getMessage(), ex);
+        }
+    }
+
+    public static final ThreadLocal session = new ThreadLocal();
+
+    public static Session currentSession() throws HibernateException {
+        Session s = (Session) session.get();
+        // Open a new Session, if this Thread has none yet
+        if (s == null) {
+            s = sessionFactory.openSession();
+            session.set(s);
+        }
+        return s;
+    }
+
+    public static void closeSession() throws HibernateException {
+        Session s = (Session) session.get();
+        session.set(null);
+        if (s != null)
+            s.close();
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestAgilaUserLdapImpl.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestAgilaUserLdapImpl.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestAgilaUserLdapImpl.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestAgilaUserLdapImpl.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import junit.framework.TestCase;
+
+import org.apache.agila.bpel.engine.common.lifecycle.LifecycleManager;
+
+/**
+ * LDAP has to be configurated (agila-configuration-ldap.xml),  
+ * @author grofcik
+ * @version $Id: TestAgilaUserLdapImpl.java,v 1.1 2004/12/29 14:52:39 chudikm Exp $
+ */
+public class TestAgilaUserLdapImpl extends TestCase {
+
+	AgilaUser agilaUser = null;
+
+	protected void setUp() throws Exception {
+
+		LifecycleManager.getLifecycleManager(
+				Class.class
+						.getResourceAsStream("/agila-configuration-ldap.xml"))
+				.createResources();
+		LifecycleManager.getLifecycleManager().startResources();
+
+		agilaUser = AgilaUserFactory.getAgilaUser();
+
+	}
+
+	protected void tearDown() throws Exception {
+		LifecycleManager.getLifecycleManager().stopResources();
+		LifecycleManager.getLifecycleManager().destroyResources();
+		agilaUser = null;
+	}
+
+	/*
+	 *  ROLES
+	 */
+	public void testFindAllRoles() throws Exception {
+		agilaUser.findAllRoles();
+	}
+
+	public void testFindRoleById() throws Exception {
+		Role r = agilaUser.findRoleById( new Long( "1"));
+		assertEquals("admin", r.getName());		
+	}
+
+	public void testFindRoleByName() throws Exception {
+		Role r = agilaUser.findRoleByName( "admin");
+		assertEquals( new Long(1), r.getId());
+	}
+	
+	/*
+	 * GROUPS
+	 */
+	public void testFindAllGroups() throws Exception {
+		agilaUser.findAllGroups();
+	}
+	
+	public void testFindGroupById() throws Exception {
+		Group r = agilaUser.findGroupById( new Long( "1"));
+		assertEquals("admin", r.getName());		
+	}
+
+	public void testFindGroupByName() throws Exception {
+		Group r = agilaUser.findGroupByName( "admin");
+		assertEquals( new Long(1), r.getId());
+	}
+
+	/*
+	 * USERS
+	 */
+	public void testFindAllUsers() throws Exception {
+		agilaUser.findAllUsers();
+	}
+	
+	public void testFindUserById() throws Exception {
+		User r = agilaUser.findUserById( new Long( "1"));
+		assertEquals("admin", r.getName());		
+	}
+
+	public void testFindUserByName() throws Exception {
+		User r = agilaUser.findUserByName( "admin");
+		assertEquals( new Long(1), r.getId());
+	}
+	
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestUser.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestUser.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestUser.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/TestUser.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,522 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.agila.bpel.user;
+
+import junit.framework.TestCase;
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Session;
+import net.sf.hibernate.Transaction;
+import net.sf.hibernate.cfg.Configuration;
+import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
+import org.apache.agila.bpel.engine.common.lifecycle.LifecycleManager;
+import org.apache.agila.bpel.engine.common.persistence.CreationException;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionManager;
+import org.apache.agila.bpel.user.exception.AgilaUserException;
+import org.apache.agila.bpel.user.priv.GroupImpl;
+import org.apache.agila.bpel.user.priv.RoleImpl;
+import org.apache.agila.bpel.user.priv.UserImpl;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class TestUser extends TestCase {
+
+    AgilaUser agilaUser = null;
+
+    private DBSessionManager session = null;
+
+    protected void setUp() throws Exception {
+        SchemaExport schemaExport = new SchemaExport(new Configuration().configure());
+        schemaExport.create(true, true);
+
+        LifecycleManager.getLifecycleManager().createResources();
+        LifecycleManager.getLifecycleManager().startResources();
+
+        agilaUser = AgilaUserFactory.getAgilaUser();
+
+    }
+
+    protected void tearDown() throws Exception {
+        LifecycleManager.getLifecycleManager().stopResources();
+        LifecycleManager.getLifecycleManager().destroyResources();
+        agilaUser = null;
+    }
+
+
+    public void testCreateRole() throws Exception {
+        RoleImpl role = createAdminRole();
+        agilaUser.findRoleById(role.getId());
+    }
+
+    public void testCreateExistingRole() throws Exception {
+        createAdminRole();
+        try {
+            createAdminRole();
+            fail("Should rise a CreationException");
+        } catch (CreationException e) {
+            // it's OK!
+        }
+    }
+
+    public void testUpdateRole() throws Exception {
+        RoleImpl role = createAdminRole();
+        role.setName("test");
+        Role r = agilaUser.updateRole(role);
+        r = agilaUser.findRoleById(r.getId());
+        assertEquals("role name should be equals", "test", r.getName());
+    }
+
+    public void testUpdateUnexistingRole() throws Exception {
+        RoleImpl role = new RoleImpl();
+        role.setId(new Long(-1));
+        try {
+            agilaUser.updateRole(role);
+            fail("Should rise a AgilaUserException");
+        } catch (AgilaUserException e) {
+            // it's OK!
+        }
+    }
+
+    public void testUpdateRoleWithExistingRolename() throws Exception {
+        RoleImpl role = createAdminRole();
+        try {
+            agilaUser.updateRole(role);
+            fail("Should rise a AgilaUserException");
+        } catch (AgilaUserException e) {
+            // it's OK
+        }
+    }
+
+    public void testCreateGroup() throws Exception {
+        GroupImpl group = createAdminGroup();
+        agilaUser.findGroupById(group.getId());
+    }
+
+    public void testCreateExistingGroup() throws Exception {
+        createAdminGroup();
+        try {
+            createAdminGroup();
+            fail("Should rise a CreationException");
+        } catch (CreationException e) {
+            // it's OK!
+        }
+    }
+
+    public void testUpdateGroup() throws Exception {
+        GroupImpl group = createAdminGroup();
+        group.setName("test");
+        Group g = agilaUser.updateGroup(group);
+        g = agilaUser.findGroupById(g.getId());
+        assertEquals("group name should be equals", "test", g.getName());
+    }
+
+    public void testUpdateUnexistingGroup() throws Exception {
+        GroupImpl g = new GroupImpl();
+        g.setId(new Long(-1));
+        try {
+            agilaUser.updateGroup(g);
+            fail("Should rise a AgilaUserException");
+        } catch (AgilaUserException e) {
+            // it's OK!
+        }
+    }
+
+    public void testUpdateGroupWithExistingGroupname() throws Exception {
+        GroupImpl group = createAdminGroup();
+        System.out.println(group.getName());
+        try {
+            group = (GroupImpl) agilaUser.updateGroup(group);
+            System.out.println(group.getName());
+            fail("Should rise a AgilaUserException");
+        } catch (AgilaUserException e) {
+            // it's OK
+        }
+    }
+
+
+    public void testCreateUser() throws Exception {
+//        Set adminDevGroups = new HashSet();
+//        adminDevGroups.add(adminGroup);
+//        homerUser.setGroups(adminDevGroups);
+//        agilaUser.createUser(homerUser);
+    }
+
+    public void _testCreateUser1() throws Exception {
+//        createRoles();
+//        createGroups();
+
+        Set adminDevGroups = new HashSet();
+//        adminDevGroups.add(adminGroup);
+//        adminDevGroups.add(devGroup);
+//        homerUser.setGroups(adminDevGroups);
+//        agilaUser.createUser(homerUser);
+
+        Set devGroups = new HashSet();
+//        devGroups.add(devGroup);
+//        joeUser.setGroups(devGroups);
+//        agilaUser.createUser(joeUser);
+
+        Collection usersRoles = agilaUser.findRolesForUser("homerUser");
+        for (Iterator it = usersRoles.iterator(); it.hasNext();) {
+            RoleImpl role = (RoleImpl) it.next();
+            System.out.println(role);
+        }
+
+        System.out.println("");
+        usersRoles = agilaUser.findRolesForUser("joeUser");
+        for (Iterator it = usersRoles.iterator(); it.hasNext();) {
+            RoleImpl role = (RoleImpl) it.next();
+            System.out.println(role);
+        }
+
+        Collection usersInGroup = null;
+        usersInGroup = agilaUser.findUsersInGroup("devGroup");
+        for (Iterator it = usersInGroup.iterator(); it.hasNext();) {
+            UserImpl user = (UserImpl) it.next();
+            System.out.println(user.getName());
+        }
+
+        Collection usersInRole = null;
+        usersInRole = agilaUser.findUsersInRole("adminRole");
+        for (Iterator it = usersInRole.iterator(); it.hasNext();) {
+            UserImpl user = (UserImpl) it.next();
+            System.out.println(user.getName());
+        }
+
+        Collection usersInRole1 = null;
+        usersInRole1 = agilaUser.findUsersInRole("devRole");
+        for (Iterator it = usersInRole1.iterator(); it.hasNext();) {
+            UserImpl user = (UserImpl) it.next();
+            System.out.println(user.getName());
+        }
+
+//        agilaUser.deleteRole(devRole);
+    }
+
+    private GroupImpl createGroup(String groupName, Set roles) throws Exception {
+        GroupImpl group = null;
+        group = new GroupImpl();
+        group.setName(groupName);
+
+        group.setRoles(roles);
+        group = (GroupImpl) agilaUser.createGroup(group);
+        return group;
+
+    }
+
+    private GroupImpl createAdminGroup() throws Exception {
+        Set adminRole = new HashSet();
+        adminRole.add(createAdminRole());
+        return createGroup("adminGroup", adminRole);
+
+    }
+
+    private GroupImpl createDevGroup() throws Exception {
+        Set devRoles = new HashSet();
+        devRoles.add(createDevRole());
+        return createGroup("devGroup", devRoles);
+    }
+
+    private GroupImpl createManagerGroup() throws Exception {
+        Set devManagerRoles = new HashSet();
+        devManagerRoles.add(createDevRole());
+        devManagerRoles.add(createManagerRole());
+        return createGroup("managerGroup", devManagerRoles);
+    }
+
+    private RoleImpl createRole(String rolename) throws Exception {
+        RoleImpl role = null;
+        role = new RoleImpl();
+        role.setName(rolename);
+        role = (RoleImpl) agilaUser.createRole(role);
+        return role;
+    }
+
+    private RoleImpl createAdminRole() throws Exception {
+        return createRole("adminRole");
+    }
+
+    private RoleImpl createDevRole() throws Exception {
+        return createRole("devRole");
+    }
+
+    private RoleImpl createManagerRole() throws Exception {
+        return createRole("managerRole");
+    }
+
+//    public void _testFindUserByName() throws Exception {
+//        adminRole = (RoleImpl) agilaUser.createRole(adminRole);
+//        Set rs = new HashSet();
+//        rs.add(adminRole);
+//        homerUser.setRoles(rs);
+//        agilaUser.createUser(homerUser);
+//        agilaUser.findUserByUsername("fred");
+//    }
+
+//    public void _testCreateRole() throws Exception {
+//        agilaUser.createRole(adminRole);
+//    }
+//
+//    public void _testCreateRoleBis() throws Exception {
+//        try {
+//            agilaUser.createRole(adminRole);
+//            agilaUser.createRole(adminRole);
+//            fail("should rise an exception");
+//        } catch (CreationException e) {
+//             it's OK
+//        }
+//    }
+
+//    public void _testAB() throws Exception {
+//        RoleImpl admin = new RoleImpl();
+//        admin.setName("admin");
+//        create(admin);
+//
+//        RoleImpl manager = new RoleImpl();
+//        manager.setName("manager");
+//        create(manager);
+//
+//        RoleImpl dev = new RoleImpl();
+//        dev.setName("dev");
+//        create(dev);
+//
+//        GroupImpl agila = new GroupImpl();
+//        agila.setName("agila");
+//        agila.setPassword("agila");
+//        Set roles = new HashSet();
+//        roles.add(dev);
+//        agila.setRoles(roles);
+//        create(agila);
+//
+//        UserImpl fred = new UserImpl();
+//        fred.setName("fred");
+//        fred.setPassword("fred");
+//        Set groups = new HashSet();
+//        groups.add(agila);
+//        fred.setGroups(groups);
+//        Set rs = new HashSet();
+//        rs.add(admin);
+//        rs.add(dev);
+//        fred.setRoles(rs);
+//        create(fred);
+
+//        RoleImpl r = new RoleImpl();
+//        r.setId(dev.getId());
+//        delete(r);
+//    }
+
+    private void delete(Object o) throws HibernateException {
+        Session sess = HibernateUtil.currentSession();
+        Transaction tx = sess.beginTransaction();
+        sess.delete(o);
+        tx.commit();
+        HibernateUtil.closeSession();
+    }
+
+    private void create(Object o) throws HibernateException {
+        Session sess = HibernateUtil.currentSession();
+        Transaction tx = sess.beginTransaction();
+        sess.save(o);
+        tx.commit();
+        HibernateUtil.closeSession();
+    }
+
+    private void update(Object o) throws HibernateException {
+        Session sess = HibernateUtil.currentSession();
+        Transaction tx = sess.beginTransaction();
+        sess.update(o);
+        tx.commit();
+        HibernateUtil.closeSession();
+    }
+//        String FIND_ROLE_BY_ROLENAME =
+//                "FROM org.apache.agila.bpel.user.priv.RoleImpl as role " +
+//                "WHERE role.name = :rolename";
+//        List results = null;
+//        results = HibernateUtil.currentSession().find(FIND_ROLE_BY_ROLENAME, "admin", Hibernate.STRING);
+//        RoleImpl r;
+//        System.out.println(r=(RoleImpl) results.get(0));
+//        rs = r.getUsers();
+//        for (Iterator it = rs.iterator(); it.hasNext();) {
+//            UserImpl user = (UserImpl) it.next();
+//            System.out.println(user);
+//        }
+
+//        fred.setGroups(new HashSet());
+//        fred.setId(new Long(666));
+//        rs.clear();
+//        rs.add(manager);
+//        fred.setRoles(rs);
+//        update(fred);
+
+
+/*
+    private Role createAdminRole(User user) throws Exception {
+        if (adminRole == null) {
+            Role res = new Role();
+            res.setRolename("admin");
+            res.setUser(user);
+            adminRole = res;
+        }
+        return adminRole;
+    }
+
+    private Role createManagerRole(User user) throws Exception {
+        if (managerRole == null) {
+            Role res = new Role();
+            res.setRolename("manager");
+            res.setUser(user);
+            managerRole = res;
+        }
+        return managerRole;
+    }
+
+    private Role createDeveloperRole(User user) throws Exception {
+        if (devRole == null) {
+            Role res = new Role();
+            res.setRolename("developer");
+            res.setUser(user);
+            devRole = res;
+        }
+        return devRole;
+    }
+
+    public void testAB() throws Exception {
+    }
+
+    public void testInitDB() throws Exception {
+        User user = new User();
+        user.setUsername("fred");
+        user.setPassword("fred");
+        HashSet roles = new HashSet();
+        roles.add(createAdminRole(user));
+        roles.add(createManagerRole(user));
+        roles.add(createDeveloperRole(user));
+        user.setRoles(roles);
+        agilaUser.createUser(user);
+        user = new User();
+        user.setUsername("matt");
+        user.setPassword("matt");
+        roles = new HashSet();
+        roles.add(createAdminRole(user));
+        roles.add(createManagerRole(user));
+        roles.add(createDeveloperRole(user));
+        user.setRoles(roles);
+        agilaUser.createUser(user);
+    }
+
+    public void testFindAllUsers() throws Exception {
+        testInitDB();
+        Collection users = agilaUser.findAllUsers();
+        for (Iterator it = users.iterator(); it.hasNext();) {
+            User user = (User) it.next();
+            System.out.println(user);
+        }
+    }
+
+    public void testCreateUserWithoutRole() throws Exception {
+        User user1 = new User();
+        user1.setUsername("user1");
+        user1.setPassword("password1");
+        try {
+            agilaUser.createUser(user1);
+            fail("Should throw CreationException");
+        } catch (CreationException e) {
+        }
+    }
+
+    public void testCreateUser() throws Exception {
+        User user1 = new User();
+        user1.setUsername("user1");
+        user1.setPassword("password1");
+        HashSet roles = new HashSet();
+        roles.add(createAdminRole(user1));
+        roles.add(createDeveloperRole(user1));
+        user1.setRoles(roles);
+        User createdUser = agilaUser.createUser(user1);
+        assertTrue("invalid username", createdUser.getName().equals("user1"));
+        assertTrue("invalid password", createdUser.getPassword().equals("password1"));
+        assertTrue("The 2 collections of roles are different", createdUser.getRoles().equals(roles));
+    }
+
+    public void testFindUserByUsername() throws Exception {
+        User user1 = new User();
+        user1.setUsername("user1");
+        user1.setPassword("password1");
+        HashSet roles = new HashSet();
+        roles.add(createAdminRole(user1));
+        roles.add(createDeveloperRole(user1));
+        user1.setRoles(roles);
+        agilaUser.createUser(user1);
+        User user2 = agilaUser.findUserByUsername("user1");
+        assertTrue("invalid username", user2.getName().equals("user1"));
+        assertTrue("invalid password", user2.getPassword().equals("password1"));
+//        assertEquals("users are different", user1, user2);
+    }
+
+    public void testCreateUserAlreadyExists() throws Exception {
+        User user1 = new User();
+        user1.setUsername("user1");
+        user1.setPassword("password1");
+        HashSet roles = new HashSet();
+        roles.add(createAdminRole(user1));
+        user1.setRoles(roles);
+        agilaUser.createUser(user1);
+        try {
+            agilaUser.createUser(user1);
+            fail("Should throw CreationException");
+        } catch (CreationException e) {
+        }
+    }
+
+//    public void testFindUsersInRole() throws Exception {
+//        User user1 = new User();
+//        user1.setName("user1");
+//        user1.setPassword("password1");
+//        HashSet roles = new HashSet();
+//        Role adminRole = createAdminRole(user1);
+//        Role mgrRole = createManagerRole(user1);
+//        roles.add(adminRole);
+//        roles.add(mgrRole);
+//        adminRole.setUser(user1);
+//        mgrRole.setUser(user1);
+//        user1.setRoles(roles);
+//        agilaUser.createUser(user1);
+//
+//        User user2 = new User();
+//        user2.setName("user2");
+//        user2.setPassword("password2");
+//        HashSet roles2 = new HashSet();
+//        Role adminRole2 = createAdminRole(user2);
+//        Role devRole2 = createDeveloperRole(user2);
+//        roles2.add(adminRole2);
+//        roles2.add(devRole2);
+//        adminRole2.setUser(user2);
+//        devRole2.setUser(user2);
+//        user2.setRoles(roles2);
+//        agilaUser.createUser(user2);
+//
+//        Collection usersInAdmin = agilaUser.findUsersInRole("admin");
+//        Collection usersInDeveloper = agilaUser.findUsersInRole("developer");
+//        Collection usersInManager = agilaUser.findUsersInRole("manager");
+//
+//        assertTrue("Size of usersInAdmin collection should be 2", usersInAdmin.size() == 2);
+//        assertTrue("Size of usersInDeveloper collection should be 1", usersInDeveloper.size() == 1);
+//        assertTrue("Size of usersInManager collection should be 1", usersInManager.size() == 1);
+//    }
+*/
+}

Added: incubator/agila/trunk/modules/bpel/engine/user/src/test/resource/agila-configuration.xml
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/user/src/test/resource/agila-configuration.xml?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/user/src/test/resource/agila-configuration.xml (added)
+++ incubator/agila/trunk/modules/bpel/engine/user/src/test/resource/agila-configuration.xml Wed Apr 27 13:27:43 2005
@@ -0,0 +1,121 @@
+<agila>
+    <lifecycle>
+        <resource>org.apache.agila.bpel.engine.common.transaction.TransactionManager</resource>
+        <resource>org.apache.agila.bpel.engine.common.event.EventManager</resource>
+        <resource>org.apache.agila.bpel.engine.priv.timer.EngineTimer</resource>
+    </lifecycle>
+    <transaction>
+        <resource>org.apache.agila.bpel.engine.common.persistence.DBSessionManager</resource>
+        <resource>org.apache.agila.bpel.engine.common.persistence.XMLSessionManager</resource>
+    </transaction>
+    <event-listeners>
+        <listener>org.apache.agila.bpel.engine.common.event.DebuggingListener</listener>
+    </event-listeners>
+    <tools>
+        <xindice>
+            <url>xmldb:xindice://localhost:8080/db</url>
+        </xindice>
+    </tools>
+    <deployer>
+        <namespaces>
+            <map remote-url="http://www.apache.org/agila/examples/loop/service/"
+                 local-url="loop-defs.xml"/>
+            <map remote-url="http://www.apache.org/agila/examples/process-defs.xml"
+                 local-url="process-defs.xml"/>
+            <map remote-url="http://www.apache.org/agila/test/flow/service/"
+                 local-url="test-flow-defs.xml"/>
+            <map remote-url="http://www.apache.org/agila/test/pick/service/"
+                 local-url="test-pick-defs.xml"/>
+            <map remote-url="http://www.apache.org/agila/test/reply/service/"
+                 local-url="test-reply-defs.xml"/>
+            <ignore>http://schemas.xmlsoap.org/ws/2003/03/business-process/</ignore>
+        </namespaces>
+    </deployer>
+    <engine>
+        <history>
+            <sent-messages>true</sent-messages>
+        </history>
+        <implementations>
+            <message-broker impl="org.apache.agila.bpel.engine.priv.messaging.impl.DefaultMessageBrokerImpl"/>
+
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Assign"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.AssignImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Empty"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.EmptyImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Flow"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.FlowImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Invoke"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.InvokeImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Pick"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.PickImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Receive"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.ReceiveImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Reply"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.ReplyImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Sequence"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.SequenceImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Scope"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.ScopeImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Switch"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.SwitchImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Terminate"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.TerminateImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Wait"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.WaitImpl"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.While"
+                impl="org.apache.agila.bpel.engine.priv.core.definition.impl.WhileImpl"/>
+
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.AssignEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.AssignECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.EmptyEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.EmptyECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.FlowEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.FlowECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.InvokeEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.InvokeECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.PickEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.PickECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.ReceiveEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.ReceiveECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.ReplyEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.ReplyECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.SequenceEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.SequenceECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.SwitchEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.SwitchECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.TerminateEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.TerminateECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.WaitEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.WaitECImpl"/>
+            <execution-context interface="org.apache.agila.bpel.engine.priv.core.dynamic.WhileEC"
+                impl="org.apache.agila.bpel.engine.priv.core.dynamic.impl.WhileECImpl"/>
+        </implementations>
+
+        <executions>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Assign"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.AssignEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Empty"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.EmptyEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Flow"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.FlowEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Invoke"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.InvokeEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Pick"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.PickEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Receive"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.ReceiveEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Reply"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.ReplyEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Sequence"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.SequenceEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Switch"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.SwitchEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Terminate"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.TerminateEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.Wait"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.WaitEC"/>
+            <activity interface="org.apache.agila.bpel.engine.priv.core.definition.While"
+                execution="org.apache.agila.bpel.engine.priv.core.dynamic.WhileEC"/>
+        </executions>
+    </engine>
+</agila>
\ No newline at end of file