com.ddtek.xmlconverter
Class Configuration

java.lang.Object
  extended by com.ddtek.xmlconverter.Configuration

public class Configuration
extends Object

A Configuration object contains user settable policies that govern certain aspects of the conversion process.

Each ConverterFactory contains a Configuration object which can be modified by the application; any changes affect all Converter objects created subsequently from that ConverterFactory.

When the user creates a Converter object from the ConverterFactory, the Converter object gets a copy of the factory's Configuration. This copy can also be modified by the application if desired.

The Configuration object is fully Thread-safe, however if one Thread modifies a Configuration object, that may affect the behavior of another Thread's conversion which is using the same Configuration.


Field Summary
static int ABORT
          Value for setBufferOverflowPolicy and setTempFilePolicy.
static int UNLIMITED_BUFFER
          Value for setMaxBufferSize to indicate there should be no limit.
static int USE_MEMORY
          Value for setTempFilePolicy.
static int USE_TEMP_FILE
          Value for setBufferOverflowPolicy.
 
Constructor Summary
 
Method Summary
 int getBufferOverflowPolicy()
          Get the current value of the memory buffer overflow policy.
 ConverterListener getConverterListener()
          Return the current ConverterListener
 int getMaxBufferSize()
          Get the current size limit for the memory buffer.
 String getProperty(String property, String defaultValue)
          Get the current value of a property which affects the behavior of an XML Converter.
 int getTempFilePolicy()
          Get the current value of the temp file policy.
 void setBufferOverflowPolicy(int value)
          Set the memory buffer overflow policy.
 void setConverterListener(ConverterListener listener)
          Set a ConverterListener
 void setEDIExtension(StreamSource source)
          Load a SEF file to be used by EDI converters.
 void setMaxBufferSize(int value)
          Set the maximum size limit for the memory buffer.
 void setProperty(String property, String value)
          Set a property which affects the behavior of an XML Converter.
 void setTempFilePolicy(int value)
          Set the temp file policy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNLIMITED_BUFFER

public static final int UNLIMITED_BUFFER
Value for setMaxBufferSize to indicate there should be no limit.

See Also:
Constant Field Values

ABORT

public static final int ABORT
Value for setBufferOverflowPolicy and setTempFilePolicy.

See Also:
Constant Field Values

USE_TEMP_FILE

public static final int USE_TEMP_FILE
Value for setBufferOverflowPolicy.

See Also:
Constant Field Values

USE_MEMORY

public static final int USE_MEMORY
Value for setTempFilePolicy.

See Also:
Constant Field Values
Constructor Detail
Method Detail

getMaxBufferSize

public int getMaxBufferSize()
Get the current size limit for the memory buffer.


setMaxBufferSize

public void setMaxBufferSize(int value)
Set the maximum size limit for the memory buffer. The value UNLIMITED_BUFFER indicates that the memory buffer can grow without limit. Any positive value is used as the size limit for the memory buffer. The default value is 1MB.


getBufferOverflowPolicy

public int getBufferOverflowPolicy()
Get the current value of the memory buffer overflow policy.


setBufferOverflowPolicy

public void setBufferOverflowPolicy(int value)
Set the memory buffer overflow policy. Permitted values are: The default is USE_TEMP_FILE.


getTempFilePolicy

public int getTempFilePolicy()
Get the current value of the temp file policy.


setTempFilePolicy

public void setTempFilePolicy(int value)
Set the temp file policy. Permitted values are: The default is ABORT.


setProperty

public void setProperty(String property,
                        String value)
Set a property which affects the behavior of an XML Converter. Currently, there are no supported properties.

Parameters:
property - The property name.
value - The property value.

getProperty

public String getProperty(String property,
                          String defaultValue)
Get the current value of a property which affects the behavior of an XML Converter. Currently, there are no supported properties.

Parameters:
property - The property name.
defaultValue - The default value if the property is not set.
Returns:
The value associated with the property name.

getConverterListener

public ConverterListener getConverterListener()
Return the current ConverterListener

Returns:
Returns the current error handling object, or null if no handler is set and the default error handling action should be taken.

setConverterListener

public void setConverterListener(ConverterListener listener)
Set a ConverterListener

Parameters:
listener - The ConverterListener object, or null to revert to the default error handling behavior. If an error handler is set at the ConverterFactory level, then each instance of a Converter created by that factory will share the same instance of the ConverterListener set here.

setEDIExtension

public void setEDIExtension(StreamSource source)
                     throws IOException
Load a SEF file to be used by EDI converters. The source parameter must identify a SEF file (EDI Standard Exchange Format). When the setEDIExtension method is called, the input is immediately read and parsed, building an internal representation of the SEF file to be used by subsequent EDI conversions.

Converter objects have an extensive, builtin repository of 100s of EDI standards. For most uses, it is not necessary to provide a SEF file. However, if you need to do a conversion where the data varies from the published EDI standards, you can use a SEF file to identify the necessary modifications to the EDI standards. The SEF file does not need to contain the entire standard, just those parts which have been changed.

If the SEF file was built by the Stylus Studio EDI to XML editor, then it will contain a converter:EDI URI. The properties in that URI will be used for all conversions which use this Configuration object.

Parameters:
source - source designates the SEF file. If source contains an InputStream, that will be used. Otherwise, if it contains a Reader, that will be used. Otherwise, it must contain a systemID which will be opened using an instance of ConverterResolver. If source is null, the extension object (if any) will be removed from this Configuration.
Throws:
IOException