edu.sc.seis.fissuresUtil.xml
Class XMLDataSet

java.lang.Object
  extended by edu.sc.seis.fissuresUtil.xml.XMLDataSet
All Implemented Interfaces:
DataSet, StdDataSetParamNames, java.io.Serializable

public class XMLDataSet
extends java.lang.Object
implements DataSet, java.io.Serializable

Describe class XMLDataSet here.

See Also:
Serialized Form

Field Summary
protected  java.net.URL base
          Describe variable base here.
protected  org.w3c.dom.Element config
          Describe variable config here.
protected  java.util.HashMap dataSetCache
          Describe variable dataSetCache here.
protected  java.lang.String[] dataSetIdCache
          Describe variable dataSetIdCache here.
protected  javax.xml.parsers.DocumentBuilder docBuilder
          Describe variable docBuilder here.
protected  java.util.HashMap parameterCache
          Describe variable parameterCache here.
protected  java.lang.String[] parameterNameCache
          Describe variable parameterNameCache here.
protected  java.util.HashMap seismogramCache
          Describe variable seismogramCache here.
protected  java.lang.String[] seismogramNameCache
          Describe variable seismogramNameCache here.
 
Fields inherited from interface edu.sc.seis.fissuresUtil.xml.StdDataSetParamNames
CHANNEL, EVENT, prefix
 
Constructor Summary
XMLDataSet(javax.xml.parsers.DocumentBuilder docBuilder, java.net.URL datasetURL)
          Creates a new XMLDataSet instance.
XMLDataSet(javax.xml.parsers.DocumentBuilder docBuilder, java.net.URL base, org.w3c.dom.Element config)
          Creates a new XMLDataSet instance.
XMLDataSet(javax.xml.parsers.DocumentBuilder docBuilder, java.net.URL base, java.lang.String id, java.lang.String name, java.lang.String owner)
           
 
Method Summary
 void addDataSet(DataSet dataset, edu.iris.Fissures.AuditInfo[] audit)
          Describe addDataSet method here.
 void addDataSetRef(java.net.URL datasetURL, edu.iris.Fissures.AuditInfo[] audit)
          Describe addDataSetRef method here.
 void addDataSetSeismogram(DataSetSeismogram dss, edu.iris.Fissures.AuditInfo[] audit)
          adds the DataSetSeismogram to this DataSet.
 void addParameter(java.lang.String name, java.lang.Object value, edu.iris.Fissures.AuditInfo[] audit)
          Adds a new parameter.
 void addParameterRef(java.net.URL paramURL, java.lang.String name, java.lang.Object object, edu.iris.Fissures.AuditInfo[] audit)
           
 void addSeismogram(edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis, edu.iris.Fissures.AuditInfo[] audit)
          Adds a seismogram.
 void addSeismogramRef(edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis, java.net.URL seisURL, java.lang.String name, edu.iris.Fissures.IfSeismogramDC.Property[] props, edu.iris.Fissures.IfParameterMgr.ParameterRef[] parm_ids, edu.iris.Fissures.AuditInfo[] audit)
          Adds a reference to a remote seismogram.
 java.lang.String[] cacheParameterNames()
           
protected  java.lang.String[] cacheSeismogramNames()
          Describe cacheSeismogramNames method here.
protected  void checkForLegacySeismograms()
           
 DataSet createChildDataSet(java.lang.String id, java.lang.String name, java.lang.String owner, edu.iris.Fissures.AuditInfo[] audit)
          Creates a new DataSet as a child of this one.
 java.net.URL getBase()
          Gets the base URL that other URLs in this dataset are relative to.
 edu.iris.Fissures.IfNetwork.Channel getChannel(edu.iris.Fissures.IfNetwork.ChannelId channelId)
          Optional method to get the channel from the parameters, if it exists.
 edu.iris.Fissures.IfNetwork.ChannelId[] getChannelIds()
          Optional method to get channel id of all Channel parameters.
 DataSet getDataSet(java.lang.String name)
          Describe getDataSet method here.
 DataSet getDataSetById(java.lang.String id)
          Describe getDataSetById method here.
 java.lang.String[] getDataSetIds()
          Gets the Ids for all child datasets of this dataset.
 java.lang.String[] getDataSetNames()
          Gets the names of all child datasets of this dataset.
 DataSetSeismogram getDataSetSeismogram(java.lang.String name)
           
 java.lang.String[] getDataSetSeismogramNames()
           
