Developing Security Providers
An MBean Definition File is an input file to the WebLogic MBeanMaker utility that uses the file to create an MBean type for managing a custom security provider. An MBean Definition File 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 available for use in a valid MBean Definition File:
An MBean Definition File must contain one root element called MBeanType
that has the following syntax:
<MBeanType Name=
string optional_attributes>
subelements
</MBeanType>
The MBeanType
element must include a Name attribute that 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>
Table A-1 describes the attributes you can use with the MBeanType
root element.
A |
||
Indicates that the MBean type is deprecated. This information appears in the generated Java source. If you do not specify this attribute, the assumed value is |
||
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 and DisplayMessage attributes. |
||
The message that a user interface displays to describe the MBean type. There is no default or assumed value. The |
||
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. See also Implements. |
||
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: Two or more MBean type names can be the same as long as the package name varies. |
||
Translates to the Java
Users who change an MBean class in an incompatible way will need to modify the For more information about |
||
A When specified in the |
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>
Table A-2 describes the attributes available to the MBeanAttribute
subelement.
The default value of the The value of this attribute is a Java expression that must evaluate to an object of a type that is compatible with the data type for this attribute. If you do not specify this attribute, the assumed value is |
||
Same as Default, but can be used if the type of the attribute is String. If |
||
Indicates that the MBean attribute is deprecated. This information appears in the generated Java source. If you do not specify this attribute, the assumed value is |
||
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 and DisplayMessage attributes. |
||
The message that a user interface displays to describe the MBean attribute. There is no default or assumed value. The |
||
The name that a user interface displays to identify the MBean attribute. |
||
A |
||
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 |
||
The value of this attribute is limited to a single numeric primitive value represented as a string. 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. |
||
The value of this attribute is limited to a single numeric primitive value represented as a string. 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. If you do not specify this attribute, the assumed value is |
||
A When specified in the |
Listing A-1 provides of an example of an MBean Definition File that uses many of the attributes described in this Appendix. It shows the used to generate the MBean type for a Sample Audit provider.
<?xml version="1.0" ?>
<!DOCTYPE MBeanType SYSTEM "commo.dtd">
<!-- MBean Definition File (MDF) for the Sample Auditor.
Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
-->
<!-- Declare your mbean.
Since it is for an auditor, it must extend the
weblogic.management.security.audit.Auditor mbean.
The Name and DisplayName must be the same.
They specify the name that will appear on the
console for this provider.
Note that since this is an xml document, you can't use double
quotes directly. Instead you need to use "
Note that setting "Writeable" to "false" on an attribute
makes the attribute read-only. The default is read-write.
-->
<MBeanType
Name = "SampleAuditor"
DisplayName = "SampleAuditor"
Package = "examples.security.providers.audit"
Extends = "weblogic.management.security.audit.Auditor"
>
<!-- You must set the value of the ProviderClassName attribute
(inherited from the weblogic.management.security.Provider mbean)
to the name of the java class you wrote that implements the
weblogic.security.spi.AuditProvider interface.
You can think of the provider's mbean as the factory
for your provider's runtime implementation.
-->
<MBeanAttribute
Name = "ProviderClassName"
Type = "java.lang.String"
Writeable = "false"
Default = ""examples.security.providers.audit.SampleAuditProviderImpl""
/>
<!-- You must set the value of the Description attribute
(inherited from the weblogic.management.security.Provider mbean)
to a brief description of your provider.
It is displayed in the console.
-->
<MBeanAttribute
Name = "Description"
Type = "java.lang.String"
Writeable = "false"
Default = ""WLES Sample Audit Provider""
/>
<!-- You must set the value of the Version attribute
(inherited from the weblogic.management.security.Provider mbean)
to your provider's version. There is no required format.
-->
<MBeanAttribute
Name = "Version"
Type = "java.lang.String"
Writeable = "false"
Default = ""1.0""
/>
<!-- Add any custom attributes for your provider here.
The sample auditor adds a custom attribute named
LogFileName. It contains the pathname of the
file that the sample auditor should write its
audit log to.
The sample auditor's runtime implementation
(SampleAuditProviderImpl) will read the value
of this attribute from its mbean.
-->
<MBeanAttribute
Name = "LogFileName"
Type = "java.lang.String"
Default = ""SampleAuditor.log""
/>
</MBeanType>