## mx4j.tools.remote
Class AbstractJMXConnector

    java.lang.Object
      mx4j.tools.remote.AbstractJMXConnector

All Implemented Interfaces:
  javax.management.remote.JMXConnector, java.io.Serializable

Direct Known Subclasses:
  HTTPConnector, LocalConnector

public abstract class AbstractJMXConnector
extends java.lang.Object
implements javax.management.remote.JMXConnector, java.io.Serializable

Abstract implementation of the JMXConnector interface. It gives support for emitting connection notifications and implements JMXConnector methods using the template method pattern.

Version:
  $Revision: 1.8 $
See Also:
  Serialized Form

Field Summary

Fields inherited from interface javax.management.remote.JMXConnector
`CREDENTIALS`

Constructor Summary
`protected` `AbstractJMXConnector(javax.management.remote.JMXServiceURL address)` Creates a new JMXConnector that will connect to the given JMXServiceURL

Method Summary
`void` `addConnectionNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)`
`void` `close()`
`void` `connect()`
`void` `connect(java.util.Map environment)`
`protected ConnectionNotificationEmitter` `createConnectionNotificationEmitter()` Creates a notification emitter used to emit connection notifications.
`protected abstract void` `doClose()` Template method to be implemented by subclasses to close this JMXConnector
`protected abstract void` `doConnect(java.util.Map environment)`
`protected abstract javax.management.MBeanServerConnection` `doGetMBeanServerConnection(javax.security.auth.Subject delegate)` Template method to be implemented by subclasses to return an MBeanServerConnection for the given delegate subject.
`protected javax.management.remote.JMXServiceURL` `getAddress()` Returns the JMXServiceURL this JMXConnector will connect to.
`protected ConnectionNotificationEmitter` `getConnectionNotificationEmitter()`
`javax.management.MBeanServerConnection` `getMBeanServerConnection()`
`javax.management.MBeanServerConnection` `getMBeanServerConnection(javax.security.auth.Subject delegate)`
`protected boolean` `isClosed()` Returns whether the `close()` method has been called.
`protected boolean` `isConnected()` Returns whether the `connect()` or `connect(Map)` method has been called on this JMXConnector.
`void` `removeConnectionNotificationListener(javax.management.NotificationListener listener)`
`void` `removeConnectionNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)`
`protected void` `sendConnectionNotificationClosed()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.management.remote.JMXConnector
`getConnectionId`

Constructor Detail

### AbstractJMXConnector

    protected AbstractJMXConnector(javax.management.remote.JMXServiceURL address)
                            throws java.io.IOException

  Creates a new JMXConnector that will connect to the given JMXServiceURL

Method Detail

### getAddress

    protected javax.management.remote.JMXServiceURL getAddress()

  Returns the JMXServiceURL this JMXConnector will connect to.

### connect

    public void connect()
                 throws java.io.IOException,
                        java.lang.SecurityException

  Specified by:
    `connect` in interface `javax.management.remote.JMXConnector`
  Throws:
    `java.io.IOException`
    `java.lang.SecurityException`

### connect

    public void connect(java.util.Map environment)
                 throws java.io.IOException,
                        java.lang.SecurityException

  Specified by:
    `connect` in interface `javax.management.remote.JMXConnector`
  Throws:
    `java.io.IOException`
    `java.lang.SecurityException`

### doConnect

    protected abstract void doConnect(java.util.Map environment)
                               throws java.io.IOException,
                                      java.lang.SecurityException

  Throws:
    `java.io.IOException`
    `java.lang.SecurityException`

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `javax.management.remote.JMXConnector`
  Throws:
    `java.io.IOException`

### doClose

    protected abstract void doClose()
                             throws java.io.IOException

  Template method to be implemented by subclasses to close this JMXConnector

  Throws:
    `java.io.IOException`

### getMBeanServerConnection

    public javax.management.MBeanServerConnection getMBeanServerConnection()
                                                                    throws java.io.IOException

  Specified by:
    `getMBeanServerConnection` in interface `javax.management.remote.JMXConnector`
  Throws:
    `java.io.IOException`

### getMBeanServerConnection

    public javax.management.MBeanServerConnection getMBeanServerConnection(javax.security.auth.Subject delegate)
                                                                    throws java.io.IOException

  Specified by:
    `getMBeanServerConnection` in interface `javax.management.remote.JMXConnector`
  Throws:
    `java.io.IOException`

### doGetMBeanServerConnection

    protected abstract javax.management.MBeanServerConnection doGetMBeanServerConnection(javax.security.auth.Subject delegate)
                                                                                  throws java.io.IOException

  Template method to be implemented by subclasses to return an MBeanServerConnection for the given delegate subject. This method should return an MBeanServerConnection that delegates method calls to a `JMXConnection` (or an equivalent client side connection object). The JMXConnection object to which calls are delegated can in turn be a chain of objects that decorate the call performing some other operation; the final object in the chain is the one that really communicates with the server side, and it is normally called <protocol>ClientInvoker.

  Throws:
    `java.io.IOException`

### addConnectionNotificationListener

    public void addConnectionNotificationListener(javax.management.NotificationListener listener,
                                                  javax.management.NotificationFilter filter,
                                                  java.lang.Object handback)

  Specified by:
    `addConnectionNotificationListener` in interface `javax.management.remote.JMXConnector`

### removeConnectionNotificationListener

    public void removeConnectionNotificationListener(javax.management.NotificationListener listener)
                                              throws javax.management.ListenerNotFoundException

  Specified by:
    `removeConnectionNotificationListener` in interface `javax.management.remote.JMXConnector`
  Throws:
    `javax.management.ListenerNotFoundException`

### removeConnectionNotificationListener

    public void removeConnectionNotificationListener(javax.management.NotificationListener listener,
                                                     javax.management.NotificationFilter filter,
                                                     java.lang.Object handback)
                                              throws javax.management.ListenerNotFoundException

  Specified by:
    `removeConnectionNotificationListener` in interface `javax.management.remote.JMXConnector`
  Throws:
    `javax.management.ListenerNotFoundException`

### sendConnectionNotificationClosed

    protected void sendConnectionNotificationClosed()

### createConnectionNotificationEmitter

    protected ConnectionNotificationEmitter createConnectionNotificationEmitter()

  Creates a notification emitter used to emit connection notifications. This method is called once per JMXConnector.

### getConnectionNotificationEmitter

    protected ConnectionNotificationEmitter getConnectionNotificationEmitter()

### isConnected

    protected boolean isConnected()

  Returns whether the `connect()` or `connect(Map)` method has been called on this JMXConnector.

### isClosed

    protected boolean isClosed()

  Returns whether the `close()` method has been called.

Copyright © 2001-2003 MX4J Team. All Rights Reserved.