1 5 package com.opensymphony.workflow.util.jndi; 6 7 import com.opensymphony.module.propertyset.PropertySet; 8 9 import com.opensymphony.workflow.*; 10 11 import org.apache.commons.logging.Log; 12 import org.apache.commons.logging.LogFactory; 13 14 import java.util.Map ; 15 16 import javax.naming.InitialContext ; 17 import javax.naming.NamingException ; 18 19 20 26 public class JNDICondition implements Condition { 27 29 private static final Log log = LogFactory.getLog(JNDICondition.class); 30 31 33 public boolean passesCondition(Map transientVars, Map args, PropertySet ps) throws WorkflowException { 34 String location = (String ) args.get(AbstractWorkflow.JNDI_LOCATION); 35 location = location.trim(); 36 37 Condition condition = null; 38 39 try { 40 try { 41 condition = (Condition) new InitialContext ().lookup(location); 42 } catch (NamingException e) { 43 condition = (Condition) new InitialContext ().lookup("java:comp/env/" + location); 45 } 46 } catch (NamingException e) { 47 String message = "Could not lookup JNDI condition at: " + location; 48 throw new WorkflowException(message, e); 49 } 50 51 return condition.passesCondition(transientVars, args, ps); 52 } 53 } 54 | Popular Tags |