static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
           
static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
           
 org.w3c.dom.Element getElement()
          returns a DOM Element that represents this dataset.
 edu.iris.Fissures.IfEvent.EventAccessOperations getEvent()
          Optional method to get the event associated with this dataset.
 java.lang.String getId()
          Gets the dataset Id.
 java.lang.String getName()
          Gets the displayable name.
 java.lang.String getOwner()
          Gets the displayable name.
 java.lang.Object getParameter(java.lang.String name)
          Gets the parameter with the given name.
 java.lang.String[] getParameterNames()
          Gets the names of all parameters within this dataset.
 edu.iris.Fissures.seismogramDC.LocalSeismogramImpl getSeismogram(java.lang.String name)
          Gets the seismogram for the given name, Null if it cannot be found.
 edu.iris.Fissures.IfSeismogramDC.SeismogramAttr[] getSeismogramAttrs()
           
 java.lang.String[] getSeismogramNames()
          Gets the names of the seismograms in this dataset.
static XMLDataSet load(java.net.URL datasetURL)
          Load a xml dataset from a URL.
 void remove(DataSetSeismogram dss)
           
 void setBase(java.net.URL base)
          Sets the base URL that other URLs in this dataset are relative to.
 void setName(java.lang.String name)
          Sets the displayable name.
 void setOwner(java.lang.String owner)
          Sets the displayable name.
 java.lang.String toString()
           
 void write(java.io.OutputStream out)
          Writes the xml version of this dataset to the output stream.
static void write(java.io.OutputStream out, org.w3c.dom.Element el)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

base

protected java.net.URL base
Describe variable base here.


config

protected org.w3c.dom.Element config
Describe variable config here.


docBuilder

protected javax.xml.parsers.DocumentBuilder docBuilder
Describe variable docBuilder here.


parameterCache

protected java.util.HashMap parameterCache
Describe variable parameterCache here.


parameterNameCache

protected java.lang.String[] parameterNameCache
Describe variable parameterNameCache here.


dataSetIdCache

protected java.lang.String[] dataSetIdCache
Describe variable dataSetIdCache here.


dataSetCache

protected java.util.HashMap dataSetCache
Describe variable dataSetCache here.


seismogramCache

protected java.util.HashMap seismogramCache
Describe variable seismogramCache here.


seismogramNameCache

protected java.lang.String[] seismogramNameCache
Describe variable seismogramNameCache here.

Constructor Detail

XMLDataSet

public XMLDataSet(javax.xml.parsers.DocumentBuilder docBuilder,
                  java.net.URL datasetURL)
Creates a new XMLDataSet instance.

Parameters:
docBuilder - a DocumentBuilder value
datasetURL - an URL to a dsml file

XMLDataSet

public XMLDataSet(javax.xml.parsers.DocumentBuilder docBuilder,
                  java.net.URL base,
                  java.lang.String id,
                  java.lang.String name,
                  java.lang.String owner)

XMLDataSet

public XMLDataSet(javax.xml.parsers.DocumentBuilder docBuilder,
                  java.net.URL base,
                  org.w3c.dom.Element config)
Creates a new XMLDataSet instance.

Parameters:
docBuilder - a DocumentBuilder to use to create the document.
base - the URL other urls should be made relative to.
config - the dataset contents as a DOM Element
Method Detail

load

