KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > communication > message > impl > BaseMessageProtocolPlugin


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.services.communication.message.impl;
6
7 import org.exoplatform.services.communication.message.*;
8 import org.picocontainer.Startable;
9 /**
10  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
11  * @since Sep 6, 2004
12  * @version $Id: BaseMessageProtocolPlugin.java,v 1.2 2004/09/17 15:13:17 tuan08 Exp $
13  */

14 abstract public class BaseMessageProtocolPlugin
15     implements MessageProtocolPlugin, Startable {
16   protected MessageService mservice_ ;
17   
18   public BaseMessageProtocolPlugin(MessageService mservice) {
19     mservice_ = mservice ;
20     mservice.addMessageProtocolPlugin(this) ;
21   }
22   
23   protected void saveSentMessage(Account account, Message message) throws Exception JavaDoc {
24     MessageImpl mesageImpl = (MessageImpl) message ;
25     Folder folder = mservice_.getFolder(account, MessageService.SENT_FOLDER) ;
26     Message backupMessage = mesageImpl.cloneMessage() ;
27     mservice_.createMessage(account, folder, backupMessage) ;
28   }
29   
30   protected String JavaDoc formatEmail(String JavaDoc email) {
31     if(email == null || email.length() == 0) {
32       email = "unknown@unknown.host" ;
33     }
34     return email ;
35   }
36    
37   public void start() {}
38   public void stop() {}
39 }
Popular Tags