GBeans

The gbean element defines a GBean that will be deployed as part of the module. The schema diagram for this element is shown below:

The name attribute of the gbean element specifies a unique name for this GBean within this module. This name will be used as a name component in AbstractName, hence AbstractName will be unique, server-wide. The class attribute of the gbean element specifies the fully-qualified name of the Java class containing the GBeanInfo for this GBean. The description of the child elements of gbean is as follows:

  • attribute: This element provides a value for the GBean attribute. The name of the GBean attribute is specified using the name attribute of the attribute element. The type of the GBean attribute is specified by using the type attribute of the attribute element. The value of the attribute is specified by the value of this element.

  • xml-attribute: This element specifies the value of a particular GBean attribute in XML format, interpreted by a component running in the system, which converts it to a single value for this attribute. The name of the GBean attribute is specified by using the name attribute of the element.

  • reference: This element specifies the value of a particular reference for this GBean, in its simplest form. It holds the reference to the GBean that matches the single pattern specified here; if no value is specified it will refer to all the matching GBeans. The name of the GBean reference is specified by using the name attribute of this element. The child elements of this element are as follows:

    • groupId: This element specifies the name of the group containing the module to match. By default is it the wild card '*'.

    • artifactId: This element specifies the name of the module in a specified group to be matched.

    • version: This element specifies the version number of the module, formatted by dot-separated numbers. If no version is provided it will be defaulted to the latest available version that matches the other criteria.

    • module: The value specified for module should match the file name of the referenced module.

    • type: This element defines the type of the module to be matched. The type could be CAR, JAR, EAR, WAR, and so on. If no type is provided, it will be defaulted to the wild card '*'.

    • name: This element specifies the name to identify the referenced GBean by.

  • references: This element specifies the value of a particular reference for this GBean if it matches multiple pattern elements. Each pattern element may have groupId, artifactId, version, module, type, and name child elements.

  • xml-reference: This element specifies the value of a particular reference in XML format, which will be interpreted by a component running in the system, which converts it to a single value for this reference. The name of the reference is specified by using the name attribute of this element.

  • dependency: This element is used to resolve dependencies at the GBean level. This is normally used only if, for some reason, the GBeans within a module must be started in a certain order that is not reflected in the references between them. Dependencies are specified by using multiple pattern elements. Each pattern element may have groupId, artifactId, version, module, type, and name child elements.

The following is an example of a GBean definition:

<gbean name="packt-properties-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
GBeansdefinition, example<attribute name="realmName">packt-properties-realm </attribute>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
<xml-reference name="LoginModuleConfiguration">
<log:login-config xmlns:log="http://geronimo.apache.org/ xml/ns/loginconfig-2.0">
<log:login-module control-flag="REQUIRED" wrap-principals="false">
<log:login-domain-name>packt-properties-realm </log:login-domain-name>
<log:login-module-class>org.apache.geronimo. security.realm.providers.PropertiesFileLoginModule </log:login-module-class>
<log:option name="usersURI"> var/security/packt-users.properties </log:option>
<log:option name="groupsURI"> var/security/packt-groups.properties </log:option>
</log:login-module>
</log:login-config>
</xml-reference>
</gbean>

Here, a security realm GBean with name of packt-properties-realm is created using XML. It configures one GBean attribute, with a name of realmName, using an attribute element and two references, namely, ServerInfo using a reference element and LoginModuleConfiguration using an xml-reference element.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset