org.apache.qpid.management.domain.model
Class QpidClass

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.apache.qpid.management.domain.model.QpidEntity
          extended by org.apache.qpid.management.domain.model.QpidClass
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, QpidClassMBean

 class QpidClass
extends QpidEntity
implements QpidClassMBean

Qpid Class definition. A type definition for a manageable object. This class is also responsible to manage incoming obejct instance data (configuration & instrumentation). How can we handle data before schema is injected into this class? simply we must retain that data in raw format. This class has 3 states : 1) first state is when schema is not yet injected. In this case the incoming object data is retained as is (in raw format) and a schema request is sent; 2) second state is when schema has been requested but not yet injected. The incoming object data is still retained as is (in raw format) 3) third state is when schema is injected. Each injection of data will result in an update / create / delete of the corresponding object instance. In addition, the first time the state change, the old retained raw data is cnverted in object instance(s).


Nested Class Summary
(package private)  class QpidClass.QManManagedObject
          MBean used for representing remote broker object instances.
(package private) static interface QpidClass.State
          State interface for this class definition.
 
Nested classes/interfaces inherited from class org.apache.qpid.management.domain.model.QpidEntity
QpidEntity.QManManagedEntity
 
Field Summary
(package private)  Map<Binary,QpidClass.QManManagedObject> _objectInstances
           
(package private)  Map<String,QpidProperty> _properties
           
(package private)  QpidClass.State _schemaInjected
          After a schema is built into this definition this is the current state of the class.
(package private)  QpidClass.State _schemaNotRequested
          This is the initial state of every qpid class.
(package private)  QpidClass.State _schemaRequestedButNotYetInjected
          This is the first state of this class definition : the schema is not yet injected so each injection of object data will be retained in raw format.
(package private)  QpidClass.State _state
           
(package private)  Map<String,QpidStatistic> _statistics
           
 
Fields inherited from class org.apache.qpid.management.domain.model.QpidEntity
_hash, _logger, _metadata, _name, _objectName, _parent, _service, JMX_SERVICE
 
Constructor Summary
QpidClass(String className, Binary hash, QpidPackage parentPackage)
          Builds a new class with the given name and package as parent.
 
Method Summary
(package private)  void addConfigurationData(Binary objectId, byte[] rawData)
          Adds the instrumentation data for the object instance associated to the given object identifier.
(package private)  void addInstrumentationData(Binary objectId, byte[] rawData)
          Adds the configuration data for the object instance associated to the given object identifier.
(package private)  void buildAttributes(List<Map<String,Object>> props, List<Map<String,Object>> stats, MBeanAttributeInfo[] attributes)
          Internal method used for building attributes definitions.
(package private)  void buildMethods(List<MethodOrEventDataTransferObject> definitions, MBeanOperationInfo[] operationsMetadata)
          Internal method used for building method defintiions.
(package private)  QpidClass.QManManagedObject getObjectInstance(Binary objectId, boolean registration)
          Returns the object instance associated to the given identifier.
(package private)  void releaseResources()
          Deregisters all the object instances and release all previously acquired resources.
(package private)  void removeObjectInstance(Binary objectId)
          Removes the object instance associated to the given identifier.
(package private)  void setSchema(List<Map<String,Object>> propertyDefinitions, List<Map<String,Object>> statisticDefinitions, List<MethodOrEventDataTransferObject> methodDefinitions)
          Sets the schema for this class definition.
 String toString()
           
(package private)  void updateInstanceWithConfigurationData(QpidClass.QManManagedObject instance, byte[] rawData)
          Updates the given obejct instance with the given incoming configuration data.
(package private)  void updateInstanceWithInstrumentationData(QpidClass.QManManagedObject instance, byte[] rawData)
          Updates the given object instance with the given incoming instrumentation data.
 
Methods inherited from class org.apache.qpid.management.domain.model.QpidEntity
getName, getPackageName, requestSchema
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.qpid.management.domain.model.QpidClassMBean
getName, getPackageName
 

Field Detail

_schemaNotRequested

final QpidClass.State _schemaNotRequested
This is the initial state of every qpid class. The class definition instance is created but its schema has not been injected. Incoming configuration & instrumentation data will be stored in raw format because we don't know how to parse it until the schema arrives. In addition, this state is responsible (when data arrives) to request its schema.


