All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.bonita.facade.ejb.CommandAPIBean Maven / Gradle / Ivy

/**
 * Copyright (C) 2006  Bull S. A. S.
 * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
 * This library 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
 * version 2.1 of the License.
 * This library 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
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA  02110-1301, USA.
 **/
package org.ow2.bonita.facade.ejb;

import java.rmi.RemoteException;

import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

import org.ow2.bonita.facade.impl.StandardInternalAPIAccessorImpl;
import org.ow2.bonita.facade.internal.InternalCommandAPI;
import org.ow2.bonita.facade.uuid.PackageDefinitionUUID;
import org.ow2.bonita.util.Command;

public class CommandAPIBean implements InternalCommandAPI, SessionBean {

  /**
   * 
   */
  private static final long serialVersionUID = 8431354001040613714L;

  protected SessionContext ctx = null;

  protected InternalCommandAPI commandAPI;

  protected InternalCommandAPI getAPI() {
    EJB2SecurityOwner.setUser(this.ctx.getCallerPrincipal().getName());
    if (this.commandAPI == null) {
      this.commandAPI = new StandardInternalAPIAccessorImpl().getCommandAPI();
    }
    return this.commandAPI;
  }

  public void ejbCreate() {

  }

  public void ejbActivate() {

  }

  public void ejbPassivate() {

  }

  public void ejbRemove() {

  }

  public void setSessionContext(final SessionContext arg0) throws RemoteException {
    this.ctx = arg0;
  }

  public  T execute(final Command command) throws Exception {
    return getAPI().execute(command);
  }

  public  T execute(final Command command, final PackageDefinitionUUID packageUUID)
    throws Exception {
    return getAPI().execute(command, packageUUID);
  }
}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy