com.solab.iso8583.parse
Class ConfigParser

java.lang.Object
  extended by com.solab.iso8583.parse.ConfigParser

public class ConfigParser
extends Object

This class is used to parse a XML configuration file and configure a MessageFactory with the values from it.

Author:
Enrique Zamudio

Constructor Summary
ConfigParser()
           
 
Method Summary
static void configureFromClasspathConfig(MessageFactory mfact, String path)
          Configures a MessageFactory using the configuration file at the path specified (will be searched within the classpath using the MessageFactory's ClassLoader).
static void configureFromDefault(MessageFactory mfact)
          Configures a MessageFactory using the default configuration file j8583.xml.
static MessageFactory createDefault()
          Creates a message factory configured from the default file, which is j8583.xml located in the root of the classpath.
static MessageFactory createFromClasspathConfig(String path)
          Creates a message factory from the specified path inside the classpath.
static MessageFactory createFromUrl(URL url)
          Creates a message factory from the file located at the specified URL.
protected static void parse(MessageFactory mfact, InputStream stream)
          Reads the XML from the stream and configures the message factory with its values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigParser

public ConfigParser()
Method Detail

createDefault

public static MessageFactory createDefault()
                                    throws IOException
Creates a message factory configured from the default file, which is j8583.xml located in the root of the classpath.

Throws:
IOException

createFromClasspathConfig

public static MessageFactory createFromClasspathConfig(String path)
                                                throws IOException
Creates a message factory from the specified path inside the classpath.

Throws:
IOException

createFromUrl

public static MessageFactory createFromUrl(URL url)
                                    throws IOException
Creates a message factory from the file located at the specified URL.

Throws:
IOException

parse

protected static void parse(MessageFactory mfact,
                            InputStream stream)
                     throws IOException
Reads the XML from the stream and configures the message factory with its values.

Parameters:
mfact - The message factory to be configured with the values read from the XML.
stream - The InputStream containing the XML configuration.
Throws:
IOException

configureFromDefault

public static void configureFromDefault(MessageFactory mfact)
                                 throws IOException
Configures a MessageFactory using the default configuration file j8583.xml. This is useful if you have a MessageFactory created using Spring for example.

Throws:
IOException

configureFromClasspathConfig

public static void configureFromClasspathConfig(MessageFactory mfact,
                                                String path)
                                         throws IOException
Configures a MessageFactory using the configuration file at the path specified (will be searched within the classpath using the MessageFactory's ClassLoader). This is useful for configuring Spring-bound instances of MessageFactory for example.

Throws:
IOException