org.gloin.resource
Class StartResourceService

java.lang.Object
  |
  +--org.gloin.resource.StartResourceService

public class StartResourceService
extends java.lang.Object

Utility to create a resource service and cause it to register with a Jini federation. Utility performs the following steps to accomplish these tasks:

  • Constructs a FileByteStore which will hold resource bytes that will be registered by other Jini services. The resource service will use the FileByteStore interface to serve resource bytes for client requests.

  • Creates an http server which will serve as the main transport by which clients download resources from the resource service. If no port argument is supplied the http server will be started on an anonymous port.

  • Reserves the name, "jrap-resource-service-dl.jar", in the "reserved" namespace of the http server. This enables the http server to double as the codebase for the resource service itself. The resource service proxy is annotated with an http url, not a jrap url.

    Warning: Please note that by default, since the resource service proxy annotation uses an anonymous port, a particular annotation will not survive multiple incarnations of the resource service.

    But this is a feature, it demonstrates that clients of the resource service dont need to be configured with apriori knownledge of the resource service.

  • Create the resource service. Loads the class, ResourceServiceImpl in an export class loader so that the codebase of the resource service will point to the newly created http server. Uses reflection to instantiate the impl class. The resource service is responsible for registering with a federation.

  • Constructor Summary
    StartResourceService()
               
     
    Method Summary
    static void main(java.lang.String[] args)
              The command line options are:
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    StartResourceService

    public StartResourceService()
    Method Detail

    main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception
    The command line options are:
     -query  [-resource_dir resource_files] [-trees] [-verbose]
     
    The default directory, . ; the default can be overridden with the -dir option. By default, all files under this directory (including all subdirectories) are served up via HTTP. If the pathname of a file is path relative to the top-level directory, then the file can be downloaded using the URL
     http://host:port/path
     
    No caching of directory contents or file contents is performed. If the -verbose option is given, then all attempts to download files are output.

     http://host:port/name/file