public abstract class BaseNPLProgram extends java.lang.Object implements NPLProgramIfc
Modifier and Type | Field and Description |
---|---|
static NonExistentAttributeException |
nonexistent_attr_exception |
IMPORTED_JAVA_HANDLER_NAME
Constructor and Description |
---|
BaseNPLProgram()
Initializes this NPL program's built-in function table.
|
BaseNPLProgram(java.lang.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.
|
Modifier and Type | Method and Description |
---|---|
protected NPLFunctionTable |
builtInFunctionTable() |
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) |
java.lang.String |
getConfigValue(java.lang.String key)
Gets the value of a configuration attribute.
|
DataReceiverIfc |
getDataReceiver() |
java.util.ArrayList |
getExposedFields(java.lang.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,
java.lang.String attr_id) |
protected static byte[] |
getFieldValueAsString(DCFieldContainer dcfc,
FieldKey attr_id) |
java.util.ArrayList |
getInputFields()
Gets a list of the input fields defined in the input records.
|
LoggerIfc |
getLogger()
Returns the LoggerIfc being used to log messages generated by this
NPLProgram during data processing
|
IDCMethodHandler |
getMethodHandler()
Returns the method handler imported by the NPL program and set
using
setMethodHandler(IDCMethodHandler mh) . |
IDCMethodHandler |
getMethodHandler(java.lang.String name)
Returns the method handler with the specified name.
|
java.util.ArrayList |
getOutputFields()
Gets a list of the output fields defined in the output records.
|
protected DCFieldContainer |
getOutputRecInstance() |
java.lang.Class |
getOutputType()
Returns the Class for the DCFieldContainer object that this
NPLProgram will produce.
|
void |
handleException(java.lang.String msg,
java.lang.Exception e)
Exception handler for exceptions that occur during NPL program execution.
|
protected void |
initBuiltInFunctionTable() |
protected static byte[] |
int2bytes(int i) |
protected static byte[] |
long2bytes(long l) |
DCFieldContainer[] |
processData(DCFieldContainer input,
java.lang.Class out_type)
Process the given input fields with this NPL program.
|
protected abstract DCFieldContainer[] |
processRecord(DCFieldContainer input) |
void |
setDataReceiver(DataReceiverIfc ireceiver) |
void |
setLogger(LoggerIfc logIfc)
Sets the LoggerIfc to be used for logging messages generated by this
NPLProgram during data processing
|
void |
setMethodHandler(IDCMethodHandler mh)
Set the method handler object of the NPL program corresponding to
the method handler imported by the NPL program.
|
void |
setOutputType(java.lang.Class out_type)
Returns the Class for the DCFieldContainer object that this
NPLProgram will produce.
|
protected static byte[] |
short2bytes(short s) |
public static final NonExistentAttributeException nonexistent_attr_exception
public BaseNPLProgram()
public BaseNPLProgram(java.lang.Class outputType, DataReceiverIfc ireceiver, LoggerIfc logIfc)
public LoggerIfc getLogger()
getLogger
in interface NPLProgramIfc
public void setLogger(LoggerIfc logIfc)
setLogger
in interface NPLProgramIfc
public java.lang.Class getOutputType()
public void setOutputType(java.lang.Class out_type) throws java.lang.ClassCastException
java.lang.ClassCastException
public DataReceiverIfc getDataReceiver()
getDataReceiver
in interface NPLProgramIfc
public void setDataReceiver(DataReceiverIfc ireceiver)
setDataReceiver
in interface NPLProgramIfc
public DCFieldContainer[] processData(DCFieldContainer input, java.lang.Class out_type) throws NPLException
NPLProgramIfc
processData
in interface NPLProgramIfc
input
- input fields to processout_type
- type of any output records created by this NPL program
(must implement DCFieldContainer interface)NPLException
- if error while processing datapublic void setMethodHandler(IDCMethodHandler mh) throws NPLException
NPLProgramIfc
setMethodHandler
in interface NPLProgramIfc
mh
- object that implements sub-interface of IDCMethodHandlerNPLException
- if object passed to this method does not
implement interface imported in NPL filepublic IDCMethodHandler getMethodHandler()
NPLProgramIfc
setMethodHandler(IDCMethodHandler mh)
.getMethodHandler
in interface NPLProgramIfc
public IDCMethodHandler getMethodHandler(java.lang.String name)
NPLProgramIfc
IMPORTED_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.getMethodHandler
in interface NPLProgramIfc
name
- name of method handler to getpublic java.util.ArrayList getInputFields()
NPLProgramIfc
getInputFields
in interface NPLProgramIfc
ArrayList
are actually other
ArrayList
s, one for each input record.
The elements of these ArrayList
s are
FieldDescriptor
objects, one for each
field in the input record.public java.util.ArrayList getOutputFields()
NPLProgramIfc
getOutputFields
in interface NPLProgramIfc
ArrayList
are actually other
ArrayList
s, one for each output record.
The elements of these ArrayList
s are
FieldDescriptor
objects, one for each
field in the output record.public java.util.ArrayList getExposedFields(java.lang.String reason)
NPLProgramIfc
getExposedFields
in interface NPLProgramIfc
reason
- Reason the fields are being exposed.ArrayList
are
FieldDescriptor
objects, one
for each field in the expose clause matching
the reason provided.public java.lang.String getConfigValue(java.lang.String key)
NPLProgramIfc
getConfigValue
in interface NPLProgramIfc
key
- Configuration attribute to get the value of.public void handleException(java.lang.String msg, java.lang.Exception e)
msg
- a text message that is prepended to the standard message
of the exception handlere
- the exception that occurredprotected DCFieldContainer getOutputRecInstance() throws NPLException
NPLException
protected void initBuiltInFunctionTable()
protected NPLFunctionTable builtInFunctionTable()
protected static byte[] getFieldValue(DCFieldContainer dcfc, java.lang.String attr_id) throws NonExistentAttributeException
NonExistentAttributeException
protected static byte[] getFieldValue(DCFieldContainer dcfc, FieldKey attr_id) throws NonExistentAttributeException
NonExistentAttributeException
protected static byte[] getFieldValueAsString(DCFieldContainer dcfc, FieldKey attr_id) throws NonExistentAttributeException
NonExistentAttributeException
protected static byte[] byte2bytes(byte b)
protected static byte bytes2byte(byte[] barr) throws java.lang.RuntimeException
java.lang.RuntimeException
protected static byte[] short2bytes(short s)
protected static short bytes2short(byte[] barr) throws java.lang.RuntimeException
java.lang.RuntimeException
protected static byte[] int2bytes(int i)
protected static int bytes2int(byte[] barr) throws java.lang.RuntimeException
java.lang.RuntimeException
protected static byte[] long2bytes(long l)
protected static long bytes2long(byte[] barr) throws java.lang.RuntimeException
java.lang.RuntimeException
protected static byte[] float2bytes(float f)
protected static float bytes2float(byte[] barr) throws java.lang.RuntimeException
java.lang.RuntimeException
protected static byte[] double2bytes(double d)
protected static double bytes2double(byte[] barr) throws java.lang.RuntimeException
java.lang.RuntimeException
protected abstract DCFieldContainer[] processRecord(DCFieldContainer input) throws NPLException
NPLException