biz.c24.io.api.presentation.swift
Class SwiftPreParser

java.lang.Object
  extended by biz.c24.io.api.presentation.Source
      extended by biz.c24.io.api.presentation.swift.SwiftPreParser
All Implemented Interfaces:
Serializable, Cloneable

public class SwiftPreParser
extends Source

A source capable of parsing any SWIFT message.

If the element passed to the readObject(biz.c24.io.api.data.Element) method is null then the appropriate message type will be found via reflection. If the base package name has not been set, then the SWIFT messages will be presumed to have been deployed into (the default) packages:
biz.c24.io.swift2008.mt1xx
biz.c24.io.swift2008.mt2xx
biz.c24.io.swift2008.mt3xx
biz.c24.io.swift2008.mt4xx
biz.c24.io.swift2008.mt5xx
biz.c24.io.swift2008.mt6xx
biz.c24.io.swift2008.mt7xx
biz.c24.io.swift2008.mt8xx
biz.c24.io.swift2008.mt9xx
biz.c24.io.swift2008.commongroup
If none of these yield a valid class then the default packages for past releases will be examined, i.e. biz.c24.io.swift2006.*, biz.c24.io.swift2005.*, biz.c24.io.swift2003.*, biz.c24.io.swift2002.*.
The elements that represent the root of the message types will be presumed to use the (default) naming scheme of the SWIFT data model, i.e. "MTxxxi" for incoming messages or "MTxxxo" for outgoing messages.

If the element passed to the readObject(biz.c24.io.api.data.Element) method is not null then it should have a complex type which contains elements whose types are the incoming and outgoing SWIFT messages. The names of these elements should conform to the naming scheme described above.

See Also:
Source, Serialized Form

Constructor Summary
SwiftPreParser()
          Constructs a new instance.
SwiftPreParser(InputStream stream)
          Constructs a new instance which will read from stream.
SwiftPreParser(Reader reader)
          Constructs a new instance which will read from reader.
SwiftPreParser(SwiftPreParser clone)
          Constructs a new instance cloned from clone.
 
Method Summary
 Object clone()
           
 String getBasePackageName()
          Returns the base package name.
 ClassLoader getClassLoader()
          Returns the class loader.
 TextualSource getWrappedSource()
          Deprecated. Use getWrappedSwiftSource() instead.
 SwiftSource getWrappedSwiftSource()
           
 ComplexDataObject readObject()
          Reads an object from the the reader or input stream that has been set, infering the SWIFT FIN message type by pre-parsing the required header blocks.
 void readObject(ComplexDataObject object)
          Reads an object from the the reader or input stream that has been set (optional operation).
 ComplexDataObject readObject(Element element)
          Reads an object from the the reader or input stream that has been set.
 SwiftMessage readSwiftMessage()
          Reads a SwiftMessage from the the reader or input stream that has been set, infering the SWIFT FIN message type by pre-parsing.
 void setBasePackageName(String basePackageName)
          Sets the base package name.
 void setClassLoader(ClassLoader classLoader)
          Sets the class loader.
 void setInputStream(InputStream stream, URI systemId)
          Sets the input stream and system ID (optional operation).
 void setReader(Reader reader)
          Sets the reader (optional operation).
 
Methods inherited from class biz.c24.io.api.presentation.Source
checkInit, getEncoding, getInputStream, getMarkableInputStream, getParseListener, getReader, getSystemId, reader, ready, setEncoding, setInputStream, setParseListener, setReader, setSystemId, stream
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwiftPreParser

public SwiftPreParser()
Constructs a new instance.


SwiftPreParser

public SwiftPreParser(SwiftPreParser clone)
Constructs a new instance cloned from clone.

Parameters:
clone - The instance to clone.

SwiftPreParser

public SwiftPreParser(Reader reader)
Constructs a new instance which will read from reader.

Parameters:
reader - The reader to read the SWIFT data from.

SwiftPreParser

public SwiftPreParser(InputStream stream)
Constructs a new instance which will read from stream.

Parameters:
stream - The stream to read the SWIFT data from.
Method Detail

getBasePackageName

public String getBasePackageName()
Returns the base package name.
The base package name is used to locate the SWIFT message elements when null is passed to the readObject(biz.c24.io.api.data.Element) method.

Returns:
The base package name, or null if it has not been set.

setBasePackageName

public void setBasePackageName(String basePackageName)
Sets the base package name.
If this property has not been set then the default package name for the message type will be used.

Parameters:
basePackageName - The new base package name.

getClassLoader

public ClassLoader getClassLoader()
Returns the class loader.
The class loader is used when loading resolved types.

Returns:
The class loader.

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets the class loader. If this property has not been set then the class loader of this class will be used.

Parameters:
classLoader - The new class loader.

setReader

public void setReader(Reader reader)
Description copied from class: Source
Sets the reader (optional operation). This method will also clear the system ID.

Overrides:
setReader in class Source
Parameters:
reader - The new value.

setInputStream

public void setInputStream(InputStream stream,
                           URI systemId)
Description copied from class: Source
Sets the input stream and system ID (optional operation).

Overrides:
setInputStream in class Source
Parameters:
stream - The new value.
systemId - The system ID identifying the stream.

readObject

public ComplexDataObject readObject(Element element)
                             throws IOException
Reads an object from the the reader or input stream that has been set.

This method can be used as for other Source subclasses. Passing the value (Element) null is equivalent to calling readObject() and this later approach should be preferred for code simplicity.

Specified by:
readObject in class Source
Parameters:
element - The element declaration to which the input data is expected to adhere.
Returns:
The newly created object.
Throws:
IOException - If the complete object could not be read for any reason.

readObject

public void readObject(ComplexDataObject object)
                throws IOException
Reads an object from the the reader or input stream that has been set (optional operation).

This method can be used as for other Source subclasses. Passing the value (ComplexDataObject) null is equivalent to calling readObject() and this later approach should be preferred for code simplicity.

Specified by:
readObject in class Source
Parameters:
object - The object into which the input data should be parsed.
Throws:
IOException - If the complete object could not be read for any reason.

readObject

public ComplexDataObject readObject()
                             throws IOException
Reads an object from the the reader or input stream that has been set, infering the SWIFT FIN message type by pre-parsing the required header blocks.

Returns:
The newly created object.
Throws:
IOException - If there is a problem reading the message.

readSwiftMessage

public SwiftMessage readSwiftMessage()
                              throws IOException
Reads a SwiftMessage from the the reader or input stream that has been set, infering the SWIFT FIN message type by pre-parsing.

This method wraps the return value of readObject() in a new SwiftMessage object.

Returns:
The newly created SWIFT message object.
Throws:
IOException - If there is a problem reading the message.

getWrappedSource

public TextualSource getWrappedSource()
Deprecated. Use getWrappedSwiftSource() instead.

Gets the underlying source that will be used to parse the actual SWIFT message.

Returns:
The underlying source.

getWrappedSwiftSource

public SwiftSource getWrappedSwiftSource()

clone

public Object clone()
Specified by:
clone in class Source


C24 Technologies © 2002-2012: All Rights Reserved.