Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * 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
  * 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:
 package org.jbpm.ejb;
 import  javax.jms.ConnectionFactory;
 import  javax.jms.Queue;
Stateless session bean that executes commands by calling their execute method on a separate jBPM context.


The environment entries and resources available for customization are summarized in the table below.

JbpmCfgResourceEnvironment EntryThe classpath resource from which to read the jBPM configuration. Optional, defaults to jbpm.cfg.xml.
jdbc/JbpmDataSourceResource Manager ReferenceLogical name of the data source that provides JDBC connections to the persistence service. Must match the hibernate.connection.datasource property in the Hibernate configuration file.
jms/JbpmConnectionFactoryResource Manager ReferenceLogical name of the factory that provides JMS connections to the JMS connector service. Required for processes that contain asynchronous continuations.
jms/JobQueueMessage Destination ReferenceThe message service sends job messages to the queue referenced here. Must be the same queue from which the job listener bean receives messages.

Alejandro Guizar
 @Resources(value = {
   @Resource(name = "jdbc/JbpmDataSource", type = DataSource.class, shareable = true),
   @Resource(name = "jms/JbpmConnectionFactory", type = ConnectionFactory.class, shareable = true),
   @Resource(name = "jms/JobQueue", type = Queue.class)
 public class CommandServiceBean implements LocalCommandService {
   private static final long serialVersionUID = 1L;
  @Resource(name = "JbpmCfgResource")
  private String jbpmCfgResource;
Creates the JbpmConfiguration to be used by this command service. In case the environment key JbpmCfgResource is specified, that value is interpreted as the name of the configuration resource to load from the classpath. If that key is absent, the default configuration file will be used (jbpm.cfg.xml).
  void createConfiguration() {
     = JbpmConfiguration.getInstance();
  public Object execute(Command command) {
    try {
      Object result = command.execute(jbpmContext);
      // check whether command requested a rollback
      if (jbpmContext.getServices().getTxService().isRollbackOnly()) {
      return result;
    catch (RuntimeException e) {
      throw e;
    catch (Exception e) {
      throw new JbpmException("failed to execute " + commande);
    finally {
New to GrepCode? Check out our FAQ X