Global directory tree Implementation and custom resource development and usage on Apache Geronimo

Source: Internet
Author: User
Tags connection pooling resource

Server-side Global directory tree

What is a global directory tree

JNDI (Java naming and directory Interface) is a group of applications that access the naming and directory services, through which client programs can access multiple directory services in a unified manner. Java EE application servers typically integrate the implementation of a directory tree to maintain a server-side global shared directory tree. In this way, the server can bind some resources to a directory tree, such as database connection pooling, JMS resources, and so on, while client applications can obtain these resource references through standard JNDI interfaces. The so-called global, is relative to the java:comp/env of this local directory, for the latter, each program component has its own space, in other words, each application component in retrieving java:comp/env to obtain content is independent and irrelevant. In a later example of this article, we will describe how to map objects on a global tree to a local directory.

Xbean-naming

Xbean-naming is a component of the Geronimo subproject Xbean, about Apache Xbean, which you can refer to http://geronimo.apache.org/xbean/. It provides a single virtual machine's directory tree implementation, while also providing some extension implementation capabilities.

Because Xbean-naming is implemented as a Geronimo directory tree, the following properties are set to System properties when Geronimo starts:

Java.naming.factory.initial = Org.apache.xbean.naming.global.GlobalContextManager Java.naming.factory.initial contains Initial Context Factory class name

java.naming.factory.url.pkgs = org.apache.xbean.naming java.naming.factory.url.pkgs A multiple package name prefix at the colon interval, which will be used for load operations in the URL context factory.

Java.naming.provider.url = rmi://localhost:1099 Java.naming.provider.url provides naming service registration address

The user program running in Geronimo, if you need to access the global tree, does not need to specify the above properties when you create the InitialContext object, and the settings are automatically read from the system properties. It should be emphasized here that users who want to read additional JNDI directories in the Geronimo runtime environment need to explicitly specify the above attribute values, such as when reading a remote EJB object reference in Geronimo, you specify the OPENEJB proprietary attribute value.

Resource binding implementation mechanism on Geronimo Global directory tree

Magical resourcebinding GBean and Resourcesource interface

In Geronimo, whenever a database connection pool or JMS resource is created through a console or deployment file, the corresponding connectionfactory and JMS Queue/topic are bound to the global tree in a certain format. So how does the Geronimo platform perceive that new resources are created and bound to the Global directory tree? The key function is resourcebinding GBean and Resourcesource interface. Let's take a concrete look at the structure and implementation of these two classes.

Figure 1. Resourcebinding Class inheritance Structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.