KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mx > remoting > provider > iiop > ClientProvider


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.iiop;
10
11 import java.io.IOException JavaDoc;
12 import java.net.MalformedURLException JavaDoc;
13 import java.util.Map JavaDoc;
14 import javax.management.remote.JMXConnector JavaDoc;
15 import javax.management.remote.JMXConnectorProvider JavaDoc;
16 import javax.management.remote.JMXServiceURL JavaDoc;
17 import javax.management.remote.rmi.RMIConnector JavaDoc;
18
19 /**
20  * @author <a HREF="mailto:tom@jboss.org">Tom Elrod</a>
21  */

22 public class ClientProvider implements JMXConnectorProvider JavaDoc
23 {
24    public static final String JavaDoc PROTOCOL = "iiop";
25
26    public ClientProvider()
27    {
28
29    }
30
31    public JMXConnector JavaDoc newJMXConnector(JMXServiceURL JavaDoc serviceURL, Map JavaDoc environment)
32          throws IOException JavaDoc
33    {
34       if(serviceURL != null && serviceURL.getProtocol() != null && serviceURL.getProtocol().equalsIgnoreCase(PROTOCOL))
35       {
36          return new RMIConnector JavaDoc(serviceURL, environment);
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 }
Popular Tags