org.objectweb.jonas.jmx
Class ConnectorFactory

java.lang.Object
  extended byorg.objectweb.jonas.jmx.ConnectorFactory

public class ConnectorFactory
extends java.lang.Object

Manages the current "jonas provided" RMIConnector used to communicate with the MBEanServer.

Author:
Bruno Michel and Guillaume Riviere

Constructor Summary
ConnectorFactory()
           
 
Method Summary
static javax.naming.Context getContext()
           
static java.lang.String getCurrentRMIConnectorName()
           
static java.lang.String getJonasNamingServiceURL()
           
static RMIConnector getRMIConnector()
           
static java.util.Set getRMIConnectorsNames()
           
static void lookupRMIConnector()
          Lookup for the RMI connector registered with the currentRMIConnectorName JNDI name.
static void resetCurrentRMIConnectorName()
          Set the currentRMIConnectorName to null
static void setCurrentRMIConnectorName(java.lang.String name)
          Set the currentRMIConnectorName to the specified value, then lookup for the RMI connector
static void setJonasNamingServiceURL(java.lang.String url)
          Sets the PROVIDER_URL property to the specified value.
static void setNamingEnvCtx(java.util.Properties env)
          Create a new naming context based on the given env.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectorFactory

public ConnectorFactory()
Method Detail

getContext

public static javax.naming.Context getContext()
                                       throws javax.naming.NamingException
Returns:
Context the current application context, create an initial context if there is no current context.
Throws:
javax.naming.NamingException

getCurrentRMIConnectorName

public static java.lang.String getCurrentRMIConnectorName()
Returns:
String the name of the current RMI connector. If no RMI connector is selected, returns the first RMI connector found with the getRMIConnectorsNames method. Return null if no RMI connector is available.

setCurrentRMIConnectorName

public static void setCurrentRMIConnectorName(java.lang.String name)
                                       throws javax.naming.NamingException
Set the currentRMIConnectorName to the specified value, then lookup for the RMI connector

Throws:
javax.naming.NamingException

resetCurrentRMIConnectorName

public static void resetCurrentRMIConnectorName()
Set the currentRMIConnectorName to null


getRMIConnectorsNames

public static java.util.Set getRMIConnectorsNames()
                                           throws javax.naming.NamingException
Returns:
Set a set containning all RMI connector names available in the current context.
Throws:
javax.naming.NamingException

getJonasNamingServiceURL

public static java.lang.String getJonasNamingServiceURL()
Returns:
String the value of the PROVIDER_URL property in the current context. If a javax.naming.NamingException is catch, the exception message is returned.

setNamingEnvCtx

public static void setNamingEnvCtx(java.util.Properties env)
                            throws javax.naming.NamingException
Create a new naming context based on the given env. properties

Parameters:
env - properties to create a new naming context
Throws:
javax.naming.NamingException

setJonasNamingServiceURL

public static void setJonasNamingServiceURL(java.lang.String url)
                                     throws javax.naming.NamingException
Sets the PROVIDER_URL property to the specified value. Then, sets the current RMI connector to null.

Throws:
javax.naming.NamingException

getRMIConnector

public static RMIConnector getRMIConnector()
                                    throws javax.naming.NamingException
Returns:
RMIConnector the current RMI connector, if null, lookup for a new one.
Throws:
javax.naming.NamingException

lookupRMIConnector

public static void lookupRMIConnector()
                               throws javax.naming.NamingException
Lookup for the RMI connector registered with the currentRMIConnectorName JNDI name.

Throws:
javax.naming.NamingException