1 29 30 package hero.client.samples; 31 32 import javax.security.auth.login.LoginContext ; 33 import hero.client.test.SimpleCallbackHandler; 34 35 import hero.interfaces.Constants; 36 import hero.interfaces.ProjectSession; 37 import hero.interfaces.ProjectSessionHome; 38 import hero.interfaces.ProjectSessionUtil; 39 40 import hero.interfaces.UserSession; 41 import hero.interfaces.UserSessionHome; 42 import hero.interfaces.UserSessionUtil; 43 44 public class LoadJavaHook { 45 46 static public void main(String [] args) throws Exception { 47 char[] password={'t','o','t','o'}; 49 SimpleCallbackHandler handler = new SimpleCallbackHandler("admin",password); 50 LoginContext lc = new LoginContext ("TestClient", handler); 51 lc.login(); 52 53 ProjectSessionHome projectSessionh=ProjectSessionUtil.getHome(); 54 UserSessionHome usersh=UserSessionUtil.getHome(); 55 UserSession usr=usersh.create(); 56 57 ProjectSession pss=projectSessionh.create(); 58 pss.initProject("LoadJavaHook"); 59 60 pss.addNode("node1",Constants.Nd.AND_JOIN_NODE); 61 pss.setNodeRole("node1","admin"); 62 pss.addNode("node2",Constants.Nd.AND_JOIN_NODE); 63 pss.addEdge("node1","node2"); 64 pss.addNodeHook("node1","hero.hook.TestHook",hero.interfaces.Constants.Nd.AFTERSTART,Constants.Hook.JAVA); 65 66 usr.startActivity("LoadJavaHook","node1"); 67 usr.terminateActivity("LoadJavaHook","node1"); 68 } 69 } 70 71 72 | Popular Tags |