[jbpm-commits] JBoss JBPM SVN: r5307 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/cfg and 10 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 16 03:24:19 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-07-16 03:24:19 -0400 (Thu, 16 Jul 2009)
New Revision: 5307

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/UserProvidedEnvironmentObject.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java
Removed:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Authentication.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/AuthenticationFilter.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WireObject.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java
Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Environment.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentFactory.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
Log:
JBPM-2417 first part of user provided authentication through service api

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Configuration.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -136,4 +136,11 @@
   public ProcessEngine buildProcessEngine() {
     return impl.buildProcessEngine();
   }
+  
+  /** provides the hibernate session factory programmatically.
+   * The hibernateSessionFactory parameter is of type Object to 
+   * prevent a dependency of the API on hibernate directly.*/
+  public Configuration setHibernateSessionFactory(Object hibernateSessionFactory){
+    return impl.setHibernateSessionFactory(hibernateSessionFactory);
+  }
 }

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -21,7 +21,9 @@
  */
 package org.jbpm.api;
 
+import java.sql.Connection;
 
+
 /** central starting point for all process engine API
  * interactions.  This is a thread safe object so it can be 
  * kept in a static member field or in JNDI or something
@@ -62,4 +64,21 @@
 
   /** retrieve and object defined in the process engine by name */
   Object get(String name);
+  
+  /** sets the authenticated user's id for the next invocation of 
+   * a service method in the same thread. 
+   * This method returns the process engine for convenient method concatenations. */
+  ProcessEngine setAuthenticatedUserId(String authenticatedUserId);
+
+  /** sets the hibernate session for the next invocation of 
+   * a service method in the same thread. 
+   * The hibernateSession parameter is of type Object to 
+   * prevent a dependency of the API on hibernate directly.
+   * This method returns the process engine for convenient method concatenations. */
+  ProcessEngine setHibernateSession(Object hibernateSession);
+
+  /** sets the hibernate session for the next invocation of 
+   * a service method in the same thread.
+   * This method returns the process engine for convenient method concatenations. */
+  ProcessEngine setJdbcConnection(Connection jdbcConnection);
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/JbpmConfiguration.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -24,6 +24,8 @@
 import java.io.File;
 import java.io.InputStream;
 import java.net.URL;
+import java.sql.Connection;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
@@ -41,7 +43,7 @@
 import org.jbpm.pvm.internal.env.EnvironmentFactory;
 import org.jbpm.pvm.internal.env.JbpmConfigurationParser;
 import org.jbpm.pvm.internal.env.PvmEnvironment;
-import org.jbpm.pvm.internal.env.WireObject;
+import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
 import org.jbpm.pvm.internal.stream.FileStreamInput;
 import org.jbpm.pvm.internal.stream.InputStreamInput;
 import org.jbpm.pvm.internal.stream.ResourceStreamInput;
@@ -90,7 +92,10 @@
   protected boolean isConfigured = false;
   protected WireContext processEngineWireContext = new WireContext(new WireDefinition(), Context.CONTEXTNAME_PROCESS_ENGINE);
   protected WireDefinition transactionWireDefinition = new WireDefinition();
-
+  
+  protected ThreadLocal<List<UserProvidedEnvironmentObject>> userProvidedEnvironmentObjectsThreadLocal = new ThreadLocal<List<UserProvidedEnvironmentObject>>();
+  protected ThreadLocal<String> authenticatedUserIdThreadLocal = new ThreadLocal<String>();
+  
   public JbpmConfiguration() {
     super((Configuration)null);
   }
@@ -122,10 +127,11 @@
     return this;
   }
 
