Package de.danet.an.workflow.tools

Source Code of de.danet.an.workflow.tools.GenericSimpleApplicationTool

/*
* 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: GenericSimpleApplicationTool.java 1860 2006-10-25 21:43:03Z mlipp $
*
* $Log$
*/
package de.danet.an.workflow.tools;

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

import de.danet.an.workflow.api.Activity;
import de.danet.an.workflow.api.FormalParameter;
import de.danet.an.workflow.spis.aii.CannotExecuteException;
import de.danet.an.workflow.tools.util.SimpleApplicationAgent;

/**
* This class provides a generic tool agent for creating an entry
* in the <code>SimpleApplicationDirectory</code>. This implementation
* is intended for testing and evaluation purposes.
*
* @author Michael Lipp
*
*/
public class GenericSimpleApplicationTool extends SimpleApplicationAgent {

    private String applicationName = null;
   
    /**
     * @return Returns the applicationName.
     */
    public String getApplicationName() {
        return applicationName;
    }

    /**
     * @param applicationName The applicationName to set.
     */
    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    /* (non-Javadoc)
     * @see de.danet.an.workflow.spis.aii.ToolAgent#invoke
     */
    public void invoke(Activity activity, FormalParameter[] formalParameters,
                       Map actualParameters) throws RemoteException,
            CannotExecuteException {
        if (applicationName == null) {
            throw new CannotExecuteException("Application name not configured");
        }
        if (formalParameters.length > 0
            && formalParameters[0].id().equals("key")
            && actualParameters.get("key") instanceof String) {
            applicationDirectory().registerInstance
                (applicationName, (String)actualParameters.get("key"), activity,
                 new Object[] { formalParameters, actualParameters }, true);
        } else {
            applicationDirectory().registerInstance
                (applicationName, activity,
                 new Object[] { formalParameters, actualParameters }, true);
        }
    }
}
TOP

Related Classes of de.danet.an.workflow.tools.GenericSimpleApplicationTool

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.