org.gloin.example.jrap.useresourceservice
Class StartUserService

java.lang.Object
  |
  +--org.gloin.example.jrap.useresourceservice.StartUserService

public class StartUserService
extends java.lang.Object

Start a simple service which references a resource service in its codebase annotation (i.e. the service proxy is annotated with a jrap url). Steps startup utility takes to perform this task:

  • Install the jrap protocol handler using org.gloin.resource.protocol.jrap.Handler.install().

    Other ways to install the handler include:

  • Create a JrapURLParser using the supplied query string parameter
  • Create a webserver to serve the bytes of the proxy jar file which resides in the well known location: jar:user-service.jar!/export-jars/user-service-dl.jar.

    The httpServer will send the proxy jar file to discovered resource services when this service registers its proxy byte codes with those services.

    Please note: the http server is only one way to create an inputstream from which the resource service can read jar file bytes. For example, sending a simple ByteArrayInputStream would also have worked (though it would have the minor drawback of not being able to do chunked data transfer).

  • Pass a URLInputStream to ResourceRegistration.registerResource to register the bytes of the user service proxy jar file resource
  • Load the user service class files in an ExportClassLoader from a location not in CLASSPATH. The implementation class for this user defined service is defined in a class loader whose export urls (see ExportClassLoader) are a jrap url built from the query string parameter to this program.
  • Register with the Jini lookup service.

  • Constructor Summary
    StartUserService()
               
     
    Method Summary
    static void main(java.lang.String[] args)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    StartUserService

    public StartUserService()
    Method Detail

    main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception