|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectAbstractLogEnabled
org.exist.cocoon.XMLDBSource
This class implements the xmldb:// pseudo-protocol and allows to get XML content from an XML:DB enabled XML database.
This class starts on XMLDBSource from Cocoon project. Some improvments may be useful for Cocoon, some others may be Exist specific. Interesting new features :
| Field Summary | |
protected static java.lang.String |
CDATA
|
Collection |
collection
|
protected static java.lang.String |
COLLECTION
Element <collection> |
protected static java.lang.String |
COLLECTION_BASE_ATTR
|
protected static java.lang.String |
COLLECTION_COUNT_ATTR
Attribute collections on the root element indicates count of collections in the collection |
protected static java.lang.String |
COLLECTIONS
Root element <collections> |
java.lang.String |
encoding
default encoding to write outputStream |
protected static java.lang.String |
NAME_ATTR
Attribute name on the collection/resource element |
java.lang.String |
password
The supplied password |
static java.lang.String |
PREFIX
Source prefix |
protected static java.lang.String |
QCOLLECTION
Element <xmldb:collection> (raw name) |
protected static java.lang.String |
QCOLLECTIONS
Root element <xmldb:collections> (raw name) |
protected static java.lang.String |
QRESOURCE
Element <resource> (raw name) |
protected static java.lang.String |
QRESULT
Element <xmldb:result> (raw name) |
protected static java.lang.String |
QRESULTSET
Root element <xmldb:results> (raw name) |
protected java.lang.String |
query
The part of URL after # sign |
protected static java.lang.String |
QUERY_ATTR
|
Resource |
resource
|
protected static java.lang.String |
RESOURCE
Element <resource> |
protected static java.lang.String |
RESOURCE_COUNT_ATTR
Attribute resources on the root element indicates count of resources in the collection |
protected static java.lang.String |
RESULT
Element <result> |
protected static java.lang.String |
RESULT_DOCID_ATTR
|
protected static java.lang.String |
RESULT_ID_ATTR
|
protected static java.lang.String |
RESULTS_COUNT_ATTR
|
protected static java.lang.String |
RESULTSET
Root element <results> |
protected java.lang.String |
systemId
The System ID |
static java.lang.String |
URI
Source namespace |
java.lang.String |
url
The requested URL |
java.lang.String |
user
The supplied user |
| Constructor Summary | |
XMLDBSource(Logger logger,
java.lang.String user,
java.lang.String password,
java.lang.String srcUrl)
The constructor. |
|
| Method Summary | |
boolean |
canCancel(java.io.OutputStream stream)
Can the data sent to an OutputStream returned by
getOutputStream() be cancelled ? |
void |
cancel(java.io.OutputStream stream)
Cancel the data sent to an OutputStream returned by
getOutputStream(). |
java.lang.String |
createId()
Create a new identifier for a resource within a collection. |
void |
delete()
Delete the source |
boolean |
exists()
|
java.io.OutputStream |
getBinaryOutputStream()
Return an OutputStream to write data to a binary resource. |
Source |
getChild(java.lang.String name)
|
java.util.Collection |
getChildren()
|
Collection |
getCollection()
A getter for the xmldb Collection object for this Source |
org.w3c.dom.Node |
getContentAsDOM()
get content as DOM |
long |
getContentLength()
|
java.lang.String |
getEncoding()
Set a default encoding for outputStream |
java.io.InputStream |
getInputStream()
Get an InputSource for the given URL. |
long |
getLastModified()
|
java.lang.String |
getMimeType()
|
java.lang.String |
getName()
|
java.io.OutputStream |
getOutputStream()
Return an OutputStream to write to. |
Source |
getParent()
|
java.lang.String |
getPassword()
A getter for the password configured in cocoon.xconf for the connection |
Resource |
getResource()
A getter for the xmldb Resource object for this Source |
java.lang.String |
getScheme()
|
java.lang.String |
getURI()
|
java.lang.String |
getUser()
A getter for the user login configured in cocoon.xconf |
SourceValidity |
getValidity()
|
boolean |
isCollection()
|
void |
makeCollection()
|
void |
refresh()
|
void |
setContentAsDOM(org.w3c.dom.Node doc)
set content as DOM |
void |
setEncoding(java.lang.String s)
Set a default encoding for outputStream |
void |
toSAX(org.xml.sax.ContentHandler handler)
Stream SAX events to a given ContentHandler. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String URI
public static final java.lang.String PREFIX
protected static final java.lang.String COLLECTIONS
<collections>
protected static final java.lang.String QCOLLECTIONS
<xmldb:collections> (raw name)
protected static final java.lang.String RESOURCE_COUNT_ATTR
resources on the root element indicates count of resources in the collection
protected static final java.lang.String COLLECTION_COUNT_ATTR
collections on the root element indicates count of collections in the collection
protected static final java.lang.String COLLECTION_BASE_ATTR
protected static final java.lang.String COLLECTION
<collection>
protected static final java.lang.String QCOLLECTION
<xmldb:collection> (raw name)
protected static final java.lang.String RESOURCE
<resource>
protected static final java.lang.String QRESOURCE
<resource> (raw name)
protected static final java.lang.String NAME_ATTR
name on the collection/resource element
protected static final java.lang.String RESULTSET
<results>
protected static final java.lang.String QRESULTSET
<xmldb:results> (raw name)
protected static final java.lang.String QUERY_ATTR
protected static final java.lang.String RESULTS_COUNT_ATTR
protected static final java.lang.String RESULT
<result>
protected static final java.lang.String QRESULT
<xmldb:result> (raw name)
protected static final java.lang.String RESULT_DOCID_ATTR
protected static final java.lang.String RESULT_ID_ATTR
protected static final java.lang.String CDATA
public java.lang.String encoding
public java.lang.String url
public java.lang.String user
public java.lang.String password
protected java.lang.String query
protected java.lang.String systemId
public Collection collection
public Resource resource
| Constructor Detail |
public XMLDBSource(Logger logger,
java.lang.String user,
java.lang.String password,
java.lang.String srcUrl)
logger - the Logger instance.srcUrl - the URL being queried.| Method Detail |
public Collection getCollection()
throws SourceException,
XMLDBException
SourceException
XMLDBException
public Resource getResource()
throws SourceException,
XMLDBException
SourceException
XMLDBExceptionpublic java.lang.String getUser()
public java.lang.String getPassword()
public void toSAX(org.xml.sax.ContentHandler handler)
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic java.lang.String getURI()
public long getContentLength()
public long getLastModified()
public boolean exists()
public java.lang.String getMimeType()
public java.lang.String getScheme()
public SourceValidity getValidity()
public void refresh()
public java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOException
public java.io.OutputStream getOutputStream()
throws java.io.IOException,
java.net.MalformedURLException
OutputStream to write to. This method expects an XML document to be
written in that stream. To create a binary resource, use getBinaryOutputStream().
java.io.IOException
java.net.MalformedURLException
public void setContentAsDOM(org.w3c.dom.Node doc)
throws java.io.IOException,
java.net.MalformedURLException
java.io.IOException
java.net.MalformedURLExceptionhttp://exist.sourceforge.net/api/org/xmldb/api/modules/XMLResource.html#setContentAsDOM(org.w3c.dom.Node)
public org.w3c.dom.Node getContentAsDOM()
throws java.io.IOException,
java.net.MalformedURLException
java.io.IOException
java.net.MalformedURLExceptionhttp://exist.sourceforge.net/api/org/xmldb/api/modules/XMLResource.html#setContentAsDOM(org.w3c.dom.Node)
public java.io.OutputStream getBinaryOutputStream()
throws java.io.IOException,
java.net.MalformedURLException
OutputStream to write data to a binary resource.
java.io.IOException
java.net.MalformedURLException
public java.lang.String createId()
throws SourceException
SourceExceptionpublic void setEncoding(java.lang.String s)
public java.lang.String getEncoding()
public void delete()
throws SourceException
SourceExceptionpublic boolean canCancel(java.io.OutputStream stream)
OutputStream returned by
getOutputStream() be cancelled ?
public void cancel(java.io.OutputStream stream)
throws java.io.IOException
OutputStream returned by
getOutputStream().
After cancelling, the stream should no longer be used.
java.io.IOException
public void makeCollection()
throws SourceException
SourceExceptionpublic boolean isCollection()
public java.util.Collection getChildren()
throws SourceException
SourceException
public Source getChild(java.lang.String name)
throws SourceException
SourceExceptionpublic java.lang.String getName()
public Source getParent()
throws SourceException
SourceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||