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: --------------------------------------------------------------------------
025: * $Id: UpdateEnumDyn.java,v 1.1 2006/08/07 10:01:26 mvaldes Exp $
026: *
027: --------------------------------------------------------------------------
028: */package hero.hook;
029:
030: import java.util.ArrayList;
031: import java.util.Collection;
032: import java.util.Iterator;
033: import java.util.TreeSet;
034:
035: import hero.util.HeroHookException;
036: import hero.interfaces.BnNodeLocal;
037: import hero.interfaces.BnNodePropertyValue;
038: import hero.interfaces.BnProjectLocal;
039: import hero.interfaces.Constants;
040: import hero.interfaces.ProjectSession;
041: import hero.interfaces.ProjectSessionHome;
042: import hero.interfaces.ProjectSessionUtil;
043:
044: public class UpdateEnumDyn implements hero.hook.NodeHookI {
045:
046: public String getMetadata() {
047: return Constants.Nd.ONREADY;
048: }
049:
050: public void create(Object b, BnNodeLocal n)
051: throws HeroHookException {
052: }
053:
054: public void beforeStart(Object b, BnNodeLocal n)
055: throws HeroHookException {
056: }
057:
058: public void beforeTerminate(Object b, BnNodeLocal n)
059: throws HeroHookException {
060: try {
061:
062: BnProjectLocal project = n.getBnProject();
063: String prjName = project.getName();
064:
065: ProjectSessionHome prjhome = (ProjectSessionHome) ProjectSessionUtil
066: .getHome();
067: ProjectSession prjSession = prjhome.create();
068: prjSession.initProject(prjName);
069:
070: String nodeName = n.getName();
071:
072: TreeSet setSCRoles = new TreeSet();
073: setSCRoles.add("miguel");
074: setSCRoles.add("marc");
075: setSCRoles.add("florent");
076:
077: ArrayList arDefault = new ArrayList();
078: arDefault.add("miguel");
079:
080: prjSession.updateNodePropertyPossibleValues(nodeName,
081: "enumdyn", setSCRoles, arDefault);
082:
083: } catch (Exception e) {
084: throw new HeroHookException(e.getMessage());
085: }
086: }
087:
088: public void afterTerminate(Object b, BnNodeLocal n)
089: throws HeroHookException {
090: }
091:
092: public void onCancel(Object b, BnNodeLocal n)
093: throws HeroHookException {
094: }
095:
096: public void anticipate(Object b, BnNodeLocal n)
097: throws HeroHookException {
098: }
099:
100: public void onDeadline(Object b, BnNodeLocal n)
101: throws HeroHookException {
102: }
103:
104: public void afterStart(Object b, BnNodeLocal n)
105: throws HeroHookException {
106: }
107:
108: public void onReady(Object b, BnNodeLocal n)
109: throws HeroHookException {
110: }
111:
112: }
|