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
Fields inherited from class org.scictrl.mp.orbitcorrect.accessories.AbstractParameterReader
log, st, tok, uRL
Fields inherited from interface org.scictrl.mp.orbitcorrect.IDataBushReader
ST_FILE, ST_URL
-
Constructor Summary
ConstructorDescriptionDefaultDBReader constructor, that sets default keys and values to java.util.Properties. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds new reader to java.util.Properties.void
close()
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.void
open.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, setProperties
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
close
in interfaceIDataBushReader
- Overrides:
close
in 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 inElementList
list. List is created and filled after call toread()
method.- Specified by:
getList
in interfaceIDataBushReader
- Returns:
ElementList
list 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 inElementList
list.- Returns:
ElementList
of sample elements
-
open
open.
- Parameters:
reader
- aReader
object- Throws:
DataBushException
- if any.
-
read
Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStream
methods. Created elements are stored and returned inElementList
. Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStream
methods. Created instances of DataBush elements are stored and returned inElementList
. Call read only once per new opened stream.- Specified by:
read
in interfaceIDataBushReader
- Returns:
ElementList
list 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.openInStream
methods. Created elements are stored and returned inElementList
. Reads input and creates DataBush elements. Input must be opened with one ofParameterReader.openInStream
methods. Created instances of DataBush elements are stored and returned inElementList
. Call read only once per new opened stream.- Specified by:
read
in interfaceIDataBushReader
- Parameters:
l
- aElementList
object- Returns:
ElementList
list of created elements- Throws:
DataBushException
- if any.- See Also:
-