View Javadoc

1   /***
2    * 
3    * Copyright RAJD Consultancy Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11   * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
12   * specific language governing permissions and limitations under the License.
13   * 
14   */
15  package org.logicblaze.lingo.jmx.remote.provider.jms;
16  
17  import javax.management.MBeanServer;
18  import javax.management.remote.JMXConnectorServer;
19  import javax.management.remote.JMXConnectorServerProvider;
20  import javax.management.remote.JMXServiceURL;
21  import org.logicblaze.lingo.jmx.remote.jms.JmsJmxConnectorServer;
22  
23  import java.io.IOException;
24  import java.net.MalformedURLException;
25  import java.util.Map;
26  
27  /***
28   * @version $Revision: 1.3 $
29   */
30  public class ServerProvider implements JMXConnectorServerProvider{
31      /***
32       * Create a JmsJmxConnectorServer
33       * @param url
34       * @param environment
35       * @param server
36       * @return the JmsJmxConnectorServer
37       * @throws IOException 
38       */
39      public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,Map environment,MBeanServer server) throws IOException{
40          String protocol = url.getProtocol();
41          if (!"jms".equals(protocol)) throw new MalformedURLException("Wrong protocol " + protocol + " for provider " + this);
42          return new JmsJmxConnectorServer(url,environment,server);
43      }
44  }