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.RepositoryException;
048: import org.obe.spi.WorkflowService;
049: import org.obe.xpdl.model.pkg.XPDLPackage;
050: import org.obe.xpdl.model.workflow.WorkflowProcess;
051: import org.wfmc.wapi.WMFilter;
052: import org.wfmc.wapi.WMProcessDefinitionState;
053:
054: /**
055: * Provides persistence for packages and process definitions. Methods return
056: * either the parsed, in-memory form as required to support the run-time, or
057: * WAPI value objects as required to support the client API.
058: * <p/>
059: * TODO: in the future, it may be desirable to support the WAPI2 process
060: * modeling APIs, although there may be no reason for this to be a remote API.
061: * <p/>
062: * TODO: Think about implementing a WebDAV interface to the process repository.
063: *
064: * @author Adrian Price
065: */
066: public interface ProcessRepository extends WorkflowService {
067: String SERVICE_NAME = "ProcessRepository";
068:
069: /**
070: * Purges all data from the process repository. <b>WARNING! All packages
071: * and process definitions will be permanently deleted.</b>
072: */
073: void purge() throws RepositoryException;
074:
075: /**
076: * Creates a package using the supplied content.
077: *
078: * @param pkg The pre-parsed package object.
079: * @throws RepositoryException
080: */
081: void createPackage(XPDLPackage pkg) throws RepositoryException;
082:
083: /**
084: * Permanently deletes the specified package.
085: *
086: * @param packageId The package ID.
087: * @throws RepositoryException
088: */
089: void deletePackage(String packageId) throws RepositoryException;
090:
091: /**
092: * Retrieves a set of packages.
093: *
094: * @param filter A package filter specification.
095: * @param countFlag Flag to return just a count of the matching packages.
096: * @return An array of matching packages.
097: */
098: XPDLPackage[] findPackages(WMFilter filter, boolean countFlag)
099: throws RepositoryException;
100:
101: /**
102: * Retrieves the specified package.
103: *
104: * @param packageId The ID of the package to retrieve.
105: * @return The requested package.
106: */
107: XPDLPackage findPackage(String packageId)
108: throws RepositoryException;
109:
110: /**
111: * Sets the content of the specified package.
112: *
113: * @param pkg The package to write.
114: * @throws RepositoryException
115: */
116: void updatePackage(XPDLPackage pkg) throws RepositoryException;
117:
118: /**
119: * Retrieves a process definition in executable form.
120: *
121: * @param processDefinitionId The process definition ID.
122: * @return The requested process definition.
123: */
124: WorkflowProcess findWorkflowProcess(String processDefinitionId)
125: throws RepositoryException;
126:
127: /**
128: * Retrieves process definitions in executable form. The method returns all
129: * process definitions with the specified name. If the
130: * <code>validOnly</code> flag is <code>true</code> the method returns only
131: * versions of the specified workflow which could be instantiated at the
132: * current time, according to their state, status, and validFrom and validTo
133: * dates.
134: *
135: * @param name The process definition name. Must not be <code>null</code>
136: * To find all workflows, call
137: * {@link #findWorkflowProcesses(WMFilter, boolean)}.
138: * @param validOnly <code>true</code> to return only workflows which are
139: * available for instantiation at the current time.
140: * @return The process definition(s) matching the specified name.
141: * @see #findWorkflowProcesses(WMFilter, boolean)
142: */
143: WorkflowProcess[] findWorkflowProcesses(String name,
144: boolean validOnly) throws RepositoryException;
145:
146: /**
147: * Retrieves a list of process definitions in executable form. The method
148: * returns all process definitions which match the supplied filter.
149: *
150: * @param filter A process definition filter specification.
151: * @return An array of matching process definitions.
152: * @see #findWorkflowProcesses(String, boolean)
153: */
154: WorkflowProcess[] findWorkflowProcesses(WMFilter filter,
155: boolean countFlag) throws RepositoryException;
156:
157: /**
158: * Returns the state of a process definition.
159: *
160: * @param processDefinitionId The process definition id
161: * @return The process definition state, as defined in
162: * {@link WMProcessDefinitionState}
163: * @throws RepositoryException
164: */
165: int findProcessDefinitionState(String processDefinitionId)
166: throws RepositoryException;
167:
168: /**
169: * Changes the process definition state.
170: *
171: * @param processDefinitionId The process definition id
172: * @param newState The new process definition state
173: * @throws RepositoryException Workflow client exception
174: */
175: void updateProcessDefinitionState(String processDefinitionId,
176: int newState) throws RepositoryException;
177: }
|