Several Terms in J2EE

RMI: Java Remote Method Invocation

RMI is the Java language's native way to communicate between distributed objects, such as two different objects running on different machines. It has some interestiong features not available in RMI-IIOP, such as distributed garbage collection, object activation, and downloadable class files. But EJB and J2EE mandate that you use RMI-IIOP, not RMI. Any object that implements java.rmi.Remote is a remote object and is callable form a differnet Java Virtual Machine.

 

ROMI-IIOP: Java Remote Method Invocation over the Internet Inter-ORB Protocal

RMI-IIOP is an extension of RMI  that can be used for CORBA integration. It is the official API that we use in J2EE. RMI-IIOP makes extensive use of the comcept of separating the interface of code form its implementation. All networking code you write is applied to interfaces, not implementation. It is impossible to perform a remote invocation derectly on an object implementation. You can operate solely on the interface to that object's class. Therefore, when using RMI-IIOP, you must build a custom interface, called a remote interface. This remote interface should extend the interface java.rmi.Remote. Your interface should hava within it a copy of each method your remote object express.

 

Client: interfaces, help classes, stubs

Local Client

Remote Client

 

Java RMI-IIOP based clients: use JNDI to look up objects, use JTA to control transactions

CORBA Clients: CORBA standard. Call EJB components using another language. Use CORBA Naming Service(Cos Naming) to look up objects. Use CORBA's object Transactiong Service(OTS) to control transactions.

 

How Client code works?

look up a home object => use the home object to create an EJB object => call business methods on the EJB object => remove the EJB object

 

We need way to publish the server and have the client locate the server. This process calles bootstrapping, is achieved via the JNDI.

JNDI: Java Naming and Directory Interface

The JNDI is a J2EE API that provide a standard interface for location users, machines, networks, objects, and services. JNDI is used in  EJB, RMI-IIOP, JDBC, and more. JNDI is a system for Java-based clients to interact with naming and directory systems. It is a bridge over naming and directory services, which provides one common interface to dispareate directories.

 The starting point of exporing a namespace is called an initial context using an initial context factory to acquire it. Initial context factories are used bootstrapping , or jumping-starting, your naming and directory service perations. You use an initial context factory as a bootstrapping mechanism for identifying an initial naming system. When you acquire an initial context, you must supply the necessary information for JNDI to qcquire that initial context. For example, if you're trying to access a JNDI implementation that runs within a J2EE server, you might supply:

  • The IP address of the J2EE server
  • The port number that the J2EE server accepts
  • The starting location within the JNDI tree
  • Any username/password necessary to user the J2EE server

There are essentially two uses of JNDI with RMI-IIOP:

  • An RMI-IIOP server first publishes itself to a JNDI tree using the JNDI API
  • A client then uses JNDI to look up an RMI-IIOP server

你可能感兴趣的:(java,jdbc,ejb,Access,UP)