-  public void setSessionFactory(Object sessionFactory) {
+  public Configuration setHibernateSessionFactory(Object hibernateSessionFactory) {
     processEngineWireContext
         .getWireDefinition()
-        .addDescriptor(new ProvidedObjectDescriptor(sessionFactory, true));
+        .addDescriptor(new ProvidedObjectDescriptor(hibernateSessionFactory, true));
+    return this;
   }
 
   public Configuration setInputStream(InputStream inputStream) {
@@ -189,32 +195,28 @@
     return processEngineWireContext.get(RepositoryService.class);
   }
 
-
   public Environment openEnvironment() {
-    return openEnvironment(null);
-  }
-  
-  public Environment openEnvironment(List<WireObject> txWireObjects) {
     PvmEnvironment environment = new PvmEnvironment(this);
 
     if (log.isTraceEnabled()) log.trace("opening " + environment);
 
-    // set the classloader
-    ClassLoader classLoader = processEngineWireContext.getClassLoader();
-    if (classLoader != null) {
-      environment.setClassLoader(classLoader);
-    }
+    installAuthenticatedUserId(environment);
+    installProcessEngineContext(environment);
+    installTransactionContext(environment);
 
-    // add the process-engine context
-    environment.setContext(processEngineWireContext);
+    return environment;
+  }
 
-    // add the transaction context
-    WireDefinition usedWireDefinition = transactionWireDefinition;
-    if (txWireObjects!=null) {
-      usedWireDefinition = new WireDefinition(transactionWireDefinition, txWireObjects);
+  protected void installAuthenticatedUserId(Environment environment) {
+    String authenticatedUserId = authenticatedUserIdThreadLocal.get();
+    if (authenticatedUserId!=null) {
+      environment.setAuthenticatedUserId(authenticatedUserId);
+      authenticatedUserIdThreadLocal.set(null);
     }
-    
-    WireContext transactionContext = new WireContext(usedWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
+  }
+
+  protected void installTransactionContext(PvmEnvironment environment) {
+    WireContext transactionContext = new WireContext(transactionWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
     // add the environment block context to the environment
     environment.setContext(transactionContext);
 
@@ -227,9 +229,11 @@
       Environment.popEnvironment();
       throw e;
     }
+  }
 
-    // if all went well, return the created environment
-    return environment;
+  protected void installProcessEngineContext(PvmEnvironment environment) {
+    // add the process-engine context
+    environment.setContext(processEngineWireContext);
   }
 
   public void close() {
@@ -285,4 +289,28 @@
   public WireDefinition getTransactionWireDefinition() {
     return transactionWireDefinition;
   }
+
+  public ProcessEngine setAuthenticatedUserId(String authenticatedUserId) {
+    authenticatedUserIdThreadLocal.set(authenticatedUserId);
+    return this;
+  }
+
+  public ProcessEngine setHibernateSession(Object hibernateSession) {
+    addUserProvidedEnvironmentObject(new UserProvidedEnvironmentObject(hibernateSession, null, true));
+    return this;
+  }
+
+  public ProcessEngine setJdbcConnection(Connection jdbcConnection) {
+    addUserProvidedEnvironmentObject(new UserProvidedEnvironmentObject(jdbcConnection, null, true));
+    return this;
+  }
+
+  protected synchronized void addUserProvidedEnvironmentObject(UserProvidedEnvironmentObject userProvidedEnvironmentObject) {
+    List<UserProvidedEnvironmentObject> environmentObjects = userProvidedEnvironmentObjectsThreadLocal.get();
+    if (environmentObjects==null) {
+      environmentObjects = new ArrayList<UserProvidedEnvironmentObject>();
+      userProvidedEnvironmentObjectsThreadLocal.set(environmentObjects);
+    }
+    environmentObjects.add(userProvidedEnvironmentObject);
+  }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/SpringConfiguration.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -25,12 +25,13 @@
 import java.util.List;
 
 import org.jbpm.api.ProcessEngine;
+import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.env.Context;
 import org.jbpm.pvm.internal.env.Environment;
 import org.jbpm.pvm.internal.env.EnvironmentFactory;
 import org.jbpm.pvm.internal.env.PvmEnvironment;
 import org.jbpm.pvm.internal.env.SpringContext;
-import org.jbpm.pvm.internal.env.WireObject;
+import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.WireDefinition;
 import org.springframework.context.ApplicationContext;
@@ -46,122 +47,89 @@
  * 
  * @author Andries Inze
  */
-public class SpringConfiguration extends JbpmConfiguration implements
-        EnvironmentFactory, ProcessEngine, ApplicationContextAware {
+public class SpringConfiguration extends JbpmConfiguration implements EnvironmentFactory, ProcessEngine, ApplicationContextAware {
 
-    private static final long serialVersionUID = 1L;
+  private static final Log log = Log.getLog(SpringConfiguration.class.getName());
+  
+  private static final long serialVersionUID = 1L;
 
-    private ApplicationContext applicationContext;
+  private ApplicationContext applicationContext;
 
-    private String jbpmConfigurationLocation;
+  private String jbpmConfigurationLocation;
 
-    /**
-     * Instantiates a new spring configuration.
-     */
-    public SpringConfiguration(String jbpmConfigurationLocation) {
-        try {
-            super.setInputStream(new ClassPathResource(
-                    jbpmConfigurationLocation).getInputStream());
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
+  /**
+   * Instantiates a new spring configuration.
+   */
+  public SpringConfiguration(String jbpmConfigurationLocation) {
+    try {
+      super.setInputStream(new ClassPathResource(jbpmConfigurationLocation).getInputStream());
+    } catch (IOException e) {
+      throw new RuntimeException(e);
     }
+  }
 
-    public SpringConfiguration() {
-        // By jbpmTestCase
-    }
+  public SpringConfiguration() {
+    // By jbpmTestCase
+  }
 
-    @Override
-    public ProcessEngine buildProcessEngine() {
-        if (applicationContext == null) {
-            applicationContext = new ClassPathXmlApplicationContext(System
-                    .getProperty("jbpm.test.cfg.applicationContext"));
-        }
-
-        return super.buildProcessEngine();
+  @Override
+  public ProcessEngine buildProcessEngine() {
+    if (applicationContext == null) {
+      applicationContext = new ClassPathXmlApplicationContext(System.getProperty("jbpm.test.cfg.applicationContext"));
     }
 
-    /**
-     * {@inheritDoc)
+    return super.buildProcessEngine();
+  }
 
-     */
-    @Override
-    public Environment openEnvironment(List<WireObject> txWireObjects) {
+  public Environment openEnvironment() {
+    PvmEnvironment environment = new PvmEnvironment(this);
 
-        PvmEnvironment environment = new PvmEnvironment(this);
+    if (log.isTraceEnabled())
+      log.trace("opening jbpm-spring" + environment);
 
-        // FIXME: All beneath should be a super call
+    environment.setContext(new SpringContext(applicationContext));
 
-        // set the classloader
-        ClassLoader classLoader = processEngineWireContext.getClassLoader();
-        if (classLoader != null) {
-            environment.setClassLoader(classLoader);
-        }
+    installAuthenticatedUserId(environment);
+    installProcessEngineContext(environment);
+    installTransactionContext(environment);
 
-        // add the process-engine context
-        environment.setContext(new SpringContext(applicationContext));
-        environment.setContext(processEngineWireContext);
+    return environment;
+  }
 
-        // add the transaction context
-        WireDefinition usedWireDefinition = transactionWireDefinition;
-        if (txWireObjects != null) {
-            usedWireDefinition = new WireDefinition(transactionWireDefinition,
-                    txWireObjects);
-        }
-
-        WireContext transactionContext = new WireContext(usedWireDefinition,
-                Context.CONTEXTNAME_TRANSACTION, environment, true);
-        // add the environment block context to the environment
-        environment.setContext(transactionContext);
-
-        Environment.pushEnvironment(environment);
-        try {
-            // finish the creation of the environment wire context
-            transactionContext.create();
-
-        } catch (RuntimeException e) {
-            Environment.popEnvironment();
-            throw e;
-        }
-
-        // if all went well, return the created environment
-        return environment;
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T> T get(Class<T> type) {
+    String[] names = applicationContext.getBeanNamesForType(type);
+    if (names.length == 1) {
+      return (T) applicationContext.getBean(names[0]);
     }
 
-    @SuppressWarnings("unchecked")
-    @Override
-    public <T> T get(Class<T> type) {
-        String[] names = applicationContext.getBeanNamesForType(type);
-        if (names.length == 1) {
-            return (T) applicationContext.getBean(names[0]);
-        }
+    return super.get(type);
+  }
 
-        return super.get(type);
+  @Override
+  public Object get(String key) {
+    if (applicationContext.containsBean(key)) {
+      return applicationContext.getBean(key);
     }
 
-    @Override
-    public Object get(String key) {
-        if (applicationContext.containsBean(key)) {
-            return applicationContext.getBean(key);
-        }
+    return super.get(key);
+  }
 
-        return super.get(key);
-    }
+  /**
+   * {@inheritDoc)
 
-    /**
-     * {@inheritDoc)
+   */
+  public void setApplicationContext(ApplicationContext applicationContext) {
+    this.applicationContext = applicationContext;
+  }
 
-     */
-    public void setApplicationContext(ApplicationContext applicationContext) {
-        this.applicationContext = applicationContext;
-    }
-
-    /**
-     * Gets the application context.
-     * 
-     * @return the application context
-     */
-    public ApplicationContext getApplicationContext() {
-        return applicationContext;
-    }
+  /**
+   * Gets the application context.
+   * 
+   * @return the application context
+   */
+  public ApplicationContext getApplicationContext() {
+    return applicationContext;
+  }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AbstractCommand.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -21,10 +21,7 @@
  */
 package org.jbpm.pvm.internal.cmd;
 
-import java.util.List;
 
-import org.jbpm.pvm.internal.env.WireObject;
-
 /**
  * @author Tom Baeyens
  */
@@ -32,13 +29,14 @@
   
   private static final long serialVersionUID = 1L;
 
-  protected List<WireObject> txWireObjects;
+  String authenticatedUserId;
 
-  public List<WireObject> getTxWireObjects() {
-    return txWireObjects;
+  
+  public String getAuthenticatedUserId() {
+    return authenticatedUserId;
   }
   
-  public void setTxWireObjects(List<WireObject> txWireObjects) {
-    this.txWireObjects = txWireObjects;
+  public void setAuthenticatedUserId(String authenticatedUserId) {
+    this.authenticatedUserId = authenticatedUserId;
   }
 }

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Authentication.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Authentication.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Authentication.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.env;
-
-/** knows how to get the userId (String) of the currently authenticated user.
- * @author Tom Baeyens */
-public class Authentication {
-  
-  static final ThreadLocal<String> userIdThreadLocal = new ThreadLocal<String>();
-  
-  public String getUserId() {
-    return userIdThreadLocal.get();
-  }
-
-  public static void setUserId(String userId) {
-    userIdThreadLocal.set(userId);
-  }
-}

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/AuthenticationFilter.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/AuthenticationFilter.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/AuthenticationFilter.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.env;
-
-import java.io.IOException;
-import java.security.Principal;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AuthenticationFilter implements Filter {
-
-  public void init(FilterConfig filterConfig) throws ServletException {
-  }
-
-  public void destroy() {
-  }
-
-  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
-    HttpServletRequest httpRequest = (HttpServletRequest)request;
-    Principal userPrincipal = httpRequest.getUserPrincipal();
-    if (userPrincipal!=null) {
-      String userId = userPrincipal.getName();
-      Authentication.setUserId(userId);
-      try {
-        chain.doFilter(request, response);
-      } finally {
-        Authentication.setUserId(null);
-      }
-    } else {
-      chain.doFilter(request, response);
-    }
-  }
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -38,7 +38,7 @@
   
   private static final Log log = Log.getLog(BasicEnvironment.class.getName()); 
 
-  protected String userId;
+  protected String authenticatedUserId;
   protected Map<String, Context> contexts;
   protected ArrayList<String> defaultSearchOrderList;
   protected String[] defaultSearchOrder;
@@ -87,27 +87,14 @@
     return getContext(Context.CONTEXTNAME_TRANSACTION);
   }
 
-  // userId methods ///////////////////////////////////////////////////////////
+  // authenticatedUserId //////////////////////////////////////////////////////
   
-  public String getUserId() {
-    // if the authenticated user was explicitely set
-    if (userId!=null) {
-      // return that one
-      return userId;
-    }
-    
-    // if an Authentication was specified
-    Authentication authentication = get(Authentication.class);
-    if (authentication!=null) {
-      // let the authentication do the work
-      return authentication.getUserId();
-    }
-
-    return null; 
+  public String getAuthenticatedUserId() {
+    return authenticatedUserId;
   }
   
-  public void setUserId(String userId) {
-    this.userId = userId;
+  public void setAuthenticatedUserId(String authenticatedUserId) {
+    this.authenticatedUserId = authenticatedUserId;
   }
 
   // classloader methods //////////////////////////////////////////////////////
@@ -115,6 +102,7 @@
   public ClassLoader getClassLoader() {
     return classLoader;
   }
+  
   public void setClassLoader(ClassLoader classLoader) {
     this.classLoader = classLoader;
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Environment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Environment.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/Environment.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -155,10 +155,10 @@
   public abstract <T> T get(Class<T> type, String[] searchOrder);
 
   /** get the authenticated user id */
-  public abstract String getUserId();
+  public abstract String getAuthenticatedUserId();
   
   /** set the authenticated user id */
-  public abstract void setUserId(String userId);
+  public abstract void setAuthenticatedUserId(String authenticatedUserId);
 
   /**
    * closes the Environment by removing all its contexts.

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentFactory.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentFactory.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -57,14 +57,6 @@
   Environment openEnvironment();
   
   /**
-   * open a new Environment and pass in a list of objects
-   * that must be placed/exposed in the transaction context.  
-   * The client is responsible for 
-   * closing the environment with {@link Environment#close()}.
-   */
-  Environment openEnvironment(List<WireObject> txWireObjects);
-  
-  /**
    * closes this environment factory and cleans any allocated 
    * resources.
    */

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/ProvidedAuthentication.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.env;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProvidedAuthentication extends Authentication {
-
-  protected String userId;
-
-  public ProvidedAuthentication(String userId) {
-    this.userId = userId;
-  }
-
-  public String getUserId() {
-    return userId;
-  }
-}

Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/UserProvidedEnvironmentObject.java (from rev 5297, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WireObject.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/UserProvidedEnvironmentObject.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/UserProvidedEnvironmentObject.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.env;
+
+import org.jbpm.api.JbpmException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserProvidedEnvironmentObject {
+
+  protected String name;
+  protected Object object;
+  protected boolean isTypeExposed;
+  
+  public UserProvidedEnvironmentObject(Object object) {
+    this(object, null, true);
+  }
+
+  public UserProvidedEnvironmentObject(Object object, String name) {
+    this(object, null, true);
+  }
+
+  public UserProvidedEnvironmentObject(Object object, String name, boolean isTypeExposed) {
+    if (object==null) {
+      throw new JbpmException("object is null");
+    }
+    this.object = object;
+    this.isTypeExposed = isTypeExposed;
+    this.name = name;
+  }
+
+  public String getName() {
+    return name;
+  }
+  public Object getObject() {
+    return object;
+  }
+  public boolean isTypeExposed() {
+    return isTypeExposed;
+  }
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/UserProvidedEnvironmentObject.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WireObject.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WireObject.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/WireObject.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.env;
-
-import org.jbpm.api.JbpmException;
-
-
-/**
- * @author Tom Baeyens
- */
-public class WireObject {
-
-  protected String name;
-  protected Object object;
-  protected boolean isTypeExposed;
-  
-  public WireObject(Object object) {
-    this(object, null, true);
-  }
-
-  public WireObject(Object object, String name) {
-    this(object, null, true);
-  }
-
-  public WireObject(Object object, String name, boolean isTypeExposed) {
-    if (object==null) {
-      throw new JbpmException("object is null");
-    }
-    this.object = object;
-    this.isTypeExposed = isTypeExposed;
-    this.name = name;
-  }
-
-  public String getName() {
-    return name;
-  }
-  public Object getObject() {
-    return object;
-  }
-  public boolean isTypeExposed() {
-    return isTypeExposed;
-  }
-}

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/history/model/HistoryDetailImpl.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -59,7 +59,7 @@
     
     Environment environment = Environment.getCurrent();
     if (environment!=null) {
-      this.userId = environment.getUserId();
+      this.userId = environment.getAuthenticatedUserId();
     }
   }
   

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AbstractServiceImpl.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -21,14 +21,7 @@
  */
 package org.jbpm.pvm.internal.svc;
 
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.cmd.AbstractCommand;
 import org.jbpm.pvm.internal.cmd.CommandService;
-import org.jbpm.pvm.internal.env.ProvidedAuthentication;
-import org.jbpm.pvm.internal.env.WireObject;
 
 
 /**
@@ -37,7 +30,6 @@
 public class AbstractServiceImpl {
   
   protected CommandService commandService;
-  protected ThreadLocal<List<WireObject>> contextThreadLocal;
 
   public CommandService getCommandService() {
     return commandService;
@@ -46,31 +38,4 @@
   public void setCommandService(CommandService commandService) {
     this.commandService = commandService;
   }
-
-  public void setUserId(String userId) {
-    addTxWireObject(new WireObject(new ProvidedAuthentication(userId)));
-  }
-
-  public void setConnection(Connection connection) {
-    addTxWireObject(new WireObject(connection));
-  }
-
-  protected synchronized void addTxWireObject(WireObject wireObject) {
-    if (contextThreadLocal==null) {
-      contextThreadLocal = new ThreadLocal<List<WireObject>>();
-    }
-    List<WireObject> txWireObjects = contextThreadLocal.get();
-    if (txWireObjects==null) {
-      txWireObjects = new ArrayList<WireObject>();
-      contextThreadLocal.set(txWireObjects);
-    }
-    txWireObjects.add(wireObject);
-  }
-  
-  protected void addTxWireObjects(AbstractCommand cmd) {
-    if (contextThreadLocal!=null) {
-      cmd.setTxWireObjects(contextThreadLocal.get());
-      contextThreadLocal.set(null);
-    }
-  }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -51,14 +51,14 @@
     execution.setState(Execution.STATE_ACTIVE_ROOT);
 
     if (userId!=null) {
-      environment.setUserId(userId);
+      environment.setAuthenticatedUserId(userId);
     }
     try {
       CommandService commandService = environment.get(CommandService.class);
       commandService.execute(command);
     } finally {
       if (userId!=null) {
-        environment.setUserId(null);
+        environment.setAuthenticatedUserId(null);
       }
     }
     return null;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandService.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -44,7 +44,7 @@
     if (messageSession==null) {
       throw new JbpmException("no message session for executing command asynchronously");
     }
-    String userId = (propagateUserId ? environment.getUserId() : null);
+    String userId = (propagateUserId ? environment.getAuthenticatedUserId() : null);
     messageSession.send(new AsyncCommandMessage(command, userId));
     return null;
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -21,13 +21,12 @@
  */
 package org.jbpm.pvm.internal.svc;
 
-import java.util.List;
-
-import org.jbpm.pvm.internal.cmd.AbstractCommand;
 import org.jbpm.pvm.internal.cmd.Command;
+import org.jbpm.pvm.internal.env.Context;
 import org.jbpm.pvm.internal.env.Environment;
 import org.jbpm.pvm.internal.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.env.WireObject;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
 
 
 /** sets up an environment around the execution of the command.
@@ -41,16 +40,9 @@
   public <T> T execute(Command<T> command) {
     Environment environment;
     
-    if (command instanceof AbstractCommand) {
-      AbstractCommand abstractCommand = (AbstractCommand) command;
-      List<WireObject> txWireObjects = abstractCommand.getTxWireObjects();
-      environment = environmentFactory.openEnvironment(txWireObjects);
-
-    } else {
-      environment = environmentFactory.openEnvironment();
-    }
-    
+    environment = environmentFactory.openEnvironment();
     try {
+      injectEnvironmentObjects(environment);
       return next.execute(command);
       
     } finally {
@@ -58,6 +50,11 @@
     }
   }
 
+  protected void injectEnvironmentObjects(Environment environment) {
+    WireContext transactionContext = (WireContext) environment.getContext(Context.CONTEXTNAME_TRANSACTION);
+    transactionContext.getWireDefinition().addDescriptor(new ProvidedObjectDescriptor());
+  }
+
   public EnvironmentFactory getEnvironmentFactory() {
     return environmentFactory;
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/WireDefinition.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -28,7 +28,7 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.jbpm.pvm.internal.env.WireObject;
+import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
 import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
 
@@ -58,7 +58,7 @@
   public WireDefinition() {
   }
 
-  public WireDefinition(WireDefinition other, List<WireObject> txWireObjects) {
+  public WireDefinition(WireDefinition other, List<UserProvidedEnvironmentObject> txWireObjects) {
     if (other.descriptors!=null) {
       this.descriptors = new HashMap<String, Descriptor>(other.descriptors);
     }
@@ -70,11 +70,11 @@
     }
     this.useTypes = other.useTypes;
     
-    for (WireObject wireObject: txWireObjects) {
+    for (UserProvidedEnvironmentObject userProvidedEnvironmentObject: txWireObjects) {
       ProvidedObjectDescriptor descriptor = new ProvidedObjectDescriptor(
-        wireObject.getObject(),
-        wireObject.isTypeExposed(),
-        wireObject.getName()
+        userProvidedEnvironmentObject.getObject(),
+        userProvidedEnvironmentObject.isTypeExposed(),
+        userProvidedEnvironmentObject.getName()
       );
       addDescriptor(descriptor);
     }

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.env.Authentication;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AuthenticationBinding extends WireDescriptorBinding {
-
-  public AuthenticationBinding() {
-    super("authentication");
-  }
-
-  public Object parse(Element element, Parse parse, Parser parser) {
-    ObjectDescriptor objectDescriptor = new ObjectDescriptor();
-    
-    objectDescriptor.setClassName(Authentication.class.getName());
-    
-    return objectDescriptor;
-  }
-}

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-07-16 07:24:19 UTC (rev 5307)
@@ -23,8 +23,6 @@
       <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
     </script-manager>
     
-    <authentication />
-
     <id-generator />
     <types resource="jbpm.variable.types.xml" />
 

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml	2009-07-16 07:24:19 UTC (rev 5307)
@@ -38,7 +38,6 @@
   <binding class="org.jbpm.pvm.internal.wire.binding.ScriptManagerBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.BusinessCalendarBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.IdGeneratorBinding" />
-  <binding class="org.jbpm.pvm.internal.wire.binding.AuthenticationBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.AddressResolverBinding"/>
   <!-- hibernate bindings -->

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.auth;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UserProvidedAuthenticationTest extends JbpmTestCase {
+
+  public void testUserProvidedAuthentication() {
+    deployJpdlXmlString(
+      "<process name='UserProvidedAuthentication'>" +
+      "  <start>" +
+      "    <transition to='t' />" +
+      "  </start>" +
+      "  <task name='t' assignee='johndoe'>" +
+      "    <transition to='s' />" +
+      "  </task>" +
+      "  <state name='s' />" +
+      "</process>"
+    );
+  
+    Execution processInstance = executionService.startProcessInstanceByKey("UserProvidedAuthentication");
+    
+    Task task = taskService.createTaskQuery()
+      .processInstanceId(processInstance.getId())
+      .uniqueResult();
+
+    processEngine.setAuthenticatedUserId("jackblack");
+    taskService.addTaskComment(task.getId(), "the lord of the ring");
+
+    task.getId();
+  }
+}


Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java	2009-07-16 07:00:37 UTC (rev 5306)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ExecutionEagerLoadingTest.java	2009-07-16 07:24:19 UTC (rev 5307)
@@ -21,8 +21,6 @@
  */
 package org.jbpm.test.execution;
 
-import java.util.HashMap;
-
 import org.jbpm.api.Execution;
 import org.jbpm.test.JbpmTestCase;
 



More information about the jbpm-commits mailing list