RMI also supports a registry, which allows clients to perform lookups for a particular service. The following diagram shows the interaction between different components of an RMI system. Clients that know about a service can look up its location from a registry and access the service. If a new class is required, it can be downloaded from a web server. Client connects to a registry server, accesses a RMI service, and downloads new code as required from a web server.
Remote method invocation has a lot of potential, from remote processing and load sharing of CPU's to transport mechanisms for higher level tasks, such as mobile agents which execute on remote machines Reilly, Because of the flexibility of remote method invocation, it has become an important tool for Java developers when writing distributed systems.
If legacy systems need to interface with your RMI systems, or your RMI systems need to interface with them, problems can occur. RMI is Java specific, and you'll need to write a bridge between older systems. Additionally, if you or your company plans on using other languages in the future, you may also find yourself in a bind because of RMI's tie to Java - one day Java itself may become a legacy platform.
Writing interfaces to legacy systems isn't my idea of fun programming! That said, for Java developers, CORBA offers less flexibility, because it doesn't allow executable code to be sent to remote systems. IDL mappings to most popular languages are available, and mappings can be written for languages written in the future that require CORBA support.
So why is the Dynamic Invocation Interface useful? After all, shouldn't the designer of an application know what kind of objects the application will need to access? In most cases, this is true, but some types of applications, although uncommon, do benefit from the capability to discover new object types and use them. There are at least two practical examples: a CORBA design tool and a generic object browser application. However, because you can never be sure what developers are going to do, it would be a nice touch for the tool to have the capability to discover existing CORBA interfaces and generate client code to use those objects.
Another possible use for the Dynamic Invocation Interface is in an esoteric, but sometimes practical, application: one that browses objects on the network. There are many reasons why you might want to do this in some types of applications. For example, envision an automated test application that discovers objects, learns their interfaces, and invokes each method in the interface with a set of dummy parameters.
The results could then be recorded and later analyzed to determine objects' compliance with a test plan. Because the test application would discover object interfaces dynamically using DII, it would not need to be recompiled to handle new types of objects, making it useful as a generic testing tool.
Yet another type of object browsing tool could look for objects that implement particular methods and then enable a user to access those objects. This would be helpful if a particular design called for a set of standard methods that should be implemented by all objects in the system, but for some reason it did not define a base class from which all interfaces would derive this is not always possible when mixing together interfaces from various sources, such as different products or different projects.
For example, if each object were to define a killObject method, an object browser could use DII to look for objects that defined such a method, which would in turn enable users to kill objects at will. Although this is a trivial example, it sets the stage for a more complex set of methods that could, for example, provide remote system administration features.
Objects could support a basic interface and also, optionally, offer additional capabilities in the form of methods that the browser could discover through DII. Because such an application would most likely be interactive, the user could determine which methods were interesting through inspection.
In fact, a clever browser application could determine which methods are interesting, based on their names and parameter lists. As a final example, consider an interpreted scripting language such as Perl or Tcl or some other fictitious scripting language. When a script accessed an operation on a CORBA object, the interpreter could use DII to "assemble" a remote method invocation from the IDL interface definition, pass the proper arguments to the method, and return the result to the script.
Here the language interpreter would essentially replace the IDL compiler, which as you should recall is usually responsible for interfacing CORBA objects with various languages. By now it has been established that DII offers at least one advantage over the conventional static process of invoking methods on objects.
You have also seen some potential applications in which DII would prove useful. Although this range of applications is admittedly limited, DII is instrumental in making them possible--without DII, such applications could not exist at all.
To review the advantages of DII:. This makes possible enormous flexibility in applications using DII if you can find an application that requires such flexibility. The client application can obtain the result normally, invoke the method using oneway semantics even if the interface's IDL did not declare the method as oneway , although this may not be advisable , or poll for a result. These options enable even greater flexibility in DII applications than in their static invocation-making counterparts.
There are, however, some disadvantages associated with using the Dynamic Invocation Interface:. Helper classes for each of the types defined in the IDL interface.
A helper class contains a narrow method, which is used to cast down from a given object reference to the class to which it belongs. The architecture is shown on the previous slide. It can be seen that it is similar to the RMI implementation shown on previous topic with the addition of three components: The object adapter. The implementation repository.
Interface repository. ORB Core: Role similar to that of the communication module in the previous topic.
Its role covers the remote reference module and the dispatcher in the previous topic. It dispatches each remote method invocation to the skeleton to be passed then to the remote object servant.
It forms part of all the object references it manages. Passes remote method invocations to the appropriate servant remote object. Unmarshals the invocation input parameters and marshals the results and exceptions in the invocation return.
Proxies: Generated by the IDL compiler in the client language. Marshals and unmarshals the input parameters and returns to method invocations.
Implementation Repository: Responsible for activating registered objects on demand and locating servers that are currently running. A table is maintained in the implementation repository which maps names of object adaptors to the path names of files containing object implementation.
Object implementations and object adaptor names are registered with the implementation repository when server programs are installed. Not all CORBA object need to be called on demand, such objects do not use the implementation repository. If a client receives a remote object reference and it does not have a proxy for it, it can ask the interface repository about the methods of the objects by enquiring its interface.
This identifier is used to register type interfaces uniquely in the interface repository. Next Longest Subarray consisting of unique elements from an Array. Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert.
Writing code in comment? Please use ide.
0コメント