Package mx4j.remote

Examples of mx4j.remote.ConnectionResolver


   protected void doStart() throws IOException
   {
      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      Map environment = getEnvironment();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);

      MBeanServer realServer = null;
      MBeanServer server = super.getMBeanServer();

      MBeanServer resolvedServer = (MBeanServer)resolver.createServer(address, environment);
      if (resolvedServer == null)
      {
         if (server == null) throw new IllegalStateException("This LocalConnectorServer is not attached to an MBeanServer");
         realServer = server;
      }
      else
      {
         if (server == null)
         {
            realServer = resolvedServer;
         }
         else
         {
            if (server != resolvedServer) throw new IllegalStateException("This LocalConnectorServer cannot be attached to 2 MBeanServers");
            realServer = server;
         }
      }
      this.mbeanServer = realServer;

      connectionManager = new LocalConnectionManager(this, environment);

      setAddress(resolver.bindServer(realServer, address, environment));

      // Here is where we give to clients the possibility to access us
      register(getAddress(), connectionManager);
   }
View Full Code Here


      connectionManager.close();

      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      Map environment = getEnvironment();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);
      MBeanServer server = getMBeanServer();
      resolver.unbindServer(server, address, environment);
      resolver.destroyServer(server, address, environment);

      unregister(address);
   }
View Full Code Here

   protected void doConnect(Map environment) throws IOException, SecurityException
   {
      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);

      ConnectionManager server = (ConnectionManager)resolver.lookupClient(address, environment);
      server = (ConnectionManager)resolver.bindClient(server, environment);

      Object credentials = environment == null ? null : environment.get(CREDENTIALS);
      connection = server.connect(credentials);
   }
View Full Code Here

      if (server == null) throw new IllegalStateException("This JMXConnectorServer is not attached to an MBeanServer");

      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      Map environment = getEnvironment();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);

      webContainer = (WebContainer)resolver.createServer(address, environment);

      setAddress(resolver.bindServer(webContainer, address, environment));

      connectionManager = createConnectionManager(this, address, environment);

      // Here is where we give to clients the possibility to access us
      register(getAddress(), connectionManager);
View Full Code Here

         connectionManager = null;
      }

      String protocol = url.getProtocol();
      Map environment = getEnvironment();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);

      resolver.unbindServer(webContainer, url, environment);

      resolver.destroyServer(webContainer, url, environment);
   }
View Full Code Here

   protected void doConnect(Map environment) throws IOException, SecurityException
   {
      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);

      HTTPConnection temp = (HTTPConnection)resolver.lookupClient(address, environment);
      connection = (HTTPConnection)resolver.bindClient(temp, environment);

      Object credentials = environment == null ? null : environment.get(CREDENTIALS);
      connectionId = connection.connect(credentials);

      this.heartbeat = createHeartBeat(connection, getConnectionNotificationEmitter(), environment);
View Full Code Here

      MBeanServer server = getMBeanServer();
      if (server == null) throw new IllegalStateException("This RMIConnectorServer is not attached to an MBeanServer");

      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (rmiServer == null)
      {
         if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);
         rmiServer = (RMIServerImpl)resolver.createServer(address, environment);
      }

      rmiServer.setRMIConnectorServer(this);
      rmiServer.setMBeanServer(server);
      rmiServer.setDefaultClassLoader(defaultClassLoader);

      rmiServer.export();

      // Replace the JMXServiceURL, as it can now contain the encoded stub/ior
      url = resolver.bindServer(rmiServer, address, environment);

      active = true;

      if (logger.isEnabledFor(Logger.INFO)) logger.info("RMIConnectorServer started at: " + url);
   }
View Full Code Here

      if (rmiServer != null) rmiServer.close();

      JMXServiceURL address = getAddress();
      String protocol = address.getProtocol();
      ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, environment);
      if (resolver == null) throw new MalformedURLException("Unsupported protocol: " + protocol);
      resolver.unbindServer(rmiServer, address, environment);
      resolver.destroyServer(rmiServer, address, environment);

      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.INFO)) logger.info("RMIConnectorServer stopped at: " + address);
   }
View Full Code Here

            defaultClassLoader = Thread.currentThread().getContextClassLoader();

         Map env = environment == null ? new HashMap() : environment;

         String protocol = jmxServiceURL.getProtocol();
         ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, env);
         if (resolver == null) throw new IOException("Unsupported protocol: " + protocol);
         if (rmiServer == null) rmiServer = (RMIServer)resolver.lookupClient(jmxServiceURL, env);
         rmiServer = (RMIServer)resolver.bindClient(rmiServer, env);

         Object credentials = env.get(CREDENTIALS);
         this.connection = rmiServer.newClient(credentials);

         connected = true;
View Full Code Here

            defaultClassLoader = Thread.currentThread().getContextClassLoader();

         Map env = environment == null ? new HashMap() : environment;

         String protocol = jmxServiceURL.getProtocol();
         ConnectionResolver resolver = ConnectionResolver.newConnectionResolver(protocol, env);
         if (resolver == null) throw new IOException("Unsupported protocol: " + protocol);
         if (rmiServer == null) rmiServer = (RMIServer)resolver.lookupClient(jmxServiceURL, env);
         rmiServer = (RMIServer)resolver.bindClient(rmiServer, env);

         Object credentials = env.get(CREDENTIALS);
         this.connection = rmiServer.newClient(credentials);

         connected = true;
View Full Code Here

TOP

Related Classes of mx4j.remote.ConnectionResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.