org.jpos.iso.packager
Class GenericPackager

java.lang.Object
  extended by org.jpos.iso.ISOBasePackager
      extended by org.jpos.iso.packager.GenericPackager
All Implemented Interfaces:
Configurable, ISOPackager, LogSource
Direct Known Subclasses:
GenericSubFieldPackager, GenericValidatingPackager, X92GenericPackager

public class GenericPackager
extends ISOBasePackager
implements Configurable

 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 and emitBitmap
 are allowed on the isopackager node.

 

Version:
$Revision$ $Date$
Author:
Eoin Flood
See Also:
ISOPackager, ISOBasePackager

Nested Class Summary
 class GenericPackager.GenericContentHandler
           
 class GenericPackager.GenericEntityResolver
           
 
Field Summary
 
Fields inherited from class org.jpos.iso.ISOBasePackager
fld, headerLength, logger, realm
 
Constructor Summary
GenericPackager()
           
GenericPackager(InputStream input)
          Create a GenericPackager with the field descriptions from an XML InputStream
GenericPackager(String filename)
          Create a GenericPackager with the field descriptions from an XML File
 
Method Summary
protected  boolean emitBitMap()
           
protected  ISOFieldPackager getBitMapfieldPackager()
           
 String getDescription()
           
protected  int getFirstField()
          usually 2 for normal fields, 1 for bitmap-less or ANSI X9.2
protected  int getMaxValidField()
           
 void readFile(InputStream input)
          Parse the field descriptions from an XML InputStream.
 void readFile(String filename)
          Parse the field descriptions from an XML file.
 void setConfiguration(Configuration cfg)
          Packager Configuration.
 void setLogger(Logger logger, String realm)
           
 
Methods inherited from class org.jpos.iso.ISOBasePackager
createISOMsg, getFieldDescription, getFieldPackager, getHeaderLength, getLogger, getRealm, pack, setFieldPackager, setFieldPackager, setHeaderLength, unpack, unpack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericPackager

public GenericPackager()
                throws ISOException
Throws:
ISOException

GenericPackager

public GenericPackager(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(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.

Specified by:
setConfiguration in interface Configurable
Parameters:
cfg - Configuration
Throws:
ConfigurationException

getMaxValidField

protected int getMaxValidField()
Overrides:
getMaxValidField in class ISOBasePackager
Returns:
128 for ISO-8583, should return 64 for ANSI X9.2

emitBitMap

protected boolean emitBitMap()
Overrides:
emitBitMap in class ISOBasePackager
Returns:
true if BitMap have to be emited

getBitMapfieldPackager

protected ISOFieldPackager getBitMapfieldPackager()
Overrides:
getBitMapfieldPackager in class ISOBasePackager
Returns:
suitable ISOFieldPackager for Bitmap

readFile

public void readFile(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(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,
                      String realm)
Specified by:
setLogger in interface LogSource
Overrides:
setLogger in class ISOBasePackager

getDescription

public String getDescription()
Specified by:
getDescription in interface ISOPackager
Overrides:
getDescription in class ISOBasePackager
Returns:
Packager's Description

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 class ISOBasePackager
Returns:
first valid field


Copyright © 1998-2012 jPOS.org. All Rights Reserved.