Package com.nt.udc.npl
Class BaseNPLProgram
java.lang.Object
com.nt.udc.npl.BaseNPLProgram
- All Implemented Interfaces:
NPLProgramIfc
-
Field Summary
FieldsFields inherited from interface com.nt.udc.npl.NPLProgramIfc
IMPORTED_JAVA_HANDLER_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes this NPL program's built-in function table.BaseNPLProgram
(Class outputType, DataReceiverIfc ireceiver, LoggerIfc logIfc) Sets the the output type, Data Receiver and Logger with the given values for this NPLProgram and then initializes this NPL program's built-in function table. -
Method Summary
Modifier and TypeMethodDescriptionprotected NPLFunctionTable
protected static byte[]
byte2bytes
(byte b) protected static byte
bytes2byte
(byte[] barr) protected static double
bytes2double
(byte[] barr) protected static float
bytes2float
(byte[] barr) protected static int
bytes2int
(byte[] barr) protected static long
bytes2long
(byte[] barr) protected static short
bytes2short
(byte[] barr) protected static byte[]
double2bytes
(double d) protected static byte[]
float2bytes
(float f) getConfigValue
(String key) Gets the value of a configuration attribute.getExposedFields
(String reason) Gets a list of the fields defined in the expose clause for the reason provided.protected static byte[]
getFieldValue
(DCFieldContainer dcfc, FieldKey attr_id) protected static byte[]
getFieldValue
(DCFieldContainer dcfc, String attr_id) protected static byte[]
getFieldValueAsString
(DCFieldContainer dcfc, FieldKey attr_id) Gets a list of the input fields defined in the input records.Returns the LoggerIfc being used to log messages generated by this NPLProgram during data processingReturns the method handler imported by the NPL program and set usingsetMethodHandler(IDCMethodHandler mh)
.getMethodHandler
(String name) Returns the method handler with the specified name.Gets a list of the output fields defined in the output records.protected DCFieldContainer
Returns the Class for the DCFieldContainer object that this NPLProgram will produce.void
handleException
(String msg, Exception e) Exception handler for exceptions that occur during NPL program execution.protected void
protected static byte[]
int2bytes
(int i) protected static byte[]
long2bytes
(long l) processData
(DCFieldContainer input, Class out_type) Process the given input fields with this NPL program.protected abstract DCFieldContainer[]
processRecord
(DCFieldContainer input) void
setDataReceiver
(DataReceiverIfc ireceiver) void
Sets the LoggerIfc to be used for logging messages generated by this NPLProgram during data processingvoid
Set the method handler object of the NPL program corresponding to the method handler imported by the NPL program.void
setOutputType
(Class out_type) Returns the Class for the DCFieldContainer object that this NPLProgram will produce.protected static byte[]
short2bytes
(short s)
-
Field Details
-
nonexistent_attr_exception
-
-
Constructor Details
-
BaseNPLProgram
public BaseNPLProgram()Initializes this NPL program's built-in function table. -
BaseNPLProgram
Sets the the output type, Data Receiver and Logger with the given values for this NPLProgram and then initializes this NPL program's built-in function table.
-
-
Method Details
-
getLogger
Returns the LoggerIfc being used to log messages generated by this NPLProgram during data processing- Specified by:
getLogger
in interfaceNPLProgramIfc
-
setLogger
Sets the LoggerIfc to be used for logging messages generated by this NPLProgram during data processing- Specified by:
setLogger
in interfaceNPLProgramIfc
-
getOutputType
Returns the Class for the DCFieldContainer object that this NPLProgram will produce. -
setOutputType
Returns the Class for the DCFieldContainer object that this NPLProgram will produce.- Throws:
ClassCastException
-
getDataReceiver
- Specified by:
getDataReceiver
in interfaceNPLProgramIfc
-
setDataReceiver
- Specified by:
setDataReceiver
in interfaceNPLProgramIfc
-
processData
Description copied from interface:NPLProgramIfc
Process the given input fields with this NPL program. If this NPL program is creating any output records, the specified output type is used.- Specified by:
processData
in interfaceNPLProgramIfc
- Parameters:
input
- input fields to processout_type
- type of any output records created by this NPL program (must implement DCFieldContainer interface)- Throws:
NPLException
- if error while processing data
-
setMethodHandler
Description copied from interface:NPLProgramIfc
Set the method handler object of the NPL program corresponding to the method handler imported by the NPL program.- Specified by:
setMethodHandler
in interfaceNPLProgramIfc
- Parameters:
mh
- object that implements sub-interface of IDCMethodHandler- Throws:
NPLException
- if object passed to this method does not implement interface imported in NPL file
-
getMethodHandler
Description copied from interface:NPLProgramIfc
Returns the method handler imported by the NPL program and set usingsetMethodHandler(IDCMethodHandler mh)
.- Specified by:
getMethodHandler
in interfaceNPLProgramIfc
-
getMethodHandler
Description copied from interface:NPLProgramIfc
Returns the method handler with the specified name. UseIMPORTED_JAVA_HANDLER_NAME
to retrieve the imported method handler. For method handlers declared using the JavaHook declaration, use the name given to identify the method handler in the JavaHook declaration.- Specified by:
getMethodHandler
in interfaceNPLProgramIfc
- Parameters:
name
- name of method handler to get- Returns:
- method handler with given name or null if no method handler with given name
-
getInputFields
Description copied from interface:NPLProgramIfc
Gets a list of the input fields defined in the input records.- Specified by:
getInputFields
in interfaceNPLProgramIfc
- Returns:
- List of input fields. The elements in this
ArrayList
are actually otherArrayList
s, one for each input record. The elements of theseArrayList
s areFieldDescriptor
objects, one for each field in the input record.
-
getOutputFields
Description copied from interface:NPLProgramIfc
Gets a list of the output fields defined in the output records.- Specified by:
getOutputFields
in interfaceNPLProgramIfc
- Returns:
- List of output fields. The elements in this
ArrayList
are actually otherArrayList
s, one for each output record. The elements of theseArrayList
s areFieldDescriptor
objects, one for each field in the output record.
-
getExposedFields
Description copied from interface:NPLProgramIfc
Gets a list of the fields defined in the expose clause for the reason provided.- Specified by:
getExposedFields
in interfaceNPLProgramIfc
- Parameters:
reason
- Reason the fields are being exposed.- Returns:
- List of exposed fields. The elements in the
ArrayList
areFieldDescriptor
objects, one for each field in the expose clause matching the reason provided.
-
getConfigValue
Description copied from interface:NPLProgramIfc
Gets the value of a configuration attribute.- Specified by:
getConfigValue
in interfaceNPLProgramIfc
- Parameters:
key
- Configuration attribute to get the value of.- Returns:
- Value of the attribute. Returns null if the attribute does not exist.
-
handleException
Exception handler for exceptions that occur during NPL program execution. The purpose is to log a message and not throw exceptions while processing.- Parameters:
msg
- a text message that is prepended to the standard message of the exception handlere
- the exception that occurred
-
getOutputRecInstance
- Throws:
NPLException
-
initBuiltInFunctionTable
protected void initBuiltInFunctionTable() -
builtInFunctionTable
-
getFieldValue
protected static byte[] getFieldValue(DCFieldContainer dcfc, String attr_id) throws NonExistentAttributeException - Throws:
NonExistentAttributeException
-
getFieldValue
protected static byte[] getFieldValue(DCFieldContainer dcfc, FieldKey attr_id) throws NonExistentAttributeException - Throws:
NonExistentAttributeException
-
getFieldValueAsString
protected static byte[] getFieldValueAsString(DCFieldContainer dcfc, FieldKey attr_id) throws NonExistentAttributeException - Throws:
NonExistentAttributeException
-
byte2bytes
protected static byte[] byte2bytes(byte b) -
bytes2byte
- Throws:
RuntimeException
-
short2bytes
protected static byte[] short2bytes(short s) -
bytes2short
- Throws:
RuntimeException
-
int2bytes
protected static byte[] int2bytes(int i) -
bytes2int
- Throws:
RuntimeException
-
long2bytes
protected static byte[] long2bytes(long l) -
bytes2long
- Throws:
RuntimeException
-
float2bytes
protected static byte[] float2bytes(float f) -
bytes2float
- Throws:
RuntimeException
-
double2bytes
protected static byte[] double2bytes(double d) -
bytes2double
- Throws:
RuntimeException
-
processRecord
- Throws:
NPLException
-