it.geosolutions.geobatch.flow.file
Class FileBasedFlowManager

java.lang.Object
  extended by it.geosolutions.geobatch.catalog.impl.BaseIdentifiable
      extended by it.geosolutions.geobatch.catalog.impl.BaseResource
          extended by it.geosolutions.geobatch.catalog.impl.BasePersistentResource<FileBasedFlowConfiguration>
              extended by it.geosolutions.geobatch.flow.file.FileBasedFlowManager
All Implemented Interfaces:
Identifiable, PersistentResource<FileBasedFlowConfiguration>, Resource, FlowManager<FileSystemEvent,FileBasedFlowConfiguration>, Job, java.lang.Cloneable, java.lang.Runnable

@Component(value="FlowManager")
@ManagedResource(objectName="spring:name=FileBasedFlowManager",
                 description="A JMX-managed FileBasedFlowManager")
public class FileBasedFlowManager
extends BasePersistentResource<FileBasedFlowConfiguration>
implements FlowManager<FileSystemEvent,FileBasedFlowConfiguration>, java.lang.Runnable, Job

Author:
Alessio Fabiani, GeoSolutions, (rev2) Carlo Cancellieri - carlo.cancellieri@geo-solutions.it

Constructor Summary
FileBasedFlowManager(FileBasedFlowConfiguration configuration)
           
FileBasedFlowManager(java.lang.String baseName, java.lang.String name, java.lang.String description)
           
 
Method Summary
 void dispose()
           
 void dispose(FileBasedEventConsumer fbec)
          Remove the given consumer instance from the ones handled by this flow.
 java.util.List<FileBasedEventConsumer> getEventConsumers()
           
 EventGenerator<FileSystemEvent> getEventGenerator()
           
 java.util.concurrent.ThreadPoolExecutor getExecutor()
           
 java.io.File getWorkingDirectory()
           
 boolean isAutorun()
           
 boolean isInited()
           
 boolean isPaused()
           
 boolean isRunning()
           
 boolean isTermination()
           
 void load()
           
 boolean pause()
          Implements the Job.pause() interface.
 boolean pause(boolean sub)
           
 void persist()
           
 void postEvent(FileSystemEvent event)
           
 boolean remove()
           
 void reset()
           
 void resume()
           
 void run()
          Main thread loop.
 void setAutorun(boolean autorun)
           
 void setConfiguration(FileBasedFlowConfiguration configuration)
           
 void setEventGenerator(EventGenerator<FileSystemEvent> eventGenerator)
           
 void setWorkingDirectory(java.io.File outputDir)
           
 java.lang.String toString()
           
 
Methods inherited from class it.geosolutions.geobatch.catalog.impl.BasePersistentResource
getConfiguration, getDAO, setDAO
 
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.flow.FlowManager
setName
 
Methods inherited from interface it.geosolutions.geobatch.catalog.PersistentResource
getConfiguration
 
Methods inherited from interface it.geosolutions.geobatch.catalog.Identifiable
getDescription, getId, getName, setDescription, setId
 

Constructor Detail

FileBasedFlowManager

public FileBasedFlowManager(FileBasedFlowConfiguration configuration)
                     throws java.io.IOException,
                            java.lang.NullPointerException
Parameters:
configuration - the fileBasedFlowConfiguration to use in initialization
Throws:
java.io.IOException
java.lang.NullPointerException

FileBasedFlowManager

public FileBasedFlowManager(java.lang.String baseName,
                            java.lang.String name,
                            java.lang.String description)
Method Detail

getExecutor

@ManagedAttribute
public java.util.concurrent.ThreadPoolExecutor getExecutor()

dispose

public void dispose()
Specified by:
dispose in interface Resource
Specified by:
dispose in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>
Overrides:
dispose in class BaseResource

isRunning

public boolean isRunning()
Specified by:
isRunning in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>

dispose

public void dispose(FileBasedEventConsumer fbec)
Remove the given consumer instance from the ones handled by this flow.

It should only be used on instances that are not running, i.e. in a COMPLETED or FAILED state.

Parameters:
fbec - the consumer to be removed.

run

public void run()
Main thread loop. TODO the stopping condition is never used...

Specified by:
run in interface java.lang.Runnable

resume

public void resume()
Specified by:
resume in interface Job

pause

public boolean pause()
Implements the Job.pause() interface.

Pausing is implemented by stopping and removing the EventGenerator so that no events are put into the mailbox.

Specified by:
pause in interface Job
See Also:
FlowManager

pause

public boolean pause(boolean sub)
Specified by:
pause in interface Job

reset

public void reset()
Specified by:
reset in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>

toString

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

isInited

public boolean isInited()
Returns:
the initialized

isPaused

public boolean isPaused()
Specified by:
isPaused in interface Job
Returns:
the paused

isTermination

public boolean isTermination()
Returns:
the termination

getWorkingDirectory

public java.io.File getWorkingDirectory()
Specified by:
getWorkingDirectory in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>
Returns:
the workingDirectory

setWorkingDirectory

public void setWorkingDirectory(java.io.File outputDir)
Specified by:
setWorkingDirectory in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>
Parameters:
workingDirectory - the workingDirectory to set

getEventGenerator

public EventGenerator<FileSystemEvent> getEventGenerator()
Specified by:
getEventGenerator in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>

setEventGenerator

public void setEventGenerator(EventGenerator<FileSystemEvent> eventGenerator)
Specified by:
setEventGenerator in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>

setConfiguration

public void setConfiguration(FileBasedFlowConfiguration configuration)
Specified by:
setConfiguration in interface PersistentResource<FileBasedFlowConfiguration>
Overrides:
setConfiguration in class BasePersistentResource<FileBasedFlowConfiguration>

load

public void load()
          throws java.io.IOException
Specified by:
load in interface PersistentResource<FileBasedFlowConfiguration>
Overrides:
load in class BasePersistentResource<FileBasedFlowConfiguration>
Throws:
java.io.IOException

remove

public boolean remove()
               throws java.io.IOException
Specified by:
remove in interface PersistentResource<FileBasedFlowConfiguration>
Overrides:
remove in class BasePersistentResource<FileBasedFlowConfiguration>
Throws:
java.io.IOException

persist

public void persist()
             throws java.io.IOException
Specified by:
persist in interface PersistentResource<FileBasedFlowConfiguration>
Overrides:
persist in class BasePersistentResource<FileBasedFlowConfiguration>
Throws:
java.io.IOException

isAutorun

public boolean isAutorun()
Returns:

setAutorun

public void setAutorun(boolean autorun)
Parameters:
autorun -

getEventConsumers

public java.util.List<FileBasedEventConsumer> getEventConsumers()
Specified by:
getEventConsumers in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>

postEvent

public void postEvent(FileSystemEvent event)
Specified by:
postEvent in interface FlowManager<FileSystemEvent,FileBasedFlowConfiguration>


Copyright © 2008-2012 GeoSolutions. All Rights Reserved.