The ManagementView is an API for querying profiles for the deployment management object interface.
The ManagementView aggregates ManagementObjects from different sources and provides a unified management and query API for managed deployment and components in a profile.
In general ManagedObjects are build based on the metadata attachments with their corresponding annotations (see ManagedObjects).
Types of queries:
ManagedDeployments e.g. getDeployment(String deploymentName);
ManagedComponents e.g. getComponent(String componentName, ComponentType type);
The ManagedDeployments are containers for ManagedObjects and ManagedComponents for a deployment. The structure of a ManagedDeployment represents the structure of the actual Deployment in the deployers.
The structure of a ManagedDeployment:
- name: the full name of the associated DeploymentUnit
- simpleName: the simple name (X.ear) for the deployment
- parent: the parent deployment
- children: the nested deployment modules
- deploymentState: the current state of the deployment (started, stopped)
- managedObjects: the managedObjects in this deployment
- managedComponents: the managedComponents in this deployment
The ManagedComponents are a extension to ManagedObjects which additinally provide a ComponentType(String type, String subType) and represent a sub-component of a ManagedObject and are owned by a ManagedDeployment. ProfileService takes care of mapping those components back to the original structure.
Additionally to ManagedObjects can represent the actual runtime bean and expose statistics properties and managed operations. Furthermore ProfileService adds a persistence to runtime changes to components, which will be restored after a restart of JBoss ApplicationServer.
The ManagedComponent structure:
- name: the external name by which the ManagedComponent is known
- component-type; tye component classification as a type/subtype
- component-name: the runtime component name
- properties: the managed properties for this component
- operations: the managed operations for this component
- deployment: the associated deployment
// Get the ProfileService ManagementView ManagementView mgtView = getManagementView(); // Get the DefaultDS ComponentType type = new ComponentType("DataSource", "LocalTx"); ManagedComponent hsqldb = mgtView.getComponent("DefaultDS", type); // Change the value of min-pool-size ManagedProperty minSize = hsqldb.getProperty("min-pool-size"); MetaValue value = SimpleValueSupport.wrap(new Integer(13)); minSize.setValue(value); // Update the component mgtView.updateComponent(hsqldb);
This is an example how to use update the DefaultDS datasource min-pool-size. ProfileService will take care of dispatching the changes to the runtime component and persist the changes.