This project has retired. For details please refer to its
Attic page.
001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.oozie.workflow;
019
020 import org.apache.hadoop.conf.Configuration;
021
022
023 /**
024 * The workflow library provides application parsing and storage capabilities for workflow instances. <p/> The
025 * implementation is responsible for doing the store operations in a transactional way, either in autocommit or within
026 * the scope of a transaction.
027 */
028 public interface WorkflowLib {
029
030 /**
031 * Parse a workflow application definition.
032 *
033 * @param wfXml string containing the workflow definition.
034 * @return the parse workflow application.
035 * @throws WorkflowException thrown if the definition could not be parsed.
036 */
037 public WorkflowApp parseDef(String wfXml) throws WorkflowException;
038
039
040 /**
041 * Create a workflow instance.
042 *
043 * @param app application to create a workflow instance of.
044 * @param conf job configuration.
045 * @return the newly created workflow instance.
046 * @throws WorkflowException thrown if the instance could not be created.
047 */
048 public WorkflowInstance createInstance(WorkflowApp app, Configuration conf) throws WorkflowException;
049
050 /**
051 * Create a workflow instance with the given wfId. This will be used for re-running workflows.
052 *
053 * @param app application to create a workflow instance of.
054 * @param conf job configuration.
055 * @param wfId Workflow ID.
056 * @return the newly created workflow instance.
057 * @throws WorkflowException thrown if the instance could not be created.
058 */
059 public WorkflowInstance createInstance(WorkflowApp app, Configuration conf, String wfId) throws WorkflowException;
060
061 /**
062 * Insert a workflow instance in storage.
063 *
064 * @param instance of the workflow instance to insert.
065 * @throws WorkflowException thrown if the instance could not be inserted.
066 */
067 public void insert(WorkflowInstance instance) throws WorkflowException;
068
069 /**
070 * Load a workflow instance from storage.
071 *
072 * @param id ID of the workflow instance to load.
073 * @return the loaded workflow instance.
074 * @throws WorkflowException thrown if the instance could not be loaded.
075 */
076 public WorkflowInstance get(String id) throws WorkflowException;
077
078 /**
079 * Update a workflow instance in storage.
080 *
081 * @param instance workflow instance to update.
082 * @throws WorkflowException thrown if the instance could not be loaded.
083 */
084 public void update(WorkflowInstance instance) throws WorkflowException;
085
086 /**
087 * Delete a workflow instance from storage.
088 *
089 * @param id ID of the workflow instance to delete.
090 * @throws WorkflowException thrown if the instance could not be deleted.
091 */
092 public void delete(String id) throws WorkflowException;
093
094
095 /**
096 * Commit changes to store.
097 *
098 * @throws WorkflowException thrown if the commit could not be done.
099 */
100 public void commit() throws WorkflowException;
101
102 /**
103 * Close store. It rollbacks if there was no commit.
104 *
105 * @throws WorkflowException thrown if the close could not be done.
106 */
107 public void close() throws WorkflowException;
108
109 }