de.folt.models.datamodel.multipledatasource
Class MultipleDataSource

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.models.datamodel.BasicDataSource
          extended by de.folt.models.datamodel.multipledatasource.MultipleDataSource
All Implemented Interfaces:
DataSource, java.util.Enumeration<MultiLingualObject>, java.util.Observer

public class MultipleDataSource
extends BasicDataSource

Author:
klemens To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and Comments

Nested Class Summary
 
Nested classes/interfaces inherited from class de.folt.models.datamodel.BasicDataSource
BasicDataSource.BasicDataSourceObserver
 
Constructor Summary
MultipleDataSource()
           
MultipleDataSource(DataSourceProperties dataSourceProperties)
           
 
Method Summary
 boolean addDataSource(java.lang.String dataSourceName)
          addDataSource adds a data source to the Multiple DateSource; checks if data source is already in the list of data sources
 boolean addDataSource(java.util.Vector<java.lang.String> dataSourceNames)
          addDataSource adds a vector of data source to the Multiple DateSource; checks if data source is already in the list of data sources
 void cleanDataSource()
          cleanDataSource method is used to allow some clean operations e.g. after an instance has been loaded.
 boolean clearDataSource()
          clearDataSource removes the content in a data source.
 boolean createDataSource(DataSourceProperties dataModelProperties)
          createDataSource creates a new Data source; this is esp. intended for creating a new database, e.g. in MySQL or Ms SQL Server.
 java.util.Vector<java.lang.String> getDataSourceNames()
           
 java.lang.String getDataSourceType()
          getDataSourceType get the type of the database
static void main(java.lang.String[] args)
          main
 boolean removeDataSource(java.lang.String dataSourcename)
          removeDataSource removes a data source to the Multiple DateSource; checks if data source is already in the list of data sources
 org.jdom.Element[] subSegmentResultsToGlossary(java.lang.String sourceLangauge, java.lang.String targetLanguage)
          subSegmentResultsToGlossary returns an array of glossary elements for the subSegment matching translations
 org.jdom.Element subSegmentTranslate(org.jdom.Element transUnit, XliffDocument xliffDocument, java.lang.String sourceLanguage, java.lang.String targetLanguage, java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters)
          translate subSegmentTranslate a trans-unit given the source language, target Language on a sub segment level (e.g.phrase or terminology based)
 org.jdom.Element translate(org.jdom.Element transUnit, org.jdom.Element file, XliffDocument xliffDocument, java.lang.String sourceLanguage, java.lang.String targetLanguage, int matchSimilarity, java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters)
          translate translates a trans-unit given the source language, target Language and match similarity
 
Methods inherited from class de.folt.models.datamodel.BasicDataSource
addData, addMonoLingualObject, addMultiLingualObject, bAuthenticate, bPersist, bSupportMultiThreading, changedMonolingualObjects, checkIfTranslationExistsInDataSource, checkIfTranslationExistsInDataSource, containsKey, containsValue, copyFrom, copyTo, currentTimeMillis, deleteDataSource, exportTmxFile, exportXliffFile, getAllAttributes, getChangedIds, getData, getDataSourceName, getDataSourceProperties, getDefaultDataSourceConfigurationsFileName, getFuzzyTree, getIds, getILogLevel, getLastErrorCode, getMonoLingualObjectFromId, getMonoLingualObjectFromUniqueId, getMultiLingualObjectCache, getMultiLingualObjectFromId, getMultiLingualObjectFromUniqueId, getUniqueIds, hasMoreElements, importTbxFile, importTmxFile, importXliffFile, initEnumeration, isBChanged, isBLoadAttributesLazy, isSyncDataSource, nextElement, removeData, removeDataSource, removeMonoLingualObject, removeMultiLingualObject, runFilterMethod, saveModifiedMonoLingualObject, saveModifiedMultiLingualObject, search, searchRegExp, searchWordBased, setBChanged, setBLoadAttributesLazy, setDataSourceType, setDefaultDataSourceConfigurationsFileName, setILogLevel, setILogLevel, setLastErrorCode, setMultiLingualObjectCache, setOpenTMSPropertiesFile, update, update
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleDataSource

public MultipleDataSource()

MultipleDataSource

public MultipleDataSource(DataSourceProperties dataSourceProperties)
Parameters:
dataSourceProperties -
Method Detail

main

public static void main(java.lang.String[] args)
main

Parameters:
args -

addDataSource

public boolean addDataSource(java.lang.String dataSourceName)
addDataSource adds a data source to the Multiple DateSource; checks if data source is already in the list of data sources

Parameters:
dataSourceName - the data source name to be added
Returns:
true if the data source could be added; false if data source exists in list or data source is not a (known) data source