public static XMLDataSet load(java.net.URL datasetURL)
Load a xml dataset from a URL.

Parameters:
datasetURL - an URL to an xml dataset
Returns:
a XMLDataSet populated form the URL

checkForLegacySeismograms

protected void checkForLegacySeismograms()

getId

public java.lang.String getId()
Gets the dataset Id. This should be unique.

Specified by:
getId in interface DataSet
Returns:
a String id

getBase

public java.net.URL getBase()
Gets the base URL that other URLs in this dataset are relative to.

Returns:
the base URL

setBase

public void setBase(java.net.URL base)
Sets the base URL that other URLs in this dataset are relative to.

Parameters:
base - an URL

getName

public java.lang.String getName()
Gets the displayable name.

Specified by:
getName in interface DataSet
Returns:
a String name

setName

public void setName(java.lang.String name)
Sets the displayable name.

Specified by:
setName in interface DataSet
Parameters:
name - a String name

getOwner

public java.lang.String getOwner()
Gets the displayable name.

Specified by:
getOwner in interface DataSet
Returns:
a String name

setOwner

public void setOwner(java.lang.String owner)
Sets the displayable name.

Specified by:
setOwner in interface DataSet
Parameters:
name - a String name

getParameterNames

public java.lang.String[] getParameterNames()
Gets the names of all parameters within this dataset.

Specified by:
getParameterNames in interface DataSet
Returns:
an array of names.

cacheParameterNames

public java.lang.String[] cacheParameterNames()

getParameter

public java.lang.Object getParameter(java.lang.String name)
Gets the parameter with the given name. The returns null if the parameter cannot be found.

Specified by:
getParameter in interface DataSet
Parameters:
name - a String paramter name
Returns:
the parameter with that name

addParameter

public void addParameter(java.lang.String name,
                         java.lang.Object value,
                         edu.iris.Fissures.AuditInfo[] audit)
Adds a new parameter. Currently objects that are not DOM Elements are stored in memory, but cannot be premanantly saved in the xml file.

Specified by:
addParameter in interface DataSet
Parameters:
name - a String name for this parameter
value - an Object value
audit - the audit related to this paramter

addParameterRef

public void addParameterRef(java.net.URL paramURL,
                            java.lang.String name,
                            java.lang.Object object,
                            edu.iris.Fissures.AuditInfo[] audit)

getDataSetIds

public java.lang.String[] getDataSetIds()
Gets the Ids for all child datasets of this dataset.

Returns:
a String[] id

getDataSetNames

public java.lang.String[] getDataSetNames()
Gets the names of all child datasets of this dataset.

Specified by:
getDataSetNames in interface DataSet
Returns:
a String[] value

getDataSet

public DataSet getDataSet(java.lang.String name)
Describe getDataSet method here.

Specified by:
getDataSet in interface DataSet
Parameters:
name - a String value
Returns:
a DataSet value

addDataSet

public void addDataSet(DataSet dataset,
                       edu.iris.Fissures.AuditInfo[] audit)
Describe addDataSet method here.

Specified by:
addDataSet in interface DataSet
Parameters:
dataset - an edu.sc.seis.fissuresUtil.xml.DataSet value
audit - an AuditInfo[] value

addDataSetRef

public void addDataSetRef(java.net.URL datasetURL,
                          edu.iris.Fissures.AuditInfo[] audit)
Describe addDataSetRef method here.

Parameters:
datasetURL - an URL value
audit - an AuditInfo[] value

createChildDataSet

public DataSet createChildDataSet(java.lang.String id,
                                  java.lang.String name,
                                  java.lang.String owner,
                                  edu.iris.Fissures.AuditInfo[] audit)
Creates a new DataSet as a child of this one.

Specified by:
createChildDataSet in interface DataSet

getDataSetById

public DataSet getDataSetById(java.lang.String id)
Describe getDataSetById method here.

Parameters:
id - a String value
Returns:
a DataSet value

