Class DefaultDBReader
java.lang.Object
org.scictrl.mp.orbitcorrect.accessories.AbstractParameterReader
org.scictrl.mp.orbitcorrect.accessories.DefaultDBReader
- All Implemented Interfaces:
IDataBushReader
This is straightforward implementation of
The only difference is, that you should call
IDataBushReader.
DefaultDBReader is designed for reading input written in DataBush specific format.
String, written in this format is obtained by calling DataBush.toString() method.
Proper read sequence is
- open input stream with any of openInStream method
- read input with
DefaultDBReader.read()method. List elements can be returned by read or obtained withDefaultDBReader.getList()method. - close input with
DefaultDBReader.closeInStream().
ParameterReader. The only difference is, that you should call
read() instead init().
Method init() does not implements any functionallity.
Result of reading are instances of DataBush elements, with parameters initialized
as described in input format. Elements are stored in ElementList.
The list is used to initialize DataBush.
Examples, how elements are written in DataBush specific format, can be obtained by calling
DefaultDBReader.getSamples().- Author:
- igor@scictrl.com
- See Also:
-
Field Summary
FieldsFields inherited from class org.scictrl.mp.orbitcorrect.accessories.AbstractParameterReader
log, st, tok, uRLFields inherited from interface org.scictrl.mp.orbitcorrect.IDataBushReader
ST_FILE, ST_URL -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDBReader constructor, that sets default keys and values to java.util.Properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds new reader to java.util.Properties.voidclose()Closes opened input stream.getList()Returns list of instances of DataBush elements created byread()method.Returnes IDataBushReader with given key.To IDataBushReader are propeties also set.Returnes readers.static ElementList<AbstractDataBushElement> Returns samples of all elements recognized by DataBush and DefaultDBReader.voidopen.read()Reads input and creates DataBush elements.Reads input and creates DataBush elements.Methods inherited from class org.scictrl.mp.orbitcorrect.accessories.AbstractParameterReader
debugPrint, debugPrintln, getProperties, getSourceType, getURL, open, open, setPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.scictrl.mp.orbitcorrect.IDataBushReader
getProperties, getSourceType, open, open, setProperties
-
Field Details
-
readers
Holdes a set of properties. -
template
Template.
-
-
Constructor Details
-
DefaultDBReader
public DefaultDBReader()DefaultDBReader constructor, that sets default keys and values to java.util.Properties.
-
-
Method Details
-
addReader
Adds new reader to java.util.Properties.- Parameters:
tag- java.lang.Stringreader- java.lang.Class
-
close
Closes opened input stream. After stream is closed, new stream may be opened and read. Close opened input stream. After stream is closed, new stream may be opened and read.
This is implementation ofParameterReader.closeInStream().- Specified by:
closein interfaceIDataBushReader- Overrides:
closein classAbstractParameterReader- Throws:
DataBushException- if any.
-
getList
Returns list of instances of DataBush elements created byread()method. Returns list of elements created by DefaultDBReader. Elements are stored inElementListlist. List is created and filled after call toread()method.- Specified by:
getListin interfaceIDataBushReader- Returns:
ElementListlist of read elements
-
getReader
public IDataBushReader getReader(String tag) throws IllegalArgumentException, ClassNotFoundException, InstantiationException, IllegalAccessException, ClassCastException, InvocationTargetException, NoSuchMethodException, SecurityException Returnes IDataBushReader with given key.To IDataBushReader are propeties also set.- Parameters:
tag- java.lang.String key to reader- Returns:
- accessories.DataBushReader
- Throws:
SecurityException- if read failsNoSuchMethodException- if read failsInvocationTargetException- if read failsIllegalArgumentException- if read failsClassNotFoundException- if read failsInstantiationException- if read failsIllegalAccessException- if read failsClassCastException- if read fails
-
getReaders
Returnes readers.- Returns:
- java.util.Properties
-
getSamples
Returns samples of all elements recognized by DataBush and DefaultDBReader. Elements are stored inElementListlist.- Returns:
ElementListof sample elements
-
open
open.
- Parameters:
reader- aReaderobject- Throws:
DataBushException- if any.
-
read
Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStreammethods. Created elements are stored and returned inElementList. Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStreammethods. Created instances of DataBush elements are stored and returned inElementList. Call read only once per new opened stream.- Specified by:
readin interfaceIDataBushReader- Returns:
ElementListlist of created elements- Throws:
DataBushException- if any.
-
read
public ElementList<AbstractDataBushElement> read(ElementList<AbstractDataBushElement> l) throws DataBushException Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStreammethods. Created elements are stored and returned inElementList. Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStreammethods. Created instances of DataBush elements are stored and returned inElementList. Call read only once per new opened stream.- Specified by:
readin interfaceIDataBushReader- Parameters:
l- aElementListobject- Returns:
ElementListlist of created elements- Throws:
DataBushException- if any.- See Also:
-