01: /**
02: *
03: * Bonita
04: * Copyright (C) 1999 Bull S.A.
05: * Bull 68 route de versailles 78434 Louveciennes Cedex France
06: * Further information: bonita@objectweb.org
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation; either
11: * version 2.1 of the License, or any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public
19: * License along with this library; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21: * USA
22: *
23: *
24: --------------------------------------------------------------------------
25: * $Id: PropertyPerformerAssign.java,v 1.2 2005/11/16 22:31:59 brice Exp $
26: *
27: --------------------------------------------------------------------------
28: */package hero.performerAssign;
29:
30: import hero.interfaces.BnNodeLocal;
31: import hero.util.HeroException;
32:
33: import java.lang.reflect.InvocationTargetException;
34: import java.lang.reflect.Method;
35:
36: import org.apache.log4j.Category;
37:
38: public class PropertyPerformerAssign extends PerformerAssign {
39:
40: // Utility variable
41: private static final Category log = Category
42: .getInstance(PropertyPerformerAssign.class);
43:
44: public PropertyPerformerAssign(String name, int type) {
45: super (name, type);
46: }
47:
48: public void execute(Object bean, int type, BnNodeLocal node,
49: String userName) throws HeroException {
50: log.debug("execute: type=" + type + " node=" + node.getName());
51:
52: try {
53: Class clperformerAssign = Class.forName(
54: "hero.performerAssign.PropertySelectActors", true,
55: Thread.currentThread().getContextClassLoader());
56: NodePerformerAssignI ndh = (NodePerformerAssignI) clperformerAssign
57: .newInstance();
58: Class[] param = {
59: Class.forName("java.lang.Object"),
60: Class.forName("hero.interfaces.BnNodeLocal", true,
61: Thread.currentThread()
62: .getContextClassLoader()),
63: Class.forName("java.lang.String") };
64: Method evth = clperformerAssign.getMethod("selectActors",
65: param);
66: Object[] o = { bean, node, userName };
67: evth.invoke(ndh, o);
68: } catch (InvocationTargetException ite) {
69: ite.printStackTrace();
70: throw new HeroException(
71: "Failure during performerAssign execution : "
72: + ite.getMessage());
73: } catch (Exception e) {
74: throw new HeroException(
75: "Dynamic invocation of performerAssign failed :"
76: + this .getName() + " Node:"
77: + node.getName()
78: + "--> performerAssign type = " + type
79: + " ///" + e);
80: }
81: }
82:
83: }
|