Package org.jpos.iso.packager
Class GenericPackager
- java.lang.Object
-
- org.jpos.iso.ISOBasePackager
-
- org.jpos.iso.packager.GenericPackager
-
- All Implemented Interfaces:
Configurable
,ISOPackager
,GenericPackagerParams
,LogSource
- Direct Known Subclasses:
BERTLVPackager
,GenericSubFieldPackager
,GenericTaggedFieldsPackager
,GenericValidatingPackager
,GICCSubFieldPackager
,TaggedSequencePackager
,X92GenericPackager
public class GenericPackager extends ISOBasePackager implements Configurable, GenericPackagerParams
GenericPackager uses an XML config file to describe the layout of an ISOMessage The general format is as follows <isopackager> <isofield id="[field id]" name="[field name]" length="[max field length]" class="[org.jpos.iso.IF_*]" pad="true|false"> </isofield> ... </isopackager> Fields that contain subfields can be handled as follows <isofieldpackager id="[field id]" name="[field name]" length="[field length]" class="[org.jpos.iso.IF_*]" packager="[org.jpos.iso.packager.*]"> <isofield id="[subfield id]" name="[subfield name]" length="[max subfield length]" class="[org.jpos.iso.IF_*]" pad="true|false"> </isofield> ... </isofieldpackager> The optional attributes maxValidField, bitmapField, thirdBitmapField, and emitBitmap are allowed on the isopackager node.
- See Also:
ISOPackager
,ISOBasePackager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GenericPackager.GenericContentHandler
static class
GenericPackager.GenericEntityResolver
-
Field Summary
-
Fields inherited from class org.jpos.iso.ISOBasePackager
fld, headerLength, logFieldName, logger, realm, thirdBitmapField
-
-
Constructor Summary
Constructors Constructor Description GenericPackager()
GenericPackager(java.io.InputStream input)
Create a GenericPackager with the field descriptions from an XML InputStreamGenericPackager(java.lang.String filename)
Create a GenericPackager with the field descriptions from an XML File
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
emitBitMap()
protected ISOFieldPackager
getBitMapfieldPackager()
java.lang.String
getDescription()
protected int
getFirstField()
usually 2 for normal fields, 1 for bitmap-less or ANSI X9.2protected int
getMaxValidField()
void
readFile(java.io.InputStream input)
Parse the field descriptions from an XML InputStream.void
readFile(java.lang.String filename)
Parse the field descriptions from an XML file.void
setConfiguration(Configuration cfg)
Packager Configuration.void
setGenericPackagerParams(org.xml.sax.Attributes atts)
void
setLogger(Logger logger, java.lang.String realm)
-
Methods inherited from class org.jpos.iso.ISOBasePackager
createISOMsg, fieldUnpackLogger, getFieldDescription, getFieldPackager, getHeaderLength, getLogger, getRealm, getThirdBitmapField, pack, setFieldPackager, setFieldPackager, setHeaderLength, setThirdBitmapField, unpack, unpack
-
-
-
-
Constructor Detail
-
GenericPackager
public GenericPackager() throws ISOException
- Throws:
ISOException
-
GenericPackager
public GenericPackager(java.lang.String filename) throws ISOException
Create a GenericPackager with the field descriptions from an XML File- Parameters:
filename
- The XML field description file- Throws:
ISOException
-
GenericPackager
public GenericPackager(java.io.InputStream input) throws ISOException
Create a GenericPackager with the field descriptions from an XML InputStream- Parameters:
input
- The XML field description InputStream- Throws:
ISOException
-
-
Method Detail
-
setConfiguration
public void setConfiguration(Configuration cfg) throws ConfigurationException
Packager Configuration.- packager-config
- packager-logger
- packager-log-fieldname
- packager-realm
- Specified by:
setConfiguration
in interfaceConfigurable
- Parameters:
cfg
- Configuration- Throws:
ConfigurationException
-
getMaxValidField
protected int getMaxValidField()
- Overrides:
getMaxValidField
in classISOBasePackager
- Returns:
- 128 for ISO-8583, should return 64 for ANSI X9.2
-
emitBitMap
protected boolean emitBitMap()
- Overrides:
emitBitMap
in classISOBasePackager
- Returns:
- true if BitMap have to be emited
-
getBitMapfieldPackager
protected ISOFieldPackager getBitMapfieldPackager()
- Overrides:
getBitMapfieldPackager
in classISOBasePackager
- Returns:
- suitable ISOFieldPackager for Bitmap
-
readFile
public void readFile(java.lang.String filename) throws ISOException
Parse the field descriptions from an XML file.Uses the sax parser specified by the system property 'sax.parser' The default parser is org.apache.crimson.parser.XMLReaderImpl
- Parameters:
filename
- The XML field description file- Throws:
ISOException
-
readFile
public void readFile(java.io.InputStream input) throws ISOException
Parse the field descriptions from an XML InputStream.Uses the sax parser specified by the system property 'sax.parser' The default parser is org.apache.crimson.parser.XMLReaderImpl
- Parameters:
input
- The XML field description InputStream- Throws:
ISOException
-
setLogger
public void setLogger(Logger logger, java.lang.String realm)
- Specified by:
setLogger
in interfaceLogSource
- Overrides:
setLogger
in classISOBasePackager
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceISOPackager
- Overrides:
getDescription
in classISOBasePackager
- Returns:
- Packager's Description
-
setGenericPackagerParams
public void setGenericPackagerParams(org.xml.sax.Attributes atts)
- Specified by:
setGenericPackagerParams
in interfaceGenericPackagerParams
-
getFirstField
protected int getFirstField()
Description copied from class:ISOBasePackager
usually 2 for normal fields, 1 for bitmap-less or ANSI X9.2- Overrides:
getFirstField
in classISOBasePackager
- Returns:
- first valid field
-
-