KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > il > rmi > RMIServerILService


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.mq.il.rmi;
23
24 import java.util.Properties JavaDoc;
25
26 import org.jboss.mq.il.ServerIL;
27 import org.jboss.mq.il.ServerILFactory;
28
29 /**
30  * Implements the ServerILJMXService which is used to manage the JVM IL.
31  *
32  * @author Hiram Chirino (Cojonudo14@hotmail.com)
33  * @version $Revision: 37459 $
34  *
35  * @jmx:mbean extends="org.jboss.mq.il.ServerILJMXServiceMBean"
36  */

37 public class RMIServerILService extends org.jboss.mq.il.ServerILJMXService implements RMIServerILServiceMBean
38 {
39    RMIServerIL serverIL;
40
41    /**
42     * Gives this JMX service a name.
43     *
44     * @return The Name value
45     */

46    public String JavaDoc getName()
47    {
48       return "JBossMQ-JVMServerIL";
49    }
50
51    /**
52     * Used to construct the GenericConnectionFactory (bindJNDIReferences()
53     * builds it)
54     *
55     * @return The ServerIL value
56     * @returns ServerIL the instance of this IL
57     */

58    public ServerIL getServerIL()
59    {
60       return serverIL;
61    }
62
63    /**
64     * Used to construct the GenericConnectionFactory (bindJNDIReferences()
65     * builds it) Sets up the connection properties need by a client to use this
66     * IL
67     *
68     * @return The ClientConnectionProperties value
69     */

70    public java.util.Properties JavaDoc getClientConnectionProperties()
71    {
72       Properties JavaDoc rc = super.getClientConnectionProperties();
73       rc.setProperty(ServerILFactory.CLIENT_IL_SERVICE_KEY, "org.jboss.mq.il.rmi.RMIClientILService");
74       return rc;
75    }
76
77    /**
78     * Starts this IL, and binds it to JNDI
79     *
80     * @exception Exception Description of Exception
81     */

82    public void startService() throws Exception JavaDoc
83    {
84       super.startService();
85       serverIL = new RMIServerIL(getJMSServer());
86       bindJNDIReferences();
87
88    }
89
90    /**
91     * Stops this IL, and unbinds it from JNDI
92     */

93    public void stopService() throws Exception JavaDoc
94    {
95       try
96       {
97          unbindJNDIReferences();
98       }
99       catch (Exception JavaDoc e)
100       {
101          e.printStackTrace();
102       }
103       super.stopService();
104       serverIL = null;
105    }
106 }
107
Popular Tags