public abstract class AbstractImplementation extends java.lang.Object implements ImplementationIF
ImplementationIF
Modifier and Type | Field and Description |
---|---|
protected java.util.Properties |
arguments
The arguments of the implementation.
|
protected XSDContextIF |
ctx
The context.
|
protected java.lang.Object |
descriptor
The XML object descriptor.
|
static java.lang.String |
NEW_LINE |
Constructor and Description |
---|
AbstractImplementation() |
Modifier and Type | Method and Description |
---|---|
protected NameValueUnit[] |
addAttributesToNameValueUnitArray(NameValueUnit[] nvu,
java.util.List<NameValueUnit> newAttributes)
This method add a list with new NameValueUnit objects to existing nvu array.
|
protected NameValueUnit[] |
addAttributeToNameValueUnitArray(NameValueUnit[] nvu,
NameValueUnit newAttribute)
This method add a new NameValueUnit object to existing nvu array.
|
protected NameValueUnit[] |
addStringValueToNameValueUnitArray(NameValueUnit[] nvuArray,
java.lang.String name,
java.lang.String value)
This method check if the array contains a NameValueUnit entry with the given name.
|
protected void |
checkDirectoy(java.io.File dir)
Check the directory exist
|
protected void |
checkDirectoy(java.io.File dir,
java.lang.String ruleName)
Checks the given directory, if it exists, is a file and can be read.
|
protected void |
checkDirectoy(java.lang.String dirName)
Check the directory exist
|
protected void |
checkFile(java.io.File file)
Check the file exist
|
protected void |
checkFile(java.io.File file,
java.lang.String ruleName)
Checks the given file, if it exists, is a file and can be read.
|
protected void |
checkFile(java.lang.String filename)
Check the file exist.
|
protected boolean |
checkIntValue(java.util.logging.Logger messenger,
java.lang.String propertyName,
int value,
int minValue,
int maxValue)
Checks if the passed int is in the correct range.
|
protected boolean |
checkStringValue(java.util.logging.Logger messenger,
java.lang.String errorMessage,
java.lang.String value)
Checks if the passed String is not null and not an empty string.
|
NameValueUnit[][] |
compressNvuArray(NameValueUnit[][] nvuArray)
Remove all null entries or entries without name from nvu[][].
|
protected java.lang.String |
createMessageFromPropertyFile(java.util.logging.Logger messenger,
java.lang.String propertyName)
Creates a message with message text from properties.
|
protected java.lang.String |
createMessageFromPropertyFile(java.util.logging.Logger messenger,
java.lang.String propertyName,
java.lang.String parameter)
Creates a message with message text from properties.
|
protected java.lang.String |
createMessageFromPropertyFile(java.util.logging.Logger messenger,
java.lang.String propertyName,
java.lang.String parameter0,
java.lang.String parameter1)
Creates a message with message text from properties.
|
protected TS_Union |
createTsUnionFromObject(java.lang.Object obj)
Create a TS_Union instance from the given object,
The data type is generated on base of the object class.
|
NameValueUnit[][] |
deleteRowWithAttributes(NameValueUnit[][] nvu,
int indexOfRowToDelete)
This method removes an entry from a NameValueUnit[][]
The Row NameValueUnit[indexOfRowToDelete][] will be deleted.
|
java.util.Properties |
getArguments()
Get the arguments coming via the XML definition.
|
XSDContextIF |
getContext()
Get the context.
|
java.lang.Object |
getDescriptor()
Get the descriptor as an Object.
|
protected java.util.List<java.lang.String> |
getListFromProperty(java.util.logging.Logger messenger,
java.lang.String propertyName,
java.lang.String splitChar)
Read a property and converts the value of the property to an ArrayList
|
protected java.lang.String |
getMandatoryProperty(java.util.logging.Logger messenger,
java.lang.String key)
Returns the value from the given property (key).
|
protected java.lang.String |
getMandatoryProperty(java.lang.String key)
Returns the value from the given property (key).
|
protected int |
getMandatoryPropertyAsInt(java.util.logging.Logger messenger,
java.lang.String key)
Returns the value from the given property (key) as int.
|
protected java.util.List<java.lang.String> |
getMandatoryPropertyAsList(java.util.logging.Logger messenger,
java.lang.String propertyName,
java.lang.String splitChar)
Read a property and converts the value of the property to an ArrayList
|
protected java.lang.String |
getMandatoryPropertyWithRuleException(java.util.logging.Logger messenger,
java.lang.String key)
Returns the value from the given property (key).
|
protected NameValueUnit[] |
getNvuArrayFromMap(java.util.Map<java.lang.String,java.lang.Object> map,
boolean onlyValidEntries,
boolean ignoreWrongObjectTypes)
Creates a nvu array from the given map
|
protected NameValueUnit[] |
getNvuArrayFromMap(java.util.Map<java.lang.String,java.lang.String> map,
boolean onlyValidEntries)
Creates a nvu array from the given map
|
protected NameValueUnit |
getNvuObjectWithName(java.util.ArrayList<NameValueUnit> nvuAttributeArray,
java.lang.String attributeName)
Returns from the nvu array, the nvu object with the passed attribute name.
|
protected NameValueUnit |
getNvuObjectWithName(NameValueUnit[] nvuAttributeArray,
java.lang.String attributeName)
Returns from the nvu array, the nvu object with the passed attribute name.
|
protected NameValueUnit |
getNvuObjectWithName(NameValueUnit[] nvuAttributeArray,
java.lang.String attributeName,
java.util.logging.Logger messenger)
Returns from the nvu array, the nvu object with the passed attribute name.
|
protected ODSCache |
getOdsCacheFromProperty(java.util.logging.Logger messenger,
java.lang.String key)
Returns the ods cache, retrieved from context reference with the given property name.
|
protected int |
getOptioanlPropertyAsInt(java.util.logging.Logger messenger,
java.lang.String key,
int defaultValue)
Returns the value from the given property (key) as int.
|
protected java.lang.String |
getOptionalProperty(java.util.logging.Logger messenger,
java.lang.String key)
Returns the value from the given property (key).
|
protected java.lang.String |
getOptionalProperty(java.util.logging.Logger messenger,
java.lang.String key,
java.lang.String defaultValue)
Returns the value from the given property (key).
|
protected java.lang.String |
getOptionalProperty(java.lang.String key)
Returns the value from the given property (key).
|
protected java.lang.String |
getOptionalProperty(java.lang.String key,
java.lang.String defaultValue)
Returns the value from the given property (key).
|
protected java.lang.Boolean |
getOptionalPropertyAsBoolean(java.util.logging.Logger messenger,
java.lang.String key,
java.lang.String defaultValue)
Returns the value from the given property (key).
|
protected java.lang.Boolean |
getOptionalPropertyAsBoolean(java.lang.String key,
java.lang.Boolean defaultValue)
Returns the value from the given property (key).
|
protected java.lang.Boolean |
getOptionalPropertyAsBoolean(java.lang.String key,
java.lang.String defaultValue)
Returns the value from the given property (key).
|
protected java.util.List<java.lang.String> |
getOptionalPropertyAsList(java.util.logging.Logger messenger,
java.lang.String propertyName,
java.lang.String splitChar)
Read a property and converts the value of the property to an ArrayList
|
abstract void |
init()
Initialize the work.
|
static java.util.Properties |
makeUpperCaseKeyword(java.util.Properties properties)
Convert all property keyword to upper case letter keywords.
|
protected NameValueUnit[][] |
removeAttributeFromNameValueUnitArray(NameValueUnit[][] nvu,
java.lang.String attributeNameToRemove)
This method removes all attributes with the given name from the passed NameValueUnit[][]
|
protected NameValueUnit[] |
removeAttributeFromNameValueUnitArray(NameValueUnit[] nvu,
java.lang.String attributeNameToRemove)
This method removes the attributes with the specified name from the nvu array
|
void |
setArguments(java.util.Properties arguments)
Set argument property map.
|
void |
setContext(XSDContextIF ctx)
Set the context.
|
void |
setDescriptor(java.lang.Object descriptor)
Set the xml tree descriptor.
|
protected XSDContextIF ctx
protected java.util.Properties arguments
protected java.lang.Object descriptor
public static final java.lang.String NEW_LINE
public void setContext(XSDContextIF ctx)
setContext
in interface ImplementationIF
ctx
- the context.public XSDContextIF getContext()
getContext
in interface ImplementationIF
public void setArguments(java.util.Properties arguments) throws InvalidArgumentException
setArguments
in interface ImplementationIF
arguments
- the property mapInvalidArgumentException
- if the arguments are not valid.public java.util.Properties getArguments()
public void setDescriptor(java.lang.Object descriptor) throws InvalidDescriptorException
setDescriptor
in interface ImplementationIF
descriptor
- the tree node.InvalidDescriptorException
- if the descriptor isn't valid.public java.lang.Object getDescriptor()
getDescriptor
in interface ImplementationIF
public abstract void init() throws InitializationFailedException
init
in interface ImplementationIF
InitializationFailedException
- if the initialization fails.public static java.util.Properties makeUpperCaseKeyword(java.util.Properties properties)
properties
- the source property map.protected java.lang.String getMandatoryProperty(java.lang.String key) throws InitializationFailedException
key
- (name of the property)InitializationFailedException,
- when property was not found.InitializationFailedException
protected java.lang.String getMandatoryProperty(java.util.logging.Logger messenger, java.lang.String key) throws InitializationFailedException
key
- (name of the property)InitializationFailedException,
- when property was not found.InitializationFailedException
protected java.lang.String getMandatoryPropertyWithRuleException(java.util.logging.Logger messenger, java.lang.String key) throws RuleException
key
- (name of the property)InitializationFailedException,
- when property was not found.RuleException
protected int getMandatoryPropertyAsInt(java.util.logging.Logger messenger, java.lang.String key) throws InitializationFailedException
key
- (name of the property)InitializationFailedException,
- when property was not found.InitializationFailedException
protected java.util.List<java.lang.String> getMandatoryPropertyAsList(java.util.logging.Logger messenger, java.lang.String propertyName, java.lang.String splitChar) throws InitializationFailedException
messenger
- Logger for messenger outputpropertyName
- Name of the property, which will be read and converted to ArrayListsplitChar
- Charachter or reges for splitting property value.InitializationFailedException
protected int getOptioanlPropertyAsInt(java.util.logging.Logger messenger, java.lang.String key, int defaultValue) throws InitializationFailedException
key
- (name of the property)InitializationFailedException,
- when property was not found.InitializationFailedException
protected ODSCache getOdsCacheFromProperty(java.util.logging.Logger messenger, java.lang.String key) throws InitializationFailedException
messenger
- (messenger instance)key
- (name of the property)InitializationFailedException,
- when property was not found or cache ref don't exists.InitializationFailedException
protected boolean checkStringValue(java.util.logging.Logger messenger, java.lang.String errorMessage, java.lang.String value) throws InitializationFailedException
messenger
- the Logger for error texterrorMessage
- additional text for error messagevalue
- the value for checkingInitializationFailedException
protected boolean checkIntValue(java.util.logging.Logger messenger, java.lang.String propertyName, int value, int minValue, int maxValue) throws InitializationFailedException
messenger
- the Logger for error textpropertyName
- propertyName for exceptionvalue
- the value for checkingminValue
- the lower value to checkmaxValue
- the max value to checkInitializationFailedException
protected java.lang.String createMessageFromPropertyFile(java.util.logging.Logger messenger, java.lang.String propertyName, java.lang.String parameter0, java.lang.String parameter1)
messenger
- the Logger for adding logger namepropertyName
- the name of the property from the property file with messagesparameter0
- the parameter for the first parameter in the property entryparameter1
- the parameter for the second parameter in the property entryprotected java.lang.String createMessageFromPropertyFile(java.util.logging.Logger messenger, java.lang.String propertyName, java.lang.String parameter)
messenger
- the Logger for adding logger namepropertyName
- the name of the property from the property file with messagesparameter
- the parameter for the parameter in the property entryprotected java.lang.String createMessageFromPropertyFile(java.util.logging.Logger messenger, java.lang.String propertyName)
messenger
- the Logger for adding logger namepropertyName
- the name of the property from the property file with messagesprotected java.lang.String getOptionalProperty(java.lang.String key)
key
- protected java.lang.String getOptionalProperty(java.util.logging.Logger messenger, java.lang.String key)
key
- protected java.lang.String getOptionalProperty(java.lang.String key, java.lang.String defaultValue)
key
- defaultValue
- protected java.lang.String getOptionalProperty(java.util.logging.Logger messenger, java.lang.String key, java.lang.String defaultValue)
key
- defaultValue
- protected java.lang.Boolean getOptionalPropertyAsBoolean(java.util.logging.Logger messenger, java.lang.String key, java.lang.String defaultValue)
messenger,
- for logging to messengerkey
- defaultValue
- protected java.lang.Boolean getOptionalPropertyAsBoolean(java.lang.String key, java.lang.String defaultValue)
key
- defaultValue
- protected java.lang.Boolean getOptionalPropertyAsBoolean(java.lang.String key, java.lang.Boolean defaultValue)
key
- defaultValue
- protected java.util.List<java.lang.String> getOptionalPropertyAsList(java.util.logging.Logger messenger, java.lang.String propertyName, java.lang.String splitChar)
messenger
- Logger for messenger outputpropertyName
- Name of the property, which will be read and converted to ArrayListsplitChar
- Charachter or reges for splitting property value.protected java.util.List<java.lang.String> getListFromProperty(java.util.logging.Logger messenger, java.lang.String propertyName, java.lang.String splitChar)
messenger
- Logger for messenger outputpropertyName
- Name of the property, which will be read and converted to ArrayListsplitChar
- Charachter or reges for splitting property value.protected void checkFile(java.lang.String filename) throws InitializationFailedException
filename
- the name of the file.InitializationFailedException
protected void checkFile(java.io.File file) throws InitializationFailedException
file
- the fileInitializationFailedException
protected void checkFile(java.io.File file, java.lang.String ruleName) throws InitializationFailedException
InitializationFailedException
protected void checkDirectoy(java.lang.String dirName) throws InitializationFailedException
dirName
- the name of the directoryInitializationFailedException
protected void checkDirectoy(java.io.File dir) throws InitializationFailedException
dir
- the directoryInitializationFailedException
protected void checkDirectoy(java.io.File dir, java.lang.String ruleName) throws InitializationFailedException
InitializationFailedException
protected NameValueUnit getNvuObjectWithName(NameValueUnit[] nvuAttributeArray, java.lang.String attributeName, java.util.logging.Logger messenger) throws RuleException
nvuAttributeArray
- the array with nvu attribbutes which will be parsedattributeName
- the attributename, which should be searchedmessenger
- the logger for error messageRuleException
- when no nvu object with the given name is foundprotected NameValueUnit getNvuObjectWithName(NameValueUnit[] nvuAttributeArray, java.lang.String attributeName)
nvuAttributeArray
- the array with nvu attribbutes which will be parsedattributeName
- the attributename, which should be searchedprotected NameValueUnit getNvuObjectWithName(java.util.ArrayList<NameValueUnit> nvuAttributeArray, java.lang.String attributeName)
nvuAttributeArray
- the array with nvu attribbutes which will be parsedattributeName
- the attributename, which should be searchedprotected NameValueUnit[] getNvuArrayFromMap(java.util.Map<java.lang.String,java.lang.Object> map, boolean onlyValidEntries, boolean ignoreWrongObjectTypes)
map
- Map with entries to convert to nvu objectsonlyValidEntries
- if true, only valid nvu's will be returnedignoreWrongObjectTypes
- if true, error on creating NVU with not implemented object types will be ignoredprotected NameValueUnit[] getNvuArrayFromMap(java.util.Map<java.lang.String,java.lang.String> map, boolean onlyValidEntries)
map
- Map with entries to convert to nvu objectsonlyValidEntries
- if true, only valid nvu's will be returnedprotected TS_Union createTsUnionFromObject(java.lang.Object obj)
protected NameValueUnit[] addStringValueToNameValueUnitArray(NameValueUnit[] nvuArray, java.lang.String name, java.lang.String value)
nvu
- The nvu array, to which the object should be added or updatedname
- The name of the nvu elementvalue
- The value of the nvu elementprotected NameValueUnit[] addAttributeToNameValueUnitArray(NameValueUnit[] nvu, NameValueUnit newAttribute)
nvu
- The nvu array, to which the object should be addednewAttribute
- The nvu object to addprotected NameValueUnit[] addAttributesToNameValueUnitArray(NameValueUnit[] nvu, java.util.List<NameValueUnit> newAttributes)
nvu
- The nvu array, to which the object should be addednewAttribute
- The list with the nvu object to addprotected NameValueUnit[][] removeAttributeFromNameValueUnitArray(NameValueUnit[][] nvu, java.lang.String attributeNameToRemove)
nvu
- The NameValueUnit[][] array, from which the attributes should be deletedattributeNameToRemove
- The name of the attribute which should be deletedprotected NameValueUnit[] removeAttributeFromNameValueUnitArray(NameValueUnit[] nvu, java.lang.String attributeNameToRemove)
nvu
- The NameValueUnit[] array, from which the attribute should be deletedattributeNameToRemove
- The name of the attribute which should be deletedpublic NameValueUnit[][] deleteRowWithAttributes(NameValueUnit[][] nvu, int indexOfRowToDelete) throws RuleException
nvu
- The NameValueUnit[][] from which a entry should be deletedindexOfRowToDelete
- Index of the row which should be removedRuleException
public NameValueUnit[][] compressNvuArray(NameValueUnit[][] nvuArray)