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

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

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

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

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

Constructor Summary
PropertyFileProvider(java.lang.String propertyName, boolean createable, boolean appendable)
           
 
Method Summary
 java.io.InputStream getConfigStream(java.lang.String propertyName, 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

PropertyFileProvider

public PropertyFileProvider(java.lang.String propertyName,
                            boolean createable,
                            boolean appendable)
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 propertyName,
                                           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:
propertyName - - 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