KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mx > remoting > provider > rmi > ServerProvider


1 /***************************************
2  * *
3  * JBoss: The OpenSource J2EE WebOS *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  ***************************************/

9 package org.jboss.mx.remoting.provider.rmi;
10
11 import java.io.IOException JavaDoc;
12 import java.net.MalformedURLException JavaDoc;
13 import java.util.Map JavaDoc;
14 import javax.management.MBeanServer JavaDoc;
15 import javax.management.remote.JMXConnectorServer JavaDoc;
16 import javax.management.remote.JMXConnectorServerProvider JavaDoc;
17 import javax.management.remote.JMXServiceURL JavaDoc;
18 import javax.management.remote.rmi.RMIConnectorServer JavaDoc;
19
20 /**
21  * @author <a HREF="mailto:tom@jboss.org">Tom Elrod</a>
22  */

23 public class ServerProvider implements JMXConnectorServerProvider JavaDoc
24 {
25    public static final String JavaDoc PROTOCOL = "rmi";
26
27    public ServerProvider()
28    {
29    }
30
31    public JMXConnectorServer JavaDoc newJMXConnectorServer(JMXServiceURL JavaDoc serviceURL, Map JavaDoc environment, MBeanServer JavaDoc server)
32          throws IOException JavaDoc
33    {
34       if(serviceURL != null && serviceURL.getProtocol() != null && serviceURL.getProtocol().equalsIgnoreCase(PROTOCOL))
35       {
36          return new RMIConnectorServer JavaDoc(serviceURL, environment, server);
37       }
38       else
39       {
40          throw new MalformedURLException JavaDoc("JMXServiceURL provided is invalid for this provider. " +
41                                          "Protocol must be " + PROTOCOL + ". JMXServiceURL provided is " +
42                                          serviceURL);
43       }
44    }
45
46 }
Popular Tags