org.openjump.util.metaData
Class MetaInformationHandler

java.lang.Object
  extended by org.openjump.util.metaData.MetaInformationHandler
All Implemented Interfaces:
HandlerToMakeYourLifeEasier

public class MetaInformationHandler
extends java.lang.Object
implements HandlerToMakeYourLifeEasier

Tool class for easier handling of meta information on a layer basis.
- objects will be created, if neccessary
- you don't need to access the properties map of the data source (where the meta information is stored) yourself

Version:
$Rev: 1559 $
Author:
Ole Rahn

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement

Field Summary
protected  PersonalLogger logger
           
protected  ObjectContainingMetaInformation objectWithMetaInformation
           
 
Constructor Summary
MetaInformationHandler(Layer layerWithMetaInformation)
           
MetaInformationHandler(ObjectContainingMetaInformation objectWithMetaInformation)
           
 
Method Summary
 void addMetaInformation(java.lang.String key, java.lang.Object value)
          Adds a new meta information key-value-pair to the meta information map, replaces an existing pair with the same key.
 void clear()
           
 boolean containsAttribute2UnitMap()
           
 boolean containsKey(java.lang.String key)
           
 boolean containsMetaInformation()
           
 boolean containsValue(java.lang.Object value)
           
static PirolFeatureCollection createPirolFeatureCollection(FeatureCollection fc)
          creates a PirolFeatureCollection out of a regular FeatureCollection
static PirolFeatureCollection createPirolFeatureCollection(FeatureCollection fc, FeatureCollectionRole role)
          creates a PirolFeatureCollection out of a regular FeatureCollection
 Attribute2UnitMap getAttribute2UnitMap()
           
 MetaDataMap getExistentMetaInformationMap()
          Retrieve the existent meta information map.
 java.util.HashMap getMetaData()
           
 java.lang.Object getMetaInformation(java.lang.String key)
           
 MetaDataMap getMetaInformationMap()
          Retrieve the existent meta information map or create one.
 java.util.Set keySet()
           
 void putAttribute2UnitMap(Attribute2UnitMap attribute2UnitMap)
           
 java.lang.Object remove(java.lang.String key)
           
 void setMetaData(java.util.HashMap<java.lang.Object,java.lang.Object> metaData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectWithMetaInformation

protected ObjectContainingMetaInformation objectWithMetaInformation

logger

protected PersonalLogger logger
Constructor Detail

MetaInformationHandler

public MetaInformationHandler(Layer layerWithMetaInformation)
Parameters:
layerWithMetaInformation - the layer you want the meta information of (has to have a DataSource!!)

MetaInformationHandler

public MetaInformationHandler(ObjectContainingMetaInformation objectWithMetaInformation)
Parameters:
objectWithMetaInformation - the object you want the meta information of
Method Detail

createPirolFeatureCollection

public static final PirolFeatureCollection createPirolFeatureCollection(FeatureCollection fc)
creates a PirolFeatureCollection out of a regular FeatureCollection

Parameters:
fc - regular FeatureCollection
Returns:
PirolFeatureCollection

createPirolFeatureCollection

public static final PirolFeatureCollection createPirolFeatureCollection(FeatureCollection fc,
                                                                        FeatureCollectionRole role)
creates a PirolFeatureCollection out of a regular FeatureCollection

Parameters:
fc - regular FeatureCollection
Returns:
PirolFeatureCollection

getExistentMetaInformationMap

public MetaDataMap getExistentMetaInformationMap()
Retrieve the existent meta information map.

Returns:
the existent meta information map or null, if there is none

getMetaInformationMap

public MetaDataMap getMetaInformationMap()
Retrieve the existent meta information map or create one.

Returns:
the existent meta information map or an empty meta information map (that is now attached to the DataSource)
Throws:
RuntimeException, - if the given DataSource doesn't even have properties (getProperties())

containsMetaInformation

public boolean containsMetaInformation()
Returns:
true if the given layer already contains meta information, false if not

addMetaInformation

public void addMetaInformation(java.lang.String key,
                               java.lang.Object value)
Adds a new meta information key-value-pair to the meta information map, replaces an existing pair with the same key.

Parameters:
key -
value -

getMetaData

public java.util.HashMap getMetaData()

setMetaData

public void setMetaData(java.util.HashMap<java.lang.Object,java.lang.Object> metaData)

clear

public void clear()

containsKey

public boolean containsKey(java.lang.String key)

getMetaInformation

public java.lang.Object getMetaInformation(java.lang.String key)

containsValue

public boolean containsValue(java.lang.Object value)

keySet

public java.util.Set keySet()

remove

public java.lang.Object remove(java.lang.String key)

getAttribute2UnitMap

public Attribute2UnitMap getAttribute2UnitMap()
Returns:
the Attribute2UnitMap of the given DataSource or null, if there is none

putAttribute2UnitMap

public void putAttribute2UnitMap(Attribute2UnitMap attribute2UnitMap)

containsAttribute2UnitMap

public boolean containsAttribute2UnitMap()