DataSource Class Reference

Abstract class for DataSources.
More...

List of all members.

Public Member Functions

ComputedField addComputedField (String name) throws TFormerException
 Creates and adds a ComputedField to the DataSource.
DSFieldMapping addFieldMapping (String name) throws TFormerException
 Creates and adds a DSFieldMapping to the DataSource.
DataSourceParameter addParameter (String name) throws TFormerException
 Creates and adds a DataSourceParameter to the DataSource.
void dispose () throws TFormerException
 Releases the resources allocated into TFORMer runtime by the instance.
void dump (PrintStream s) throws IOException, TFormerException
 Dumps the current instance into a text stream.
String getComment () throws TFormerException
 Gets the comment of the DataSource.
ComputedField getComputedField (String name) throws TFormerException
 Gets a ComputedField defined in the DataSource.
String getCopyColumnName () throws TFormerException
 Gets the CopyColumnName of the DataSource.
String getDescription () throws TFormerException
 Gets the description of the DataSource.
DSFieldMapping getFieldMapping (String name) throws TFormerException
 Gets a DSFieldMapping defined in the DataSource.
ComputedField getFirstComputedField () throws TFormerException
 Gets the first ComputedField defined in the DataSource.
DSFieldMapping getFirstDSFieldMapping () throws TFormerException
 Gets the first FieldMapping (see DSFieldMapping) defined in the DataSource.
DataSourceParameter getFirstParameter () throws TFormerException
 Gets the first DataSourceParameter defined in the DataSource.
String getName () throws TFormerException
 Gets the name of the DataSource.
DataSource getNext () throws TFormerException
 Gets the next instance defined in the Project.
int getNumberOfComputedFields () throws TFormerException
 Gets the number of computed fields (see ComputedField) defined in the DataSource.
int getNumberOfFieldMappings () throws TFormerException
 Gets the number of field mappings (see DSFieldMapping) defined in the DataSource.
int getNumberOfParameters () throws TFormerException
 Gets the number of parameters (see DataSourceParameter) defined in the DataSource.
DataSourceParameter getParameter (String name) throws TFormerException
 Gets a DataSourceParameter defined in the DataSource.
DataSourceType getType () throws TFormerException
 Gets the type of the DataSource.
boolean isDefault () throws TFormerException
 Gets a value indicating whether this object stores the default DataSource.
boolean isHandleEscapeSequences () throws TFormerException
 Gets if escape sequences should be translated on data retrieval or not.
void removeComputedField (String name) throws TFormerException
 Removes the ComputedField from the DataSource.
void removeComputedField (ComputedField computedField) throws TFormerException
 Removes the ComputedField from the DataSource.
void removeFieldMapping (String name) throws TFormerException
 Removes the DSFieldMapping from the DataSource.
void removeFieldMapping (DSFieldMapping fieldMapping) throws TFormerException
 Removes the DSFieldMapping from the DataSource.
void removeParameter (String name) throws TFormerException
 Removes the DataSourceParameter from the DataSource.
void removeParameter (DataSourceParameter parameter) throws TFormerException
 Removes the DataSourceParameter from the DataSource.
void setComment (String sComment) throws TFormerException
 Sets the comment of the DataSource.
void setCopyColumnName (String sCopyColumnName) throws TFormerException
 Sets the CopyColumnName of the DataSource.
void setDescription (String sDescription) throws TFormerException
 Sets the description of the DataSource.
void setHandleEscapeSequences (boolean bEscapeSequences) throws TFormerException
 Sets if escape sequences should be translated on data retrieval or not.
void setName (String sName) throws TFormerException
 Sets the name of the DataSource.
String toString ()
 Returns a string representation of the instance.


Detailed Description

Abstract class for DataSources.




TFORMer Designer allows to define DataSources as part of a FormLayout. DataSources define how data is retrieved (e.g. from an ODBC database), the field-mappings ( DSFieldMappings), ComputedFields and optional DataSourceParameters. Each DataSource is identified by its unique name. Optional DataSourceParameters can be defined to control certain aspects (like filenames, SQL statement or an ODBC-DSN) during runtime.



The available DataSource classes are DataSourceCsv, DataSourceOdbc and DataSourceXml. See getNext method for more details.


