KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > perfs > PerfsAdmin


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

24 package perfs;
25
26 import org.objectweb.joram.client.jms.admin.*;
27 import org.objectweb.joram.client.jms.*;
28 import org.objectweb.joram.client.jms.tcp.*;
29
30 /**
31  */

32 public class PerfsAdmin
33 {
34   public static void main(String JavaDoc[] args) throws Exception JavaDoc
35   {
36     AdminModule.connect("root", "root", 60);
37
38     Queue queue = (Queue) Queue.create(0);
39     Topic topic = (Topic) Topic.create(0);
40
41     javax.jms.ConnectionFactory JavaDoc cf =
42       TcpConnectionFactory.create("localhost", 16010);
43
44     User user = User.create("anonymous", "anonymous", 0);
45
46     queue.setFreeReading();
47     topic.setFreeReading();
48     queue.setFreeWriting();
49     topic.setFreeWriting();
50
51     javax.naming.Context JavaDoc jndiCtx = new javax.naming.InitialContext JavaDoc();
52     jndiCtx.bind("cf", cf);
53     jndiCtx.bind("queue", queue);
54     jndiCtx.bind("topic", topic);
55     jndiCtx.close();
56
57     AdminModule.disconnect();
58   }
59 }
60
Popular Tags