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 NPLFunctionTableprotected static byte[]byte2bytes(byte b) protected static bytebytes2byte(byte[] barr) protected static doublebytes2double(byte[] barr) protected static floatbytes2float(byte[] barr) protected static intbytes2int(byte[] barr) protected static longbytes2long(byte[] barr) protected static shortbytes2short(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 DCFieldContainerReturns the Class for the DCFieldContainer object that this NPLProgram will produce.voidhandleException(String msg, Exception e) Exception handler for exceptions that occur during NPL program execution.protected voidprotected 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) voidsetDataReceiver(DataReceiverIfc ireceiver) voidSets the LoggerIfc to be used for logging messages generated by this NPLProgram during data processingvoidSet the method handler object of the NPL program corresponding to the method handler imported by the NPL program.voidsetOutputType(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:
getLoggerin interfaceNPLProgramIfc
-
setLogger
Sets the LoggerIfc to be used for logging messages generated by this NPLProgram during data processing- Specified by:
setLoggerin 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:
getDataReceiverin interfaceNPLProgramIfc
-
setDataReceiver
- Specified by:
setDataReceiverin interfaceNPLProgramIfc
-
processData
Description copied from interface:NPLProgramIfcProcess 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:
processDatain 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:NPLProgramIfcSet the method handler object of the NPL program corresponding to the method handler imported by the NPL program.- Specified by:
setMethodHandlerin 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:NPLProgramIfcReturns the method handler imported by the NPL program and set usingsetMethodHandler(IDCMethodHandler mh).- Specified by:
getMethodHandlerin interfaceNPLProgramIfc
-
getMethodHandler
Description copied from interface:NPLProgramIfcReturns the method handler with the specified name. UseIMPORTED_JAVA_HANDLER_NAMEto 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:
getMethodHandlerin 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:NPLProgramIfcGets a list of the input fields defined in the input records.- Specified by:
getInputFieldsin interfaceNPLProgramIfc- Returns:
- List of input fields. The elements in this
ArrayListare actually otherArrayLists, one for each input record. The elements of theseArrayLists areFieldDescriptorobjects, one for each field in the input record.
-
getOutputFields
Description copied from interface:NPLProgramIfcGets a list of the output fields defined in the output records.- Specified by:
getOutputFieldsin interfaceNPLProgramIfc- Returns:
- List of output fields. The elements in this
ArrayListare actually otherArrayLists, one for each output record. The elements of theseArrayLists areFieldDescriptorobjects, one for each field in the output record.
-
getExposedFields
Description copied from interface:NPLProgramIfcGets a list of the fields defined in the expose clause for the reason provided.- Specified by:
getExposedFieldsin interfaceNPLProgramIfc- Parameters:
reason- Reason the fields are being exposed.- Returns:
- List of exposed fields. The elements in the
ArrayListareFieldDescriptorobjects, one for each field in the expose clause matching the reason provided.
-
getConfigValue
Description copied from interface:NPLProgramIfcGets the value of a configuration attribute.- Specified by:
getConfigValuein 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
-