org.overlord.sramp.common.derived
Class AbstractXmlDeriver

java.lang.Object
  extended by org.overlord.sramp.common.derived.AbstractXmlDeriver
All Implemented Interfaces:
ArtifactDeriver
Direct Known Subclasses:
PolicyDeriver, XsdDeriver

public abstract class AbstractXmlDeriver
extends Object
implements ArtifactDeriver

Base class for all derivers that are based on XML documents. This base class does some of the boilerplate such as parsing the document. Child classes are responsible for processing the resulting document in interesting ways.

Author:
eric.wittmann@redhat.com

Constructor Summary
AbstractXmlDeriver()
          Constructor.
 
Method Summary
protected  void configureNamespaceMappings(StaticNamespaceContext namespaceContext)
          Configures the namespace mappings that will be available when executing XPath queries.
protected  Collection<BaseArtifactType> createDerivedArtifactCollection()
          Sub-classes could provide an alternate collection here.
 Collection<BaseArtifactType> derive(BaseArtifactType artifact, InputStream content)
          Given an artifact, this method will return a collection of derived content for it.
protected abstract  void derive(Collection<BaseArtifactType> derivedArtifacts, BaseArtifactType artifact, Element rootElement, XPath xpath)
          Derives content for the given artifact.
protected  Object query(XPath xpath, Element context, String query, QName returnType)
          Performs an x-query against the given context node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlDeriver

public AbstractXmlDeriver()
Constructor.

Method Detail

derive

public Collection<BaseArtifactType> derive(BaseArtifactType artifact,
                                           InputStream content)
                                    throws IOException
Description copied from interface: ArtifactDeriver
Given an artifact, this method will return a collection of derived content for it.

Specified by:
derive in interface ArtifactDeriver
Parameters:
artifact - the artifact to derive
content - the artifact content
Returns:
derived content
Throws:
IOException
See Also:
org.overlord.sramp.common.repository.derived.ArtifactDeriver#derive(org.s_ramp.xmlns._2010.s_ramp.BaseArtifactType, java.io.InputStream)

createDerivedArtifactCollection

protected Collection<BaseArtifactType> createDerivedArtifactCollection()
Sub-classes could provide an alternate collection here. For example, the WsdlDeriver creates an indexed artifact collection so that it can reference derived artifacts and make connections/relationships.


query

protected Object query(XPath xpath,
                       Element context,
                       String query,
                       QName returnType)
                throws XPathExpressionException
Performs an x-query against the given context node.

Parameters:
xpath -
query -
returnType -
Throws:
XPathExpressionException

derive

protected abstract void derive(Collection<BaseArtifactType> derivedArtifacts,
                               BaseArtifactType artifact,
                               Element rootElement,
                               XPath xpath)
                        throws IOException
Derives content for the given artifact.

Parameters:
derivedArtifacts -
artifact -
rootElement -
xpath -
Throws:
IOException

configureNamespaceMappings

protected void configureNamespaceMappings(StaticNamespaceContext namespaceContext)
Configures the namespace mappings that will be available when executing XPath queries.

Parameters:
namespaceContext -


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.