Package uk.ac.starlink.ttools.task
Class MapEnvironment
java.lang.Object
uk.ac.starlink.ttools.task.MapEnvironment
- All Implemented Interfaces:
uk.ac.starlink.task.Environment
,TableEnvironment
Environment which allows use of ttools tasks from an in-memory context.
Input StarTables can be set as values of parameters and output ones
can be extracted.
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new environment with no values.MapEnvironment
(Map<String, Object> map) Constructs a new environment with a map of parameter name->value pairs.Clone constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireValue
(uk.ac.starlink.task.Parameter<?> param) void
clearValue
(uk.ac.starlink.task.Parameter<?> param) String[]
Returns the error output written by the task so far, in an array one line per element.Returns a string which contains all the error output written by the task so far.uk.ac.starlink.table.jdbc.JDBCAuthenticator
Returns a JDBC authenticator suitable for use in this environment.getMap()
Returns the map object that contains the data for this environment.String[]
getNames()
String[]
Returns the output written by the task so far, in an array one line per element.uk.ac.starlink.table.StarTable
getOutputTable
(String paramName) If the task which has been executed in this environment has created an output table which has not been otherwise disposed of, you can get it from here.Returns a string which contains all the output written by the task so far.uk.ac.starlink.table.StarTableFactory
Returns a table factory suitable for use in this environment.uk.ac.starlink.table.StarTableOutput
Returns a table output marshaller suitable for use in this environment.String[]
Returns an array containing any words of the input argument list which were never queried by the application to find their value.boolean
isDebug()
Indicates whether we are running in debug mode.boolean
Determines whether votables are to be parsed in strict mode.void
setDebug
(boolean debug) Sets whether we are running in debug mode.setResourceBase
(Class<?> clazz) Sets the class which defines the context for resource discovery.void
setStrictVotable
(boolean strict) Sets whether votables should be parsed in strict mode.Sets the value of a parameter.
-
Constructor Details
-
MapEnvironment
public MapEnvironment()Constructs a new environment with no values. -
MapEnvironment
Constructs a new environment with a map of parameter name->value pairs.- Parameters:
map
- parameter map
-
MapEnvironment
Clone constructor.- Parameters:
env
- environment to copy
-
-
Method Details
-
getOutputStream
- Specified by:
getOutputStream
in interfaceuk.ac.starlink.task.Environment
-
getErrorStream
- Specified by:
getErrorStream
in interfaceuk.ac.starlink.task.Environment
-
clearValue
public void clearValue(uk.ac.starlink.task.Parameter<?> param) - Specified by:
clearValue
in interfaceuk.ac.starlink.task.Environment
-
getNames
- Specified by:
getNames
in interfaceuk.ac.starlink.task.Environment
-
getMap
Returns the map object that contains the data for this environment. Modify it at your own risk.- Returns:
- content map
-
getOutputText
Returns a string which contains all the output written by the task so far.- Returns:
- output text
-
getOutputLines
Returns the output written by the task so far, in an array one line per element.- Returns:
- output text
-
getErrorText
Returns a string which contains all the error output written by the task so far.- Returns:
- error text
-
getErrorLines
Returns the error output written by the task so far, in an array one line per element.- Returns:
- error text
-
setValue
Sets the value of a parameter. A string value is OK; in some cases other parameter types are catered for. For convenience, this method returns this object (cf. StringBuffer).- Parameters:
paramName
- namevalue
- string or other value- Returns:
- this
-
setResourceBase
Sets the class which defines the context for resource discovery.- Parameters:
clazz
- resource base class- Returns:
- this
- See Also:
-
getOutputTable
If the task which has been executed in this environment has created an output table which has not been otherwise disposed of, you can get it from here.- Parameters:
paramName
- name of a TableConsumerParameter- Returns:
- output table stored under
name
-
acquireValue
public void acquireValue(uk.ac.starlink.task.Parameter<?> param) throws uk.ac.starlink.task.TaskException - Specified by:
acquireValue
in interfaceuk.ac.starlink.task.Environment
- Throws:
uk.ac.starlink.task.TaskException
-
getTableFactory
public uk.ac.starlink.table.StarTableFactory getTableFactory()Description copied from interface:TableEnvironment
Returns a table factory suitable for use in this environment.- Specified by:
getTableFactory
in interfaceTableEnvironment
- Returns:
- table factory
-
getTableOutput
public uk.ac.starlink.table.StarTableOutput getTableOutput()Description copied from interface:TableEnvironment
Returns a table output marshaller suitable for use in this environment.- Specified by:
getTableOutput
in interfaceTableEnvironment
- Returns:
- table output
-
getJdbcAuthenticator
public uk.ac.starlink.table.jdbc.JDBCAuthenticator getJdbcAuthenticator()Description copied from interface:TableEnvironment
Returns a JDBC authenticator suitable for use in this environment.- Specified by:
getJdbcAuthenticator
in interfaceTableEnvironment
- Returns:
- JDBC authenticator
-
isDebug
public boolean isDebug()Description copied from interface:TableEnvironment
Indicates whether we are running in debug mode.- Specified by:
isDebug
in interfaceTableEnvironment
- Returns:
- true iff debugging output is required
-
setDebug
public void setDebug(boolean debug) Description copied from interface:TableEnvironment
Sets whether we are running in debug mode.- Specified by:
setDebug
in interfaceTableEnvironment
- Parameters:
debug
- set true if you want debugging messages
-
isStrictVotable
public boolean isStrictVotable()Description copied from interface:TableEnvironment
Determines whether votables are to be parsed in strict mode.- Specified by:
isStrictVotable
in interfaceTableEnvironment
- Returns:
- true if VOTables will be interpreted strictly in accordance with the standard
-
setStrictVotable
public void setStrictVotable(boolean strict) Description copied from interface:TableEnvironment
Sets whether votables should be parsed in strict mode.- Specified by:
setStrictVotable
in interfaceTableEnvironment
- Parameters:
strict
- true if VOTables should be interpreted strictly in accordance with the standard
-
getUnused
Returns an array containing any words of the input argument list which were never queried by the application to find their value. Such unused words probably merit a warning, since they may for instance be misspelled versions of real parameters.- Returns:
- array of unused words
-