at.spardat.xma.datasource
Class TableSpec

java.lang.Object
  extended byat.spardat.xma.datasource.TableSpec

public class TableSpec
extends java.lang.Object

Encapsulates a table spec as defined in ITabularDataSource.


Constructor Summary
TableSpec()
          Constructs with no properties.
TableSpec(java.lang.String spec)
          Constructor.
 
Method Summary
 void addContextParams(XMASession session)
          Adds the reserved parameters "_loc", "_man", "_env", "_av" which are extracted from the provided XMASession.
 java.util.Locale getLocale()
          Requires that this contains the attribute _loc and returns the corresponding Locale object.
 java.lang.String getProperty(java.lang.String key)
          Returns a property for a provided key or null if there is no property for that key.
 java.lang.String getType()
          Returns the type which has been part of the specification string provided in the constructor.
static boolean isContextKey(java.lang.String key)
          Returns true if key is one of the reserved context keys that are added with addContextParams.
 boolean isValid()
          Indicates if the spec String provided at construction time has been a valid one.
 java.util.Iterator iterator()
          Returns an Iterator to iterate over the properties.
 void removeProperty(java.lang.String key)
          Removes property with a given key from this or does nothing if there is no such property.
 void setLocale(java.util.Locale locale)
          Sets the TableSec's Locale.
 void setProperty(java.lang.String key, java.lang.String value)
          Adds a property (key, value).
 java.lang.String toString()
          Returns the table specification String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableSpec

public TableSpec(java.lang.String spec)
Constructor. Stores the spec string. If the provided String is not valid, the method isValid will indicate that fact.

Parameters:
spec - a data source specification as defined in ITabularDataSource.

TableSpec

public TableSpec()
Constructs with no properties. Properties may be added by calling setProperty(java.lang.String, java.lang.String).

Method Detail

isValid

public boolean isValid()
Indicates if the spec String provided at construction time has been a valid one.


toString

public java.lang.String toString()
Returns the table specification String. The order is defined as follows: The first attribute always is type. The remaining attributes are sorted according to key.compareTo. If !isValid(), the empty String is returned.


getType

public java.lang.String getType()
Returns the type which has been part of the specification string provided in the constructor. Returns null, if there was not type-property in the spec string.


getProperty

public java.lang.String getProperty(java.lang.String key)
Returns a property for a provided key or null if there is no property for that key.


setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Adds a property (key, value). An old property with the same key is replaced.

Parameters:
key - the key of the property.
value - the value of the property.

removeProperty

public void removeProperty(java.lang.String key)
Removes property with a given key from this or does nothing if there is no such property.


addContextParams

public void addContextParams(XMASession session)
Adds the reserved parameters "_loc", "_man", "_env", "_av" which are extracted from the provided XMASession.


isContextKey

public static boolean isContextKey(java.lang.String key)
Returns true if key is one of the reserved context keys that are added with addContextParams.


getLocale

public java.util.Locale getLocale()
Requires that this contains the attribute _loc and returns the corresponding Locale object.

Returns:
null, if there is no locale

setLocale

public void setLocale(java.util.Locale locale)
Sets the TableSec's Locale. Usually the Locale is taken out of the XMAContext by the XMA framework. But there might be rare cases were a manipulation of the Locale is feasable.

Parameters:
locale -
Since:
version_number

iterator

public java.util.Iterator iterator()
Returns an Iterator to iterate over the properties. The iterator returns the keys of type String. Please use method getProperty to extract the value lateron.