1 29 30 package hero.performerAssign; 31 32 33 import hero.interfaces.BnNodeLocal; 34 import hero.util.HeroException; 35 36 import java.lang.reflect.InvocationTargetException ; 37 import java.lang.reflect.Method ; 38 39 import org.apache.log4j.Category; 40 41 public class CallbackPerformerAssign extends PerformerAssign { 42 43 private static final Category log = Category.getInstance(CallbackPerformerAssign.class); 45 46 47 public CallbackPerformerAssign(String name, int type) { 48 super(name,type); 49 } 50 51 public void execute(Object bean, int type, BnNodeLocal node, String userName) throws HeroException { 52 log.debug("execute: type="+type+" node="+node.getName()); 53 54 try { 55 Class clperformerAssign=Class.forName(this.getName()); 58 NodePerformerAssignI ndh =(NodePerformerAssignI)clperformerAssign.newInstance(); 59 Class [] param={ 60 Class.forName("java.lang.Object"), 61 Class.forName("hero.interfaces.BnNodeLocal"), 62 Class.forName("java.lang.String")}; 63 Method evth=clperformerAssign.getMethod("selectActors",param); 64 Object [] o={bean,node,userName}; 65 evth.invoke(ndh,o); 66 } catch (InvocationTargetException ite) { 67 ite.printStackTrace(); 68 throw new HeroException("Failure during performerAssign execution : " + ite.getMessage()); 69 } catch (Exception e) { 70 throw new HeroException("Dynamic invocation of performerAssign failed :"+this.getName()+" Node:"+node.getName()+"--> performerAssign type = "+type+" ///"+e); 71 } 72 } 73 74 75 } 76 | Popular Tags |