|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.cocoon.components.source.impl.XMLDBSource
public class XMLDBSource
This class implements the xmldb:// pseudo-protocol and allows to get XML content from an XML:DB enabled XML database.
Field Summary | |
---|---|
protected static String |
CDATA
|
protected static String |
COLLECTION
Element <collection> |
protected static String |
COLLECTION_BASE_ATTR
|
protected static String |
COLLECTION_COUNT_ATTR
Attribute collections on the root element indicates count of collections in the collection |
protected static String |
COLLECTIONS
Root element <collections> |
protected static String |
NAME_ATTR
Attribute name on the collection/resource element |
protected String |
password
The supplied password |
static String |
PREFIX
Source prefix |
protected static String |
QCOLLECTION
Element <xmldb:collection> (raw name) |
protected static String |
QCOLLECTIONS
Root element <xmldb:collections> (raw name) |
protected static String |
QRESOURCE
Element <resource> (raw name) |
protected static String |
QRESULT
Element <xmldb:result> (raw name) |
protected static String |
QRESULTSET
Root element <xmldb:results> (raw name) |
protected String |
query
The part of URL after # sign |
protected static String |
QUERY_ATTR
|
protected static String |
RESOURCE
Element <resource> |
protected static String |
RESOURCE_COUNT_ATTR
Attribute resources on the root element indicates count of resources in the collection |
protected static String |
RESULT
Element <result> |
protected static String |
RESULT_DOCID_ATTR
|
protected static String |
RESULT_ID_ATTR
|
protected static String |
RESULTS_COUNT_ATTR
|
protected static String |
RESULTSET
Root element <results> |
static String |
URI
Source namespace |
protected String |
url
The requested URL |
protected String |
user
The supplied user |
Constructor Summary | |
---|---|
XMLDBSource(Logger logger,
String user,
String password,
String srcUrl)
The constructor. |
Method Summary | |
---|---|
boolean |
canCancel(OutputStream stream)
Can the data sent to an OutputStream returned by
getOutputStream() be cancelled ? |
void |
cancel(OutputStream stream)
Cancel the data sent to an OutputStream returned by
getOutputStream() . |
String |
createId()
Create a new identifier for a resource within a collection. |
void |
delete()
Delete the source |
boolean |
exists()
|
OutputStream |
getBinaryOutputStream()
Return an OutputStream to write data to a binary resource. |
Source |
getChild(String name)
|
Collection |
getChildren()
|
long |
getContentLength()
|
InputStream |
getInputStream()
Get an InputSource for the given URL. |
long |
getLastModified()
|
String |
getMimeType()
|
String |
getName()
|
OutputStream |
getOutputStream()
Return an OutputStream to write to. |
Source |
getParent()
|
String |
getScheme()
|
String |
getURI()
|
SourceValidity |
getValidity()
|
boolean |
isCollection()
|
void |
makeCollection()
|
void |
refresh()
|
void |
toSAX(ContentHandler handler)
Stream SAX events to a given ContentHandler. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String URI
public static final String PREFIX
protected static final String COLLECTIONS
<collections>
protected static final String QCOLLECTIONS
<xmldb:collections>
(raw name)
protected static final String RESOURCE_COUNT_ATTR
resources
on the root element indicates count of resources in the collection
protected static final String COLLECTION_COUNT_ATTR
collections
on the root element indicates count of collections in the collection
protected static final String COLLECTION_BASE_ATTR
protected static final String COLLECTION
<collection>
protected static final String QCOLLECTION
<xmldb:collection>
(raw name)
protected static final String RESOURCE
<resource>
protected static final String QRESOURCE
<resource>
(raw name)
protected static final String NAME_ATTR
name
on the collection/resource element
protected static final String RESULTSET
<results>
protected static final String QRESULTSET
<xmldb:results>
(raw name)
protected static final String QUERY_ATTR
protected static final String RESULTS_COUNT_ATTR
protected static final String RESULT
<result>
protected static final String QRESULT
<xmldb:result>
(raw name)
protected static final String RESULT_DOCID_ATTR
protected static final String RESULT_ID_ATTR
protected static final String CDATA
protected String url
protected String user
protected String password
protected String query
Constructor Detail |
---|
public XMLDBSource(Logger logger, String user, String password, String srcUrl)
logger
- the Logger instance.user
- usernamepassword
- passwordsrcUrl
- the URL being queried.Method Detail |
---|
public void toSAX(ContentHandler handler) throws SAXException
toSAX
in interface XMLizable
SAXException
public String getURI()
getURI
in interface Source
public long getContentLength()
getContentLength
in interface Source
public long getLastModified()
getLastModified
in interface Source
public boolean exists()
exists
in interface Source
public String getMimeType()
getMimeType
in interface Source
public String getScheme()
getScheme
in interface Source
public SourceValidity getValidity()
getValidity
in interface Source
public void refresh()
refresh
in interface Source
public InputStream getInputStream() throws IOException
getInputStream
in interface Source
IOException
public OutputStream getOutputStream() throws IOException, MalformedURLException
OutputStream
to write to. This method expects an XML document to be
written in that stream. To create a binary resource, use getBinaryOutputStream()
.
getOutputStream
in interface ModifiableSource
IOException
MalformedURLException
public OutputStream getBinaryOutputStream() throws IOException, MalformedURLException
OutputStream
to write data to a binary resource.
IOException
MalformedURLException
public String createId() throws SourceException
SourceException
- if collection does not exist or failed to create idpublic void delete() throws SourceException
delete
in interface ModifiableSource
SourceException
public boolean canCancel(OutputStream stream)
OutputStream
returned by
getOutputStream()
be cancelled ?
canCancel
in interface ModifiableSource
public void cancel(OutputStream stream) throws IOException
OutputStream
returned by
getOutputStream()
.
After cancelling, the stream should no longer be used.
cancel
in interface ModifiableSource
IOException
public void makeCollection() throws SourceException
makeCollection
in interface ModifiableTraversableSource
SourceException
public boolean isCollection()
isCollection
in interface TraversableSource
public Collection getChildren() throws SourceException
getChildren
in interface TraversableSource
SourceException
public Source getChild(String name) throws SourceException
getChild
in interface TraversableSource
SourceException
public String getName()
getName
in interface TraversableSource
public Source getParent() throws SourceException
getParent
in interface TraversableSource
SourceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |