org.exist.xmldb
Class XmldbURI

java.lang.Object
  extended by org.exist.xmldb.XmldbURI
All Implemented Interfaces:
Serializable, Comparable<Object>
Direct Known Subclasses:
FullXmldbURI

public class XmldbURI
extends Object
implements Comparable<Object>, Serializable

A utility class for xmldb URis. Since, java.net.URI is final this class acts as a wrapper.

Author:
Pierrick Brihaye
See Also:
Serialized Form

Field Summary
static String API_LOCAL
           
static String API_REST
           
static String API_WEBDAV
           
static String API_XMLRPC
           
static String CONFIG_COLLECTION
          Deprecated. 
static XmldbURI CONFIG_COLLECTION_URI
          Deprecated. 
static XmldbURI DB
          '/db' collection
static String DEFAULT_INSTANCE_NAME
           
static String EMBEDDED_SERVER_AUTHORITY
           
static XmldbURI EMBEDDED_SERVER_URI
           
static String EMBEDDED_SERVER_URI_PREFIX
           
static XmldbURI EMPTY_URI
           
static String LOCAL_DB
          'xmldb:exist///db'
static XmldbURI LOCAL_DB_URI
          'xmldb:exist///db' XmldbURI
static int NO_PORT
           
static XmldbURI RELATIVE_ROOT_COLLECTION_URI
           
static String ROOT_COLLECTION
          '/db' collection name
static String ROOT_COLLECTION_NAME
          'db' collection name
static XmldbURI ROOT_COLLECTION_URI
           
static XmldbURI SYSTEM
          '/db/system'
static String SYSTEM_COLLECTION
          '/db/system' collection name
static String SYSTEM_COLLECTION_NAME
          'system' collection name
static XmldbURI SYSTEM_COLLECTION_URI
          Deprecated. 
static String TEMP_COLLECTION
          '/db/system/temp' collection name
static String TEMP_COLLECTION_NAME
          'temp' collection name
static XmldbURI TEMP_COLLECTION_URI
           
static String XMLDB_SCHEME
           
static String XMLDB_URI_PREFIX
           
 
Method Summary
 XmldbURI append(String uri)
           
 XmldbURI append(XmldbURI uri)
           
 XmldbURI appendInternal(XmldbURI uri)
           
static String checkPath(String currentPath, String parentPath)
           
static String checkPath2(String fileName, String parentPath)
          Deprecated. Legacy method used here and there in the code
 int compareTo(Object ob)
           
static XmldbURI create(String uri)
           
static XmldbURI create(String uri, boolean mustHaveXMLDB)
           
static XmldbURI create(String accessURI, String collectionPath)
           
static XmldbURI create(URI uri)
           
static XmldbURI createInternal(String collectionPath)
           
 boolean endsWith(String string)
           
 boolean endsWith(XmldbURI xmldbUri)
           
 boolean equals(Object ob)
           
 boolean equalsInternal(XmldbURI other)
           
 String getApiName()
           
 String getAuthority()
           
 String getCollectionPath()
           
 String getContext()
           
 String getFragment()
           
 String getHost()
           
 String getInstanceName()
           
static String[] getPathComponents(String collectionPath)
           
 XmldbURI[] getPathSegments()
          This function returns a relative XmldbURI with the value after the last / in the collection path of the URI.
 int getPort()
           
 String getQuery()
           
 String getRawAuthority()
           
 String getRawCollectionPath()
          Method to return the collection path with reserved characters percent encoded.
 String getRawFragment()
           
 String getRawQuery()
           
 String getRawUserInfo()
           
 URI getURI()
          This returns a proper heirarchical URI - the xmldb scheme is trimmed from the beginning.
 String getUserInfo()
           
 URI getXmldbURI()
          This returns an xmldb uri.
 int hashCode()
           
 boolean isAbsolute()
           
 boolean isCollectionPathAbsolute()
           
 boolean isContextAbsolute()
           
 XmldbURI lastSegment()
          This function returns a relative XmldbURI with the value after the last / in the collection path of the URI.
 String makeAbsolute(String name)
          Deprecated. Legacy method used here and there in the code and copied as such
static String normalizeCollectionName(String name)
          Deprecated. Legacy method used here and there in the code and copied as such
 XmldbURI normalizeCollectionPath()
           
 XmldbURI normalizeContext()
           
 int numSegments()
          This function returns a relative XmldbURI with the value after the last / in the collection path of the URI.
 XmldbURI prepend(XmldbURI xmldbUri)
           
static String recoverPseudoURIs(String pseudoURI)
          Deprecated. By definition, using this method is strongly discouraged
 URI relativizeCollectionPath(URI uri)
           
 URI relativizeContext(URI uri)
           
 XmldbURI removeLastSegment()
          This function returns a string with everything after the last / removed.
 URI resolveCollectionPath(URI uri)
           
 XmldbURI resolveCollectionPath(XmldbURI child)
           
 URI resolveContext(String str)
           
 URI resolveContext(URI uri)
           
 boolean startsWith(String string)
           
 boolean startsWith(XmldbURI xmldbUri)
           
 String toASCIIString()
           
 XmldbURI toCollectionPathURI()
           
 String toString()
           
 URL toURL()
           
 XmldbURI trimFromBeginning(String string)
           
 XmldbURI trimFromBeginning(XmldbURI xmldbUri)
           
static XmldbURI xmldbUriFor(String xmldbURI)
           
static XmldbURI xmldbUriFor(String xmldbURI, boolean escape)
           
static XmldbURI xmldbUriFor(String xmldbURI, boolean escape, boolean mustHaveXMLDB)
           
static XmldbURI xmldbUriFor(String accessURI, String collectionPath)
           
static XmldbURI xmldbUriFor(URI uri)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_PORT

public static final int NO_PORT
See Also:
Constant Field Values

XMLDB_SCHEME

public static final String XMLDB_SCHEME
See Also:
Constant Field Values

XMLDB_URI_PREFIX

public static final String XMLDB_URI_PREFIX
See Also:
Constant Field Values

DEFAULT_INSTANCE_NAME

public static final String DEFAULT_INSTANCE_NAME
See Also:
Constant Field Values

EMBEDDED_SERVER_AUTHORITY

public static final String EMBEDDED_SERVER_AUTHORITY
See Also:
Constant Field Values

EMBEDDED_SERVER_URI_PREFIX

public static final String EMBEDDED_SERVER_URI_PREFIX
See Also:
Constant Field Values

ROOT_COLLECTION_NAME

public static final String ROOT_COLLECTION_NAME
'db' collection name

See Also:
Constant Field Values

ROOT_COLLECTION

public static final String ROOT_COLLECTION
'/db' collection name

See Also:
Constant Field Values

SYSTEM_COLLECTION_NAME

public static final String SYSTEM_COLLECTION_NAME
'system' collection name

See Also:
Constant Field Values

SYSTEM_COLLECTION

public static final String SYSTEM_COLLECTION
'/db/system' collection name

See Also:
Constant Field Values

TEMP_COLLECTION_NAME

public static final String TEMP_COLLECTION_NAME
'temp' collection name

See Also:
Constant Field Values

TEMP_COLLECTION

public static final String TEMP_COLLECTION
'/db/system/temp' collection name

See Also:
Constant Field Values

CONFIG_COLLECTION

@Deprecated
public static final String CONFIG_COLLECTION
Deprecated. 
See Also:
Constant Field Values

DB

public static final XmldbURI DB
'/db' collection


ROOT_COLLECTION_URI

public static final XmldbURI ROOT_COLLECTION_URI

RELATIVE_ROOT_COLLECTION_URI

public static final XmldbURI RELATIVE_ROOT_COLLECTION_URI

SYSTEM

public static final XmldbURI SYSTEM
'/db/system'


SYSTEM_COLLECTION_URI

@Deprecated
public static final XmldbURI SYSTEM_COLLECTION_URI
Deprecated. 
'/db/system'


CONFIG_COLLECTION_URI

@Deprecated
public static final XmldbURI CONFIG_COLLECTION_URI
Deprecated. 

TEMP_COLLECTION_URI

public static final XmldbURI TEMP_COLLECTION_URI

EMPTY_URI

public static final XmldbURI EMPTY_URI

EMBEDDED_SERVER_URI

public static final XmldbURI EMBEDDED_SERVER_URI

LOCAL_DB

public static final String LOCAL_DB
'xmldb:exist///db'

See Also:
Constant Field Values

LOCAL_DB_URI

public static final XmldbURI LOCAL_DB_URI
'xmldb:exist///db' XmldbURI


API_XMLRPC

public static final String API_XMLRPC
See Also:
Constant Field Values

API_WEBDAV

public static final String API_WEBDAV
See Also:
Constant Field Values

API_REST

public static final String API_REST
See Also:
Constant Field Values

API_LOCAL

public static final String API_LOCAL
See Also:
Constant Field Values
Method Detail

xmldbUriFor

public static XmldbURI xmldbUriFor(URI uri)
                            throws URISyntaxException
Throws:
URISyntaxException

xmldbUriFor

public static XmldbURI xmldbUriFor(String xmldbURI)
                            throws URISyntaxException
Throws:
URISyntaxException

xmldbUriFor

public static XmldbURI xmldbUriFor(String xmldbURI,
                                   boolean escape)
                            throws URISyntaxException
Throws:
URISyntaxException

xmldbUriFor

public static XmldbURI xmldbUriFor(String xmldbURI,
                                   boolean escape,
                                   boolean mustHaveXMLDB)
                            throws URISyntaxException
Throws:
URISyntaxException

xmldbUriFor

public static XmldbURI xmldbUriFor(String accessURI,
                                   String collectionPath)
                            throws URISyntaxException
Throws:
URISyntaxException

create

public static XmldbURI create(URI uri)

create

public static XmldbURI create(String uri)

create

public static XmldbURI create(String uri,
                              boolean mustHaveXMLDB)

create

public static XmldbURI create(String accessURI,
                              String collectionPath)

createInternal

public static XmldbURI createInternal(String collectionPath)

getURI

public URI getURI()
This returns a proper heirarchical URI - the xmldb scheme is trimmed from the beginning. The scheme will be the instance name, and all other fields will be populated as would be expected from a heirarchical URI

Returns:
DOCUMENT ME!
See Also:
getXmldbURI(java.net.URI)

getXmldbURI

public URI getXmldbURI()
This returns an xmldb uri. This is the most generic sort of uri - the only fields set in the uri are scheme and schemeSpecificPart

Returns:
DOCUMENT ME!

getInstanceName

public String getInstanceName()

getRawCollectionPath

public String getRawCollectionPath()
Method to return the collection path with reserved characters percent encoded.

Returns:
Returns the encoded collection path

getCollectionPath

public String getCollectionPath()

toCollectionPathURI

public XmldbURI toCollectionPathURI()

getApiName

public String getApiName()

getContext

public String getContext()

compareTo

public int compareTo(Object ob)
              throws ClassCastException
Specified by:
compareTo in interface Comparable<Object>
Throws:
ClassCastException

lastSegment

public XmldbURI lastSegment()
This function returns a relative XmldbURI with the value after the last / in the collection path of the URI.

Returns:
A relative XmldbURI containing the value after the last / in the collection path

numSegments

public int numSegments()
This function returns a relative XmldbURI with the value after the last / in the collection path of the URI.

Returns:
A relative XmldbURI containing the value after the last / in the collection path

getPathSegments

public XmldbURI[] getPathSegments()
This function returns a relative XmldbURI with the value after the last / in the collection path of the URI.

Returns:
A relative XmldbURI containing the value after the last / in the collection path

removeLastSegment

public XmldbURI removeLastSegment()
This function returns a string with everything after the last / removed.

