@@ -0,0 +1,3560 @@
+/*%0A * ################################################################%0A *%0A * ProActive: The Java(TM) library for Parallel, Distributed,%0A *            Concurrent computing with Security and Mobility%0A *%0A * Copyright (C) 1997-2006 INRIA/University of Nice-Sophia Antipolis%0A * Contact: proactive@objectweb.org%0A *%0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public%0A * License as published by the Free Software Foundation; either%0A * version 2.1 of the License, or any later version.%0A *%0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307%0A * USA%0A *%0A *  Initial developer(s):               The ProActive Team%0A *                        http://www.inria.fr/oasis/ProActive/contacts.html%0A *  Contributor(s):%0A *%0A * ################################################################%0A */%0Apackage org.objectweb.proactive.jmx.client;%0A%0Aimport java.io.IOException;%0Aimport java.net.MalformedURLException;%0A%0Aimport javax.management.remote.JMXConnector;%0Aimport javax.management.remote.JMXConnectorFactory;%0Aimport javax.management.remote.JMXServiceURL;%0A%0Aimport org.objectweb.proactive.jmx.ProActiveConnection;%0Aimport org.objectweb.proactive.jmx.ProActiveJMXConstants;%0A%0A%0A/**%0A *  This class creates a JMX client connector whose communication protocol is ProActive%0A * @author ProActive Team%0A *%0A */%0Apublic class ClientConnector %7B%0A    private ProActiveConnection connection;%0A    private JMXConnector connector;%0A    private String url;%0A%0A    /**%0A     * Creates a ClientConnector and connect to the remote JMX MBean Server whose at the specified url%0A     * @param url The ProActive JMX connector url ( for example localhost:8080 )%0A     */%0A    public ClientConnector(String url) %7B%0A        this.url = url;%0A        connect();%0A    %7D%0A%0A    /*%0A     *  Connect to the ProActive Connector%0A     */%0A    private void connect() %7B%0A        try %7B%0A            /*  build the jmx Url */%0A            this.url = %22service:jmx:proactive://%22 + this.url +%0A                ProActiveJMXConstants.SERVER_REGISTERED_NAME;%0A            JMXServiceURL jmxUrl = new JMXServiceURL(url);%0A            /* connect to the connector server  */%0A            this.connector = JMXConnectorFactory.connect(jmxUrl,%0A                    ProActiveJMXConstants.PROACTIVE_JMX_ENV);%0A            /* retrieve the ProActive Connection that will enable the remote calls onto the remote MBean server */%0A            this.connection = (ProActiveConnection) this.connector.getMBeanServerConnection();%0A        %7D catch (MalformedURLException e) %7B%0A            e.printStackTrace();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A    /**%0A     *  Returns the ProActiveConnection that will enable the calls onto the remote MBean Server%0A     * @return the JMX ProActive Connection%0A     */%0A    public ProActiveConnection getConnection() %7B%0A        return this.connection;%0A    %7D%0A%0A    /**%0A     * Returns the ProActive Remote connector that can be used to establish a connection to a connector server.%0A     * @returnthe ProActive JMX Connector Server%0A     */%0A    public JMXConnector getConnector() %7B%0A        return this.connector;%0A    %7D%0A%7D%0A

add jmx connector