Containment Relationship Containment and Reference Relationships

Understanding WebLogic Server MBeans 2-3 The configuration MBeans enable each server instance in the domain to have an identical in-memory representation of the domains configuration. 2. To control changes to the domains configuration, JMX clients have read-only access to these configuration MBeans. The Administration Server maintains a separate, editable copy of the domains configuration documents in the domains configpending directory. It uses the data in these pending documents to instantiate a set of configuration MBeans that JMX clients can modify. After a JMX client modifies one of these configuration MBeans, the client directs the Administration Server to save the modifications in the pending configuration documents. Then the client starts a transactional process that updates the read-only configuration documents and configuration MBeans for all server instances in the domain. For more information, see Managing Configuration Changes in Understanding Domain Configuration for Oracle WebLogic Server. 3. Configuration MBeans are destroyed when you shut down the server instance that hosts them.

2.4 WebLogic Server MBean Data Model

The JMX specification does not impose a model for organizing MBeans. However, because the configuration of a WebLogic Server domain is specified in an XML document, WebLogic Server organizes its MBeans into a hierarchical model that reflects the XML document structure. For example, the root of a domains configuration document is domain and below the root are child elements such as server and cluster. Each domain maintains a single MBean of type DomainMBean to represent the domain root element. Within DomainMBean, JMX attributes provide access to the MBeans that represent child elements such as server and cluster. The following sections describe the patterns that WebLogic Server MBeans use to model the underlying XML configuration: ■ Section 2.4.1, Containment and Reference Relationships ■ Section 2.4.2, WebLogic Server MBean Object Names

2.4.1 Containment and Reference Relationships

MBean attributes that provide access to other MBeans represent one of following types of relationships: ■ Containment, which reflects a parent-child relationship between the corresponding XML elements in the domains configuration document. ■ Reference, which reflects a sibling or other non-ancestor, non-descendant relationship.

2.4.1.1 Containment Relationship

The XML excerpt in Example 2–1 illustrates a containment relationship between domain and server and domain and cluster. Example 2–1 Containment Relationship in XML domain server 2-4 Developing Custom Management Utilities With JMX for Oracle WebLogic Server nameMyServername server cluster nameMyClustername cluster domain To reflect this relationship, DomainMBean has two attributes, Servers and Clusters . The value of the Servers attribute is an array of object names javax.management.ObjectName[] for all ServerMBeans that have been created in the domain. The value of the Clusters attribute is an array of object names for all ClusterMBeans . Another aspect of the containment relationship is expressed in a set of MBean operations that follow the design pattern for Java bean factory methods: for each contained child MBean, the parent MBean provides a createChild and destroyChild operation, where Child is the short name of the MBeans type. The short name is the MBeans unqualified type name without the MBean suffix. For example, createServer. In some cases, an MBeans factory methods are not public because of dependencies within a server instance. In these cases the parent manages the life cycle of its children. For example, each ServerMBean must have one and only one child LogMBean to configure the servers local log file. The factory methods for LogMBean are not public, and ServerMBean maintains the life cycle of its LogMBean. With a containment relationship, the parent MBean also contains a lookupChild operation. If you know the user-supplied name that was used to create a specific server or resource, you can use the lookup operation in the parent MBean to get the object name. For example, DomainMBean includes an operation named lookupServersString name , which takes as a parameter the name that was used to create a server instance. If you named a server MS1, you could pass a String object that contains MS1 to the lookupServers method and the method would return the object name for MS1.

2.4.1.2 Reference Relationship