Version: ${maven.project.version}

org.soaplab.services.metadata
Class MetadataAccessorXML

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.tulsoft.tools.xml.XMLErrorHandler
          extended by org.soaplab.services.metadata.MetadataAccessorXML
All Implemented Interfaces:
MetadataAccessor, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class MetadataAccessorXML
extends org.tulsoft.tools.xml.XMLErrorHandler
implements MetadataAccessor

A default implementation of MetadataAccessor interface that reads service metadata from XML files.

How does it find metadata for its service?

It uses singleton AnalysisInventoryProvider to get list of all available analyses (possibly from more than one provider, i.e. possibly from more analysis lists). It looks there for its analysis (whose name was given in the constructor). An analysis info (a container class AnalysisInstallation contains also a poiner to an XML metadata file describing this analysis in all details.

The pointer to an XML metadata file can be a URL, an absolute path, or a relative path. In the last case, it is expanded to an absolute path using Soaplab property Config.PROP_METADATA_DIR, or even Config.PROP_METADATA_FILE. In any case, if the path is still not absolute, it is tried to locate the file as a class resource.

Version:
$Id: MetadataAccessorXML.java,v 1.23 2008/10/07 10:14:31 mahmutuludag Exp $
Author:
Martin Senger

Field Summary
 
Fields inherited from class org.tulsoft.tools.xml.XMLErrorHandler
VERSION
 
Constructor Summary
MetadataAccessorXML(java.lang.String serviceName)
          A real constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
          characters()
 void checkMetadata()
          Check if loaded metadata contains all necessary tags.
 java.lang.String describe()
          Return the whole metadata in the raw format.
 void endDocument()
          endDocument()
 void endElement(java.lang.String namespaceURI, java.lang.String name, java.lang.String qName)
          endElement()
 AnalysisDef getAnalysisDef()
          Methods of AnalysisMetadataAccessor interface Most of these public methods are synchronized in order to prevent returning uncomplete data if the parsing of metadata is in progress.
 InputPropertyDef[] getInputDefs()
          Return a slightly simplified version of what is returned by MetadataAccessor.getParamDefs() - and only for input data and options.
 OutputPropertyDef[] getOutputDefs()
          Return a slightly simplified version of what is returned by MetadataAccessor.getParamDefs() - and only for output data.
 ParamDef[] getParamDefs()
          Return description of all parameters for an analysis.
 java.lang.String getServiceName()
          Return a name of a service providing this analysis.
 void setDocumentLocator(org.xml.sax.Locator l)
           
 void startDocument()
          startDocument()
 void startElement(java.lang.String namespaceURI, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes attrs)
          startElement()
 
Methods inherited from class org.tulsoft.tools.xml.XMLErrorHandler
error, fatalError, warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataAccessorXML

public MetadataAccessorXML(java.lang.String serviceName)
                    throws SoaplabException
A real constructor. It loads metadata for the given service.

Throws:
SoaplabException
Method Detail

getAnalysisDef

public AnalysisDef getAnalysisDef()
Methods of AnalysisMetadataAccessor interface Most of these public methods are synchronized in order to prevent returning uncomplete data if the parsing of metadata is in progress.

Specified by:
getAnalysisDef in interface MetadataAccessor
Returns:
an analysis metadata, or null if such metadata does not exist (but that would cause a havoc in Soaplab)

getParamDefs

public ParamDef[] getParamDefs()
Description copied from interface: MetadataAccessor
Return description of all parameters for an analysis. A parameter is any input or output. It contains the usual input/output data and the command-line options.

Specified by:
getParamDefs in interface MetadataAccessor
Returns:
an array of metadata, one element for each parameter; if there are no parameters, it returns an empty array (not null)

getInputDefs

public InputPropertyDef[] getInputDefs()
Description copied from interface: MetadataAccessor
Return a slightly simplified version of what is returned by MetadataAccessor.getParamDefs() - and only for input data and options.

Some elements (parameters) returned by MetadataAccessor.getParamDefs() can be represented here by more elements. For example, this typically happens for input data that can be sent to an analysis either as direct data, or as a reference to data. Such input is represented by only one ParamDef instance, but by two elements returned by this getInputDefs.

The mapping between elements returned by MetadataAccessor.getParamDefs() and by this method is done by parameter name: the names used by this method are either same as those returned by MetadataAccessor.getParamDefs(), or they have some additional suffixes. Soaplab recognizes suffixes SoaplabConstants.DIRECT_DATA_SUFFIX, SoaplabConstants.URL_SUFFIX,SoaplabConstants.USA_SUFFIX.

Specified by:
getInputDefs in interface MetadataAccessor
Returns:
an array of metadata; if there are no input parameters, it returns an empty array (not null)

getOutputDefs

public OutputPropertyDef[] getOutputDefs()
Description copied from interface: MetadataAccessor
Return a slightly simplified version of what is returned by MetadataAccessor.getParamDefs() - and only for output data.

The mapping between elements returned by MetadataAccessor.getParamDefs() and by this method is done by parameter name: the names used by this method are the same as those returned by MetadataAccessor.getParamDefs().

Specified by:
getOutputDefs in interface MetadataAccessor
Returns:
an array of metadata; if there are no output data, it returns an empty array (not null)

describe

public java.lang.String describe()
                          throws SoaplabException
Description copied from interface: MetadataAccessor
Return the whole metadata in the raw format.

Specified by:
describe in interface MetadataAccessor
Returns:
an XML representation of the analysis metadata, using the SoaplabAnalysis.dtd.
Throws:
SoaplabException - if metadata does not exist

getServiceName

public java.lang.String getServiceName()
                                throws SoaplabException
Description copied from interface: MetadataAccessor
Return a name of a service providing this analysis.

Specified by:
getServiceName in interface MetadataAccessor
Returns:
a name of a service - this may be different from the analysis name returned within MetadataAccessor.getAnalysisDef()
Throws:
SoaplabException

checkMetadata

public void checkMetadata()
                   throws SoaplabException
Check if loaded metadata contains all necessary tags.

Throws:
SoaplabException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator l)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

startDocument

public void startDocument()
startDocument()

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

endDocument

public void endDocument()
endDocument()

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String name,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
startElement()

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String name,
                       java.lang.String qName)
endElement()

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
characters()

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

Version: ${maven.project.version}

Submit a bug or feature
Generated: Tue Jun 14 15:18:14 AST 2011