org.exist.protocolhandler.xmldb
Class XmldbURL

java.lang.Object
  extended by org.exist.protocolhandler.xmldb.XmldbURL

public class XmldbURL
extends Object

A utility class for xmldb URLs. Since, java.net.URL is final this class acts as a wrapper, convenience methods have been added.

Example:
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Note: A collection URL ends with a "/":
xmldb:exist://hostname:8080/exist/xmlrpc/db/collection/

Author:
Dannes Wessels
See Also:
URI, URL, XmldbURI

Constructor Summary
XmldbURL(String txt)
          Creates a new instance of XmldbURL using an String.
XmldbURL(URI uri)
          Creates a new instance of XmldbURL using an URI object.
XmldbURL(URL url)
          Creates a new instance of XmldbURL using an URL object.
XmldbURL(XmldbURI xmldbURI)
          Creates a new instance of XmldbURL using an XmldbURI object.
 
Method Summary
 String getAuthority()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml?query#fragment
 String getCollection()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getCollectionPath()
          xmldb:exist://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml
 String getContext()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml?query#fragment Return context, null if not available.
 String getDocumentName()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getHost()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getInstanceName()
          Get eXist instance name.
 String getPassword()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getPath()
          xmldb:exist://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml
 int getPort()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getProtocol()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getQuery()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml?query#fragment
 URL getURL()
           
 String getUserInfo()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getUsername()
          xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml
 String getXmlRpcURL()
          Get http:// URL from xmldb:exist:// URL xmldb:exist://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml
 boolean hasUserInfo()
          Does the URL have at least a username?
 boolean isEmbedded()
          Get information wether URL is an embedded URL.
 String toString()
          Get textual representation of URL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmldbURL

public XmldbURL(XmldbURI xmldbURI)
         throws MalformedURLException
Creates a new instance of XmldbURL using an XmldbURI object.

Parameters:
xmldbURI - Resource location.
Throws:
MalformedURLException

XmldbURL

public XmldbURL(URL url)
         throws MalformedURLException
Creates a new instance of XmldbURL using an URL object.

Parameters:
url - Resource location.
Throws:
MalformedURLException

XmldbURL

public XmldbURL(URI uri)
         throws MalformedURLException
Creates a new instance of XmldbURL using an URI object.

Parameters:
uri - Resource location.
Throws:
MalformedURLException

XmldbURL

public XmldbURL(String txt)
         throws MalformedURLException
Creates a new instance of XmldbURL using an String.

Parameters:
txt - Resource location.
Throws:
MalformedURLException
Method Detail

getUserInfo

public String getUserInfo()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
username:password
See Also:
URL.getUserInfo()

getUsername

public String getUsername()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
username

getPassword

public String getPassword()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
password

getURL

public URL getURL()
Returns:
URL representation of location.

getAuthority

public String getAuthority()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml?query#fragment

Returns:
authority
See Also:
URL.getAuthority()

getContext

public String getContext()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml?query#fragment Return context, null if not available.


getCollection

public String getCollection()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
collection

getDocumentName

public String getDocumentName()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
collection

getProtocol

public String getProtocol()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
protocol
See Also:
URL.getProtocol()

getHost

public String getHost()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
protocol
See Also:
URL.getProtocol()

getPort

public int getPort()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml

Returns:
port
See Also:
URL.getPort()

getPath

public String getPath()
xmldb:exist://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml

Returns:
port
See Also:
URL.getPath()

getQuery

public String getQuery()
xmldb:exist://username:password@hostname:8080/exist/xmlrpc/db/collection/document.xml?query#fragment

Returns:
query
See Also:
URL.getQuery()

getCollectionPath

public String getCollectionPath()
xmldb:exist://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml

Returns:
collectionpath

getXmlRpcURL

public String getXmlRpcURL()
Get http:// URL from xmldb:exist:// URL xmldb:exist://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml

Returns:
http://username:password@hostname:8080:/exist/xmlrpc/db/collection/document.xml

hasUserInfo

public boolean hasUserInfo()
Does the URL have at least a username?

Returns:
TRUE when URL contains username

getInstanceName

public String getInstanceName()
Get eXist instance name.

Returns:
eXist-db instance name, at this moment fixed to exist

toString

public String toString()
Get textual representation of URL.

Overrides:
toString in class Object
Returns:
Text representation of URL.
See Also:
URL.toString()

isEmbedded

public boolean isEmbedded()
Get information wether URL is an embedded URL.

Returns:
TRUE when URL refers to resource in embedded eXist-db.


Copyright (C) Wolfgang Meier. All rights reserved.