_schemaRequestedButNotYetInjected

final QpidClass.State _schemaRequestedButNotYetInjected
This is the first state of this class definition : the schema is not yet injected so each injection of object data will be retained in raw format.


_schemaInjected

final QpidClass.State _schemaInjected
After a schema is built into this definition this is the current state of the class.


_properties

Map<String,QpidProperty> _properties

_statistics

Map<String,QpidStatistic> _statistics

_objectInstances

Map<Binary,QpidClass.QManManagedObject> _objectInstances

_state

QpidClass.State _state
Constructor Detail

QpidClass

QpidClass(String className,
          Binary hash,
          QpidPackage parentPackage)
Builds a new class with the given name and package as parent.

Parameters:
className - the name of the class.
hash - the class schema hash.
parentPackage - the parent of this class.
Method Detail

addInstrumentationData

void addInstrumentationData(Binary objectId,
                            byte[] rawData)
Adds the configuration data for the object instance associated to the given object identifier.

Parameters:
objectId - the object identifier.
rawData - the raw configuration data.

addConfigurationData

void addConfigurationData(Binary objectId,
                          byte[] rawData)
Adds the instrumentation data for the object instance associated to the given object identifier.

Parameters:
objectId - the object identifier.
rawData - the raw instrumentation data.

setSchema

void setSchema(List<Map<String,Object>> propertyDefinitions,
               List<Map<String,Object>> statisticDefinitions,
               List<MethodOrEventDataTransferObject> methodDefinitions)
         throws UnableToBuildFeatureException
Sets the schema for this class definition. A schema is basically a metadata description of all properties, statistics, methods and events of this class.

Parameters:
propertyDefinitions - properties metadata.
statisticDefinitions - statistics metadata.
methodDefinitions - methods metadata.
Throws:
UnableToBuildFeatureException - when some error occurs while parsing the incoming schema.

buildAttributes

void buildAttributes(List<Map<String,Object>> props,
                     List<Map<String,Object>> stats,
                     MBeanAttributeInfo[] attributes)
               throws UnableToBuildFeatureException
Internal method used for building attributes definitions.

Parameters:
props - the map contained in the properties schema.
stats - the map contained in the statistics schema.
attributes - the management metadata for attributes.
Throws:
UnableToBuildFeatureException - when it's not possibile to build one attribute definition.

getObjectInstance

QpidClass.QManManagedObject getObjectInstance(Binary objectId,
                                              boolean registration)
Returns the object instance associated to the given identifier. Note that if the identifier is not associated to any obejct instance, a new one will be created.

Parameters:
objectId - the object identifier.
registration - a flag indicating whenever the (new ) instance must be registered with MBean server.
Returns:
the object instance associated to the given identifier.

buildMethods

void buildMethods(List<MethodOrEventDataTransferObject> definitions,
                  MBeanOperationInfo[] operationsMetadata)
            throws UnableToBuildFeatureException
Internal method used for building method defintiions.

Parameters:
definitions - the properties map contained in the incoming schema.
operationsMetadata -
Throws:
UnableToBuildFeatureException - when it's not possibile to build one or more definitions.

updateInstanceWithConfigurationData

void updateInstanceWithConfigurationData(QpidClass.QManManagedObject instance,
                                         byte[] rawData)
Updates the given obejct instance with the given incoming configuration data.

Parameters:
instance - the managed object instance.
rawData - the incoming configuration data which contains new values for instance properties.

updateInstanceWithInstrumentationData

void updateInstanceWithInstrumentationData(QpidClass.QManManagedObject instance,
                                           byte[] rawData)
Updates the given object instance with the given incoming instrumentation data.

Parameters:
instance - the managed object instance.
rawData - the incoming instrumentation data which contains new values for instance properties.

toString

public String toString()
Overrides:
toString in class Object

removeObjectInstance

void removeObjectInstance(Binary objectId)
Removes the object instance associated to the given identifier.

Parameters:
objectId - the object identifier.

releaseResources

void releaseResources()
Deregisters all the object instances and release all previously acquired resources.



Licensed to the Apache Software Foundation