1 package org.jbpm.graph.action; 2 3 import java.util.HashMap ; 4 import java.util.Map ; 5 import java.util.Set ; 6 7 import org.apache.commons.logging.Log; 8 import org.apache.commons.logging.LogFactory; 9 import org.jbpm.graph.def.Action; 10 import org.jbpm.graph.node.NodeTypes; 11 import org.jbpm.scheduler.def.CancelTimerAction; 12 import org.jbpm.scheduler.def.CreateTimerAction; 13 14 15 public class ActionTypes { 16 17 public static Set getActionTypes() { 18 return actionNames.keySet(); 19 } 20 21 public static Set getActionNames() { 22 return actionTypes.keySet(); 23 } 24 25 public static Class getActionType(String name) { 26 return (Class ) actionTypes.get(name); 27 } 28 29 public static String getActionName(Class type) { 30 return (String ) actionNames.get(type); 31 } 32 33 public static boolean hasActionName(String name) { 34 return actionTypes.containsKey(name); 35 } 36 37 private static final Log log = LogFactory.getLog(ActionTypes.class); 38 private static Map actionTypes = initialiseActionTypes(); 39 private static Map actionNames = NodeTypes.createInverseMapping(actionTypes); 40 41 private static Map initialiseActionTypes() { 42 Map types = new HashMap (); 43 types.put("action", Action.class); 44 types.put("create-timer", CreateTimerAction.class); 45 types.put("cancel-timer", CancelTimerAction.class); 46 try { 47 types.put("script", Script.class); 48 } catch (Throwable t) { 51 log.debug("no beanshell lib present, disabling script actions"); 52 } 53 return types; 54 } 55 } 56 | Popular Tags |