001: /*--
002:
003: Copyright (C) 2002-2005 Adrian Price.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The names "OBE" and "Open Business Engine" must not be used to
019: endorse or promote products derived from this software without prior
020: written permission. For written permission, please contact
021: adrianprice@sourceforge.net.
022:
023: 4. Products derived from this software may not be called "OBE" or
024: "Open Business Engine", nor may "OBE" or "Open Business Engine"
025: appear in their name, without prior written permission from
026: Adrian Price (adrianprice@users.sourceforge.net).
027:
028: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
029: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
030: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
031: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
032: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
033: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
034: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
035: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
036: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
037: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
038: POSSIBILITY OF SUCH DAMAGE.
039:
040: For more information on OBE, please see
041: <http://obe.sourceforge.net/>.
042:
043: */
044:
045: package org.obe.spi.service;
046:
047: import org.obe.client.api.repository.ObjectAlreadyExistsException;
048: import org.obe.client.api.repository.ObjectNotFoundException;
049: import org.obe.client.api.repository.RepositoryException;
050: import org.obe.client.api.repository.ToolAgentMetaData;
051: import org.obe.client.api.tool.Parameter;
052: import org.obe.client.api.tool.ToolAgent;
053: import org.obe.spi.WorkflowService;
054: import org.obe.xpdl.model.application.Application;
055:
056: /**
057: * Standard interface for a tool agent factory. The tool agent factory is used
058: * to retrieve tool agents at run-time. Workflow tool IDs are mapped to a
059: * specific agent at run-time.
060: *
061: * @author Adrian Price
062: */
063: public interface ToolAgentFactory extends WorkflowService {
064: String SERVICE_NAME = "ToolAgentFactory";
065:
066: /**
067: * Registers a tool.
068: *
069: * @param tool The tool definition.
070: * @throws ObjectAlreadyExistsException if the tool ID is already
071: * registered.
072: * @throws RepositoryException if the tool could not be registered some
073: * other reason.
074: */
075: void createTool(ToolAgentMetaData tool) throws RepositoryException;
076:
077: /**
078: * Unregisters a tool.
079: *
080: * @param id The tool ID.
081: * @throws ObjectNotFoundException if the tool ID is not registered.
082: * @throws RepositoryException if the tool could not be unregistered for
083: * some other reason.
084: */
085: void deleteTool(String id) throws RepositoryException;
086:
087: /**
088: * Updates a tool.
089: *
090: * @param tool The tool definition.
091: * @throws ObjectNotFoundException if the tool ID is not registered.
092: * @throws RepositoryException if the tool could not be updated for some
093: * other reason.
094: */
095: void updateTool(ToolAgentMetaData tool) throws RepositoryException;
096:
097: /**
098: * Finds all tool types known to the repository. This method is intended to
099: * support design-time clients and management applications.
100: *
101: * @param locale The locale in which the results should be formatted.
102: * @return All tool types.
103: * @throws RepositoryException if an error occurred.
104: */
105: ToolAgentMetaData[] findToolTypes(String locale)
106: throws RepositoryException;
107:
108: /**
109: * Returns information about the specified too type. This method is
110: * intended to support design-time clients and management applications.
111: *
112: * @param className The tool type (i.e., the fully qualified name of the
113: * implementation class).
114: * @param locale The locale in which the results should be formatted.
115: * @return Information about the specified tool type.
116: * @throws ObjectNotFoundException if the tool type is unknown.
117: * @throws RepositoryException if some other error occurred.
118: */
119: ToolAgentMetaData findToolType(String className, String locale)
120: throws RepositoryException;
121:
122: /**
123: * Finds meta-data for all tools. This method is intended to support
124: * design-time clients and management applications.
125: *
126: * @return The list of all tools.
127: * @throws RepositoryException if an error occurred.
128: */
129: ToolAgentMetaData[] findToolMetaData() throws RepositoryException;
130:
131: /**
132: * Finds meta-data for a tool. This method is intended to support
133: * design-time clients and management applications.
134: *
135: * @param toolDef The XPDL tool definition.
136: * @return Meta-data about the requested tool.
137: * @throws ObjectNotFoundException if the tool is not registered.
138: * @throws RepositoryException if some other error occurred.
139: */
140: ToolAgentMetaData findToolMetaData(Application toolDef)
141: throws RepositoryException;
142:
143: /**
144: * Finds a tool agent. This method is called by the engine at run-time when
145: * it needs to execute the tool invocation.
146: *
147: * @param toolDef The XPDL tool definition.
148: * @param parameters The parameters to pass to a stateful (non-threadsafe)
149: * tool agent's constructor. N.B. Stateless tool agents ignore this
150: * parameter but it must always be passed because the caller does not know
151: * whether the tool itself is threadsafe.
152: * @return A tool agent to invoke the specified tool.
153: * @throws ObjectNotFoundException if no suitable tool agent is registered.
154: * @throws RepositoryException if some other error occurred.
155: */
156: ToolAgent findToolAgent(Application toolDef, Parameter[] parameters)
157: throws RepositoryException;
158: }
|