1 23 package mail; 24 25 import org.objectweb.joram.client.jms.admin.*; 26 import org.objectweb.joram.client.jms.*; 27 import org.objectweb.joram.client.jms.tcp.*; 28 import org.objectweb.joram.client.jms.Queue; 29 30 import java.io.*; 31 import java.util.Properties ; 32 33 public class MailAdmin { 34 public static void main(String [] args) throws Exception { 35 System.out.println("mail administration..."); 36 37 AdminModule.connect("root", "root", 60); 38 Properties prop = new Properties (); 39 prop.load(new FileInputStream("pop.properties")); 40 41 Queue queue = Queue.create(0, null, 42 "com.scalagent.joram.mom.dest.mail.JavaMailQueue",prop); 43 44 prop = new Properties (); 45 prop.load(new FileInputStream("smtp.properties")); 46 Topic topic = Topic.create(0,null, 47 "com.scalagent.joram.mom.dest.mail.JavaMailTopic",prop); 48 49 javax.jms.ConnectionFactory cf = TcpConnectionFactory.create("localhost", 16010); 50 51 User user = User.create("anonymous", "anonymous", 0); 52 53 queue.setFreeReading(); 54 queue.setFreeWriting(); 55 56 topic.setFreeReading(); 57 topic.setFreeWriting(); 58 59 javax.naming.Context jndiCtx = new javax.naming.InitialContext (); 60 jndiCtx.bind("cf", cf); 61 jndiCtx.bind("mailQueue", queue); 62 jndiCtx.bind("mailTopic", topic); 63 jndiCtx.close(); 64 65 AdminModule.disconnect(); 66 System.out.println("Admin closed, ready to send/recv mail."); 67 } 68 } 69 | Popular Tags |