Package de.danet.an.wfdemo.testtools

Source Code of de.danet.an.wfdemo.testtools.TestEjbInvoker

/*
* This file is part of the WfMOpen project.
* Copyright (C) 2001-2006 Danet GmbH (www.danet.de), BU BTS.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* $Id: TestEjbInvoker.java 1900 2006-11-03 23:04:33Z mlipp $
*
* $Log$
*/
package de.danet.an.wfdemo.testtools;

import java.rmi.RemoteException;
import java.util.Map;

import de.danet.an.util.EJBUtil;
import de.danet.an.workflow.api.Activity;
import de.danet.an.workflow.api.FormalParameter;
import de.danet.an.workflow.spis.aii.ApplicationNotStoppedException;
import de.danet.an.workflow.spis.aii.CannotExecuteException;
import de.danet.an.workflow.spis.aii.ResultProvider;
import de.danet.an.workflow.spis.aii.ToolAgent;

/**
* This class provides a test tool that invokes the test EJB
*
* @author Michael Lipp
*
*/
public class TestEjbInvoker implements ToolAgent, ResultProvider {

    private ThreadLocal result = new ThreadLocal();
   
    /* (non-Javadoc)
     * @see de.danet.an.workflow.spis.aii.ToolAgent#invoke
     */
    public void invoke(Activity activity, FormalParameter[] formalParameters,
            Map actualParameters) throws RemoteException,
            CannotExecuteException {
        de.danet.an.wfdemo.testejb.Test test
            = (de.danet.an.wfdemo.testejb.Test)EJBUtil.createSession
            (de.danet.an.wfdemo.testejb.TestHome.class, "ejb/WfMOpenTestEJB");
        try {
            Map pd = test.startAndWait();
            result.set(pd);
        } catch (Exception e) {
            throw (CannotExecuteException)
                (new CannotExecuteException (e.getMessage())).initCause(e);
        }
    }

    /* (non-Javadoc)
     * @see de.danet.an.workflow.spis.aii.ResultProvider#result()
     */
    public Object result() {
        return result.get();
    }

    /* (non-Javadoc)
     * @see de.danet.an.workflow.spis.aii.ToolAgent#terminate(de.danet.an.workflow.api.Activity)
     */
    public void terminate(Activity activity)
            throws ApplicationNotStoppedException, RemoteException {
        throw new ApplicationNotStoppedException("Not supported.");
    }

}
TOP

Related Classes of de.danet.an.wfdemo.testtools.TestEjbInvoker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.