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$
26: *
27: --------------------------------------------------------------------------
28: */package hero.client.samples;
29:
30: import javax.security.auth.login.LoginContext;
31: import hero.client.test.SimpleCallbackHandler;
32:
33: import hero.interfaces.Constants;
34: import hero.interfaces.ProjectSession;
35: import hero.interfaces.ProjectSessionHome;
36: import hero.interfaces.ProjectSessionUtil;
37:
38: import hero.interfaces.UserSession;
39: import hero.interfaces.UserSessionHome;
40: import hero.interfaces.UserSessionUtil;
41: import hero.util.BonitaConfigClient;
42:
43: public class BonitaConfigSample {
44:
45: static public void main(String[] args) throws Exception {
46: // Admin login
47: char[] password = { 't', 'o', 't', 'o' };
48: SimpleCallbackHandler handler = new SimpleCallbackHandler(
49: "admin", password);
50: LoginContext lc = new LoginContext("TestClient", handler);
51: lc.login();
52:
53: ProjectSessionHome projectSessionh = ProjectSessionUtil
54: .getHome();
55: UserSessionHome usersh = UserSessionUtil.getHome();
56: UserSession usr = usersh.create();
57:
58: ProjectSession pss = projectSessionh.create();
59: pss.initModel("NoEvents");
60:
61: BonitaConfigClient bc = BonitaConfigClient.getInstance();
62: bc.setJms(false);
63: bc.setHistoric(Constants.PURGE);
64: bc.setLogLevel(Constants.DEBUG);
65: bc.setTraceLevel(Constants.DEBUG);
66:
67: pss.addNode("node1", Constants.Nd.AND_JOIN_NODE);
68: pss.setNodeRole("node1", "admin");
69: pss.addNode("node2", Constants.Nd.AND_JOIN_NODE);
70: pss.addEdge("node1", "node2");
71: pss.addNodeHook("node1", "hero.hook.TestDeadline",
72: hero.interfaces.Constants.Nd.ONDEADLINE,
73: Constants.Hook.JAVA);
74:
75: String instName = pss.instantiateProject("NoEvents");
76:
77: usr.startActivity(instName, "node1");
78:
79: System.out
80: .println("Bonita Config Attributes: Jms, Historic, Log level and Trace Level were set to: false, Purge, Debug and Debug respectively...");
81: }
82: }
|