1 /* 2 * Copyright (C) 2007-2012 Argeo GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.argeo.slc.execution; 17 18 import java.net.URI; 19 import java.util.List; 20 21 /** 22 * A local agent can run SLC processes. It is responsible for creating their 23 * threads and integrating them with various UIs. It typically wraps 24 * {@link ExecutionModulesManager} which is used to run flows synchronously at a 25 * lower level. 26 */ 27 public interface SlcAgent { 28 /** Agent unique identifier */ 29 public String getAgentUuid(); 30 31 /** Execute / take part to this process */ 32 public void process(ExecutionProcess process); 33 34 /** 35 * Asynchronously processes the flows defined as URIs, or interpret a single 36 * UUID URN as a scheduled or template process. 37 * 38 * @return the UUID of the process launched. 39 */ 40 public String process(List<URI> uris); 41 42 /** Kills this process */ 43 public void kill(String processUuid); 44 45 /** 46 * Wait for this process to finish. returns immediately if it does not 47 * exist. 48 * 49 * @param millis 50 * can be null 51 */ 52 public void waitFor(String processUuid, Long millis); 53 54 /** 55 * Describe all the flows provided by this execution module. Typically 56 * called in order to build a realized flow. 57 */ 58 public ExecutionModuleDescriptor getExecutionModuleDescriptor( 59 String moduleName, String version); 60 61 /** List all execution modules which can be processed by this agent. */ 62 public List<ExecutionModuleDescriptor> listExecutionModuleDescriptors(); 63 64 /** @return true if still alive. */ 65 public boolean ping(); 66 }