getSeismogramNames

public java.lang.String[] getSeismogramNames()
Gets the names of the seismograms in this dataset.

Returns:
the names.

cacheSeismogramNames

protected java.lang.String[] cacheSeismogramNames()
Describe cacheSeismogramNames method here.

Returns:
a String[] value

getSeismogramAttrs

public edu.iris.Fissures.IfSeismogramDC.SeismogramAttr[] getSeismogramAttrs()

getChannelIds

public edu.iris.Fissures.IfNetwork.ChannelId[] getChannelIds()
Description copied from interface: DataSet
Optional method to get channel id of all Channel parameters.

Specified by:
getChannelIds in interface DataSet
See Also:
for the prefix for these parameters.

getSeismogram

public edu.iris.Fissures.seismogramDC.LocalSeismogramImpl getSeismogram(java.lang.String name)
Gets the seismogram for the given name, Null if it cannot be found.

Parameters:
name - a String name
Returns:
a LocalSeismogramImpl

addSeismogram

public void addSeismogram(edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis,
                          edu.iris.Fissures.AuditInfo[] audit)
Adds a seismogram.

Parameters:
seis - a LocalSeismogramImpl seismogram
audit - the audit for this seismogram

addSeismogramRef

public void addSeismogramRef(edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis,
                             java.net.URL seisURL,
                             java.lang.String name,
                             edu.iris.Fissures.IfSeismogramDC.Property[] props,
                             edu.iris.Fissures.IfParameterMgr.ParameterRef[] parm_ids,
                             edu.iris.Fissures.AuditInfo[] audit)
Adds a reference to a remote seismogram.

Parameters:
seisURL - an URL to the seismogram
name - a String name
props - the properties for this seismogram to be stored in the dataset
parm_ids - the Parameter References for this seismogram to be stored in the dataset
audit - the audit for thie seismogram

addDataSetSeismogram

public void addDataSetSeismogram(DataSetSeismogram dss,
                                 edu.iris.Fissures.AuditInfo[] audit)
Description copied from interface: DataSet
adds the DataSetSeismogram to this DataSet.

Specified by:
addDataSetSeismogram in interface DataSet

getDataSetSeismogram

public DataSetSeismogram getDataSetSeismogram(java.lang.String name)
Specified by:
getDataSetSeismogram in interface DataSet
Returns:
the DataSetSeismogram inserted with this name

getDataSetSeismogramNames

public java.lang.String[] getDataSetSeismogramNames()
Specified by:
getDataSetSeismogramNames in interface DataSet
Returns:
the names of all directly held DataSetSeismograms

remove

public void remove(DataSetSeismogram dss)
Specified by:
remove in interface DataSet

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getElement

public org.w3c.dom.Element getElement()
returns a DOM Element that represents this dataset.

Returns:
an Element value

getEvent

public edu.iris.Fissures.IfEvent.EventAccessOperations getEvent()
Description copied from interface: DataSet
Optional method to get the event associated with this dataset. Not all datasets will have an event, return null in this case.

Specified by:
getEvent in interface DataSet
See Also:
for the prefix for these parameters.

getChannel

public edu.iris.Fissures.IfNetwork.Channel getChannel(edu.iris.Fissures.IfNetwork.ChannelId channelId)
Description copied from interface: DataSet
Optional method to get the channel from the parameters, if it exists. Should return null otherwise.

Specified by:
getChannel in interface DataSet
See Also:
for the prefix for these parameters.

write

public void write(java.io.OutputStream out)
           throws java.lang.Exception
Writes the xml version of this dataset to the output stream.

Throws:
java.lang.Exception

write

public static void write(java.io.OutputStream out,
                         org.w3c.dom.Element el)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getDocumentBuilderFactory

public static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()

getDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
                                                            throws javax.xml.parsers.ParserConfigurationException
Throws:
javax.xml.parsers.ParserConfigurationException