flex.management
Class BaseControl

java.lang.Object
  extended by flex.management.BaseControl
All Implemented Interfaces:
BaseControlMBean, javax.management.MBeanRegistration

public abstract class BaseControl
extends Object
implements BaseControlMBean, javax.management.MBeanRegistration

The implementation of the BaseControlMBean interface. This abstract class provides the core functionality that all Flex control MBeans require.

Defining concrete implementations of getId() and getType() are left to subclasses, but this base class does provide access to the parent MBean for each instance. This class also implements the MBeanRegistration interface, and it automatically stores a reference to the MBean server in each instance upon registration. Subclasses may choose to override none, any, or all of the methods defined by the MBeanRegistration interface, but any overrides should be sure to invoke the overridden method with a call to their superclass.

The register() method provides a simple and consistent way to register instances with the MBean server, and the getObjectName() method gaurantees consistent, well-formed ObjectNames for all MBean instances.


Field Summary
static String DOMAIN_PREFIX
          The prefix used for the domain part of control MBean names.
 
Constructor Summary
BaseControl(BaseControl parent)
          Constructs a BaseControl instance that references its parent; the parent may be null for root control MBeans.
 
Method Summary
 String getApplicationId()
          Returns an identifier for the application that hosts the component that this control manages.
abstract  String getId()
          Returns the id for this MBean.
 javax.management.MBeanServer getMBeanServer()
          The MBeanServer that this instance is registered with.
 javax.management.ObjectName getObjectName()
          Returns the ObjectName for this instance, according to the following format: {domain}[.{appId}]:type={type}[,{parent type}={parent id}]*[,server={server}]?,id={id} domain: The domain specified by the DOMAIN_PREFIX constant followed by the application identifier if one is available. type: The short type name of the resource managed by the MBean.
- The MessageBrokerControlMBean manages the flex.messaging.MessageBroker so: type=MessageBroker id: The id value for the resource managed by this MBean.
 javax.management.ObjectName getParent()
          Returns the parent for this MBean.
 BaseControl getParentControl()
          Returns the parent BaseControl of this instance.
abstract  String getType()
          Returns the type for this MBean.
 void postDeregister()
          Implements javax.management.MBeanRegistration.postDeregister.
 void postRegister(Boolean registrationDone)
          Implements javax.management.MBeanRegistration.postRegister.
 void preDeregister()
          Implements javax.management.MBeanRegistration.preDeregister.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          Implements javax.management.MBeanRegistration.preRegister.
 void register()
          Registers this instance with the MBean server.
 void setStartTimestamp(Date value)
          Sets the start timestamp for the managed component.
 void unregister()
          Unregisters this instance from the MBean server if it has been registered previously.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOMAIN_PREFIX

public static final String DOMAIN_PREFIX
The prefix used for the domain part of control MBean names.

See Also:
Constant Field Values
Constructor Detail

BaseControl

public BaseControl(BaseControl parent)
Constructs a BaseControl instance that references its parent; the parent may be null for root control MBeans.

Parameters:
parent - The parent BaseControl for this instance or null if this instance is the root of a control hierarchy.
Method Detail

getId

public abstract String getId()
Description copied from interface: BaseControlMBean
Returns the id for this MBean. This is the value that is set for the id key in the ObjectName for this MBean.

Specified by:
getId in interface BaseControlMBean
Returns:
The MBean instance id.

getType

public abstract String getType()
Description copied from interface: BaseControlMBean
Returns the type for this MBean. This is the value that is set for the type key in the ObjectName for this MBean.

Specified by:
getType in interface BaseControlMBean
Returns:
The MBean instance type.

getParent

public final javax.management.ObjectName getParent()
Description copied from interface: BaseControlMBean
Returns the parent for this MBean. The value is the ObjectName for the parent MBean that conceptually contains this MBean instance. If no parent exists, this method returns null.

Specified by:
getParent in interface BaseControlMBean
Returns:
The ObjectName for the parent of this MBean instance.

getApplicationId

public String getApplicationId()
Returns an identifier for the application that hosts the component that this control manages.

Returns:
An identifier for the application that hosts the component this control manages.

getParentControl

public final BaseControl getParentControl()
Returns the parent BaseControl of this instance.

Returns:
The parent BaseControl.

getMBeanServer

public final javax.management.MBeanServer getMBeanServer()
The MBeanServer that this instance is registered with. If this instance has not been registered this method returns null.

Returns:
The MBeanServer that this instance is registered with.

register

public final void register()
Registers this instance with the MBean server.

Throws:
ManagementException - If an MBeanRegistrationException or InstanceAlreadyExistsException is thrown while registering this MBean, the typed exception is wrapped in a runtime ManagementException and rethrown.

unregister

public final void unregister()
Unregisters this instance from the MBean server if it has been registered previously.


getObjectName

public final javax.management.ObjectName getObjectName()
Returns the ObjectName for this instance, according to the following format: {domain}[.{appId}]:type={type}[,{parent type}={parent id}]*[,server={server}]?,id={id} The runtime MBean model is hierarchical, with all MBeans ultimately contained by the root MessageBrokerControlMBean. The FDS ObjectNames used for these MBeans describe this containment in the following fashion. First, the 'type' key for a contained MBean indicates the containment hierarchy for the bean. So, the ObjectName for an RTMPEndpointControlMBean would be: type=MessageBroker.RTMPEndpoint
In addition to the hierarchical 'type' key, the full ObjectName for this RTMPEndpointControlMBean also contains a containment key: MessageBroker=MessageBroker1
Optional containment keys have the format: {parent type}={parent name}. A containment key is added for each ancestor up to the root of the hierarchy and these keys allow the ObjectName for any MBean instance to fully describe its specific location in the hierarchy. To complete the example, the full ObjectName for the example RTMPEndpointControlMBean would be: flex:type=MessageBroker.RTMPEndpoint,MessageBroker=MessageBroker1,id=RTMPEndpoint1

Returns:
The ObjectName for this instance.

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws Exception
Implements javax.management.MBeanRegistration.preRegister. Allows the MBean to perform any operations it needs before being registered in the MBean server. This base implementation stores a reference to the MBean server that may be accessed via getMBeanServer(). If subclasses override, they must call super.preRegister().

Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - The Mbean server in which the MBean will be registered.
name - The object name of the MBean.
Returns:
The name the MBean will be registered under.
Throws:
Exception

postRegister

public void postRegister(Boolean registrationDone)
Implements javax.management.MBeanRegistration.postRegister. Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. This base implementation is a no-op that may be overridden.

Specified by:
postRegister in interface javax.management.MBeanRegistration
Parameters:
registrationDone - Indicates whether or not the MBean was successfully registered in the MBean server.

preDeregister

public void preDeregister()
                   throws Exception
Implements javax.management.MBeanRegistration.preDeregister. Allows the MBean to perform any operations needed after having been unregistered in the MBean server. This base implementation is a no-op that may be overridden.

Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Implements javax.management.MBeanRegistration.postDeregister. Allows the MBean to perform any operations it needs before being unregistered by the MBean server. This base implementation is a no-op that may be overridden.

Specified by:
postDeregister in interface javax.management.MBeanRegistration

setStartTimestamp

public void setStartTimestamp(Date value)
Sets the start timestamp for the managed component.

Parameters:
value - The start timestamp for the managed component.


Copyright © 2007 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcdsjavadoc/flex/management/BaseControl.html