|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object smbdav.AbstractProperty
This class provides a basic implementation of much of the
Property
interface. Subclasses need only provide an
implementation of the retrieve
method for read-only
properties which apply to all resources.
Field Summary |
Fields inherited from interface smbdav.Property |
DAV_NAMESPACE, WEB_FOLDERS_NAMESPACE, XMLNS_NAMESPACE |
Constructor Summary | |
AbstractProperty()
|
Method Summary | |
protected void |
addNamespace(org.w3c.dom.Document document,
java.lang.String namespace,
java.lang.String prefix)
Assigns the given prefix to the specified namespace URI in the provided document. |
org.w3c.dom.Element |
createElement(org.w3c.dom.Document document,
jcifs.smb.SmbFile file)
Creates a property element for the given resource (if applicable), with the specified document as the owner. |
void |
destroy()
Disposes of the property. |
boolean |
equals(java.lang.Object obj)
Indicates whether an Object is equivalent to this
Property object. |
java.lang.String |
getName()
Returns the property name. |
java.lang.String |
getNamespace()
Returns the namespace URI of the property. |
protected java.lang.String |
getNamespace(org.w3c.dom.Document document,
java.lang.String prefix)
Returns the namespace URI with the given assigned prefix in the specified document. |
java.lang.String |
getPrefix()
Returns the prefix used when creating elements for this property. |
protected java.lang.String |
getPrefix(org.w3c.dom.Document document,
java.lang.String namespace)
Returns the prefix for the specified namespace URI in the given document, or null for the default namespace. |
protected javax.servlet.ServletConfig |
getServletConfig()
Returns the servlet configuration. |
int |
hashCode()
Returns the hash code for this property. |
void |
init(java.lang.String name,
javax.servlet.ServletConfig config)
Initilizes the property and identifies it with the provided name. |
abstract int |
retrieve(jcifs.smb.SmbFile file,
org.w3c.dom.Element element)
Populates the provided Element with the current value
of the property for the given resource. |
java.lang.String |
toString()
|
int |
update(jcifs.smb.SmbFile file,
org.w3c.dom.Element element)
Updates this property on the given resource using the information int the specified element. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AbstractProperty()
Method Detail |
public void init(java.lang.String name, javax.servlet.ServletConfig config) throws javax.servlet.ServletException
Property
init
in interface Property
name
- The name by which the property will be identified.config
- The servlet configuration object containing
initialization information for the property.
javax.servlet.ServletException
- If the property could not be initialized.public void destroy()
Property
destroy
in interface Property
public java.lang.String getName()
Property
getName
in interface Property
String
containing the name of the property.
This will be the local name of the element in the XML document.public java.lang.String getNamespace()
Property
getNamespace
in interface Property
String
containing the namespace URI in
which the property resides.public java.lang.String getPrefix()
Property
getPrefix
in interface Property
String
containing the prefix applied
to elements created by this property.public org.w3c.dom.Element createElement(org.w3c.dom.Document document, jcifs.smb.SmbFile file) throws java.io.IOException
createElement
in interface Property
document
- The document that is to own the property element.file
- The resource being queried.
Element
for the property. If this property
does not apply to the specified resource, null
will
be returned. The default implementation creates an empty element
for all resources.
java.io.IOException
- If an IO error occurs while creating the element.public int update(jcifs.smb.SmbFile file, org.w3c.dom.Element element) throws java.io.IOException
HttpServletResponse.SC_CONFLICT
.
update
in interface Property
file
- The resource that is to be updated.element
- The element containing the update information.
int
containing the HTTP response code.
java.io.IOException
- If an IO error occurs while updating the
property value.public boolean equals(java.lang.Object obj)
Property
Object
is equivalent to this
Property
object. Two properties are equal if they
reside in the same namespace and have the same name (regardless
of prefix equivalence).
equals
in interface Property
public int hashCode()
Property
hashCode
in interface Property
public java.lang.String toString()
protected javax.servlet.ServletConfig getServletConfig()
ServletConfig
containing the servlet's
configuration information.protected java.lang.String getPrefix(org.w3c.dom.Document document, java.lang.String namespace)
null
for the default namespace.
If the namespace has not been mapped to a prefix in the
document, an IllegalArgumentException
is thrown.
document
- The document whose assigned prefix for the given
namespace URI is to be retrieved.namespace
- The namespace URI whose prefix in the document
is to be retrieved.
String
containing the prefix assigned
to the given namespace URI in the specified document. If the
given namespace URI is the default namespace for the document,
this method returns null
.
java.lang.IllegalArgumentException
- If the specified namespace URI
has not been assigned a prefix in the given document.protected java.lang.String getNamespace(org.w3c.dom.Document document, java.lang.String prefix)
null
if the prefix
has not been assigned to a namespace.
document
- The document from which the namespace is to be retrieved.prefix
- The prefix for which a namespace is to be retrieved.
A value of null
for this parameter will retrieve
the default namespace of the document.
String
containing the namespace URI to which
the given prefix has been assigned in the specified document.
If no such namespace exists, this method returns null
.protected void addNamespace(org.w3c.dom.Document document, java.lang.String namespace, java.lang.String prefix) throws java.io.IOException
document
- The document in which the namespace assignment is
to be made.namespace
- The namespace URI for which an assignment is
being established.prefix
- The prefix to assign to the namespace URI.
java.io.IOException
- If the prefix has already been assigned
to another namespace URI in the document.public abstract int retrieve(jcifs.smb.SmbFile file, org.w3c.dom.Element element) throws java.io.IOException
Property
Element
with the current value
of the property for the given resource.
retrieve
in interface Property
file
- The resource whose property value is to be retrieved.element
- The element which receives the value.
int
containing the HTTP response code.
For a successful retrieval, this will be
HttpServletResponse.SC_OK
.
java.io.IOException
- If an IO error occurs while retrieving the
property value.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |