1. Technical Field
The present invention is directed to J2EE software applications. More specifically, the present invention is directed to a system, computer program product and method of narrowing an EJB object reference to a home implementation class name.
2. Description of Related Art
Java™, an object-oriented programming language developed by Sun Microsystems, Inc., is platform-independent, and networking/distributed-computing friendly. As a distributed-computing friendly programming language, Java provides for naming and directory services. A naming service provides a mechanism for giving names to objects so they can be used without knowing their storage location. A directory service, on the other hand, associates names with objects. Some directory services may provide additional information by associating attributes with the objects.
Java provides for naming and directory services through Java Naming and Directory Interface (JNDI). JNDI is a Java application program interface (API) for accessing naming and directory Services. That is, JNDI is an API and not, in itself, a naming and directory service. To use JNDI, an implementation of a naming and directory service, such as Lightweight Directory Access Protocol (LDAP), Domain Name System (DNS), Novell Directory Services (NDS), Network Information Service (NIS) etc. must also be available. JNDI also supports more specialized naming systems such as the Common Object Request Broker Architecture (CORBA) and the Remote Method Invocation (RMI). CORBA is an open distributed object computing infrastructure that is being standardized by the Object Management Group (OMG). CORBA automates many common network programming tasks such as object registration, location, activation et cetera. RMI allows an object running in one Java Virtual Machine (JVM) to invoke methods on an object running in another JVM. That is, RMI provides for remote communication between programs written in the Java programming language.
In its simplest form, JNDI is used to find resources, such as Enterprise Java Beans (EJBs) that have been registered via a Java 2 platform Enterprise Edition (J2EE) server. J2EE is a platform-independent, Java-centric environment for developing, building and deploying Web-based enterprise applications online. The J2EE platform consists of a set of services, APIs, and protocols that provide functionality for developing multi-tiered, Web-based applications. J2EE applications allow for deployment-time binding while maintaining type and link safety by having each component export a list of needed external components and resources. Thus, in a J2EE application, components find other components not via static linking, but through JNDI lookups.
When a JNDI lookup for an EJB is performed, a lookup( ) method is executed. The lookup( ) method generally returns a reference to the EJB (or an object reference) that in EJB version 1.0 would have to be cast to the home interface of the EJB. Casting is an explicit conversion from one data type to another. A data type is a named category of data that is characterized by a set of values, together with a way to denote those values and a collection of operations that interpret and manipulate the values. However, in EJB version 1.1 casting is not permitted.
Specifically, the communication between an EJB server and client is based on RMI. RMI, as mentioned above, is a set of protocols that enables Java objects to communicate remotely with other Java objects. Unlike CORBA, which is designed to support objects created in any language, RMI works only with Java objects.
The underlying protocol that RMI used for the communication is Internet Inter-Orb Protocol (IIOP), which is part of CORBA. IIOP is a protocol developed by the Object Management Group (OMG) to implement CORBA solutions over the World Wide Web. IIOP enables browsers and servers to exchange integers, arrays, and more complex objects. Since IIOP is part of CORBA, it has not been designed for Java, but rather for generic languages, and as such it has some limitations. One of its limitations is that it does not allow for casting.
Nonetheless, Java RMI-IIOP provides a mechanism to convert an object type received from a lookup( ) method to an appropriate type. This is done through a narrow( ) method. To use the narrow( ) method, however, a remote reference to a home implementation class name of the EJB must be known. This will allow the EJB to be called for instantiation without error. But, in cases where the EJB instance is being treated as an interface implementation, the home implementation class name is not known. An interface defines operations or methods that a class implements (i.e., declares what a class does). A class is used to instantiate or create objects in memory.
Thus, there is a need for a system, computer program product and method of dynamically determining EJB home implementation class names.
The present invention provides a system, computer program product and method of narrowing an enterprise Java bean (EJB) object reference to a home implementation class name. Generally, when a Java Naming and Directory Interface lookup is performed for an EJB, an object reference is returned. In the case of the invention, an interoperable object reference (IOR) associated with the object is also obtained. The IOR contains information that may lead to the home implementation class name of the object. Once the class name is obtained, the object may be instantiated.
Thus, the invention first determines the location of the EJB in a network by performing a JNDI lookup. Using the location, an IOR of the EJB is obtained. The IOR is then processed to obtain the home implementation class name of the object. Processing the IOR includes decomposing the IOR to arrive at a typeId string stored therein. The typeId string is further processed to obtain the home implementation class name contained therein.
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
With reference now to the figures,
In the depicted example, server 104 is connected to network 102 along with storage unit 106. In addition, clients 108, 110, and 112 are connected to network 102. These clients 108, 110, and 112 may be, for example, personal computers or network computers. In the depicted example, server 104 provides data, such as boot files, operating system images, and applications to clients 108, 110 and 112. Clients 108, 110 and 112 are clients to server 104. Network data processing system 100 may include additional servers, clients, and other devices not shown. In the depicted example, network data processing system 100 is the Internet with network 102 representing a worldwide collection of networks and gateways that use the TCP/IP suite of protocols to communicate with one another. At the heart of the Internet is a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational and other computer systems that route data and messages. Of course, network data processing system 100 also may be implemented as a number of different types of networks, such as for example, an intranet, a local area network (LAN), or a wide area network (WAN).
Referring to
Peripheral component interconnect (PCI) bus bridge 214 connected to I/O bus 212 provides an interface to PCI local bus 216. A number of modems may be connected to PCI local bus 216. Typical PCI bus implementations will support four PCI expansion slots or add-in connectors. Communications links to network computers 108, 110 and 112 in
Additional PCI bus bridges 222 and 224 provide interfaces for additional PCI local buses 226 and 228, from which additional modems or network adapters may be supported. In this manner, data processing system 200 allows connections to multiple network computers. A memory-mapped graphics adapter 230 and hard disk 232 may also be connected to I/O bus 212 as depicted, either directly or indirectly.
Those of ordinary skill in the art will appreciate that the hardware depicted in
The data processing system depicted in
With reference now to
An operating system runs on processor 302 and is used to coordinate and provide control of various components within data processing system 300 in
Those of ordinary skill in the art will appreciate that the hardware in
As another example, data processing system 300 may be a stand-alone system configured to be bootable without relying on some type of network communication interface, whether or not data processing system 300 comprises some type of network communication interface. As a further example, data processing system 300 may be a Personal Digital Assistant (PDA) device, which is configured with ROM and/or flash ROM in order to provide non-volatile memory for storing operating system files and/or user-generated data.
The depicted example in
The present invention provides a system, computer program product and method of dynamically determining EJB home implementation class names for narrowing purposes. The invention may be local to client systems 108, 110 and 112 of
Generally, objects publish their identities and locations via object references. In CORBA, object references are exchanged over IIOP in the form of interoperable object reference (IOR). An IOR is a data structure associated with an object that contains enough information to locate the object from anywhere on a network. Put simply, an IOR allows an application to make remote method calls on an object. To do so, an IOR usually contains one or more profiles. A profile describes how a client can contact and send requests to the object using a particular protocol. The profile contains the Internet address of the object's server and a key value used by the server to find the specific object described by the reference.
Typically, the application that creates a CORBA object produces a file containing a stringified IOR. To use a CORBA object, an application has to obtain the stringified IOR from the file in which it is stored, and call the object request broker's (ORB's) string_to_object method( ). This method will convert the string to a real CORBA object reference for use.
Thus, in operation, if server 104 is a J2EE server with which an EJB is registered. And, if an application on one of the clients 108, 110 and 112 wants to dynamically link to the EJB, the application may perform a JNDI lookup for the EJB. As mentioned before, an object reference to the EJB will be returned to the application. Further, the application may use a utility method to retrieve the IOR of the RMI/IIOP CORBA object. Once the IOR is obtained, it may be decomposed to isolate the “typeId string.” From the “typeId string,” the class name of the object may be obtained. Using the class name of the object, the application may call the object for instantiation.
The description of the present invention has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiment was chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.