001: /*
002: * Created on 14 avr. 2005
003: *
004: * TODO To change the template for this generated file go to
005: * Window - Preferences - Java - Code Style - Code Templates
006: */
007: package hero.hook;
008:
009: /**
010: *
011: * Bonita
012: * Copyright (C) 1999 Bull S.A.
013: * Bull 68 route de versailles 78434 Louveciennes Cedex France
014: * Further information: bonita@objectweb.org
015: *
016: * This library is free software; you can redistribute it and/or
017: * modify it under the terms of the GNU Lesser General Public
018: * License as published by the Free Software Foundation; either
019: * version 2.1 of the License, or any later version.
020: *
021: * This library is distributed in the hope that it will be useful,
022: * but WITHOUT ANY WARRANTY; without even the implied warranty of
023: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
024: * Lesser General Public License for more details.
025: *
026: * You should have received a copy of the GNU Lesser General Public
027: * License along with this library; if not, write to the Free Software
028: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
029: * USA
030: *
031: *
032: --------------------------------------------------------------------------
033: * $Id: MailAccept.java,v 1.1 2006/07/21 13:19:53 mvaldes Exp $
034: *
035: --------------------------------------------------------------------------
036: */
037: import hero.interfaces.*;
038: import hero.interfaces.BnNodeLocal;
039: import hero.util.HeroHookException;
040: import hero.util.BonitaServiceLocator;
041:
042: import javax.naming.InitialContext;
043: import javax.mail.Session;
044: import javax.mail.Address;
045: import javax.mail.Transport;
046: import javax.mail.internet.InternetAddress;
047: import javax.mail.internet.MimeMessage;
048: import javax.rmi.PortableRemoteObject;
049:
050: import java.util.*;
051:
052: public class MailAccept implements hero.hook.NodeHookI {
053:
054: public String getMetadata() {
055: return Constants.Nd.BEFORETERMINATE;
056: }
057:
058: public void create(Object b, BnNodeLocal n)
059: throws HeroHookException {
060: }
061:
062: public void beforeStart(Object b, BnNodeLocal n)
063: throws HeroHookException {
064: }
065:
066: public void afterTerminate(Object b, BnNodeLocal n)
067: throws HeroHookException {
068: }
069:
070: public void onCancel(Object b, BnNodeLocal n)
071: throws HeroHookException {
072: }
073:
074: public void anticipate(Object b, BnNodeLocal n)
075: throws HeroHookException {
076: }
077:
078: public void onDeadline(Object b, BnNodeLocal n)
079: throws HeroHookException {
080: }
081:
082: public void afterStart(Object b, BnNodeLocal n)
083: throws HeroHookException {
084: }
085:
086: public void onReady(Object b, BnNodeLocal n)
087: throws HeroHookException {
088: }
089:
090: public void beforeTerminate(Object b, BnNodeLocal n)
091: throws HeroHookException {
092: try {
093: String nodeName = n.getName();
094:
095: BnProjectLocal project = n.getBnProject();
096: String prjName = project.getName();
097:
098: System.out.println("send mail accept OK during the "
099: + nodeName + " execution");
100: } catch (Exception e) {
101: System.out.println("mail service error: " + e);
102: e.printStackTrace();
103: }
104: }
105:
106: }
|