org.equanda.subjectory
Class DataContainerAdapter

java.lang.Object
  extended by org.equanda.subjectory.DataContainerAdapter
All Implemented Interfaces:
DataContainer
Direct Known Subclasses:
XmlFileContainer

public abstract class DataContainerAdapter
extends Object
implements DataContainer

Adapter class for creating specific data container classes.

Author:
Joachim Van der Auwera

Field Summary
protected  HashMap<String,Node> containerMap
           
static String DEFAULT_CONTAINER
           
protected  XPathFactory xPathFactory
           
 
Constructor Summary
DataContainerAdapter()
           
 
Method Summary
 byte[] getAttachment(String s)
          Get an attachment which is part of the data container by specifying the (relative) filename within the container.
 Node getContainer(String container)
          Get xml dom tree for the specified container.
protected  Document getDom(File dir, String fileName)
           
 NodeList getNodeList(String container, String xPathExpr)
          Get the list of nodes which are referenced by the given xpath expression in the (current location in) the given container.
 String getString(String container, String xPathExpr)
          Get the string which is referenced by the given xpath expression in the (current location in) the given container.
protected  Object getXPath(String container, String xPathExpr, QName xPathType)
           
 void setContainer(String container, Node node)
          Set xml tree for a container.
protected abstract  void setNameSpaceContext(XPath xPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.equanda.subjectory.DataContainer
getContainerType
 

Field Detail

DEFAULT_CONTAINER

public static final String DEFAULT_CONTAINER
See Also:
Constant Field Values

containerMap

protected HashMap<String,Node> containerMap

xPathFactory

protected XPathFactory xPathFactory
Constructor Detail

DataContainerAdapter

public DataContainerAdapter()
Method Detail

getDom

protected Document getDom(File dir,
                          String fileName)

setNameSpaceContext

protected abstract void setNameSpaceContext(XPath xPath)

getString

public String getString(String container,
                        String xPathExpr)
Description copied from interface: DataContainer
Get the string which is referenced by the given xpath expression in the (current location in) the given container.

Specified by:
getString in interface DataContainer
Parameters:
container - name of the container to search in
xPathExpr - xpath expression to evaluate
Returns:
string result of null of not found

getNodeList

public NodeList getNodeList(String container,
                            String xPathExpr)
Description copied from interface: DataContainer
Get the list of nodes which are referenced by the given xpath expression in the (current location in) the given container.

Specified by:
getNodeList in interface DataContainer
Parameters:
container - name of the container to search in
xPathExpr - xpath expression to evaluate
Returns:
string result of null of not found

getXPath

protected Object getXPath(String container,
                          String xPathExpr,
                          QName xPathType)

getContainer

public Node getContainer(String container)
Description copied from interface: DataContainer
Get xml dom tree for the specified container.

Specified by:
getContainer in interface DataContainer
Parameters:
container - container identifier or null for "Default" container
Returns:
dom tree

setContainer

public void setContainer(String container,
                         Node node)
Description copied from interface: DataContainer
Set xml tree for a container.

Specified by:
setContainer in interface DataContainer
Parameters:
container - container identifier or null for "Default" container
node - dom tree to set

getAttachment

public byte[] getAttachment(String s)
Description copied from interface: DataContainer
Get an attachment which is part of the data container by specifying the (relative) filename within the container.

Specified by:
getAttachment in interface DataContainer
Parameters:
s - filename inside data container
Returns:
attachment contents


Copyright © 2007-2009. All Rights Reserved.