org.xiruss.util
Class AddressingUtil

java.lang.Object
  extended by org.xiruss.util.AddressingUtil

public class AddressingUtil
extends java.lang.Object

Utilities for doing address resolution and management. Holds the knowledge of how to resolve particular addressing elements or attributes to their targets. FIXME: Not sure this is the best way to organize this functionality. WEK.


Field Summary
(package private) static org.apache.log4j.Logger logger
           
 
Constructor Summary
AddressingUtil()
           
 
Method Summary
static java.lang.String constructXPathForElement(org.w3c.dom.Element inElem)
          Constructs an XPath to an element.
static java.lang.String constructXPathForElement(org.w3c.dom.Element inElem, java.lang.String xPathRest)
           
static java.io.File getHrefTargetDocument(org.w3c.dom.Element elem, java.io.File baseFile)
          Resolves the href= attribute of an XInclude element to it's target file.
static java.io.File getReferenceTargetFile(org.w3c.dom.Element elem, java.io.File baseFile)
           
static Resource getReferenceTargetResource(org.w3c.dom.Element elem, Resource baseResource)
          Given an element with an pointer attribute, resolves it to a resource inside the repository.
static org.w3c.dom.NodeList resolveXPointer(java.lang.String xpointerString, org.w3c.dom.Document targetDocument)
          Given an xpointer string, attempts to resolve it to a node list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
Constructor Detail

AddressingUtil

public AddressingUtil()
Method Detail

getReferenceTargetFile

public static java.io.File getReferenceTargetFile(org.w3c.dom.Element elem,
                                                  java.io.File baseFile)
                                           throws AddressingException
Parameters:
elem -
Returns:
Throws:
AddressingException

getReferenceTargetResource

public static Resource getReferenceTargetResource(org.w3c.dom.Element elem,
                                                  Resource baseResource)
                                           throws AddressingException
Given an element with an pointer attribute, resolves it to a resource inside the repository. Requires that the reference be a URL that points into the repository.

Parameters:
elem -
resource -
Returns:
Throws:
AddressingException

getHrefTargetDocument

public static java.io.File getHrefTargetDocument(org.w3c.dom.Element elem,
                                                 java.io.File baseFile)
                                          throws AddressingException
Resolves the href= attribute of an XInclude element to it's target file.

Parameters:
elem -
Returns:
Throws:
AddressingException

constructXPathForElement

public static java.lang.String constructXPathForElement(org.w3c.dom.Element inElem)
Constructs an XPath to an element. Assumes that attributes named "id" are ID-type attributes.

Parameters:
inElem -
Returns:

constructXPathForElement

public static java.lang.String constructXPathForElement(org.w3c.dom.Element inElem,
                                                        java.lang.String xPathRest)

resolveXPointer

public static org.w3c.dom.NodeList resolveXPointer(java.lang.String xpointerString,
                                                   org.w3c.dom.Document targetDocument)
                                            throws XPointerException
Given an xpointer string, attempts to resolve it to a node list.

Parameters:
xpointer - XPointer string (e.g., as specified in an xpointer= attribute.
targetDocument - The document the XPointer is to be resolved to.
Throws:
XPointerException