Xindice API

org.apache.xindice.core.request
Class URIMapper

java.lang.Object
  |
  +--java.net.URLConnection
        |
        +--org.apache.xindice.core.request.URIMapper
All Implemented Interfaces:
Poolable

public final class URIMapper
extends java.net.URLConnection
implements Poolable

URIMapper maps a URI (from whence it came) to a Xindice object. Xindice URIs can identify any of several different object types, each of which exposes a different (or slightly different) interface to the outside world.


Field Summary
static int APPLICATION
           
static int COLLECTION
           
static int DOCUMENT
           
static int UNKNOWN
           
static int XMLOBJECT
           
 
Constructor Summary
URIMapper()
          Constructor for older URIMapper instances
URIMapper(java.lang.String uri)
          Constructor for older URIMapper instances
URIMapper(java.net.URL u)
          Constructor for creating URIMapper instance using a standard URL
 
Method Summary
 void connect()
          Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
 java.lang.String[] getArguments()
          getArguments returns method arguments in the form of a String array.
 Collection getCollection()
          getCollection returns the Collection object that was resolved in the parsing of the URI.
 Container getContainer()
          getContainer returns the Document Container that was resolved in the parsing of the URI.
 java.lang.String getContentEncoding()
          Returns the value of the content-encoding header field.
 int getContentLength()
          Returns the value of the content-length header field.
 java.lang.String getContentType()
          Returns the value of the content-type header field.
 Database getDatabase()
          getDatabase returns the Database that was resolved in the parsing of this URI.
 org.w3c.dom.Document getDocument()
          getDocument returns the Document object that was resolved in the parsing of the URI.
 java.io.InputStream getInputStream()
          Returns an input stream that reads from this open connection.
 long getLastModified()
          Returns the value of the last-modified header field.
 java.lang.String getMethod()
          getMethod returns the method name that was resolved in the parsing of the URI.
 int getObjectType()
          getObjectType returns the type of Object that was identified in the parsing of the URI.
 java.util.Properties getProperties()
          getProperties returns the Properties object that was produced in parsing the URI's Query String.
 XMLObject getXMLObject()
          getXMLObject returns the XMLObject that was resolved in the parsing of the URI.
 java.lang.Object invokeRequest()
           
 void reclaim()
          reclaim prompts the Poolable object to return itself to the ObjectPool.
 void setPool(ObjectPool pool)
          setPool passes a reference to the originating ObjectPool for this Object.
 void setURI(java.lang.String uri)
          setURI sets the URI for the URIMapper and parses it.
 
Methods inherited from class java.net.URLConnection
getAllowUserInteraction, getContent, getContent, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getIfModifiedSince, getOutputStream, getPermission, getRequestProperty, getURL, getUseCaches, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN

APPLICATION

public static final int APPLICATION

COLLECTION

public static final int COLLECTION

DOCUMENT

public static final int DOCUMENT

XMLOBJECT

public static final int XMLOBJECT
Constructor Detail

URIMapper

public URIMapper(java.net.URL u)
Constructor for creating URIMapper instance using a standard URL

URIMapper

public URIMapper(java.lang.String uri)
          throws XindiceException
Constructor for older URIMapper instances

URIMapper

public URIMapper()
Constructor for older URIMapper instances
Method Detail

invokeRequest

public java.lang.Object invokeRequest()
                               throws XMLObjectException

connect

public void connect()
Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
Overrides:
connect in class java.net.URLConnection

getInputStream

public java.io.InputStream getInputStream()
Returns an input stream that reads from this open connection.
Overrides:
getInputStream in class java.net.URLConnection

getContentEncoding

public java.lang.String getContentEncoding()
Returns the value of the content-encoding header field. Returns: the content encoding of the resource that the URL references, or null if not known.
Overrides:
getContentEncoding in class java.net.URLConnection

getContentType

public java.lang.String getContentType()
Returns the value of the content-type header field. Returns: the content type of the resource that the URL references, or null if not known.
Overrides:
getContentType in class java.net.URLConnection

getContentLength

public int getContentLength()
Returns the value of the content-length header field. Returns: the content length of the resource that this connection's URL references, or -1 if the content length is not known.
Overrides:
getContentLength in class java.net.URLConnection

getLastModified

public long getLastModified()
Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT. Returns: the date the resource referenced by this URLConnection was last modified, or 0 if not known.
Overrides:
getLastModified in class java.net.URLConnection

setPool

public void setPool(ObjectPool pool)
Description copied from interface: Poolable
setPool passes a reference to the originating ObjectPool for this Object. This will allow the Poolable Object to call back to the ObjectPool in order to be reclaimed.
Specified by:
setPool in interface Poolable
Following copied from interface: org.apache.xindice.util.Poolable
Parameters:
pool - The parent ObjectPool

reclaim

public void reclaim()
Description copied from interface: Poolable
reclaim prompts the Poolable object to return itself to the ObjectPool. A Poolable implementation should perform any necessary cleanup before calling pool.putObject to return itself to the ObjectPool.
Specified by:
reclaim in interface Poolable

setURI

public void setURI(java.lang.String uri)
            throws XindiceException
setURI sets the URI for the URIMapper and parses it. The parsed components of a URI can be retrieved using getObjectType and any of the get methods.
Parameters:
uri - The URI

getObjectType

public int getObjectType()
getObjectType returns the type of Object that was identified in the parsing of the URI. This method will return one of the following values: UNKNOWN, APPLICATION, DATABASE, COLLECTION, DOCUMENT or XMLOBJECT.
Returns:
The object type

getDatabase

public Database getDatabase()
getDatabase returns the Database that was resolved in the parsing of this URI.
Returns:
The Database

getCollection

public Collection getCollection()
getCollection returns the Collection object that was resolved in the parsing of the URI. If no Collection was resolved, this method will return null.
Returns:
The Collection

getDocument

public org.w3c.dom.Document getDocument()
getDocument returns the Document object that was resolved in the parsing of the URI. If no Document was resolved, this method will return null.
Returns:
The Document

getContainer

public Container getContainer()
getContainer returns the Document Container that was resolved in the parsing of the URI. If no Container was resolved, this method will return null.
Returns:
The Container

getXMLObject

public XMLObject getXMLObject()
getXMLObject returns the XMLObject that was resolved in the parsing of the URI. If no XMLObject was resolve, this method will return null.
Returns:
The XMLObject

getMethod

public java.lang.String getMethod()
getMethod returns the method name that was resolved in the parsing of the URI. Method names are associated with XMLObjects. If no method name was resolved, this method will return null.
Returns:
The method name

getProperties

public java.util.Properties getProperties()
getProperties returns the Properties object that was produced in parsing the URI's Query String. Properties are passed into methods that are associated with XMLObjects. This method will return null if no Properties were resolved.
Returns:
The Query String Properties

getArguments

public java.lang.String[] getArguments()
getArguments returns method arguments in the form of a String array. Method arguments are passed to a method in the order that they are specified in the URI. If no arguments were parsed, this method will return null.
Returns:
The method arguments

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation