[jbpm-commits] JBoss JBPM SVN: r6816 - in jbpm3/branches/jbpm-3.2-soa: core/src/main/java/org/jbpm and 17 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 12 06:11:09 EST 2010


Author: alex.guizar at jboss.com
Date: 2010-11-12 06:11:07 -0500 (Fri, 12 Nov 2010)
New Revision: 6816

Added:
   jbpm3/branches/jbpm-3.2-soa/tomcat/
   jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath
   jbpm3/branches/jbpm-3.2-soa/tomcat/.project
   jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/
   jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml
Modified:
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java
   jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
   jbpm3/branches/jbpm-3.2-soa/pom.xml
   jbpm3/branches/jbpm-3.2-soa/profiles.example.xml
Log:
JBPM-2978 support tomcat as deployment target

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmConfiguration.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -246,7 +246,7 @@
   private final String resourceName;
   private transient final ThreadLocal threadLocalContextStack = new ThreadLocalStack();
   private JobExecutor jobExecutor;
-  private boolean isClosed;
+  private volatile boolean isClosed;
 
   static class ThreadLocalStack extends ThreadLocal {
     protected Object initialValue() {
@@ -522,10 +522,10 @@
   }
 
   public void close(String jbpmContextName) {
+    // prevent configuration from being closed more than once
+    if (isClosed) return;
+
     synchronized (this) {
-      // prevent configuration from being closed more than once
-      if (isClosed) return;
-
       // stop job executor
       if (jobExecutor != null) {
         try {
@@ -568,11 +568,11 @@
 
       // release thread-local context stack
       threadLocalContextStack.set(null);
-
-      // closing service factories requires open configuration
-      isClosed = true;
     }
 
+    // closing service factories requires open configuration
+    isClosed = true;
+
     // remove from configuration cache
     if (resourceName != null) {
       synchronized (instances) {
@@ -591,7 +591,9 @@
   }
 
   static void clearInstances() {
-    instances.clear();
+    synchronized (instances) {
+      instances.clear();
+    }
   }
 
   public JbpmContext getCurrentJbpmContext() {
@@ -658,11 +660,13 @@
     getJobExecutor().start();
   }
 
-  public synchronized JobExecutor getJobExecutor() {
+  public JobExecutor getJobExecutor() {
     ensureOpen();
 
-    if (jobExecutor == null) {
-      jobExecutor = (JobExecutor) objectFactory.createObject("jbpm.job.executor");
+    synchronized (this) {
+      if (jobExecutor == null) {
+        jobExecutor = (JobExecutor) objectFactory.createObject("jbpm.job.executor");
+      }
     }
     return jobExecutor;
   }

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/JbpmContext.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -142,12 +142,10 @@
     if (isClosed) return;
 
     RuntimeException saveException = autoSave();
-    if (saveException != null) {
-      closeServices();
-      throw saveException;
-    }
-
     RuntimeException serviceException = closeServices();
+    isClosed = true;
+
+    if (saveException != null) throw saveException;
     if (serviceException != null) throw serviceException;
   }
 
@@ -169,15 +167,14 @@
   private RuntimeException closeServices() {
     try {
       services.close();
+      return null;
     }
     catch (RuntimeException e) {
       return e;
     }
     finally {
-      isClosed = true;
       jbpmConfiguration.popJbpmContext(this);
     }
-    return null;
   }
 
   /**

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/executor/JobExecutorServlet.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -34,83 +34,55 @@
 import org.jbpm.JbpmConfiguration;
 
 /**
- * starts the job executor on init and closes the 
- * jbpm configuration upon destroy.  The closing of the
- * jbpm configuration will also shut down the job executor 
- * thread pool. 
- * <h1>Config parameters</h1>
+ * <p>
+ * Starts the job executor on initialization and closes the jBPM configuration on destruction.
+ * Closing the jBPM configuration also stops the job executor.
+ * </p>
+ * <h3>Servlet context parameters</h3>
  * <table border="1">
- *   <tr>
- *     <th>Name</th> 
- *     <th>Description</th> 
- *     <th>Type</th>
- *     <th>Default value</th>
- *   </tr> 
- *   <tr>
- *     <td>jbpm.configuration.resource</td>
- *     <td>resource location of the jbpm.cfg.xml</td>
- *     <td>String</td>
- *     <td>jbpm.cfg.xml</td>
- *   </tr> 
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Default value</th>
+ * </tr>
+ * <tr>
+ * <td>jbpm.configuration.resource</td>
+ * <td>classpath resource containing the jBPM configuration</td>
+ * <td>jbpm.cfg.xml</td>
+ * </tr>
  * </table>
  * 
- * <p>Configuration example:
- * <pre>
- * &lt;web-app&gt;
- *   ...
- *   &lt;servlet &gt;
- *     &lt;servlet-name>JobExecutorServlet&lt;/servlet-name>
- *     &lt;servlet-class>org.jbpm.job.executor.JobExecutorServlet&lt;/servlet-class>
- *     &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
- *   &lt;/servlet&gt;
- *   &lt;servlet-mapping &gt;
- *     &lt;servlet-name&gt;JobExecutorServlet&lt;/servlet-name&gt;
- *     &lt;url-pattern&gt;/jobexecutor&lt;/url-pattern&gt;
- *   &lt;/servlet-mapping&gt;
- *   ...
- * &lt;/web-app&gt;
- * </pre>
- * </p>
  * @deprecated Replaced by {@link org.jbpm.web.JobExecutorLauncher}
  */
 public class JobExecutorServlet extends HttpServlet {
 
   private static final long serialVersionUID = 1L;
-  
-  JbpmConfiguration jbpmConfiguration;
-  
+
+  private JbpmConfiguration jbpmConfiguration;
+
   public void init() throws ServletException {
-    String configurationName = getInitParameter("jbpm.configuration.resource", null);
+    String configurationName = getServletContext().getInitParameter("jbpm.configuration.resource");
     jbpmConfiguration = JbpmConfiguration.getInstance(configurationName);
     jbpmConfiguration.startJobExecutor();
   }
-  
-  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+  protected void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
     PrintWriter out = response.getWriter();
     out.println("<html>");
+    out.println("<head><title>jBPM Job Executor</title></head>");
     out.println("<body>");
-    out.println("<h2>JBoss jBPM Scheduler Servlet</h2><hr />");
+    out.println("<h3>jBPM Job Executor</h3><hr />");
     Collection threads = jbpmConfiguration.getJobExecutor().getThreads().values();
-    Iterator iter = threads.iterator();
-    while (iter.hasNext()) {
+    for (Iterator iter = threads.iterator(); iter.hasNext();) {
       Thread thread = (Thread) iter.next();
-      out.println("<h4>"+thread.getName()+"</h4>");
-      out.println("<b>isAlive</b>:"+thread.isAlive());
+      out.println("<p>" + thread.getName() + "</p>");
     }
     out.println("</body>");
     out.println("</html>");
   }
 
-  String getInitParameter(String name, String defaultValue) {
-    String value = getInitParameter(name);
-    if (value!=null) {
-      return value;
-    }
-    return defaultValue;
-  }
-  
-  public void destroy() { 
-    super.destroy();
+  public void destroy() {
     jbpmConfiguration.close();
   }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/CloseJbpmConfigurationServlet.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -6,44 +6,37 @@
 import org.jbpm.JbpmConfiguration;
 
 /**
- * Closes the jBPM configuration on servlet context destruction.
- * <h1>Config parameters</h1>
+ * <p>
+ * Closes the jBPM configuration on destruction.
+ * </p>
+ * <h3>Servlet context parameters</h3>
  * <table border="1">
- *   <tr>
- *     <th>Name</th> 
- *     <th>Description</th> 
- *     <th>Type</th>
- *     <th>Default value</th>
- *   </tr> 
- *   <tr>
- *     <td>jbpm.configuration.resource</td>
- *     <td>resource location of the jbpm.cfg.xml</td>
- *     <td>String</td>
- *     <td>jbpm.cfg.xml</td>
- *   </tr> 
+ * <tr>
+ * <th>Name</th>
+ * <th>Description</th>
+ * <th>Default value</th>
+ * </tr>
+ * <tr>
+ * <td>jbpm.configuration.resource</td>
+ * <td>classpath resource containing the jBPM configuration</td>
+ * <td>jbpm.cfg.xml</td>
+ * </tr>
  * </table>
+ * 
  * @deprecated Replaced by {@link org.jbpm.web.JbpmConfigurationCloser}
  */
 public class CloseJbpmConfigurationServlet extends HttpServlet {
 
   private static final long serialVersionUID = 1L;
 
-  String configurationName;
-  
+  private String configurationName;
+
   public void init() throws ServletException {
-    configurationName = getInitParameter("jbpm.configuration.resource", null);
+    configurationName = getServletContext().getInitParameter("jbpm.configuration.resource");
   }
-  
+
   public void destroy() {
     JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(configurationName);
     jbpmConfiguration.close();
   }
-
-  String getInitParameter(String name, String defaultValue) {
-    String value = getInitParameter(name);
-    if (value!=null) {
-      return value;
-    }
-    return defaultValue;
-  }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmConfigurationCloser.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -30,7 +30,7 @@
  * <p>
  * Closes the jBPM configuration on servlet context destruction.
  * </p>
- * <h3>Configuration</h3> Servlet context initialization parameters
+ * <h3>Servlet context parameters</h3>
  * <table border="1">
  * <tr>
  * <th>Name</th>
@@ -39,7 +39,7 @@
  * </tr>
  * <tr>
  * <td>jbpm.configuration.resource</td>
- * <td>name of classpath resource containing the configuration</td>
+ * <td>classpath resource containing the jBPM configuration</td>
  * <td>jbpm.cfg.xml</td>
  * </tr>
  * </table>
@@ -51,8 +51,7 @@
   private JbpmConfiguration jbpmConfiguration;
 
   public void contextInitialized(ServletContextEvent event) {
-    String resource = event.getServletContext()
-        .getInitParameter("jbpm.configuration.resource");
+    String resource = event.getServletContext().getInitParameter("jbpm.configuration.resource");
     jbpmConfiguration = JbpmConfiguration.getInstance(resource);
   }
 

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JbpmContextFilter.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -38,56 +38,50 @@
 
 public class JbpmContextFilter implements Filter, Serializable {
 
-  private static final long serialVersionUID = 1L;
+  private static final long serialVersionUID = 2L;
 
-  String jbpmConfigurationResource = null;
-  String jbpmContextName = null;
-  boolean isAuthenticationEnabled = true;
+  private JbpmConfiguration jbpmConfiguration;
+  private String jbpmContextName;
+  private boolean isAuthenticationEnabled = true;
 
   public void init(FilterConfig filterConfig) throws ServletException {
     // get the jbpm configuration resource
-    this.jbpmConfigurationResource = filterConfig.getInitParameter("jbpm.configuration.resource");
-    
+    String resource = filterConfig.getServletContext()
+      .getInitParameter("jbpm.configuration.resource");
+    jbpmConfiguration = JbpmConfiguration.getInstance(resource); 
+
     // get the jbpm context to be used from the jbpm configuration
-    this.jbpmContextName = filterConfig.getInitParameter("jbpm.context.name");
-    if (jbpmContextName==null) {
+    jbpmContextName = filterConfig.getInitParameter("jbpm.context.name");
+    if (jbpmContextName == null) {
       jbpmContextName = JbpmContext.DEFAULT_JBPM_CONTEXT_NAME;
     }
-    
+
     // see if authentication is turned off
     String isAuthenticationEnabledText = filterConfig.getInitParameter("authentication");
-    if ( (isAuthenticationEnabledText!=null)
-         && ("disabled".equalsIgnoreCase(isAuthenticationEnabledText))
-       ) {
+    if (isAuthenticationEnabledText != null
+      && "disabled".equalsIgnoreCase(isAuthenticationEnabledText)) {
       isAuthenticationEnabled = false;
     }
   }
 
-  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
-    String actorId = null;
-
-    // see if we can get the authenticated swimlaneActorId
-    if (servletRequest instanceof HttpServletRequest) {
-      HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
-      Principal userPrincipal = httpServletRequest.getUserPrincipal();
-      if (userPrincipal != null) {
-        actorId = userPrincipal.getName();
-      }
-    }
-
+  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
+    FilterChain filterChain) throws IOException, ServletException {
     JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext(jbpmContextName);
     try {
-      if (isAuthenticationEnabled) {
-        jbpmContext.setActorId(actorId);
+      if (isAuthenticationEnabled && servletRequest instanceof HttpServletRequest) {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+        Principal userPrincipal = httpServletRequest.getUserPrincipal();
+        if (userPrincipal != null) jbpmContext.setActorId(userPrincipal.getName());
       }
       filterChain.doFilter(servletRequest, servletResponse);
-    } finally {
+    }
+    finally {
       jbpmContext.close();
     }
   }
 
   protected JbpmConfiguration getJbpmConfiguration() {
-    return JbpmConfiguration.getInstance(jbpmConfigurationResource);
+    return jbpmConfiguration;
   }
 
   public void destroy() {

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/web/JobExecutorLauncher.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -28,10 +28,10 @@
 import org.jbpm.job.executor.JobExecutor;
 
 /**
- * Starts the job executor on servlet context initialization and stops it on servlet context
- * destruction.
- * <h3>Configuration</h3>
- * Servlet context initialization parameters
+ * <p>
+ * Starts the job executor on initialization and stops it on destruction.
+ * </p>
+ * <h3>Servlet context parameters</h3>
  * <table border="1">
  * <tr>
  * <th>Name</th>

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -97,6 +97,11 @@
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-tomcat</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>jbpm-userguide</artifactId>
       <version>${project.version}</version>
       <type>jdocbook</type>
@@ -113,6 +118,11 @@
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jsf-console-tomcat</artifactId>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>gpd-deployer</artifactId>
       <type>war</type>
     </dependency>
@@ -247,6 +257,7 @@
                 <property name="container" value="${container}" />
                 <property name="jboss.home" value="${jboss.home}" />
                 <property name="jboss.server" value="${jboss.server}" />
+                <property name="tomcat.home" value="${tomcat.home}" />
                 <property name="database" value="${database}" />
                 <ant antfile="scripts/antrun-installer.xml" target="process-resources" />
               </tasks>

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/scripts/antrun-installer.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -98,6 +98,11 @@
     <macro-enable file="${hsqldb.cfg.xml}" section="DataSource properties" />
     <macro-enable file="${hsqldb.cfg.xml}" section="JTA transaction properties" />
 
+    <property name="tomcat.cfg.xml"
+              value="${project.build.assembly.dir}/config/hibernate.cfg.tomcat.xml" />
+    <copy file="${hsqldb.cfg.xml}" tofile="${tomcat.cfg.xml}" />
+    <macro-disable file="${tomcat.cfg.xml}" section="JTA transaction properties" />
+
     <edit-hibernate-config file="${project.build.assembly.dir}/config/hibernate.cfg.db2.xml"/>
     <edit-hibernate-config file="${project.build.assembly.dir}/config/hibernate.cfg.mssql.xml"/>
     <edit-hibernate-config file="${project.build.assembly.dir}/config/hibernate.cfg.mysql.xml"/>
@@ -120,6 +125,7 @@
         <filter token="container" value="${container}" />
         <filter token="jboss.home" value="${jboss.home}" />
         <filter token="jboss.server" value="${jboss.server}"/>
+        <filter token="tomcat.home" value="${tomcat.home}" />
         <filter token="database" value="${database}" />
       </filterset>
     </copy>

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/auto-install-template.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -13,9 +13,10 @@
     <pack name="JBoss AS Integration" index="4" selected="true" />
     <pack name="jBPM Service" index="5" selected="true" />
     <pack name="JSF Console" index="6" selected="true" />
-    <pack name="Optional Downloads" index="7" selected="false" />
-    <pack name="JBoss AS" index="8" selected="false" />
-    <pack name="Eclipse" index="9" selected="false" />
+    <pack name="Tomcat Integration" index="7" selected="false" />
+    <pack name="Optional Downloads" index="8" selected="false" />
+    <pack name="JBoss AS" index="9" selected="false" />
+    <pack name="Eclipse" index="10" selected="false" />
   </com.izforge.izpack.panels.TreePacksPanel>
   <com.izforge.izpack.panels.UserInputPanel>
     <userInput>
@@ -25,14 +26,19 @@
   </com.izforge.izpack.panels.UserInputPanel>
   <com.izforge.izpack.panels.UserInputPanel>
     <userInput>
-      <entry key="dbSelection" value="@database@" />
+      <entry key="jbossInstallPath" value="@jboss.home@" />
     </userInput>
   </com.izforge.izpack.panels.UserInputPanel>
   <com.izforge.izpack.panels.UserInputPanel>
     <userInput>
-      <entry key="jbossInstallPath" value="@jboss.home@" />
+      <entry key="tomcatInstallPath" value="@tomcat.home@" />
     </userInput>
   </com.izforge.izpack.panels.UserInputPanel>
+  <com.izforge.izpack.panels.UserInputPanel>
+    <userInput>
+      <entry key="dbSelection" value="@database@" />
+    </userInput>
+  </com.izforge.izpack.panels.UserInputPanel>
   <com.izforge.izpack.panels.SummaryPanel />
   <com.izforge.izpack.panels.InstallPanel />
   <com.izforge.izpack.panels.FinishPanel />

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -40,6 +40,7 @@
     <variable name="jboss423.home" value="@{jboss423.home}" />
     <variable name="jboss501.home" value="@{jboss501.home}" />
     <variable name="jboss510.home" value="@{jboss510.home}" />
+    <variable name="tomcat.home" value="@{tomcat.home}" />
   </variables>
 
   <!-- Dynamic Variables -->
@@ -109,6 +110,7 @@
     <panel classname="UserInputPanel" />
     <panel classname="UserInputPanel" />
     <panel classname="UserInputPanel" />
+    <panel classname="UserInputPanel" />
     <panel classname="SummaryPanel" />
     <panel classname="InstallPanel" />
     <panel classname="FinishPanel" />
@@ -210,7 +212,7 @@
     <pack name="jBPM Service" parent="JBoss AS Integration" required="no" preselected="no">
       <description>Business process management service</description>
 
-      <!-- jbpm/jbpm-service.sar -->
+      <!-- jbpm-service.sar -->
       <file src="@{assemblyDirectory}/lib/jbpm-enterprise-config.jar"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
         unpack="true" condition="isJBoss405" />
@@ -236,14 +238,8 @@
       <file condition="isJBoss423"
         src="@{assemblyDirectory}/lib/hibernate-jbc-cacheprovider.jar"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" />
-      <file condition="isJBoss501"
-        src="@{assemblyDirectory}/lib/commons-lang.jar"
-        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" />
-      <file condition="isJBoss510"
-        src="@{assemblyDirectory}/lib/commons-lang.jar"
-        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" />
 
-      <!-- jbpm/jbpm-enterprise.jar -->
+      <!-- jbpm-enterprise.jar -->
       <file src="@{assemblyDirectory}/lib/jbpm-enterprise.jar"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise.jar"
         unpack="true" condition="isJBoss405" />
@@ -373,7 +369,7 @@
     <pack name="JSF Console" parent="JBoss AS Integration" required="no" preselected="no">
       <description>Web console based on the Java Server Faces technology</description>
 
-      <!-- jbpm/jsf-console.war -->
+      <!-- jsf-console.war -->
       <file src="@{assemblyDirectory}/lib/jsf-console.war"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
         unpack="true" condition="isJBoss405" />
@@ -387,7 +383,7 @@
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
         unpack="true" condition="isJBoss510" />
 
-      <!-- jbpm/gpd-deployer.war -->
+      <!-- gpd-deployer.war -->
       <file src="@{assemblyDirectory}/lib/gpd-deployer.war"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/gpd-deployer.war"
         unpack="true" />
@@ -395,6 +391,50 @@
 
     <!--
     ********************************
+    *   Tomcat Integration          *
+    ********************************
+    -->
+    <pack name="Tomcat Integration" required="no" preselected="no">
+      <description>Web server integration</description>
+
+      <!-- lib -->
+      <file src="@{assemblyDirectory}/lib/jbpm-tomcat.jar"
+        targetdir="${tomcatInstallPath}/lib" />
+      <file src="@{assemblyDirectory}/lib/hsqldb.jar" targetdir="${tomcatInstallPath}/lib" />
+
+      <!-- webapps/jbpm-console -->
+      <file src="@{assemblyDirectory}/lib/jsf-console-tomcat.war"
+        targetdir="${tomcatInstallPath}/webapps/jbpm-console"
+        unpack="true" />
+      <fileset dir="@{assemblyDirectory}/lib"
+        targetdir="${tomcatInstallPath}/webapps/jbpm-console/WEB-INF/lib">      
+        <include name="antlr.jar" />
+        <include name="asm.jar" />
+        <include name="backport-util-concurrent.jar" />
+        <include name="bsh.jar" />
+        <include name="cglib.jar" />
+        <include name="commons-collections.jar" />
+        <include name="commons-logging.jar" />
+        <include name="dom4j.jar" />
+        <include name="hibernate.jar" />
+        <include name="jbpm-jpdl.jar" />
+        <include name="jbpm-identity.jar" />
+        <include name="jta.jar" />
+      </fileset>
+      <file src="@{assemblyDirectory}/config/jbpm.cfg.xml"
+        targetdir="${tomcatInstallPath}/webapps/jbpm-console/WEB-INF/classes" />
+      <singlefile src="@{assemblyDirectory}/config/hibernate.cfg.tomcat.xml"
+        target="${tomcatInstallPath}/webapps/jbpm-console/WEB-INF/classes/hibernate.cfg.xml" />
+
+      <!-- work/jbpm-console -->
+      <fileset dir="@{resourcesDirectory}/database/hypersonic"
+        targetdir="${tomcatInstallPath}/work/Catalina/localhost/jbpm-console">
+        <include name="jbpmDB.*" />
+      </fileset>
+    </pack>
+
+    <!--
+    ********************************
     *   Optional Downloads         *
     ********************************
     -->

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_eng.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -2,6 +2,7 @@
 <langpack>
   <str id="jboss.selection" txt="JBoss AS version" />
   <str id="jboss.configuration" txt="Server configuration" />
-  <str id="jboss.home" txt="JBoss AS home" />
+  <str id="jboss.home" txt="JBoss AS directory" />
+  <str id="tomcat.home" txt="Tomcat directory" />
   <str id="database.selection" txt="Database" />
 </langpack>
\ No newline at end of file

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-lang_spa.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -2,6 +2,7 @@
 <langpack>
   <str id="jboss.selection" txt="Versión de JBoss AS" />
   <str id="jboss.configuration" txt="Configuración del servidor" />
-  <str id="jboss.home" txt="Ruta de JBoss AS" />
+  <str id="jboss.home" txt="Directorio de JBoss AS" />
+  <str id="tomcat.home" txt="Directorio de Tomcat" />
   <str id="database.selection" txt="Base de datos" />
 </langpack>
\ No newline at end of file

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/user-input-spec.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -23,6 +23,12 @@
     </field>
   </panel>
   <panel order="2">
+    <createForPack name="Tomcat Integration" />
+    <field type="dir" align="left" variable="tomcatInstallPath">
+      <spec id="tomcat.home" size="20" set="${tomcat.home}" />
+    </field>
+  </panel>
+  <panel order="3">
     <createForPack name="JBoss AS Integration" />
     <field type="radio" variable="dbSelection">
       <description align="left" id="database.selection" />

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -19,7 +19,6 @@
     <groupId>org.jbpm.jbpm3</groupId>
     <artifactId>jbpm</artifactId>
     <version>3.2.10-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <build>
@@ -92,7 +91,7 @@
         <activeByDefault>true</activeByDefault>
       </activation>
       <build>
-        <finalName>${project.artifactId}-${project.version}-soa4x.jar</finalName>
+        <finalName>${project.artifactId}-${project.version}-soa4x</finalName>
         <resources>
           <resource>
             <directory>src/main/resources</directory>
@@ -107,12 +106,12 @@
     <profile>
       <id>soa5x</id>
       <build>
-        <finalName>${project.artifactId}-${project.version}-soa5x.jar</finalName>
+        <finalName>${project.artifactId}-${project.version}-soa5x</finalName>
         <resources>
           <resource>
             <directory>src/main/resources</directory>
             <excludes>
-              <exclude>*soa5x*</exclude>
+              <exclude>*soa4x*</exclude>
             </excludes>
           </resource>
         </resources>

Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -72,6 +72,12 @@
       </dependency>
       <dependency>
         <groupId>org.jbpm.jbpm3</groupId>
+        <artifactId>jsf-console-tomcat</artifactId>
+        <version>${project.version}</version>
+        <type>war</type>
+      </dependency>
+      <dependency>
+        <groupId>org.jbpm.jbpm3</groupId>
         <artifactId>gpd-deployer</artifactId>
         <version>${project.version}</version>
         <type>war</type>
@@ -190,12 +196,6 @@
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate</artifactId>
         <version>3.2.4.sp1</version>
-        <exclusions>
-          <exclusion>
-            <groupId>javax.transaction</groupId>
-            <artifactId>jta</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.jboss.cluster</groupId>
@@ -596,6 +596,7 @@
         <jdk>[1.5,1.7)</jdk>
       </activation>
       <modules>
+        <module>tomcat</module>
         <module>enterprise-jee5</module>
       </modules>
     </profile>

Modified: jbpm3/branches/jbpm-3.2-soa/profiles.example.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/profiles.example.xml	2010-11-12 11:07:44 UTC (rev 6815)
+++ jbpm3/branches/jbpm-3.2-soa/profiles.example.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -63,6 +63,7 @@
         <jboss510.home>$USER_HOME/jboss-5.1.0.GA</jboss510.home>
         <jboss.server>all</jboss.server>
 
+        <tomcat.home>$USER_HOME/apache-tomcat-6.0.29</tomcat.home>
         <jbpm.home>$USER_HOME/jbpm-${project.version}</jbpm.home>
       </properties>
     </profile>


Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat
___________________________________________________________________
Name: svn:ignore
   + .settings
target


Added: jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/.classpath	2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: jbpm3/branches/jbpm-3.2-soa/tomcat/.project
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/.project	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/.project	2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>tomcat</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,42 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <name>jBPM3 - Tomcat</name>
+  <groupId>org.jbpm.jbpm3</groupId>
+  <artifactId>jbpm-tomcat</artifactId>
+
+  <parent>
+    <artifactId>jbpm</artifactId>
+    <groupId>org.jbpm.jbpm3</groupId>
+    <version>3.2.10-SNAPSHOT</version>
+  </parent>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <!-- Provided dependencies -->
+    <dependency>
+      <groupId>org.apache.tomcat</groupId>
+      <artifactId>catalina</artifactId>
+      <version>6.0.29</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>


Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java	2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,270 @@
+/*
+ * 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.realm;
+
+import java.security.Principal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.realm.GenericPrincipal;
+import org.apache.catalina.realm.RealmBase;
+import org.apache.naming.ContextBindings;
+
+/**
+ * Realm implementation that works with any JDBC data source. Unlike the standard
+ * {@link org.apache.catalina.realm.DataSourceRealm DataSourceRealm} provided by Tomcat, this
+ * implementation allows for a wider variety of database schemas by externalizing the queries
+ * used to retrieve users and roles.
+ * 
+ * @see <a href="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html">Realm How-To</a>
+ * @author Alejandro Guizar
+ */
+public class DataSourceRealm extends RealmBase {
+
+  /** The JNDI name of the data source */
+  private String dataSourceName;
+
+  /** Context-local datasource. */
+  private boolean localDataSource;
+
+  /** SQL query for retrieving the password associated to a user name. */
+  private String userQuery;
+
+  /** SQL query for retrieving the roles associated to a user name. */
+  private String roleQuery;
+
+  /**
+   * Return the JNDI name of the data source.
+   */
+  public String getDataSourceName() {
+    return dataSourceName;
+  }
+
+  /**
+   * Set the JNDI name of the data source.
+   * 
+   * @param dataSourceName the JNDI name of the data source.
+   */
+  public void setDataSourceName(String dataSourceName) {
+    this.dataSourceName = dataSourceName;
+  }
+
+  /**
+   * Tells whether the realm uses a data source defined for the enclosing Context rather than a
+   * global data source.
+   */
+  public boolean getLocalDataSource() {
+    return localDataSource;
+  }
+
+  /**
+   * Sets whether the realm uses a data source defined for the enclosing Context rather than a
+   * global data source.
+   * 
+   * @param localDataSource the new flag value
+   */
+  public void setLocalDataSource(boolean localDataSource) {
+    this.localDataSource = localDataSource;
+  }
+
+  /** Returns the SQL query for retrieving the password associated to a user name. */
+  public String getUserQuery() {
+    return userQuery;
+  }
+
+  /**
+   * Sets the the SQL query for retrieving the password associated to a user name. The query
+   * must
+   * 
+   * @param userQuery
+   */
+  public void setUserQuery(String userQuery) {
+    this.userQuery = userQuery;
+  }
+
+  /** Returns the SQL query for retrieving the roles associated to a user name. */
+  public String getRoleQuery() {
+    return roleQuery;
+  }
+
+  /**
+   * Sets the SQL query for retrieving the roles associated to a user name.
+   * 
+   * @param rolesQuery
+   */
+  public void setRoleQuery(String rolesQuery) {
+    this.roleQuery = rolesQuery;
+  }
+
+  protected String getName() {
+    return "JbpmConsoleRealm";
+  }
+
+  protected String getPassword(String username) {
+    // Ensure that we have an open database connection
+    Connection dbConnection = open();
+    if (dbConnection != null) {
+      try {
+        return getPassword(dbConnection, username);
+      }
+      finally {
+        close(dbConnection);
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Return the password associated with the given principal's user name.
+   * 
+   * @param dbConnection The database connection to be used
+   * @param username user for which password should be retrieved
+   */
+  private String getPassword(Connection dbConnection, String username) {
+    PreparedStatement statement = null;
+    try {
+      statement = dbConnection.prepareStatement(userQuery);
+      statement.setString(1, username);
+
+      ResultSet resultSet = statement.executeQuery();
+      if (resultSet.next()) return resultSet.getString(1);
+    }
+    catch (SQLException e) {
+      containerLog.error(sm.getString("dataSourceRealm.getPassword.exception", username));
+    }
+    finally {
+      if (statement != null) {
+        try {
+          // When a Statement is closed, its current ResultSet, if one exists, is also closed
+          statement.close();
+        }
+        catch (SQLException e) {
+          containerLog.error(sm.getString("dataSourceRealm.getPassword.exception", username));
+        }
+      }
+    }
+    return null;
+  }
+
+  protected Principal getPrincipal(String username) {
+    Connection dbConnection = open();
+    if (dbConnection != null) {
+      try {
+        return (new GenericPrincipal(this,
+          username,
+          getPassword(dbConnection, username),
+          getRoles(dbConnection, username)));
+      }
+      finally {
+        close(dbConnection);
+      }
+    }
+    return new GenericPrincipal(this, username, null, null);
+  }
+
+  private List<String> getRoles(Connection dbConnection, String username) {
+    PreparedStatement statement = null;
+    try {
+      statement = dbConnection.prepareStatement(roleQuery);
+      statement.setString(1, username);
+
+      ResultSet rs = statement.executeQuery();
+      List<String> roles = new ArrayList<String>();
+      while (rs.next()) {
+        roles.add(rs.getString(1));
+      }
+      return roles;
+    }
+    catch (SQLException e) {
+      containerLog.error(sm.getString("dataSourceRealm.getRoles.exception", username));
+      return null;
+    }
+    finally {
+      if (statement != null) {
+        try {
+          // When a Statement is closed, its current ResultSet, if one exists, is also closed
+          statement.close();
+        }
+        catch (SQLException e) {
+          containerLog.error(sm.getString("dataSourceRealm.getRoles.exception", username));
+        }
+      }
+    }
+  }
+
+  private Connection open() {
+    try {
+      Context context;
+      if (localDataSource) {
+        context = (Context) ContextBindings.getClassLoader().lookup("comp/env");
+      }
+      else {
+        StandardServer server = (StandardServer) ServerFactory.getServer();
+        context = server.getGlobalNamingContext();
+      }
+      DataSource dataSource = (DataSource) context.lookup(dataSourceName);
+      return dataSource.getConnection();
+    }
+    catch (NamingException e) {
+      containerLog.error(sm.getString("dataSourceRealm.exception"), e);
+    }
+    catch (SQLException e) {
+      containerLog.error(sm.getString("dataSourceRealm.exception"), e);
+    }
+    return null;
+  }
+
+  /**
+   * Close the specified database connection.
+   * 
+   * @param dbConnection The connection to be closed
+   */
+  private void close(Connection dbConnection) {
+    // Commit if not auto committed
+    try {
+      if (!dbConnection.getAutoCommit()) {
+        dbConnection.commit();
+      }
+    }
+    catch (SQLException e) {
+      containerLog.error("Exception committing connection before closing:", e);
+    }
+
+    // Close this database connection, and log any errors
+    try {
+      dbConnection.close();
+    }
+    catch (SQLException e) {
+      containerLog.error(sm.getString("dataSourceRealm.close"), e); // Just log it here
+    }
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/java/org/jbpm/realm/DataSourceRealm.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml	2010-11-12 11:11:07 UTC (rev 6816)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<mbeans-descriptors>
+  <mbean name="JbpmDataSourceRealm" className="org.apache.catalina.mbeans.ClassNameMBean"
+    description="Realm implementation that works with any JDBC data source" domain="Catalina"
+    group="Realm" type="org.jbpm.realm.DataSourceRealm">
+
+    <attribute name="className" type="java.lang.String" writeable="false"
+      description="Fully qualified class name of the managed object" />
+
+    <attribute name="digest" type="java.lang.String"
+      description="Digest algorithm used for storing passwords in a hashed format" />
+
+    <attribute name="dataSourceName" type="java.lang.String"
+      description="The JNDI named JDBC data source for your database" />
+
+    <attribute name="localDataSource" type="boolean"
+      description="Configures if the DataSource is local to the webapp" />
+
+    <attribute name="userQuery" type="java.lang.String"
+      description="SQL query for retrieving the password associated to a user name." />
+
+    <attribute name="roleQuery" type="java.lang.String"
+      description="SQL query for retrieving the roles associated to a user name." />
+
+    <operation name="start" description="Start" impact="ACTION" returnType="void" />
+    <operation name="stop" description="Stop" impact="ACTION" returnType="void" />
+    <operation name="init" description="Init" impact="ACTION" returnType="void" />
+    <operation name="destroy" description="Destroy" impact="ACTION" returnType="void" />
+  </mbean>
+</mbeans-descriptors>
\ No newline at end of file


Property changes on: jbpm3/branches/jbpm-3.2-soa/tomcat/src/main/resources/org/jbpm/realm/mbeans-descriptors.xml
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the jbpm-commits mailing list