org.apache.lenya.cms.publication
Class DublinCoreImpl

java.lang.Object
  extended by org.apache.lenya.cms.publication.DublinCoreImpl

public class DublinCoreImpl
extends java.lang.Object

Access dublin core meta data in documents. This class uses the dublin core specification from 2003-03-04.


Field Summary
static java.lang.String[] ELEMENTS
           
static java.lang.String[] TERMS
           
 
Constructor Summary
protected DublinCoreImpl(Document aDocument)
          Creates a new instance of Dublin Core
 
Method Summary
 void addValue(java.lang.String key, java.lang.String value)
           
 void addValues(java.lang.String key, java.lang.String[] values)
           
protected  java.lang.String[] getElementOrTerm(java.lang.String key)
          Returns the element or term values, resp., for a certain key.
 java.lang.String getFirstValue(java.lang.String key)
          Returns the first value for a certain key.
protected  org.w3c.dom.Element getMetaElement(org.w3c.dom.Document doc)
          Returns the Lenya meta data element.
 java.lang.String[] getValues(java.lang.String key)
           
protected  void loadValues()
          Loads the dublin core values from the XML file.
 void removeAllValues(java.lang.String key)
           
 void removeValue(java.lang.String key, java.lang.String value)
           
 void replaceBy(DublinCore other)
           
 void save()
          Save the meta data.
 void setValue(java.lang.String key, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENTS

public static final java.lang.String[] ELEMENTS

TERMS

public static final java.lang.String[] TERMS
Constructor Detail

DublinCoreImpl

protected DublinCoreImpl(Document aDocument)
                  throws DocumentException
Creates a new instance of Dublin Core

Parameters:
aDocument - the document for which the Dublin Core instance is created.
Throws:
DocumentException - if an error occurs
Method Detail

loadValues

protected void loadValues()
                   throws DocumentException
Loads the dublin core values from the XML file.

Throws:
DocumentException - when something went wrong.

save

public void save()
          throws DocumentException
Save the meta data.

Throws:
DocumentException - if the meta data could not be made persistent.

getMetaElement

protected org.w3c.dom.Element getMetaElement(org.w3c.dom.Document doc)
                                      throws DocumentException
Returns the Lenya meta data element.

Parameters:
doc - The XML document.
Returns:
A DOM element.
Throws:
DocumentException

getFirstValue

public java.lang.String getFirstValue(java.lang.String key)
                               throws DocumentException
Returns the first value for a certain key.

Parameters:
key - The key.
Returns:
A string.
Throws:
DocumentException

getElementOrTerm

protected java.lang.String[] getElementOrTerm(java.lang.String key)
                                       throws DocumentException
Returns the element or term values, resp., for a certain key.

Parameters:
key - The key.
Returns:
An array of strings.
Throws:
DocumentException

getValues

public java.lang.String[] getValues(java.lang.String key)
                             throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.getValues(java.lang.String)

addValue

public void addValue(java.lang.String key,
                     java.lang.String value)
              throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.addValue(java.lang.String, java.lang.String)

setValue

public void setValue(java.lang.String key,
                     java.lang.String value)
              throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.setValue(java.lang.String, java.lang.String)

addValues

public void addValues(java.lang.String key,
                      java.lang.String[] values)
               throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.addValues(java.lang.String, java.lang.String[])

removeValue

public void removeValue(java.lang.String key,
                        java.lang.String value)
                 throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.removeValue(java.lang.String, java.lang.String)

removeAllValues

public void removeAllValues(java.lang.String key)
                     throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.removeAllValues(java.lang.String)

replaceBy

public void replaceBy(DublinCore other)
               throws DocumentException
Throws:
DocumentException
See Also:
DublinCore.replaceBy(org.apache.lenya.cms.publication.DublinCore)


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.