org.exist.xmldb
Class XmldbURI

java.lang.Object
  extended byorg.exist.xmldb.XmldbURI

public class XmldbURI
extends java.lang.Object

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

Author:
Pierrick Brihaye

Field Summary
static java.lang.String API_LOCAL
           
static java.lang.String API_REST
           
static java.lang.String API_WEBDAV
           
static java.lang.String API_XMLRPC
           
protected static Logger LOG
           
static int NO_PORT
           
static java.lang.String XMLDB_URI_PREFIX
           
 
Constructor Summary
XmldbURI(java.lang.String xmldbURI)
          Contructs an XmldbURI from given string.
XmldbURI(java.lang.String accessURI, java.lang.String collectionPath)
          Contructs an XmldbURI from the given string, handling the necessary escapings.
 
Method Summary
static java.lang.String checkPath(java.lang.String currentPath, java.lang.String parentPath)
           
static java.lang.String checkPath2(java.lang.String fileName, java.lang.String parentPath)
          Deprecated. Legacy method used here and there in the code
 int compareTo(java.lang.Object ob)
           
static XmldbURI create(java.lang.String str)
           
static XmldbURI create(java.lang.String accessURI, java.lang.String collectionPath)
           
 boolean equals(java.lang.Object ob)
           
 java.lang.String getApiName()
           
 java.lang.String getCollectionPath()
           
 java.lang.String getContext()
           
 java.lang.String getHost()
           
 java.lang.String getInstanceName()
           
static java.lang.String[] getPathComponents(java.lang.String collectionPath)
           
 int getPort()
           
 java.net.URI getURI()
           
 java.lang.String getUserInfo()
           
 boolean isAbsolute()
           
 boolean isCollectionPathAbsolute()
           
 boolean isContextAbsolute()
           
static java.lang.String normalizeCollectionName(java.lang.String name)
          Deprecated. Legacy method used here and there in the code and copied as such
 XmldbURI normalizeCollectionPath()
           
 XmldbURI normalizeContext()
           
static java.lang.String recoverPseudoURIs(java.lang.String pseudoURI)
          Deprecated. By definition, using this method is strongly discouraged
 java.net.URI relativizeCollectionPath(java.net.URI uri)
           
 java.net.URI relativizeContext(java.net.URI uri)
           
 java.net.URI resolveCollectionPath(java.lang.String str)
           
 java.net.URI resolveCollectionPath(java.net.URI uri)
           
 java.net.URI resolveContext(java.lang.String str)
           
 java.net.URI resolveContext(java.net.URI uri)
           
 void setCollectionPath(java.lang.String collectionPath)
           
 void setCollectionPath(java.net.URI collectionPath)
           
 void setContext(java.lang.String context)
           
 void setContext(java.net.URI context)
           
 void setHost(java.lang.String host)
           
 void setInstanceName(java.lang.String instanceName)
           
 void setPort(int port)
           
 void setUserInfo(java.lang.String userInfo)
           
 java.lang.String toASCIIString()
           
 java.lang.String toString()
           
 java.net.URL toURL()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final Logger LOG

NO_PORT

public static final int NO_PORT
See Also:
Constant Field Values

XMLDB_URI_PREFIX

public static final java.lang.String XMLDB_URI_PREFIX
See Also:
Constant Field Values

API_XMLRPC

public static final java.lang.String API_XMLRPC
See Also:
Constant Field Values

API_WEBDAV

public static final java.lang.String API_WEBDAV
See Also:
Constant Field Values

API_REST

public static final java.lang.String API_REST
See Also:
Constant Field Values

API_LOCAL

public static final java.lang.String API_LOCAL
See Also:
Constant Field Values
Constructor Detail

XmldbURI

public XmldbURI(java.lang.String xmldbURI)
         throws java.net.URISyntaxException
Contructs an XmldbURI from given string. Note that we construct URIs starting with XmldbURI.XMLDB_URI_PREFIX. Do not forget that org.xmldb.api.DatabaseManager trims this prefix.

Parameters:
xmldbURI - A string
Throws:
java.net.URISyntaxException - If the given string is not a valid xmldb URI.

XmldbURI

public XmldbURI(java.lang.String accessURI,
                java.lang.String collectionPath)
         throws java.net.URISyntaxException
Contructs an XmldbURI from the given string, handling the necessary escapings.

Parameters:
accessURI -
Throws:
java.net.URISyntaxException
Method Detail

setInstanceName

public void setInstanceName(java.lang.String instanceName)
                     throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setUserInfo

public void setUserInfo(java.lang.String userInfo)
                 throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setHost

public void setHost(java.lang.String host)
             throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setPort

public void setPort(int port)
             throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setContext

public void setContext(java.lang.String context)
                throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setContext

public void setContext(java.net.URI context)
                throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setCollectionPath

public void setCollectionPath(java.lang.String collectionPath)
                       throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

setCollectionPath

public void setCollectionPath(java.net.URI collectionPath)
                       throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

getURI

public java.net.URI getURI()

getInstanceName

public java.lang.String getInstanceName()

getUserInfo

public java.lang.String getUserInfo()

getHost

public java.lang.String getHost()

getPort

public int getPort()

getCollectionPath

public java.lang.String getCollectionPath()

getApiName

public java.lang.String getApiName()

getContext

public java.lang.String getContext()

compareTo

public int compareTo(java.lang.Object ob)
              throws java.lang.ClassCastException
Throws:
java.lang.ClassCastException

create

public static XmldbURI create(java.lang.String str)

create

public static XmldbURI create(java.lang.String accessURI,
                              java.lang.String collectionPath)

recoverPseudoURIs

public static java.lang.String recoverPseudoURIs(java.lang.String pseudoURI)
                                          throws java.net.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:
java.net.URISyntaxException

equals

public boolean equals(java.lang.Object ob)

isAbsolute

public boolean isAbsolute()

isContextAbsolute

public boolean isContextAbsolute()

normalizeContext

public XmldbURI normalizeContext()

relativizeContext

public java.net.URI relativizeContext(java.net.URI uri)

resolveContext

public java.net.URI resolveContext(java.lang.String str)
                            throws java.lang.NullPointerException,
                                   java.lang.IllegalArgumentException
Throws:
java.lang.NullPointerException
java.lang.IllegalArgumentException

resolveContext

public java.net.URI resolveContext(java.net.URI uri)
                            throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException

isCollectionPathAbsolute

public boolean isCollectionPathAbsolute()

normalizeCollectionPath

public XmldbURI normalizeCollectionPath()

relativizeCollectionPath

public java.net.URI relativizeCollectionPath(java.net.URI uri)

resolveCollectionPath

public java.net.URI resolveCollectionPath(java.lang.String str)
                                   throws java.lang.NullPointerException,
                                          java.lang.IllegalArgumentException
Throws:
java.lang.NullPointerException
java.lang.IllegalArgumentException

resolveCollectionPath

public java.net.URI resolveCollectionPath(java.net.URI uri)
                                   throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException

toASCIIString

public java.lang.String toASCIIString()

toURL

public java.net.URL toURL()
                   throws java.lang.IllegalArgumentException,
                          java.net.MalformedURLException
Throws:
java.lang.IllegalArgumentException
java.net.MalformedURLException

toString

public java.lang.String toString()

getPathComponents

public static java.lang.String[] getPathComponents(java.lang.String collectionPath)

checkPath

public static java.lang.String checkPath(java.lang.String currentPath,
                                         java.lang.String parentPath)

checkPath2

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

Parameters:
fileName -
parentPath -
Returns:

normalizeCollectionName

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

Parameters:
name -
Returns:


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.