org.jboss.services.binding
Class ServiceBindingManager

java.lang.Object
  extended byorg.jboss.services.binding.ServiceBindingManager
All Implemented Interfaces:
MBeanRegistration (src)

public class ServiceBindingManager
extends java.lang.Object
implements MBeanRegistration (src)

The services configuration binding manager mbean implementation.

The ServiceBindingManager enables the centralized management of ports, by service. The port configuration store is abstracted out using the ServicesStore and ServicesStoreFactory interfaces. Note that this class does not implement the JBoss services lifecycle methods and hook its behavior off of those because this service is used to configure other services before any of the lifecycle methods are invoked.


Constructor Summary
ServiceBindingManager()
           
 
Method Summary
 void applyServiceConfig(ObjectName (src)  serviceName)
          Looks up the service config for the requested service using the server name bound to this mbean and invokes the configuration delegate to apply the bindings to the service.
 java.lang.String getServerName()
           
 ServiceConfig (src) getServiceConfig(ObjectName (src)  serviceName)
          Looks up the service config for the given service using the server name bound to this mbean.
 java.lang.String getStoreFactoryClassName()
           
 java.net.URL getStoreURL()
           
 void postDeregister()
          This method is called by the MBeanServer after deregistration takes place.
 void postRegister(java.lang.Boolean registrationDone)
          This method is called by the MBeanServer after registration takes place or when registration fails.
 void preDeregister()
          This method is called by the MBeanServer before deregistration takes place.
 ObjectName (src) preRegister(MBeanServer (src)  server, ObjectName (src)  name)
          This method is called by the MBeanServer before registration takes place.
 void setServerName(java.lang.String serverName)
           
 void setStoreFactoryClassName(java.lang.String storeFactoryClassName)
           
 void setStoreURL(java.net.URL storeURL)
          Set the string representation of the store URL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceBindingManager

public ServiceBindingManager()
Method Detail

getServerName

public java.lang.String getServerName()

setServerName

public void setServerName(java.lang.String serverName)

getStoreFactoryClassName

public java.lang.String getStoreFactoryClassName()

setStoreFactoryClassName

public void setStoreFactoryClassName(java.lang.String storeFactoryClassName)

getStoreURL

public java.net.URL getStoreURL()

setStoreURL

public void setStoreURL(java.net.URL storeURL)
Set the string representation of the store URL


preRegister

public ObjectName (src)  preRegister(MBeanServer (src)  server,
                              ObjectName (src)  name)
                       throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preRegister in interface MBeanRegistration (src)
Returns:
the actual ObjectName to register this MBean with.
Throws:
java.lang.Exception - for any error, the MBean is not registered.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer after registration takes place or when registration fails.

Specified by:
postRegister in interface MBeanRegistration (src)
Parameters:
registrationDone - the MBeanServer passes true when the MBean was registered, false otherwise.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer before deregistration takes place.

The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preDeregister in interface MBeanRegistration (src)
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer after deregistration takes place.

Specified by:
postDeregister in interface MBeanRegistration (src)

getServiceConfig

public ServiceConfig (src)  getServiceConfig(ObjectName (src)  serviceName)
                               throws java.lang.Exception
Looks up the service config for the given service using the server name bound to this mbean.

Parameters:
serviceName - the JMX ObjectName of the service
Returns:
ServiceConfig instance if found, null otherwise
Throws:
java.lang.Exception

applyServiceConfig

public void applyServiceConfig(ObjectName (src)  serviceName)
                        throws java.lang.Exception
Looks up the service config for the requested service using the server name bound to this mbean and invokes the configuration delegate to apply the bindings to the service. If no config if found then this method is a noop.

Parameters:
serviceName - the JMX ObjectName of the service
Throws:
Exception, - thrown on failure to apply an existing configuration
java.lang.Exception