org.gloin.resource.protocol.jrap
Class JrapURLParser

java.lang.Object
  |
  +--org.gloin.resource.protocol.jrap.JrapURLParser

public class JrapURLParser
extends java.lang.Object

Provides a parsing utility for Jini Resource Access Protocol (JRAP) URLs. This utility parses JRAP url strings according to the JRAP URL schema defined below.

JRAPv0.01 urls have two major sections:

  • A file specification which names a particular resource that a JRAP URL references. Similar to other Java url formats, JRAP URL files begin after the third slash, '/', and end at the end of the url string or at the first ocurrence of a question mark character, '?'. Embedded slashes contained in the file section of a JRAP URL are interpreted as directory names.

    The file component of a JRAP url plays no role in looking up ResourceAccess services.

  • An optional query component that enables the creation of a Jini Service Template which can be used to query a Jini Lookup Service to lookup ResourceAcccess services. JRAP url queries follow a '?' as they do in other url formats supported by java.net.URL. JRAP queries continue to the end of JRAP url strings.
  • URL hostname and port sections are not supported.

  • JRAP URL queries are formatted as follows:

    JRAP queries are composed of variables. Variables consist of a tag followed by the string '={'. This string marks the beginning of a variable value. A variable value is terminated by a '}' character. The value string can contain formats which are specific to the variable tag. JRAP query variables are separated by commas.

    The following variable tags are supported:

    groups

    sid locators

    Attribute Variables

    Query variable tags and values can only contain the following characters: [a-z],[A-Z],[], complete list forthcoming

    Example JRAP URL:

     jrap:///directory/service-dl.jar?\
          sid={00000000-0045-0000-0000-000000000045},\
          groups={public,workgroup,management},\
          locators={host1:port1,host2:port2},\
          Name={myService},\
          ServiceInfo={phone-service,acme-corp,baz.com,1.1,zx11,345}
     


    Field Summary
    static int DEFAULT_PORT
               
     
    Constructor Summary
    JrapURLParser(java.lang.String spec)
              Constructs a JRAP URL parser from the supplied URL formatted string spec parameter.
    JrapURLParser(java.lang.String file, net.jini.core.lookup.ServiceID srvcID, java.lang.String[] groups, net.jini.core.discovery.LookupLocator[] locators, net.jini.core.entry.Entry[] knownAttrs)
              Constructs a JRAP URL parser from the supplied parameter JRAP URL components.
    JrapURLParser(java.net.URL url)
              Constructs a JRAP URL parser from the supplied url parameter.
     
    Method Summary
     boolean equals(java.lang.Object other)
               
     java.lang.String getFile()
               
     java.lang.String[] getGroups()
               
     java.lang.String getHost()
               
     net.jini.core.lookup.ServiceID getID()
               
     net.jini.core.entry.Entry[] getKnownAttributes()
               
     net.jini.core.discovery.LookupLocator[] getLocators()
               
     int getPort()
               
     java.lang.String getQuery()
               
     net.jini.core.lookup.ServiceTemplate getServiceTemplate()
               
     int hashCode()
               
     boolean sameService(java.lang.Object other)
              Tell if two JrapURLParsers refer to the same logical service, without regard to referenced files.
     int sameServiceCode()
               
     void setFile(java.lang.String file)
               
     void setGroups(java.lang.String[] groups)
               
     void setID(net.jini.core.lookup.ServiceID srvcID)
               
     void setKnownAttributes(net.jini.core.entry.Entry[] knownAttrs)
               
     void setLocators(net.jini.core.discovery.LookupLocator[] locators)
               
     java.lang.String toString()
              Return a string form of this parser
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
     

    Field Detail

    DEFAULT_PORT

    public static final int DEFAULT_PORT
    Constructor Detail

    JrapURLParser

    public JrapURLParser(java.lang.String spec)
                  throws java.net.MalformedURLException
    Constructs a JRAP URL parser from the supplied URL formatted string spec parameter.
    Parameters:
    JRAP - URL formatted string

    JrapURLParser

    public JrapURLParser(java.lang.String file,
                         net.jini.core.lookup.ServiceID srvcID,
                         java.lang.String[] groups,
                         net.jini.core.discovery.LookupLocator[] locators,
                         net.jini.core.entry.Entry[] knownAttrs)
                  throws java.net.MalformedURLException
    Constructs a JRAP URL parser from the supplied parameter JRAP URL components.
    Parameters:
    file - the file component of this parser
    srvcID - the Jini service ID component of this parser
    groups - the Jini lookup groups component of this parser
    groups - the Jini lookup locators component of this parser
    groups - the Jini lookup service template attributes component of this parser

    JrapURLParser

    public JrapURLParser(java.net.URL url)
                  throws java.net.MalformedURLException
    Constructs a JRAP URL parser from the supplied url parameter.
    Method Detail

    hashCode

    public int hashCode()
    Overrides:
    hashCode in class java.lang.Object

    sameServiceCode

    public int sameServiceCode()

    equals

    public boolean equals(java.lang.Object other)
    Overrides:
    equals in class java.lang.Object

    sameService

    public boolean sameService(java.lang.Object other)
    Tell if two JrapURLParsers refer to the same logical service, without regard to referenced files.
    Returns:
    true if everything about two parser is the same except for the file component of represented URLs.

    getFile

    public java.lang.String getFile()

    getHost

    public java.lang.String getHost()

    getPort

    public int getPort()

    getGroups

    public java.lang.String[] getGroups()

    getID

    public net.jini.core.lookup.ServiceID getID()

    getKnownAttributes

    public net.jini.core.entry.Entry[] getKnownAttributes()

    getQuery

    public java.lang.String getQuery()

    getServiceTemplate

    public net.jini.core.lookup.ServiceTemplate getServiceTemplate()

    setFile

    public void setFile(java.lang.String file)

    setGroups

    public void setGroups(java.lang.String[] groups)

    setID

    public void setID(net.jini.core.lookup.ServiceID srvcID)

    setKnownAttributes

    public void setKnownAttributes(net.jini.core.entry.Entry[] knownAttrs)

    getLocators

    public net.jini.core.discovery.LookupLocator[] getLocators()

    setLocators

    public void setLocators(net.jini.core.discovery.LookupLocator[] locators)

    toString

    public java.lang.String toString()
    Return a string form of this parser
    Overrides:
    toString in class java.lang.Object