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

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

public class ResourceFileProvider
extends java.lang.Object
implements CanyonInputProvider, CanyonConfigProvider

The default resource provider. Sources config and input streams based on the resource name. If the stream cannot be found validation will fail and an exception will be thrown

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

Constructor Summary
ResourceFileProvider(java.lang.String resourceName)
           
 
Method Summary
 java.io.InputStream getConfigStream(java.lang.String streamName, 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
 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

ResourceFileProvider

public ResourceFileProvider(java.lang.String resourceName)
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
Parameters:
properties - - the properties defined in the configuration
Throws:
CanyonException

getConfigStream

public java.io.InputStream getConfigStream(java.lang.String streamName,
                                           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:
streamName - - 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