1 package org.apache.axis2.transport.mail.server; 2 3 7 8 import javax.mail.internet.MimeMessage ; 9 import java.util.ArrayList ; 10 import java.util.Hashtable ; 11 12 public class Storage { 13 private ArrayList mails = new ArrayList (); 14 15 private Hashtable users = new Hashtable (); 16 17 18 public Storage(){ 19 } 20 21 public void addMail(String user, MimeMessage mail){ 22 ArrayList curMailBox = null; 23 if (users.containsKey(user)){ 24 curMailBox = (ArrayList )users.get(user); 25 } else { 26 curMailBox = new ArrayList (); 27 users.put(user, curMailBox); 28 } 29 curMailBox.add(mail); 30 } 31 32 public ArrayList popUserMails(String user){ 33 ArrayList usrMailBox = new ArrayList (); if (users.containsKey(user)){ 35 usrMailBox = (ArrayList )users.get(user); 36 } 37 return usrMailBox; 38 } 39 } | Popular Tags |