Sample code that iterates all DataSources of a given Repository.


 Repository rep = new Repository (System.getenv("TFORMERSAMPLES") + "Demo Repository\\Demos.tfr", false, false);       
      
 // Iterate through Projects
 for (Project proj = rep.getFirstProject(); proj != null; proj = proj.getNext()) 
 {
 
   // Iterate through DataSources
   for (DataSource ds = proj.getFirstDataSource(); ds != null; ds = ds.getNext())
   {
     System.out.println(ds.toString());
    
     // Print parameter information
     for (DataSourceParameter dsParam = ds.getFirstParameter(); dsParam != null; dsParam = dsParam.getNext())
       System.out.println (dsParam.toString());
                
     // Print computedfield information
     for (ComputedField dsComp = ds.getFirstComputedField(); dsComp != null; dsComp = dsComp.getNext())
       System.out.println (dsComp.toString());
 
     // Print fieldmapping information
     for (DSFieldMapping dsFieldmap = ds.getFirstFieldMapping(); dsFieldmap != null; dsFieldmap = dsFieldmap.getNext())
       System.out.println (dsFieldmap.toString());
   }
 }



Sample code that iterates all DataSources of a given stand-alone FormLayout.



 Repository rep = new Repository (System.getenv("TFORMERSAMPLES") + "..\\Templates\\(6) Samples_Picking List.tff", false, false);          
 
 // Iterate through DataSources
 for (DataSource ds = rep.getGlobalProject().getFirstDataSource(); ds != null; ds = ds.getNext())
 {
 
   System.out.println(ds.toString());
   
   // Print parameter information
   for (DataSourceParameter dsParam = ds.getFirstParameter(); dsParam != null; dsParam = dsParam.getNext())
     System.out.println(dsParam.toString());
 
   // Print computedfield information
   for (ComputedField dsComp = ds.getFirstComputedField(); dsComp != null; dsComp = dsComp.getNext())
     System.out.println(dsComp.toString());
     
   // Print fieldmapping information
   for (DSFieldMapping dsFieldmap = ds.getFirstFieldMapping(); dsFieldmap != null; dsFieldmap = dsFieldmap.getNext())
     System.out.println(dsFieldmap.toString());
 }


Thread-safety: A single instance of this class must not be used by different threads.

See also:
com.tecit.TFORMer.Repository.DataSourceCsv
com.tecit.TFORMer.Repository.DataSourceOdbc
com.tecit.TFORMer.Repository.DataSourceXml

Member Function Documentation

ComputedField addComputedField ( String  name  )  throws TFormerException

Creates and adds a ComputedField to the DataSource.

Parameters:
name The name of the ComputedField.
Returns:
New ComputedField.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DSFieldMapping addFieldMapping ( String  name  )  throws TFormerException

Creates and adds a DSFieldMapping to the DataSource.

Parameters:
name The name of the DataField for which a DSFieldMapping should be created.
Returns:
New DSFieldMapping.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DataSourceParameter addParameter ( String  name  )  throws TFormerException

Creates and adds a DataSourceParameter to the DataSource.

Parameters:
name The name of the DataSourceParameter.
Returns:
New DataSourceParameter.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void dispose (  )  throws TFormerException

Releases the resources allocated into TFORMer runtime by the instance.

Remember to call always this method after the use of the instance, also in exception case

Exceptions:
TFormerException error occurred into TFORMer runtime.

void dump ( PrintStream  s  )  throws IOException, TFormerException

Dumps the current instance into a text stream.

Parameters:
s instance of the stream
Exceptions:
IOException error in I/O
TFormerException error occurred into TFORMer runtime.

Reimplemented in DataSourceCsv, DataSourceXml, and DataSourceOdbc.

String getComment (  )  throws TFormerException

Gets the comment of the DataSource.

Returns:
The comment of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

ComputedField getComputedField ( String  name  )  throws TFormerException

Gets a ComputedField defined in the DataSource.

Parameters:
name The name of the ComputedField.
Returns:
null if the requested object doesn't exist, otherwise a valid instance
Exceptions:
TFormerException error occurred into TFORMer runtime.

String getCopyColumnName (  )  throws TFormerException

Gets the CopyColumnName of the DataSource.

Returns:
The CopyColumnName of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

String getDescription (  )  throws TFormerException

Gets the description of the DataSource.

Returns:
The description of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DSFieldMapping getFieldMapping ( String  name  )  throws TFormerException

Gets a DSFieldMapping defined in the DataSource.



Retrieves the DSFieldMapping for a given DataField name from the DataSource.

Parameters:
name The name of a DataField.
Returns:
null if the requested object doesn't exist, otherwise a valid instance
Exceptions:
TFormerException error occurs in TFORMer runtime

ComputedField getFirstComputedField (  )  throws TFormerException

Gets the first ComputedField defined in the DataSource.

Returns:
The first ComputedField object in the list or null.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DSFieldMapping getFirstDSFieldMapping (  )  throws TFormerException

Gets the first FieldMapping (see DSFieldMapping) defined in the DataSource.

Returns:
The first FieldMapping in the list or null.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DataSourceParameter getFirstParameter (  )  throws TFormerException

