it.geosolutions.geobatch.flow.event.consumer.file
Class FileBasedEventConsumer

java.lang.Object
  extended by it.geosolutions.geobatch.catalog.impl.BaseIdentifiable
      extended by it.geosolutions.geobatch.catalog.impl.BaseResource
          extended by it.geosolutions.geobatch.flow.event.consumer.BaseEventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>
              extended by it.geosolutions.geobatch.flow.event.consumer.file.FileBasedEventConsumer
All Implemented Interfaces:
Identifiable, Resource, EventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>, Job, ListenerRegistry<EventConsumerListener>, java.lang.Cloneable, java.util.concurrent.Callable<java.util.Queue<FileSystemEvent>>

public class FileBasedEventConsumer
extends BaseEventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>

Author:
Simone Giannecchini, GeoSolutions S.A.S., (r2)Carlo Cancellieri - carlo.cancellieri@geo-solutions.it

Nested Class Summary
 
Nested classes/interfaces inherited from class it.geosolutions.geobatch.flow.event.consumer.BaseEventConsumer
BaseEventConsumer.EventConsumerListenerForwarder
 
Field Summary
 
Fields inherited from class it.geosolutions.geobatch.flow.event.consumer.BaseEventConsumer
actions, currentAction, eventsQueue, listenerForwarder, pauseHandler
 
Constructor Summary
FileBasedEventConsumer(FileBasedEventConsumerConfiguration configuration)
           
 
Method Summary
 java.util.Queue<FileSystemEvent> call()
          Main Thread cycle.
 void cancel()
           
 void clear()
          remove all Cumulating progress listener from the Consumer and containing action(s) remove all the actions from the action list remove contextRunningDir
 boolean consume(FileSystemEvent event)
           
 void dispose()
           
 FileBasedEventConsumerConfiguration getConfiguration()
           
 java.io.File getWorkingDir()
           
 boolean isCanceled()
           
 void setConfiguration(FileBasedEventConsumerConfiguration configuration)
           
protected  void setStatus(EventConsumerStatus eventConsumerStatus)
           
 java.lang.String toString()
           
 
Methods inherited from class it.geosolutions.geobatch.flow.event.consumer.BaseEventConsumer
addActions, addListener, applyActions, getActions, getCreationTimestamp, getCurrentAction, getListenerForwarder, getProgressListener, getRunningContext, getStatus, isPaused, pause, pause, removeListener, resume, setRunningContext
 
Methods inherited from class it.geosolutions.geobatch.catalog.impl.BaseIdentifiable
clone, getDescription, getId, getName, setDescription, setId, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.geosolutions.geobatch.catalog.Identifiable
getDescription, getId, getName, setDescription, setId, setName
 

Constructor Detail

FileBasedEventConsumer

public FileBasedEventConsumer(FileBasedEventConsumerConfiguration configuration)
                       throws java.lang.InterruptedException,
                              java.io.IOException
Throws:
java.lang.InterruptedException
java.io.IOException
Method Detail

call

public java.util.Queue<FileSystemEvent> call()
                                      throws java.lang.Exception
Main Thread cycle.
  • Create needed dirs
  • Optionally backup files
  • Move files into a job-specific working dir
  • Run the actions
  • Throws:
    java.lang.Exception

    setConfiguration

    public void setConfiguration(FileBasedEventConsumerConfiguration configuration)
    Parameters:
    configuration -

    getWorkingDir

    public java.io.File getWorkingDir()
    Returns:
    the workingDirectory

    getConfiguration

    public FileBasedEventConsumerConfiguration getConfiguration()
    Returns:

    dispose

    public void dispose()
    Specified by:
    dispose in interface Resource
    Specified by:
    dispose in interface EventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>
    Overrides:
    dispose in class BaseEventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>

    clear

    public void clear()
    remove all Cumulating progress listener from the Consumer and containing action(s) remove all the actions from the action list remove contextRunningDir


    consume

    public boolean consume(FileSystemEvent event)
    Specified by:
    consume in interface EventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>
    Overrides:
    consume in class BaseEventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>

    cancel

    public void cancel()

    isCanceled

    public boolean isCanceled()
    Returns:

    setStatus

    protected void setStatus(EventConsumerStatus eventConsumerStatus)
    Overrides:
    setStatus in class BaseEventConsumer<FileSystemEvent,FileBasedEventConsumerConfiguration>

    toString

    public java.lang.String toString()
    Overrides:
    toString in class java.lang.Object


    Copyright © 2008-2012 GeoSolutions. All Rights Reserved.