001: /**
002: *
003: * Bonita
004: * Copyright (C) 1999 Bull S.A.
005: * Bull 68 route de versailles 78434 Louveciennes Cedex France
006: * Further information: bonita@objectweb.org
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Lesser General Public
010: * License as published by the Free Software Foundation; either
011: * version 2.1 of the License, or any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public
019: * License along with this library; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021: * USA
022: *
023: --------------------------------------------------------------------------
024: * Class ExtraEntryPoint.java created by Jordi Anguela - June 2006
025: --------------------------------------------------------------------------
026: */package hero.client.samples.iterations.src;
027:
028: import hero.client.test.SimpleCallbackHandler;
029: import hero.interfaces.Constants;
030: import hero.interfaces.ProjectSession;
031: import hero.interfaces.ProjectSessionHome;
032: import hero.interfaces.ProjectSessionUtil;
033:
034: import javax.security.auth.login.LoginContext;
035:
036: public class ExtraEntryPoint {
037: static public void main(String[] args) throws Exception {
038: try {
039: System.out.println(" ****** ExtraEntryPoint 1.0 ******* ");
040: System.out.println(" * Entry * ");
041: System.out.println(" * |_____ repeat=false * ");
042: System.out.println(" * A----->B----->C * ");
043: System.out.println(" * | | * ");
044: System.out.println(" * |_ _ _ | * ");
045: System.out.println(" * repeat=true * ");
046: System.out.println(" ********************************** ");
047: // User Admin login
048: char[] password = { 't', 'o', 't', 'o' };
049: SimpleCallbackHandler handler = new SimpleCallbackHandler(
050: "admin", password);
051: LoginContext lc = new LoginContext("TestClient", handler);
052: lc.login();
053:
054: ProjectSessionHome projectSessionh = ProjectSessionUtil
055: .getHome();
056: ProjectSession ps = projectSessionh.create();
057: System.out.print("\n Creating ExtraEntryPoint model");
058: ps.initModel("ExtraEntryPoint");
059:
060: // Set Properties
061: ps.setProperty("repeat", "true");
062:
063: // Set Nodes
064: ps.addNode("A", Constants.Nd.AND_JOIN_NODE);
065: ps.addNode("B", Constants.Nd.AND_JOIN_NODE);
066: ps.addNode("C", Constants.Nd.AND_JOIN_NODE);
067: ps.addNode("Entry", Constants.Nd.AND_JOIN_NODE);
068:
069: ps.setNodeTraditional("A");
070: ps.setNodeTraditional("B");
071: ps.setNodeTraditional("C");
072: ps.setNodeTraditional("Entry");
073:
074: // Set Edges
075: ps.addEdge("A", "B");
076: String fromBtoC = ps.addEdge("B", "C");
077: ps.addEdge("Entry", "B");
078:
079: ps.setEdgeCondition(fromBtoC, "repeat.equals(\"false\")");
080:
081: // Set Iteration
082: ps.addIteration("B", "A", "repeat.equals(\"true\")");
083:
084: // Set activity roles
085: ps.addRole("Administrator", "The system administator role");
086: ps.setNodeRole("A", "Administrator");
087: ps.setNodeRole("B", "Administrator");
088: ps.setNodeRole("C", "Administrator");
089: ps.setNodeRole("Entry", "Administrator");
090:
091: // Set role mapper
092: ps.addRoleMapper("Administrator", "AdministratorMapper",
093: Constants.Mapper.PROPERTIES);
094:
095: // Checks if the model is correctly defined
096: ps.checkModelDefinition();
097:
098: System.out.println(" [ OK ]");
099: } catch (Exception e) {
100: System.out.println("\n\n [ ERROR ] : " + e);
101: e.printStackTrace();
102: }
103: }
104: }
|