Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.embl.ebi.escience.baclava
Class DataThing  view DataThing download DataThing.java

java.lang.Object
  extended byorg.embl.ebi.escience.baclava.DataThing

public class DataThing
extends java.lang.Object

A simple wrapper around an arbitrary Collection object which allows lookup and storage of any metadata within the collection or its children. In addition, there is an object of metadata concerning the DataThing itself. You obtain a DataThing by invoking the bake operation on the DataThingFactory in the factory subpackage, this is to allow the factory to sensibly configure such things as types and underlying collections. TODO - LSID needs to be added to this class to allow provenance collection to work correctly with BowerBird


Field Summary
protected  java.util.HashMap metadataMap
           
protected  org.embl.ebi.escience.scufl.SemanticMarkup myMarkup
           
protected  java.lang.Object theDataObject
           
 
Constructor Summary
DataThing(org.jdom.Element e)
          Construct a new DataThing from the supplied XML Jdom Element.
DataThing(java.lang.Object o)
          Create and bind a new SemanticMarkup object to the DataThing itself, it's not totally clear there's a need for this but it does no harm so why not?
 
Method Summary
private  void drill(int iterationDepth, java.util.List targetList, java.util.Collection theDataObject)
          Drill into a collection, adding items to the list if we're at the desired depth, this makes the underlying assumption that the collection contains either collections or objects, but never a mix of both.
 java.lang.Object getDataObject()
          Get the underlying data object, this is the first level of the data document.
 org.jdom.Element getElement()
          Return the JDom Element corresponding to this DataThing represented as XML
 javax.swing.ImageIcon getIcon()
          Get a display icon for this DataThing, currently this is based on the MIME type from the syntactic type string.
 org.embl.ebi.escience.scufl.SemanticMarkup getMetadata()
          Return the SemanticMarkup object associated with the DataThing itself
 org.embl.ebi.escience.scufl.SemanticMarkup getMetadataForObject(java.lang.Object theObject, boolean supplyDefault)
          Get the SemanticMarkup associated with an object in this DataThing.
 java.lang.String getSyntacticType()
          Get the syntax type of this DataThing.
 java.lang.String getSyntacticTypeForObject(java.lang.Object o)
           
 BaclavaIterator iterator(java.lang.String desiredType)
          Given a desired type, return the BaclavaIterator that provides DataThing objects of this type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theDataObject

protected java.lang.Object theDataObject

metadataMap

protected java.util.HashMap metadataMap

myMarkup

protected org.embl.ebi.escience.scufl.SemanticMarkup myMarkup
Constructor Detail

DataThing

public DataThing(org.jdom.Element e)
Construct a new DataThing from the supplied XML Jdom Element. Delegates to the DataThingXMLFactory for almost all the real work here.


DataThing

public DataThing(java.lang.Object o)
Create and bind a new SemanticMarkup object to the DataThing itself, it's not totally clear there's a need for this but it does no harm so why not?

Method Detail

getIcon

public javax.swing.ImageIcon getIcon()
Get a display icon for this DataThing, currently this is based on the MIME type from the syntactic type string.


getMetadata

public org.embl.ebi.escience.scufl.SemanticMarkup getMetadata()
Return the SemanticMarkup object associated with the DataThing itself


getDataObject

public java.lang.Object getDataObject()
Get the underlying data object, this is the first level of the data document.


getSyntacticType

public java.lang.String getSyntacticType()
Get the syntax type of this DataThing. The type string is based around application of the collection type constructors to a base MIME type. For example, t(s('text/plain')) is a tree of sets of TEXT/PLAIN items. The MIME type may be a comma separated list of types. Possible type constructors are t(..) for trees, s(..) for sets, l(..) for lists and p(..) for partial orders.

I would imagine that we'll mostly be dealing with types of 'text/plain', lists of same and maybe the occasional 'image/png' or similar, but I think this has enough flexibility to cover most things.

The type string "null" represents and empty DataThing and is the default value returned if the collection is empty.


getSyntacticTypeForObject

public java.lang.String getSyntacticTypeForObject(java.lang.Object o)

getMetadataForObject

public org.embl.ebi.escience.scufl.SemanticMarkup getMetadataForObject(java.lang.Object theObject,
                                                                       boolean supplyDefault)
                                                                throws NoMetadataFoundException
Get the SemanticMarkup associated with an object in this DataThing. If there is no such metadata available the behavious depends upon the value of the supplyDefaults parameter. If false, then a NoMetadataFoundException is thrown, if true a new SemanticMarkup object is created, stored in the dictionary and returned to the caller.


getElement

public org.jdom.Element getElement()
Return the JDom Element corresponding to this DataThing represented as XML


iterator

public BaclavaIterator iterator(java.lang.String desiredType)
                         throws java.beans.IntrospectionException
Given a desired type, return the BaclavaIterator that provides DataThing objects of this type. If the desired collection structure is not contained by this DataThing then an exception is thrown.


drill

private void drill(int iterationDepth,
                   java.util.List targetList,
                   java.util.Collection theDataObject)
Drill into a collection, adding items to the list if we're at the desired depth, this makes the underlying assumption that the collection contains either collections or objects, but never a mix of both.