Gets the first DataSourceParameter defined in the DataSource.

Returns:
The first DataSourceParameter defined in the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

String getName (  )  throws TFormerException

Gets the name of the DataSource.

Returns:
The name of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DataSource getNext (  )  throws TFormerException

Gets the next instance defined in the Project.

A Project stores a list of DataSource objects. You can use this method to iterate through the list. To retrieve the first DataSource in the Project see Project.getFirstDataSource().

If this instance is the default data source of the repository (see Repository.getDefaultDataSource), this method returns always null.

Returns:
null if there aren't other instances into the project, otherwise a valid instance of the available implementations of this class (DataSourceCsv, DataSourceOdbc or DataSourceXml)
Exceptions:
TFormerException error occurred into TFORMer runtime.

int getNumberOfComputedFields (  )  throws TFormerException

Gets the number of computed fields (see ComputedField) defined in the DataSource.

Returns:
The number of computed fields (ComputedField) defined in the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

int getNumberOfFieldMappings (  )  throws TFormerException

Gets the number of field mappings (see DSFieldMapping) defined in the DataSource.

Returns:
The number of field mappings (see DSFieldMapping) defined in the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

int getNumberOfParameters (  )  throws TFormerException

Gets the number of parameters (see DataSourceParameter) defined in the DataSource.

Returns:
The number of parameters (see DataSourceParameter) defined in the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

DataSourceParameter getParameter ( String  name  )  throws TFormerException

Gets a DataSourceParameter defined in the DataSource.

Parameters:
name The name of the DataSourceParameter.
Returns:
null if the requested object doesn't exist, otherwise a valid instance
Exceptions:
TFormerException error occurred into TFORMer runtime.

DataSourceType getType (  )  throws TFormerException

Gets the type of the DataSource.



The DataSourceType is readonly, and is set on creation.
It specifies the concrete type of a DataSource (e.g. DataSourceOdbc, DataSourceCsv, DataSourceXml).

Returns:
The DataSourceType of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

boolean isDefault (  )  throws TFormerException

Gets a value indicating whether this object stores the default DataSource.

Returns:
true if this DataSource is the default; otherwise, false.
Exceptions:
TFormerException error occurred into TFORMer runtime.

boolean isHandleEscapeSequences (  )  throws TFormerException

Gets if escape sequences should be translated on data retrieval or not.

Returns:
true if escape sequences should be translated, otherwise, false.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void removeComputedField ( String  name  )  throws TFormerException

Removes the ComputedField from the DataSource.

Parameters:
name The name of the ComputedField.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void removeComputedField ( ComputedField  computedField  )  throws TFormerException

Removes the ComputedField from the DataSource.

Parameters:
computedField The ComputedField.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void removeFieldMapping ( String  name  )  throws TFormerException

Removes the DSFieldMapping from the DataSource.

Parameters:
name The name of the DataField for which the mapping should be deleted.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void removeFieldMapping ( DSFieldMapping  fieldMapping  )  throws TFormerException

Removes the DSFieldMapping from the DataSource.

Parameters:
fieldMapping The DSFieldMapping.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void removeParameter ( String  name  )  throws TFormerException

Removes the DataSourceParameter from the DataSource.

Parameters:
name The name of the DataSourceParameter.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void removeParameter ( DataSourceParameter  parameter  )  throws TFormerException

Removes the DataSourceParameter from the DataSource.

Parameters:
parameter The DataSourceParameter.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void setComment ( String  sComment  )  throws TFormerException

Sets the comment of the DataSource.

Parameters:
sComment The comment of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void setCopyColumnName ( String  sCopyColumnName  )  throws TFormerException

Sets the CopyColumnName of the DataSource.

Parameters:
sCopyColumnName The CopyColumnName of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void setDescription ( String  sDescription  )  throws TFormerException

Sets the description of the DataSource.

Parameters:
sDescription The description of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void setHandleEscapeSequences ( boolean  bEscapeSequences  )  throws TFormerException

Sets if escape sequences should be translated on data retrieval or not.

Parameters:
bEscapeSequences true if escape sequences should be translated, otherwise, false.
Exceptions:
TFormerException error occurred into TFORMer runtime.

void setName ( String  sName  )  throws TFormerException

Sets the name of the DataSource.

Parameters:
sName The name of the DataSource.
Exceptions:
TFormerException error occurred into TFORMer runtime.

String toString (  ) 

Returns a string representation of the instance.

Returns:
a string representation of the instance


© 2006-2009 All rights reserved by TEC-IT Datenverarbeitung GmbH
Generated on Wed Sep 2 16:01:27 2009 for TFORMer Runtime JAVA Developer Reference with doxygen 1.5.8