Interface TableParameterRuntime
-
- All Superinterfaces:
TableParameter
public interface TableParameterRuntime extends TableParameter
Runtime interface to Table parameters from RedwoodScript.Table parameters consist of two parts:
- The reference: stored in the JobParameter object's InValueString and/or OutValueString attributes, depending on direction. This is stored in the form
<type:source>, where type is from the
TableParameterType
reference, and source depends on type, as specified inJobParameter.setOutValueTableParameter(String)
. - The content: in Redwood Table XML (RTX) format.
While the content is typically stored in a JobFile, there are two other cases to consider:
TableParameterType.Inline
where the content is stored directly in the JobParameter object's InValueString and/or OutValueString. This is supported for all parameter directions.TableParameterType.Table
where the content is stored in aTable
object. This is only supported for In parameters.
Due to the nature of table parameters, and the normal rules around parameter values, not all methods are valid in all contexts:
- Writing output values of parameters is only allowed if they are for the currently running job.
- Reading output values of parameters is allowed in general, with special exceptions for parameters of the currently running job.
It is possible to create conflicts in values or content by calling certain sequences of methods from this interface and other interfaces, especially when combined with creating JobFile objects externally. Users should take care to ensure that there is only one way of writing to a JobFile. It is recommended that this interface be used exclusively when dealing with table parameters. Creating JobFile objects and String values directly is likely to lead to bugs or incompatibilities with future features.
When using InOut parameters, different references should be used, except in the case where the Out value is exactly the same as the In value, where using the same value is required to reference the same content.
For RedwoodScript jobs, there is also a distinction between the internal value and the database value of a parameter. The internal value is the value available via the variable named after the parameter, in the current job. The database value is the value visible from a SchedulerSession (from the database). When the job finishes, the internal value will be written to the database (overwriting updates made by any other means). This is the case for all parameters.
When calling methods that set the OutValueString of an attribute (ie. most of the getRTXWriter*() methods, and all the setOutValue*() methods) these changes will be reflected in the internal value immediately, and will be visible externally when the job finishes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getErrorNameEN()
Get information to identify this parameter in error messages.String
getInValueSource()
Get the source part of the In reference of an In or InOut parameter.String
getInValueString()
Get the In reference for an In or InOut parameter.TableParameterType
getInValueTableParameterType()
Get the type part of the In reference of an In or InOut parameter.String
getOutValueSource()
Get the source part of the Out reference of an Out or InOut parameter.String
getOutValueString()
Get the Out reference for an Out or InOut parameter.TableParameterType
getOutValueTableParameterType()
Get the type part of the Out reference of an Out or InOut parameter.RTXReader
getRTXReader()
Get an RTXReader to read the In content of an In or InOut parameter.RTXWriter
getRTXWriter()
Get an RTXWriter to write the Out content of an Out or InOut parameter.RTXWriter
getRTXWriter(JobFile jobFile)
Get an RTXWriter to write the Out content of an Out or InOut parameter to the specified (potentially partially populated, but not necessarily persisted) JobFile, and set the reference to it.RTXWriter
getRTXWriterInline()
Get an RTXWriter to write the Out content of an Out or InOut parameter, using the Inline type, setting the reference implicitly when the writer is closed.RTXWriter
getRTXWriterToStandardOutput()
Get an RTXWriter to write the Out content of an Out or InOut parameter to stdout.rtx, and set the reference to it.void
setOutValue(Object o)
Manually override the Out reference of an Out or InOut parameter.void
setOutValueString(TableParameterType type, String source)
Manually override the Out reference of an Out or InOut parameter.void
setOutValueString(String fullOutValue)
Manually override the Out reference of an Out or InOut parameter.
-
-
-
Method Detail
-
getRTXReader
RTXReader getRTXReader() throws IOException, RTXException, JobFileException
Get an RTXReader to read the In content of an In or InOut parameter.- Specified by:
getRTXReader
in interfaceTableParameter
- Returns:
- an RTXReader for the content.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not In or InOut.RTXFileNotFoundRuntimeException
- if the input cannot be found.IOException
- if there is an I/O error opening the content.RTXException
- if there is an RTX I/O error opening the content.JobFileException
- if the parameter references a job file that can't be opened (transient errors are automatically retried).
-
getRTXWriter
RTXWriter getRTXWriter() throws IOException, RTXException, SchedulerAPIPersistenceException
Get an RTXWriter to write the Out content of an Out or InOut parameter. This method is the equivalent of:- creating a new JobFile from jcsJob,
- passing it to
getRTXWriter(JobFile)
, - persisting jcsSession, and,
- refreshing jcsJob.
- Returns:
- an RTXWriter for the content.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.SchedulerAPIPersistenceException
- if the session cannot be persisted.IOException
- if there is an I/O error opening the content.RTXException
- if there is an RTX I/O error opening the content.
-
getRTXWriterToStandardOutput
RTXWriter getRTXWriterToStandardOutput() throws IOException, RTXException, SchedulerAPIPersistenceException
Get an RTXWriter to write the Out content of an Out or InOut parameter to stdout.rtx, and set the reference to it. This method is the equivalent of:- Getting the JobFile with order
JobFile.STANDARD_OUTPUT_ORDER
from jcsJob, - Setting its Name attribute to stdout.rtx,
- Setting its Format to GLOBAL.System_RTX,
- Passing it to
getRTXWriter(JobFile)
, - Persisting jcsSession, and,
- Refreshing jcsJob.
- Returns:
- an RTXWriter for the content.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.SchedulerAPIPersistenceException
- if the session cannot be persisted.IOException
- if there is an I/O error opening the content.RTXException
- if there is an RTX I/O error opening the content.
- Getting the JobFile with order
-
getRTXWriter
RTXWriter getRTXWriter(JobFile jobFile) throws IOException, RTXException
Get an RTXWriter to write the Out content of an Out or InOut parameter to the specified (potentially partially populated, but not necessarily persisted) JobFile, and set the reference to it. The JobFile can be from any session. The following JobFile attributes will be set if not already set:- Name will be set to <JobParameter.Name>.rtx
- FileOrder will be set to the next available value starting at
JobFile.CUSTOMER_ORDER_START
. - Format will be set to GLOBAL.System_RTX
- Type will be set to @{link JobFileType#Output}
JobFile.setFileNameAutomatic()
. The session will not be persisted, the caller must persist the session for changes to be visible.- Parameters:
jobFile
- the job file to use.- Returns:
- an RTXWriter for the content.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.IOException
- if there is an I/O error opening the content.RTXException
- if there is an RTX I/O error opening the content.
-
getRTXWriterInline
RTXWriter getRTXWriterInline() throws RTXException
Get an RTXWriter to write the Out content of an Out or InOut parameter, using the Inline type, setting the reference implicitly when the writer is closed. This should only be used for relatively small content (< 10Kb).- Returns:
- an RTXWriter for the content.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.RTXException
- if there is an I/O error opening the content.
-
getInValueTableParameterType
TableParameterType getInValueTableParameterType()
Get the type part of the In reference of an In or InOut parameter.- Returns:
- the TableParameterType part of the InValueString attribute of the JobParameter.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not In or InOut.RTXParameterValueRuntimeException
- if the value is invalid.
-
getInValueSource
String getInValueSource()
Get the source part of the In reference of an In or InOut parameter.- Returns:
- the source part of the InValueString attribute of the JobParameter.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not In or InOut.RTXParameterValueRuntimeException
- if the value is invalid.
-
getOutValueTableParameterType
TableParameterType getOutValueTableParameterType()
Get the type part of the Out reference of an Out or InOut parameter.- Returns:
- the TableParameterType part of the OutValueString attribute of the JobParameter.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.RTXParameterValueRuntimeException
- if the value is invalid.
-
getOutValueSource
String getOutValueSource()
Get the source part of the Out reference of an Out or InOut parameter.- Returns:
- the source part part of the OutValueString attribute of the JobParameter.
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.RTXParameterValueRuntimeException
- if the value is invalid.
-
setOutValueString
void setOutValueString(TableParameterType type, String source)
Manually override the Out reference of an Out or InOut parameter. The recommended way to set this data is by using one of the getRTXWriter*() methods, likegetRTXWriter()
orgetRTXWriter(JobFile)
.- Parameters:
type
- the output type.source
- the output source.- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.
-
setOutValueString
void setOutValueString(String fullOutValue)
Manually override the Out reference of an Out or InOut parameter. The recommended way to set this data is by using one of the getRTXWriter*() methods, likegetRTXWriter()
orgetRTXWriter(JobFile)
.- Parameters:
fullOutValue
- the reference in the format used byJobParameter.setInValueTableParameter(String)
.- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.
-
setOutValue
void setOutValue(Object o)
Manually override the Out reference of an Out or InOut parameter. The recommended way to set this data is by using one of the getRTXWriter*() methods, likegetRTXWriter()
orgetRTXWriter(JobFile)
. This method is intended for use by the runtime framework, it is not recommended for customer use.- Parameters:
o
- the reference to use as a source.- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.
-
getOutValueString
String getOutValueString()
Get the Out reference for an Out or InOut parameter.- Returns:
- the reference in the format used by
JobParameter.setOutValueTableParameter(String)
- Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not Out or InOut.
-
getInValueString
String getInValueString()
Get the In reference for an In or InOut parameter.- Returns:
- the reference in the format used by
JobParameter.setInValueTableParameter(String)
. - Throws:
RTXParameterDirectionRuntimeException
- if the parameter direction is not In or InOut.
-
getErrorNameEN
String getErrorNameEN()
Get information to identify this parameter in error messages. This is intended for error messages only, the value may change between versions and must not be parsed.- Specified by:
getErrorNameEN
in interfaceTableParameter
- Returns:
- information identifying this parameter for use in error messages.
-
-