org.apache.camel.component.jpa
Class JpaConsumer

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.impl.DefaultConsumer
          extended by org.apache.camel.impl.ScheduledPollConsumer
              extended by org.apache.camel.component.jpa.JpaConsumer
All Implemented Interfaces:
Runnable, BatchConsumer, Consumer, Service, ShutdownAware, SuspendableService

public class JpaConsumer
extends ScheduledPollConsumer
implements BatchConsumer, ShutdownAware

Version:
$Revision: 893983 $

Field Summary
 
Fields inherited from class org.apache.camel.impl.DefaultConsumer
log
 
Constructor Summary
JpaConsumer(JpaEndpoint endpoint, Processor processor)
           
 
Method Summary
protected  void configureParameters(Query query)
           
protected  DeleteHandler<Object> createDeleteHandler()
           
protected  Exchange createExchange(Object result)
           
protected  QueryFactory createQueryFactory()
           
 boolean deferShutdown(ShutdownRunningTask shutdownRunningTask)
           
 DeleteHandler<Object> getDeleteHandler()
           
 JpaEndpoint getEndpoint()
           
protected  String getEntityName(Class<?> clazz)
           
 String getNamedQuery()
           
 String getNativeQuery()
           
 int getPendingExchangesSize()
           
 String getQuery()
           
 QueryFactory getQueryFactory()
           
 boolean isBatchAllowed()
           
protected  boolean lockEntity(Object entity, EntityManager entityManager)
          A strategy method to lock an object with an exclusive lock so that it can be processed
protected  void poll()
           
 void processBatch(Queue<Object> exchanges)
           
 void setDeleteHandler(DeleteHandler<Object> deleteHandler)
           
 void setMaxMessagesPerPoll(int maxMessagesPerPoll)
           
 void setNamedQuery(String namedQuery)
           
 void setNativeQuery(String nativeQuery)
           
 void setQuery(String query)
           
 void setQueryFactory(QueryFactory queryFactory)
           
 
Methods inherited from class org.apache.camel.impl.ScheduledPollConsumer
doStart, doStop, getDelay, getInitialDelay, getPollStrategy, getTimeUnit, isPollAllowed, isSuspended, isUseFixedDelay, resume, run, setDelay, setInitialDelay, setPollStrategy, setTimeUnit, setUseFixedDelay, suspend
 
Methods inherited from class org.apache.camel.impl.DefaultConsumer
getExceptionHandler, getProcessor, handleException, setExceptionHandler, toString
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Constructor Detail

JpaConsumer

public JpaConsumer(JpaEndpoint endpoint,
                   Processor processor)
Method Detail

poll

protected void poll()
             throws Exception
Specified by:
poll in class ScheduledPollConsumer
Throws:
Exception

setMaxMessagesPerPoll

public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
Specified by:
setMaxMessagesPerPoll in interface BatchConsumer

processBatch

public void processBatch(Queue<Object> exchanges)
                  throws Exception
Specified by:
processBatch in interface BatchConsumer
Throws:
Exception

deferShutdown

public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask)
Specified by:
deferShutdown in interface ShutdownAware

getPendingExchangesSize

public int getPendingExchangesSize()
Specified by:
getPendingExchangesSize in interface ShutdownAware

isBatchAllowed

public boolean isBatchAllowed()
Specified by:
isBatchAllowed in interface BatchConsumer

getEndpoint

public JpaEndpoint getEndpoint()
Specified by:
getEndpoint in interface Consumer
Overrides:
getEndpoint in class DefaultConsumer

getQueryFactory

public QueryFactory getQueryFactory()

setQueryFactory

public void setQueryFactory(QueryFactory queryFactory)

getDeleteHandler

public DeleteHandler<Object> getDeleteHandler()

setDeleteHandler

public void setDeleteHandler(DeleteHandler<Object> deleteHandler)

getNamedQuery

public String getNamedQuery()

setNamedQuery

public void setNamedQuery(String namedQuery)

getNativeQuery

public String getNativeQuery()

setNativeQuery

public void setNativeQuery(String nativeQuery)

getQuery

public String getQuery()

setQuery

public void setQuery(String query)

lockEntity

protected boolean lockEntity(Object entity,
                             EntityManager entityManager)
A strategy method to lock an object with an exclusive lock so that it can be processed

Parameters:
entity - the entity to be locked
entityManager - entity manager
Returns:
true if the entity was locked

createQueryFactory

protected QueryFactory createQueryFactory()

getEntityName

protected String getEntityName(Class<?> clazz)

createDeleteHandler

protected DeleteHandler<Object> createDeleteHandler()

configureParameters

protected void configureParameters(Query query)

createExchange

protected Exchange createExchange(Object result)


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.