Developing Security Providers for WebLogic Server
An MBean Definition File (MDF) is an input file to the WebLogic MBeanMaker utility, which uses the file to create an MBean type for managing a custom security provider. An MDF must be formatted as a well-formed and valid XML file that describes a single MBean type. The following sections describe all the elements and attributes that are available for use in a valid MDF:
All MDFs must contain exactly one root element called MBeanType
, which has the following syntax:
<MBeanType Name=
string optional_attributes>
subelements
</MBeanType>
The MBeanType
element must include a Name attribute, which specifies the internal, programmatic name of the MBean type. (To specify a name that is visible in a user interface, use the DisplayName attribute.) Other attributes are optional.
The following is a simplified example of an MBeanType
(root) element:
<MBeanType Name="MyMBean" Package="com.mycompany">
<MBeanAttribute Name="MyAttr" Type="java.lang.String" Default="Hello World"/>
</MBeanType>
Attributes specified in the MBeanType
(root) element apply to the entire set of MBeans instantiated from that MBean type. To override attributes for specific MBean instances, you need to specify attributes in the MBeanAttribute
subelement. For more information, see The MBeanAttribute Subelement.
Table A-1 describes the attributes available to the MBeanType
(root) element. The JMX Specification/BEA Extension column indicates whether the attribute is a BEA extension to the JMX specification or a standard JMX attribute. Note that BEA extensions might not function on other J2EE Web servers.
A |
|||
Indicates that the MBean type is deprecated. This information appears in the generated Java source, and is also placed in the |
|||
An arbitrary string associated with the MBean type that appears in various locations, such as the Javadoc for generated classes. There is no default or assumed value. Note: To specify a description that is visible in a user interface, use the DisplayName attribute. |
|||
The name that a user interface displays to identify instances of MBean types. For an instance of type X, the default |
|||
A fully qualified MBean type name that this MBean type extends. |
|||
A comma-separated list of fully qualified MBean type names that this MBean type implements. See also Extends. |
|||
Mandatory attribute that specifies the internal, programmatic name of the MBean type. |
|||
Specifies the package name of the MBean type and determines the location of the class files that the WebLogic MBeanMaker creates. If you do not specify this attribute, the MBean type is placed in the Java default package. Note: MBean type names can be the same as long as the package name varies. |
|||
Specifies how persistence will occur:
Note: When specified in the MBeanType element, this value overrides any setting within an individual MBeanAttribute subelement. |
You must supply one instance of an MBeanAttribute
subelement for each attribute in your MBean type. The MBeanAttribute
subelement must be formatted as follows:
<MBeanAttribute Name=
string optional_attributes />
The MBeanAttribute
subelement must include a Name attribute, which specifies the internal, programmatic name of the Java attribute in the MBean type. (To specify a name that is visible in a user interface, use the DisplayName attribute.) Other attributes are optional.
The following is a simplified example of an MBeanAttribute
subelement within an MBeanType
element:
<MBeanType Name="MyMBean" Package="com.mycompany">
<MBeanAttribute Name= "WhenToCache"
Type="java.lang.String"
LegalValues="'cache-on-reference','cache-at-initialization','cache-never'"
Default= "cache-on-reference"
/>
</MBeanType>
Attributes specified in an MBeanAttribute
subelement apply to a specific MBean instance. To set attributes for the entire set of MBeans instantiated from an MBean type, you need to specify attributes in the MBeanType
(root) element. For more information, see The MBeanType (Root) Element.
Table A-2 describes the attributes available to the MBeanAttribute
subelement. The JMX Specification/BEA Extension column indicates whether the attribute is a BEA extension to the JMX specification. Note that BEA extensions might not function on other J2EE Web servers.
The value to be returned if the If you do not specify this attribute, the assumed value is |
|||
Indicates that the MBean attribute is deprecated. This information appears in the generated Java source, and is also placed in the |
|||
An arbitrary string associated with the MBean attribute that appears in various locations, such as the Javadoc for generated classes. There is no default or assumed value. Note: To specify a description that is visible in a user interface, use the DisplayName attribute. |
|||
Changes made to dynamic MBeans take effect without rebooting the server. By default, all custom security provider MBean attributes are non-dynamic. Note that in 8.1 and 7.0, all custom security provider MBean attributes were dynamic. |
|||
A |
|||
Classname of an interface to be used instead of the MBean interface generated by the WebLogic MBeanMaker. Do not specify if "Type" is |
|||
Specifies whether a generated Java interface uses the JMX |
|||
Specifies whether |
|||
Specifies a fixed set of allowable values for the current Note: The items in the list must be convertible to the data type that is specified by the subelement's |
|||
For numeric MBean attribute types only, provides a numeric value that represents the inclusive maximum value for the attribute. If you do not specify this attribute, the value can be as large as the data type allows. |
|||
For numeric MBean attribute types only, provides a numeric value which represents the inclusive minimum value for the attribute. If you do not specify this attribute, the value can be as small as the data type allows. |
|||
Mandatory attribute that specifies the internal, programmatic name of the MBean attribute. |
|||
The fully qualified classname of the data type of this attribute. This corresponding class must be available on the classpath. If you do not specify this attribute, the assumed value is |
|||
A When specified in the |
MBeanConstructor
subelements are not currently used by the WebLogic MBeanMaker, but are supported for compliance with the Java Management eXtensions 1.0 specification and upward compatibility. Therefore, attribute details for the MBeanConstructor
subelement (and its associated MBeanConstructorArg
subelement) are omitted from this documentation.
You must supply one instance of an MBeanOperation
subelement for each operation (method) that your MBean type supports. The MBeanOperation
must be formatted as follows:
<MBeanOperation Name=
string optional_attributes >
=string optional_attributes
<MBeanOperationArg Name/>
</MBeanOperation>
The MBeanOperation
subelement must include a Name attribute, which specifies the internal, programmatic name of the operation. (To specify a name that is visible in a user interface, use the DisplayName attribute.) Other attributes are optional.
Within the MBeanOperation
element, you must supply one instance of an MBeanOperationArg
subelement for each argument that your operation (method) uses. The MBeanOperationArg
must be formatted as follows:
<MBeanOperationArg Name=
string
optional_attributes />
The Name
attribute must specify the name of the operation. The only optional attribute for MBeanOperationArg
is Type
, which provides the Java class name that specifies behavior for a specific type of Java attribute. If you do not specify this attribute, the assumed value is java.lang.String
.
The following is a simplified example of an MBeanOperation
and MBeanOperationArg
subelement within an MBeanType
element:
<MBeanType Name="MyMBean" Package="com.mycompany">
<MBeanOperation
Name= "findParserSelectMBeanByKey"
ReturnType="XMLParserSelectRegistryEntryMBean"
Description="Given a public ID, system ID, or root element tag, returns the object name of the corresponding XMLParserSelectRegistryEntryMBean."
>
<MBeanOperationArg Name="publicID" Type="java.lang.String"/>
<MBeanOperationArg Name="systemID" Type="java.lang.String"/>
<MBeanOperationArg Name="rootTag" Type="java.lang.String"/>
</MBeanOperation>
</MBeanType>
Table A-3 describes the attributes available to the MBeanOperation
subelement. The JMX Specification/BEA Extension column indicates whether the attribute is a BEA extension to the JMX specification. Note that BEA extensions might not function on other J2EE Web servers.
Indicates that the MBean operation is deprecated. This information appears in the generated Java source, and is also placed in the |
|||
An arbitrary string associated with the MBean operation that appears in various locations, such as the Javadoc for generated classes. There is no default or assumed value. Note: To specify a description that is visible in a user interface, use the DisplayName attribute. |
|||
Mandatory attribute that specifies the internal, programmatic name of the MBean operation. |
|||
A string containing the fully qualified classname of the Java object returned by the operation being described. |
Table A-4 describes the attributes available to the MBeanOperationArg
subelement. The JMX Specification/BEA Extension column indicates whether the attribute is a BEA extension to the JMX specification. Note that BEA extensions might not function on other J2EE Web servers.
Your MBean Definition Files (MDFs) must use only JDK exception types or weblogic.management.utils
exception types. The following is a code fragment from Listing A-1 that shows the use of an MBeanException
within an MBeanOperation
subelement:
<MBeanOperation
Name = "registerPredicate"
ReturnType = "void"
Description = "Registers a new predicate with the specified class name."
>
<MBeanOperationArg
Name = "predicateClassName"
Type = "java.lang.String"
Description = "The name of the Java class that implements the predicate."
/>
<MBeanException>weblogic.management.utils.InvalidPredicateException</MBeanException>
<MBeanException>weblogic.management.utils.AlreadyExistsException</MBeanException>
</MBeanOperation>
Listing A-1 and Listing A-2 provide examples of MBean Definition Files (MDFs) that use many of the attributes described in this Appendix. Listing A-1 shows the MDF used to generate an MBean type that manages predicates and reads data about predicates and their arguments.Listing A-2 shows the MDF used to generate the MBean type for the WebLogic (default) Authorization provider.
Listing A-1 PredicateEditor.xml
<?xml version="1.0" ?>
<!DOCTYPE MBeanType SYSTEM "commo.dtd">
<MBeanType
Name = "PredicateEditor"
Package = "weblogic.security.providers.authorization"
Implements = "weblogic.security.providers.authorization.PredicateReader"
PersistPolicy = "OnUpdate"
Abstract = "false"
Description = "This MBean manages predicates and reads data about predicates and their arguments.<p>"
>
<MBeanOperation
Name = "registerPredicate"
ReturnType = "void"
Description = "Registers a new predicate with the specified class name."
>
<MBeanOperationArg
Name = "predicateClassName"
Type = "java.lang.String"
Description = "The name of the Java class that implements the predicate."
/>
<MBeanException>weblogic.management.utils.InvalidPredicateException</MBeanException>
<MBeanException>weblogic.management.utils.AlreadyExistsException</MBeanException>
</MBeanOperation>
<MBeanOperation
Name = "unregisterPredicate"
ReturnType = "void"
Description = "Unregisters the currently registered predicate." >
<MBeanOperationArg
Name = "predicateClassName"
Type = "java.lang.String"
Description = "The name of the Java class that implements predicate to be unregistered."
/>
<MBeanException>weblogic.management.utils.NotFoundException</MBeanException>
</MBeanOperation>
</MBeanType>
Listing A-2 DefaultAuthorizer.xml
<?xml version="1.0" ?>
<!DOCTYPE MBeanType SYSTEM "commo.dtd">
<MBeanType
Name = "DefaultAuthorizer"
DisplayName = "DefaultAuthorizer"
Package = "weblogic.security.providers.authorization"
Extends ="weblogic.management.security.authorization.DeployableAuthorizer" Implements = "weblogic.management.security.authorization.PolicyEditor, weblogic.security.providers.authorization.PredicateEditor"
PersistPolicy = "OnUpdate"
Description = "This MBean represents configuration attributes for the WebLogic Authorization provider. <p>"
>
<MBeanAttribute
Name = "ProviderClassName"
Type = "java.lang.String"
Writeable = "false"
Default""weblogic.security.providers.authorization.DefaultAuthorizationProviderImpl""
Description = "The name of the Java class used to load the WebLogic Authorization provider."
/>
<MBeanAttribute
Name = "Description"
Type = "java.lang.String"
Writeable = "false"
Default = ""Weblogic Default Authorization Provider"" Description = "A short description of the WebLogic Authorization provider." />
<MBeanAttribute
Name = "Version"
Type = "java.lang.String"
Writeable = "false"
Default = ""1.0""
Description = "The version of the WebLogic Authorization provider."
/>
</MBeanType>