|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
de.folt.models.datamodel.BasicDataSource
public class BasicDataSource
This class implements a basic data source (implements the DataSource
interface) and is intended to be sub classed for specific data sources like
TMX file data source or similar. See also the subclass de.folt.models.datamodel.ExtendedBasicSource
| Nested Class Summary | |
|---|---|
class |
BasicDataSource.BasicDataSourceObserver
Class implements a simple Observer for a basic data source |
| Constructor Summary | |
|---|---|
BasicDataSource()
Standard Constructor for basic data source |
|
BasicDataSource(DataSourceProperties dataSourceProperties)
Creates a basic data source based on the supplied dataSourceProperties. |
|
BasicDataSource(java.lang.String propertiesFileName)
|
|
| Method Summary | |
|---|---|
void |
addData(java.lang.String key,
java.lang.Object object)
addData this allows to add a whatever object to the data source based on a key |
boolean |
addMonoLingualObject(MonoLingualObject monoLingualObject,
boolean mergeObjects)
addMultiLingualObject adds a MonoLingualObject to the given MultiLingualObject to the data source |
boolean |
addMultiLingualObject(MultiLingualObject multiLingualObject,
boolean mergeObjects)
addMultiLingualObject adds a MultiLingualObject to the data source |
boolean |
bAuthenticate(java.lang.String userName,
java.lang.String password)
bAuthenticate checks if for a given data source access is granted thru user and password |
boolean |
bPersist()
bPersist method persists any data in the data source |
boolean |
bSupportMultiThreading()
bSupportMultiThreading defines support of multi threading (mainly for translate method) |
java.util.Vector<MonoLingualObject> |
changedMonolingualObjects()
changedMonolingualObjects |
TranslationCheckResult |
checkIfTranslationExistsInDataSource(MonoLingualObject source,
MonoLingualObject target)
checkIfTranslationExistsInDataSource Method checks if a for a given source and target MOL matches in the data source exist. |
TranslationCheckResult |
checkIfTranslationExistsInDataSource(java.lang.String sourceSegment,
java.lang.String sourceLanguage,
java.lang.String targetSegment,
java.lang.String targetLanguage)
checkIfTranslationExistsInDataSource function checks if for a given combination of source segment/source language - target segment (translation)/target language a translation exists |
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 |
containsKey(java.lang.String key)
containsKey checks if a key exists |
boolean |
containsValue(java.lang.Object object)
containsValue checks if a key exists |
int |
copyFrom(DataSource dataSource)
copyFrom copies the content of the data source dataSource to the this data source; this requires that the data source implements the methods nextElement; iniEnumeration and hasMoreElements. |
int |
copyTo(DataSource dataSource)
copyTo copies the content of this data source to the specified data source; this requires that the data source implements the methods nextElement; iniEnumeration and hasMoreElements. |
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. |
long |
currentTimeMillis()
currentTimeMillis This method returns the current time as a String. |
boolean |
deleteDataSource(DataSourceProperties dataModelProperties)
deleteDataSource deletes an existing Data source; this is esp. intended for deleting a database, e.g. in MySQL or Ms SQL Server. |
int |
exportTmxFile(java.lang.String tmxFile)
exportTmxFile exports the data source into an tmx file |
int |
exportXliffFile(java.lang.String xliffFile)
exportXliffFile export the xliff file from the data source; |
void |
getAllAttributes(java.lang.String outputfile)
Write all Attributes and values to output file |
java.util.Vector<java.lang.Integer> |
getChangedIds()
getChangedIds this method returns a vector of Integers of changed MULs which uniquely identify each MUL of the data source |
java.lang.Object |
getData(java.lang.String key)
getData retrieves an object associated with the key |
java.lang.String |
getDataSourceName()
getDataSourceName returns the name of the data source |
DataSourceProperties |
getDataSourceProperties()
getDataSourceProperties returns the DataSourceProperties of the data source |
java.lang.String |
getDataSourceType()
getDataSourceType get the type of the database |
java.lang.String |
getDefaultDataSourceConfigurationsFileName()
getDefaultDataSourceConfigurationsFileName return the name of the default data source configurations file name |
MonoLingualPartitionedFuzzyNodeTree |
getFuzzyTree()
|
java.util.Vector<java.lang.Integer> |
getIds()
getIds this method returns a vector of Integers which uniquely identify each MUL of the data source |
int |
getILogLevel()
|
int |
getLastErrorCode()
getLastErrorCode Method returns the last error code for an operation done by the data source |
MonoLingualObject |
getMonoLingualObjectFromId(java.lang.String uniqueID)
getMonoLingualObjectFromId search an MOL based on its (integer) id |
MonoLingualObject |
getMonoLingualObjectFromUniqueId(java.lang.String uniqueID)
getMonoLingualObjectFromUniqueId search an MOL based on its (integer) id |
ObservableHashtable<java.lang.String,MultiLingualObject> |
getMultiLingualObjectCache()
multiLingualObjectCache is a cache object which can be used by the data sources to store read MultiLingual Objects. |
MultiLingualObject |
getMultiLingualObjectFromId(java.lang.String id)
getMultiLingualObjectFromId search an MUL based on its unique id |
MultiLingualObject |
getMultiLingualObjectFromUniqueId(java.lang.String id)
getMultiLingualObjectFromUniqueId search an MUL based on its unique id |
java.util.Vector<java.lang.String> |
getUniqueIds()
getUniqueIds this method returns a vector of strings which uniquely identify each MUL of the data source |
boolean |
hasMoreElements()
|
int |
importTbxFile(java.lang.String tbxFile)
importTbxFile imports a tbx file into the data source; |
int |
importTmxFile(java.lang.String tmxFile)
importTmxFile import a tmx file into the datasource |
int |
importXliffFile(java.lang.String xliffFile)
importXliffFile imports an xliff file into the data source; it imports the approved source / target's of the trans-units |
void |
initEnumeration()
initEnumeration initialises the Enumeration of the data source |
boolean |
isBChanged()
|
boolean |
isBLoadAttributesLazy()
This method determines if the attributes of MultiLingualObjects or MonoLingualObjects should be loaded at the time when the data source is created (false) or when they are actually needed (true). |
boolean |
isSyncDataSource()
This methods returns true if the data source (the instance of the data source) is a synchronizable data source instance. |
static void |
main(java.lang.String[] args)
|
MultiLingualObject |
nextElement()
|
java.lang.Object |
removeData(java.lang.String key)
removeData removes an object associated with the key |
void |
removeDataSource()
removeDataSource method called when the DataSource should be removed |
boolean |
removeMonoLingualObject(MonoLingualObject monoLingualObject)
removeMonoLingualObject removes a MonoLingualObject from the data source; not all data source may support this method and may return false in any case (e.g. |
boolean |
removeMultiLingualObject(MultiLingualObject multiLingualObject)
removeMultiLingualObject removes a MultiLingualObject from the data source |
org.jdom.Element |
runFilterMethod(java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters,
org.jdom.Element transUnit)
Run a filter on the transUnit results |
boolean |
saveModifiedMonoLingualObject(MonoLingualObject monoLingualObject)
saveModifiedMonoLingualObject save a given MonoLingualObject in the data source by replacing the old values. |
boolean |
saveModifiedMultiLingualObject(MultiLingualObject mul)
saveModifiedMultiLingualObject saves any modification of the MultiLingualObject, esp. doen to the LinguisticProperties |
java.util.Vector<MonoLingualObject> |
search(MonoLingualObject searchMonoLingualObject,
java.util.Hashtable<java.lang.String,java.lang.Object> searchParameters)
search search for a MonoLingualObject; if no language is given in the searchMonoLingualObject the search is done independent of the language |
java.util.Vector<MonoLingualObject> |
searchRegExp(MonoLingualObject searchMonoLingualObject,
java.util.Hashtable<java.lang.String,java.lang.Object> searchParameters)
search searchRegExp for a MonoLingualObject where the plain text represents a regular expression; if no language is given in the searchMonoLingualObject the search is done independent of the language |
java.util.Vector<MonoLingualObject> |
searchWordBased(MonoLingualObject searchMonoLingualObject,
java.util.Hashtable<java.lang.String,java.lang.Object> searchParameters)
search searchWordBased for a MonoLingualObject where the plain text segment is searched by splitting it up into words; if no language is given in the searchMonoLingualObject the search is done independent of the language |
void |
setBChanged(boolean changed)
|
void |
setBLoadAttributesLazy(boolean loadAttributesLazy)
This method sets loading of the the attributes of MultiLingualObjects or MonoLingualObjects; false = they should be loaded at the time when the data source is created or true = when they are actually needed. |
void |
setDataSourceType()
setDataSourceType sets the type of the data source |
void |
setDefaultDataSourceConfigurationsFileName(java.lang.String defaultDataSourceConfigurationsFileName)
setDefaultDataSourceConfigurationsFileName set the name of the default data source configurations file name |
void |
setILogLevel()
|
void |
setILogLevel(int logLevel)
|
void |
setLastErrorCode(int lastErrorCode)
setLastErrorCode sets the error code of the currently running method of the data source |
void |
setMultiLingualObjectCache(ObservableHashtable<java.lang.String,MultiLingualObject> multiLingualObjectCache)
multiLingualObjectCache is a cache object which can be used by the data sources to store read MultiLingual Objects. |
static void |
setOpenTMSPropertiesFile(java.lang.String propFile)
setOpenTMSPropertiesFile set the name of the OpenTMS properties file |
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 |
void |
update()
This method can be called after insert or similar actions to update internal stati, fuzzy trees etc. |
void |
update(java.util.Observable arg0,
java.lang.Object arg1)
|
| 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 |
|---|
public BasicDataSource()
public BasicDataSource(DataSourceProperties dataSourceProperties)
dataSourceProperties - the dataSourceProperties to use for the constructionpublic BasicDataSource(java.lang.String propertiesFileName)
propertiesFileName - | Method Detail |
|---|
public static void main(java.lang.String[] args)
public static void setOpenTMSPropertiesFile(java.lang.String propFile)
propFile - the name of the property file
public void addData(java.lang.String key,
java.lang.Object object)
DataSource
addData in interface DataSourcekey - the key for the objectobject - the value for the key
public boolean addMonoLingualObject(MonoLingualObject monoLingualObject,
boolean mergeObjects)
DataSource
addMonoLingualObject in interface DataSourcemonoLingualObject - the MOL object to addmergeObjects - if true first a search is done if the containing
MonoLingualObjects exist in the data source (based on the
segment text); if they exist they are merged; if false the MUL
is added as new entry
public boolean addMultiLingualObject(MultiLingualObject multiLingualObject,
boolean mergeObjects)
DataSource
addMultiLingualObject in interface DataSourcemultiLingualObject - the object to addmergeObjects - if true first a search is done if the containing
MonoLingualObjects exist in the data source (based on the
segment text); if they exist they are merged; if false the MUL
is added as new entry
public boolean bAuthenticate(java.lang.String userName,
java.lang.String password)
DataSource
bAuthenticate in interface DataSourceuserName - the user namepassword - the password
public boolean bPersist()
DataSource
bPersist in interface DataSourcepublic boolean bSupportMultiThreading()
DataSource
bSupportMultiThreading in interface DataSourcepublic java.util.Vector<MonoLingualObject> changedMonolingualObjects()
DataSource
changedMonolingualObjects in interface DataSource
public TranslationCheckResult checkIfTranslationExistsInDataSource(MonoLingualObject source,
MonoLingualObject target)
DataSource
checkIfTranslationExistsInDataSource in interface DataSourcesource - the source MOLtarget - the target MOL
public TranslationCheckResult checkIfTranslationExistsInDataSource(java.lang.String sourceSegment,
java.lang.String sourceLanguage,
java.lang.String targetSegment,
java.lang.String targetLanguage)
DataSource
checkIfTranslationExistsInDataSource in interface DataSourcesourceSegment - the source segmentsourceLanguage - the source languagetargetSegment - the target segmenttargetLanguage - the target language
TranslationCheckResult)public void cleanDataSource()
DataSource
cleanDataSource in interface DataSource
public boolean clearDataSource()
throws OpenTMSException
DataSource
clearDataSource in interface DataSourceOpenTMSExceptionpublic boolean containsKey(java.lang.String key)
DataSource
containsKey in interface DataSourcekey - the key to search for
public boolean containsValue(java.lang.Object object)
DataSource
containsValue in interface DataSourceobject - the object (value) to search for
public int copyFrom(DataSource dataSource)
DataSource
copyFrom in interface DataSourcepublic int copyTo(DataSource dataSource)
DataSource
copyTo in interface DataSource
public boolean createDataSource(DataSourceProperties dataModelProperties)
throws OpenTMSException
DataSource
createDataSource in interface DataSourcedataModelProperties - the parameters of the data source
OpenTMSExceptionpublic long currentTimeMillis()
DataSource
currentTimeMillis in interface DataSource
public boolean deleteDataSource(DataSourceProperties dataModelProperties)
throws OpenTMSException
DataSource
deleteDataSource in interface DataSourcedataModelProperties - the parameters of the data source
OpenTMSExceptionpublic int exportTmxFile(java.lang.String tmxFile)
DataSource
exportTmxFile in interface DataSourcetmxFile - the tmx file to export to
public int exportXliffFile(java.lang.String xliffFile)
DataSource
exportXliffFile in interface DataSourcexliffFile - the xliff file to export
public void getAllAttributes(java.lang.String outputfile)
DataSource
getAllAttributes in interface DataSourceoutputfile - target output filepublic java.util.Vector<java.lang.Integer> getChangedIds()
DataSource
getChangedIds in interface DataSourcepublic java.lang.Object getData(java.lang.String key)
DataSource
getData in interface DataSourcekey - the key to search for
public java.lang.String getDataSourceName()
DataSource
getDataSourceName in interface DataSource
public DataSourceProperties getDataSourceProperties()
throws OpenTMSException
DataSource
getDataSourceProperties in interface DataSourceOpenTMSExceptionpublic java.lang.String getDataSourceType()
DataSource
getDataSourceType in interface DataSourcepublic java.lang.String getDefaultDataSourceConfigurationsFileName()
DataSource
getDefaultDataSourceConfigurationsFileName in interface DataSourcepublic MonoLingualPartitionedFuzzyNodeTree getFuzzyTree()
public java.util.Vector<java.lang.Integer> getIds()
DataSource
getIds in interface DataSourcepublic int getILogLevel()
public int getLastErrorCode()
getLastErrorCode in interface DataSourcepublic MonoLingualObject getMonoLingualObjectFromId(java.lang.String uniqueID)
DataSource
getMonoLingualObjectFromId in interface DataSourcepublic MonoLingualObject getMonoLingualObjectFromUniqueId(java.lang.String uniqueID)
DataSource
getMonoLingualObjectFromUniqueId in interface DataSourceuniqueID - the id to search (as String)
public ObservableHashtable<java.lang.String,MultiLingualObject> getMultiLingualObjectCache()
public MultiLingualObject getMultiLingualObjectFromId(java.lang.String id)
DataSource
getMultiLingualObjectFromId in interface DataSourceid - the id to search (as String)
public MultiLingualObject getMultiLingualObjectFromUniqueId(java.lang.String id)
DataSource
getMultiLingualObjectFromUniqueId in interface DataSourceid - the id to search (as String)
public java.util.Vector<java.lang.String> getUniqueIds()
DataSource
getUniqueIds in interface DataSourcepublic boolean hasMoreElements()
hasMoreElements in interface java.util.Enumeration<MultiLingualObject>public int importTbxFile(java.lang.String tbxFile)
DataSource
importTbxFile in interface DataSourcetbxFile - the tbx file to import
public int importTmxFile(java.lang.String tmxFile)
DataSource
importTmxFile in interface DataSourcetmxFile - the tmx file to import
public int importXliffFile(java.lang.String xliffFile)
DataSource
importXliffFile in interface DataSourcexliffFile - the xliff file to import
public void initEnumeration()
DataSource
initEnumeration in interface DataSourcepublic boolean isBChanged()
public boolean isBLoadAttributesLazy()
DataSource
isBLoadAttributesLazy in interface DataSourcepublic boolean isSyncDataSource()
DataSource
isSyncDataSource in interface DataSourcepublic MultiLingualObject nextElement()
nextElement in interface java.util.Enumeration<MultiLingualObject>public java.lang.Object removeData(java.lang.String key)
DataSource
removeData in interface DataSourcekey - the key to remove
public void removeDataSource()
DataSource
removeDataSource in interface DataSourcepublic boolean removeMonoLingualObject(MonoLingualObject monoLingualObject)
DataSource
removeMonoLingualObject in interface DataSourcemonoLingualObject - the MUL to remove
public boolean removeMultiLingualObject(MultiLingualObject multiLingualObject)
DataSource
removeMultiLingualObject in interface DataSourcemultiLingualObject - the MOL to remove
public org.jdom.Element runFilterMethod(java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters,
org.jdom.Element transUnit)
translationParameters - transUnit -
public boolean saveModifiedMonoLingualObject(MonoLingualObject monoLingualObject)
DataSource
saveModifiedMonoLingualObject in interface DataSourcemonoLingualObject - the mono lingual object to save return true for success, false
otherwisepublic boolean saveModifiedMultiLingualObject(MultiLingualObject mul)
DataSource
saveModifiedMultiLingualObject in interface DataSourcemul - the MultiLingualObject
public java.util.Vector<MonoLingualObject> search(MonoLingualObject searchMonoLingualObject,
java.util.Hashtable<java.lang.String,java.lang.Object> searchParameters)
DataSource
search in interface DataSourcesearchMonoLingualObject - the MonoLingualObject to search forsearchParameters - the hash table contains search parameters (e.g. language to
search for etc.)
public java.util.Vector<MonoLingualObject> searchRegExp(MonoLingualObject searchMonoLingualObject,
java.util.Hashtable<java.lang.String,java.lang.Object> searchParameters)
DataSource
searchRegExp in interface DataSourcesearchMonoLingualObject - the MonoLingualObject to search forsearchParameters - the hash table contains search parameters (e.g. language to
search for etc.)
public java.util.Vector<MonoLingualObject> searchWordBased(MonoLingualObject searchMonoLingualObject,
java.util.Hashtable<java.lang.String,java.lang.Object> searchParameters)
DataSource
searchWordBased in interface DataSourcesearchMonoLingualObject - the MonoLingualObject to search forsearchParameters - the hash table contains search parameters (e.g. language to
search for etc.);
public void setBChanged(boolean changed)
changed - the bChanged to set determines if the data sources has changed
- added or removed entriespublic void setBLoadAttributesLazy(boolean loadAttributesLazy)
DataSource
setBLoadAttributesLazy in interface DataSourceloadAttributesLazy - the bLoadAttributesLazy to set; false = load at creation time;
true load at time when neededpublic void setDataSourceType()
DataSource
setDataSourceType in interface DataSourcepublic void setDefaultDataSourceConfigurationsFileName(java.lang.String defaultDataSourceConfigurationsFileName)
DataSource
setDefaultDataSourceConfigurationsFileName in interface DataSourcedefaultDataSourceConfigurationsFileName - the defaultDataSourceConfigurationsFileName to setpublic void setILogLevel()
logLevel - the iLogLevel - set to the value in OpenTMSProperties
iLogLevel = de.folt.util.OpenTMSProperties.getInstance().getLogLevel(this.getClass().getCanonicalName());
public void setILogLevel(int logLevel)
logLevel - the iLogLevel to setpublic void setLastErrorCode(int lastErrorCode)
DataSource
setLastErrorCode in interface DataSourcelastErrorCode - the lastErrorCode to setpublic void setMultiLingualObjectCache(ObservableHashtable<java.lang.String,MultiLingualObject> multiLingualObjectCache)
multiLingualObjectCache - the multiLingualObjectCache to set
public org.jdom.Element[] subSegmentResultsToGlossary(java.lang.String sourceLangauge,
java.lang.String targetLanguage)
DataSource
subSegmentResultsToGlossary in interface DataSourcesourceLangauge - the source language for the glossarytargetLanguage - the target language for the glossary
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
DataSource
subSegmentTranslate in interface DataSourcetransUnit - the trans unit to translate to usexliffDocument - the basic xliff documentsourceLanguage - the source language to usetargetLanguage - the target language to usetranslationParameters - the hash table contains parameters which control some
parameters, e.g. should header/source/target properties be
written to alt-trans
OpenTMSException
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
DataSource
translate in interface DataSourcetransUnit - the trans unit to translate to usefile - the file element currently to translatexliffDocument - the basic xliff documentsourceLanguage - the source language to usetargetLanguage - the target language to usematchSimilarity - the similarity (fuzzy) match quality (0 - 100) to usetranslationParameters - the hash table contains parameters which control some
parameters, e.g. should header/source/target properties be
written to alt-trans
OpenTMSException
public void update(java.util.Observable arg0,
java.lang.Object arg1)
update in interface java.util.Observerpublic void update()
DataSource
update in interface DataSource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||