KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ha > HAAdmin


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2005 - ScalAgent Distributed Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Nicolas Tachker (ScalAgent)
21  * Contributor(s):
22  */

23 package ha;
24
25 import org.objectweb.joram.client.jms.admin.AdminModule;
26 import org.objectweb.joram.client.jms.admin.User;
27 import org.objectweb.joram.client.jms.ConnectionFactory;
28 import org.objectweb.joram.client.jms.Topic;
29 import org.objectweb.joram.client.jms.ha.tcp.TopicHATcpConnectionFactory;
30
31
32 public class HAAdmin {
33   public static void main(String JavaDoc[] args)
34     throws Exception JavaDoc {
35     System.out.println();
36     System.out.println("HA administration...");
37
38     javax.jms.TopicConnectionFactory JavaDoc tcf =
39       TopicHATcpConnectionFactory.create("hajoram://localhost:2560,localhost:2561,localhost:2562");
40     ((ConnectionFactory) tcf).getParameters().connectingTimer = 30;
41     
42     AdminModule.connect(tcf, "root", "root");
43
44     Topic topic = (Topic) Topic.create(0,"topic");
45     User user = User.create("anonymous", "anonymous");
46
47     topic.setFreeReading();
48     topic.setFreeWriting();
49
50     AdminModule.disconnect();
51     System.out.println("Admin closed.");
52   }
53 }
54
Popular Tags