co.uk.hjcs.canyon.provider.impl
Class DefaultFileProvider

java.lang.Object
  extended by co.uk.hjcs.canyon.provider.impl.DefaultFileProvider
All Implemented Interfaces:
CanyonConfigProvider, CanyonInputProvider, CanyonOutputProvider

public class DefaultFileProvider
extends java.lang.Object
implements CanyonInputProvider, CanyonOutputProvider, CanyonConfigProvider

The default file provider. Sources config, input and output files based on the fileName. If the file cannot be read (ie does not exist, or does not have permision) and the file value createable is false validation will fail and an exception will be thrown

Author:
HJC Solutions Ltd (http://canyon.hjcsolutions.co.uk)

Constructor Summary
DefaultFileProvider()
           
DefaultFileProvider(java.lang.String fileName)
           
DefaultFileProvider(java.lang.String fileName, boolean createable, boolean appendable)
           
 
Method Summary
 java.io.InputStream getConfigStream(java.lang.String fileName, java.util.Properties properties)
          This interface provides the capability to load the mapping and configuration for Canyon to process.
 java.io.InputStream[] getInputStreams(java.util.Properties properties)
          Returns an array of input streams to be consumed as input configuration or data
 java.io.OutputStream[] getOutputStreams(java.util.Properties properties)
          Returns an array of output streams to be used for output data
 void validate(java.util.Properties properties)
          Is called to validate the input streams, so that Canyon can operate on them
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFileProvider

public DefaultFileProvider(java.lang.String fileName,
                           boolean createable,
                           boolean appendable)

DefaultFileProvider

public DefaultFileProvider(java.lang.String fileName)

DefaultFileProvider

public DefaultFileProvider()
Method Detail

getInputStreams

public java.io.InputStream[] getInputStreams(java.util.Properties properties)
Description copied from interface: CanyonInputProvider
Returns an array of input streams to be consumed as input configuration or data

Specified by:
getInputStreams in interface CanyonInputProvider
Parameters:
properties - - the properties defined in the configuration
Returns:
- the input stream to read objects from

validate

public void validate(java.util.Properties properties)
              throws CanyonException
Description copied from interface: CanyonInputProvider
Is called to validate the input streams, so that Canyon can operate on them

Specified by:
validate in interface CanyonInputProvider
Specified by:
validate in interface CanyonOutputProvider
Parameters:
properties - - the properties defined in the configuration
Throws:
CanyonException

getOutputStreams

public java.io.OutputStream[] getOutputStreams(java.util.Properties properties)
Description copied from interface: CanyonOutputProvider
Returns an array of output streams to be used for output data

Specified by:
getOutputStreams in interface CanyonOutputProvider
Parameters:
properties - - the properties defined in the configuration
Returns:
- the Outputstream to persist object to

getConfigStream

public java.io.InputStream getConfigStream(java.lang.String fileName,
                                           java.util.Properties properties)
Description copied from interface: CanyonConfigProvider
This interface provides the capability to load the mapping and configuration for Canyon to process. By using this interface the configuration can be loaded from any source e.g. a database, a webservice etc. The stream must still return XML in the required format for processing

Specified by:
getConfigStream in interface CanyonConfigProvider
Parameters:
fileName - - the name of the stream to load
properties - - the properties associated with the configuration parameter
Returns:
the stream of the configuration required for processing. If stream cannot be found null must be returned