com.rhi.architecture.parc.adapter
Class AbstractInputAdapter

java.lang.Object
  extended bycom.rhi.architecture.parc.adapter.AbstractInputAdapter
All Implemented Interfaces:
Adapter, InputAdapter
Direct Known Subclasses:
AbstractFileInputAdapter, JDBCInputAdapter, JDOInputAdapter, XMLInputAdapter

public abstract class AbstractInputAdapter
extends java.lang.Object
implements InputAdapter

The InputAdapter is responsible for creating the work set that the pipeline will execute on. Common implementations will load records from either a file or from the database.

Since:
1.0
Author:
Pete McKinstry

Constructor Summary
AbstractInputAdapter()
          Default contstructor
 
Method Summary
 void addToErrorChannel(Record record)
          The concrete input adapter can use this method to add error records to the error channel while maintaining the correct audit entries for valid (returned from loadBatch() & pushed into the normal pipeline channel) & errors (added by calling addError() & pushed into the error channel.
 void cleanup()
          No-op cleanup method.
 AuditAgent getAuditAgent()
          get audit agent
protected  java.util.Collection getErrors()
          get errors
 void init(java.util.Properties props)
          No-op init() method.
protected abstract  java.util.Collection loadBatch()
          Retrieve the batch.
 int push(Channel validChannel)
          Push a set of records into the pipeline.
 void setAuditAgent(AuditAgent agent)
          Set method to tell the InputAdapter what audit agent to use.
 void setErrorChannel(Channel errorChannel)
          set the error channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInputAdapter

public AbstractInputAdapter()
Default contstructor

Since:
1.0
Method Detail

setAuditAgent

public final void setAuditAgent(AuditAgent agent)
Set method to tell the InputAdapter what audit agent to use. The input Adapter creates the initial audit record w/ the # of records being processed.

Specified by:
setAuditAgent in interface Adapter
Parameters:
agent -
Since:
1.0

getAuditAgent

public final AuditAgent getAuditAgent()
get audit agent

Specified by:
getAuditAgent in interface Adapter
Returns:
AuditAgent
Since:
1.0

init

public void init(java.util.Properties props)
          throws InitializationException
No-op init() method. Meant to be overriden if necessary.

Specified by:
init in interface Adapter
Parameters:
props -
Throws:
InitializationException
Since:
1.0

cleanup

public void cleanup()
No-op cleanup method. Meant to be overriden if necessary.

Specified by:
cleanup in interface Adapter
Since:
1.0

push

public int push(Channel validChannel)
         throws ProcessingException
Push a set of records into the pipeline.

Specified by:
push in interface InputAdapter
Parameters:
validChannel - inbound side of the pipe.
Returns:
int number of records processed.
Throws:
ProcessingException
Since:
1.0

loadBatch

protected abstract java.util.Collection loadBatch()
                                           throws ProcessingException
Retrieve the batch.

Returns:
Collection - the records bound for the channel.
Throws:
ProcessingException
Since:
1.0

setErrorChannel

public void setErrorChannel(Channel errorChannel)
set the error channel.

This method can be used by input adapters in cases where they have parsing errors or other non-fatal record level errors when loading a batch of records.

Specified by:
setErrorChannel in interface InputAdapter
Parameters:
errorChannel -
Since:
1.0

getErrors

protected java.util.Collection getErrors()
get errors

Returns:
Collection
Since:
1.1

addToErrorChannel

public final void addToErrorChannel(Record record)
The concrete input adapter can use this method to add error records to the error channel while maintaining the correct audit entries for valid (returned from loadBatch() & pushed into the normal pipeline channel) & errors (added by calling addError() & pushed into the error channel.

Specified by:
addToErrorChannel in interface InputAdapter
Parameters:
record -
Since:
1.0


Copyright © 2002-2004 Robert Half International. All Rights Reserved.