Returns:
A relative XmldbURI containing the value after the last / in the collection path

append

public XmldbURI append(String uri)

append

public XmldbURI append(XmldbURI uri)

appendInternal

public XmldbURI appendInternal(XmldbURI uri)

recoverPseudoURIs

public static String recoverPseudoURIs(String pseudoURI)
                                throws URISyntaxException
Deprecated. By definition, using this method is strongly discouraged

Ugly workaround for non-URI compliant pathes.

Parameters:
pseudoURI - What is supposed to be a URI
Returns:
an supposedly correctly escaped URI string representation
Throws:
URISyntaxException - DOCUMENT ME!

equals

public boolean equals(Object ob)
Overrides:
equals in class Object

equalsInternal

public boolean equalsInternal(XmldbURI other)

isAbsolute

public boolean isAbsolute()

isContextAbsolute

public boolean isContextAbsolute()

normalizeContext

public XmldbURI normalizeContext()

relativizeContext

public URI relativizeContext(URI uri)

resolveContext

public URI resolveContext(String str)
                   throws NullPointerException,
                          IllegalArgumentException
Throws:
NullPointerException
IllegalArgumentException

resolveContext

public URI resolveContext(URI uri)
                   throws NullPointerException
Throws:
NullPointerException

isCollectionPathAbsolute

public boolean isCollectionPathAbsolute()

normalizeCollectionPath

public XmldbURI normalizeCollectionPath()

relativizeCollectionPath

public URI relativizeCollectionPath(URI uri)

resolveCollectionPath

public XmldbURI resolveCollectionPath(XmldbURI child)
                               throws NullPointerException,
                                      IllegalArgumentException
Throws:
NullPointerException
IllegalArgumentException

resolveCollectionPath

public URI resolveCollectionPath(URI uri)
                          throws NullPointerException
Throws:
NullPointerException

toASCIIString

public String toASCIIString()

toURL

public URL toURL()
          throws IllegalArgumentException,
                 MalformedURLException
Throws:
IllegalArgumentException
MalformedURLException

startsWith

public boolean startsWith(XmldbURI xmldbUri)

startsWith

public boolean startsWith(String string)
                   throws URISyntaxException
Throws:
URISyntaxException

endsWith

public boolean endsWith(XmldbURI xmldbUri)

endsWith

public boolean endsWith(String string)
                 throws URISyntaxException
Throws:
URISyntaxException

prepend

public XmldbURI prepend(XmldbURI xmldbUri)

trimFromBeginning

public XmldbURI trimFromBeginning(XmldbURI xmldbUri)

trimFromBeginning

public XmldbURI trimFromBeginning(String string)
                           throws URISyntaxException
Throws:
URISyntaxException

toString

public String toString()
Overrides:
toString in class Object

getPathComponents

public static String[] getPathComponents(String collectionPath)

checkPath

public static String checkPath(String currentPath,
                               String parentPath)

checkPath2

public static String checkPath2(String fileName,
                                String parentPath)
Deprecated. Legacy method used here and there in the code

DOCUMENT ME!

Parameters:
fileName -
parentPath -
Returns:
DOCUMENT ME!

makeAbsolute

public String makeAbsolute(String name)
Deprecated. Legacy method used here and there in the code and copied as such

DOCUMENT ME!

Parameters:
name -
Returns:
DOCUMENT ME!

normalizeCollectionName

public static final String normalizeCollectionName(String name)
Deprecated. Legacy method used here and there in the code and copied as such

DOCUMENT ME!

Parameters:
name -
Returns:
DOCUMENT ME!

getAuthority

public String getAuthority()

getFragment

public String getFragment()

getPort

public int getPort()

getQuery

public String getQuery()

getRawAuthority

public String getRawAuthority()

getHost

public String getHost()

getUserInfo

public String getUserInfo()

getRawFragment

public String getRawFragment()

getRawQuery

public String getRawQuery()

getRawUserInfo

public String getRawUserInfo()

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright (C) The eXist-db Project. All rights reserved.