ClientProvider.java revision 16603:db6e995edd0a
190792Sgshapiro/*
2261363Sgshapiro * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
390792Sgshapiro * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
490792Sgshapiro *
590792Sgshapiro * This code is free software; you can redistribute it and/or modify it
690792Sgshapiro * under the terms of the GNU General Public License version 2 only, as
790792Sgshapiro * published by the Free Software Foundation.  Oracle designates this
890792Sgshapiro * particular file as subject to the "Classpath" exception as provided
990792Sgshapiro * by Oracle in the LICENSE file that accompanied this code.
1090792Sgshapiro *
1190792Sgshapiro * This code is distributed in the hope that it will be useful, but WITHOUT
12266692Sgshapiro * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1390792Sgshapiro * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1490792Sgshapiro * version 2 for more details (a copy is included in the LICENSE file that
1590792Sgshapiro * accompanied this code).
1690792Sgshapiro *
1790792Sgshapiro * You should have received a copy of the GNU General Public License version
1890792Sgshapiro * 2 along with this work; if not, write to the Free Software Foundation,
1990792Sgshapiro * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2090792Sgshapiro *
2190792Sgshapiro * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2290792Sgshapiro * or visit www.oracle.com if you need additional information or have any
2390792Sgshapiro * questions.
2490792Sgshapiro */
2590792Sgshapiro
2690792Sgshapiropackage com.sun.jmx.remote.protocol.rmi;
2790792Sgshapiro
2890792Sgshapiroimport java.io.IOException;
2990792Sgshapiroimport java.net.MalformedURLException;
3090792Sgshapiroimport java.util.Map;
3190792Sgshapiro
3290792Sgshapiroimport javax.management.remote.JMXConnectorProvider;
3390792Sgshapiroimport javax.management.remote.JMXConnector;
3490792Sgshapiroimport javax.management.remote.JMXServiceURL;
3590792Sgshapiroimport javax.management.remote.rmi.RMIConnector;
3690792Sgshapiro
3790792Sgshapiropublic class ClientProvider implements JMXConnectorProvider {
3890792Sgshapiro
3990792Sgshapiro    public JMXConnector newJMXConnector(JMXServiceURL serviceURL,
4090792Sgshapiro                                        Map<String,?> environment)
4190792Sgshapiro            throws IOException {
4290792Sgshapiro        if (!serviceURL.getProtocol().equals("rmi")) {
4390792Sgshapiro            throw new MalformedURLException("Protocol not rmi: " +
4490792Sgshapiro                                            serviceURL.getProtocol());
4590792Sgshapiro        }
4690792Sgshapiro        return new RMIConnector(serviceURL, environment);
4790792Sgshapiro    }
4890792Sgshapiro}
4990792Sgshapiro