addDataSource

public boolean addDataSource(java.util.Vector<java.lang.String> dataSourceNames)
addDataSource adds a vector of data source to the Multiple DateSource; checks if data source is already in the list of data sources

Parameters:
dataSourceNames - Vector with data source name
Returns:
always true

cleanDataSource

public void cleanDataSource()
Description copied from interface: DataSource
cleanDataSource method is used to allow some clean operations e.g. after an instance has been loaded.
An example is disposing a tmx document after having read all the entries.

Specified by:
cleanDataSource in interface DataSource
Overrides:
cleanDataSource in class BasicDataSource

clearDataSource

public boolean clearDataSource()
                        throws OpenTMSException
Description copied from interface: DataSource
clearDataSource removes the content in a data source. In addition it can be used to delete a TMX data source.

Specified by:
clearDataSource in interface DataSource
Overrides:
clearDataSource in class BasicDataSource
Returns:
true if success
Throws:
OpenTMSException

createDataSource

public boolean createDataSource(DataSourceProperties dataModelProperties)
                         throws OpenTMSException
Description copied from interface: DataSource
createDataSource creates a new Data source; this is esp. intended for creating a new database, e.g. in MySQL or Ms SQL Server. In addition it can be used to create a new empty TMX data source.

Specified by:
createDataSource in interface DataSource
Overrides:
createDataSource in class BasicDataSource
Parameters:
dataModelProperties - the parameters of the data source
Returns:
true if success
Throws:
OpenTMSException

getDataSourceNames

public java.util.Vector<java.lang.String> getDataSourceNames()
Returns:
the dataSourceNames

getDataSourceType

public java.lang.String getDataSourceType()
Description copied from interface: DataSource
getDataSourceType get the type of the database

Specified by:
getDataSourceType in interface DataSource
Overrides:
getDataSourceType in class BasicDataSource
Returns:
the data source type

removeDataSource

public boolean removeDataSource(java.lang.String dataSourcename)
removeDataSource removes a data source to the Multiple DateSource; checks if data source is already in the list of data sources

Parameters:
dataSourcename - the data source name to be removed
Returns:
true if the data source could be removed; otherwise false

translate

public org.jdom.Element translate(org.jdom.Element transUnit,
                                  org.jdom.Element file,
                                  XliffDocument xliffDocument,
                                  java.lang.String sourceLanguage,
                                  java.lang.String targetLanguage,
                                  int matchSimilarity,
                                  java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters)
                           throws OpenTMSException
Description copied from interface: DataSource
translate translates a trans-unit given the source language, target Language and match similarity

Specified by:
translate in interface DataSource
Overrides:
translate in class BasicDataSource
Parameters:
transUnit - the trans unit to translate to use
file - the file element currently to translate
xliffDocument - the basic xliff document
sourceLanguage - the source language to use
targetLanguage - the target language to use
matchSimilarity - the similarity (fuzzy) match quality (0 - 100) to use
translationParameters - the hash table contains parameters which control some parameters, e.g. should header/source/target properties be written to alt-trans
Returns:
the modified trans-unit with new translation
Throws:
OpenTMSException

subSegmentResultsToGlossary

public org.jdom.Element[] subSegmentResultsToGlossary(java.lang.String sourceLangauge,
                                                      java.lang.String targetLanguage)
Description copied from interface: DataSource
subSegmentResultsToGlossary returns an array of glossary elements for the subSegment matching translations

Specified by:
subSegmentResultsToGlossary in interface DataSource
Overrides:
subSegmentResultsToGlossary in class BasicDataSource
Parameters:
sourceLangauge - the source language for the glossary
targetLanguage - the target language for the glossary
Returns:
the glossary element

subSegmentTranslate

public org.jdom.Element subSegmentTranslate(org.jdom.Element transUnit,
                                            XliffDocument xliffDocument,
                                            java.lang.String sourceLanguage,
                                            java.lang.String targetLanguage,
                                            java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters)
                                     throws OpenTMSException
Description copied from interface: DataSource
translate subSegmentTranslate a trans-unit given the source language, target Language on a sub segment level (e.g.phrase or terminology based)

Specified by:
subSegmentTranslate in interface DataSource
Overrides:
subSegmentTranslate in class BasicDataSource
Parameters:
transUnit - the trans unit to translate to use
xliffDocument - the basic xliff document
sourceLanguage - the source language to use
targetLanguage - the target language to use
translationParameters - the hash table contains parameters which control some parameters, e.g. should header/source/target properties be written to alt-trans
Returns:
the modified trans-unit with new translation
Throws:
OpenTMSException