Book Image

Apache Geronimo 2.1: Quick Reference

Book Image

Apache Geronimo 2.1: Quick Reference

Overview of this book

Apache Geronimo is a robust, scalable, secure, and high-performing application server. But like all application servers, this power comes with a steep learning curve. This book can help you save your time and get working with Geronimo in matter of a few hours. This book is a quick-reference guide to Apache Geronimo that mitigates the starting pains that most developers have when they migrate to a new Application Server. It will help you to extend and amplify your existing development skills, empowering you to build new types of applications regardless of the platform or browser. The book will introduce you to the exciting features of Apache Geronimo Application Server. You will see how easily you can develop and deploy Java EE 5 applications on Geronimo. It covers everything from downloading the server to customizing it using custom GBeans. By following the practical examples in this book, you will be able to develop applications quickly using Geronimo Eclipse Plugin. The book covers Geronimo internals in detail, which helps you write custom services on Geronimo. Also, it helps you to gain a deep understanding of Geronimo plugin architecture and teaches you to extend your server functionality via plugins. By the end of the book, you will develop proficiency in Geronimo and Java EE 5 application development.
Table of Contents (21 chapters)
Apache Geronimo 2.1
Credits
About the Authors
About the Reviewer
Preface

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.