info.sswap.ontologies.exec.impl
Class HotboxPollerImpl

java.lang.Object
  extended by info.sswap.ontologies.exec.impl.HotboxPollerImpl
All Implemented Interfaces:
HotboxPoller

public class HotboxPollerImpl
extends java.lang.Object
implements HotboxPoller

Implementation of a hotbox poller: the class "polls"--repeatedly checks after a pre-set delay--the contents of a "hotbox" directory. If files, subject to filename filtering, are newer than their associated file in another directory (the "public" or target directory), then a method is run on the files.

This poller checks for JSON formated Resource Description Graphs ( RDGs); if one is found that is newer than its RDF/XML RDG, it is sent to the HTTP API /makeRDG. On success, this returns a valid RDG which is placed in the target directory.

Running the poller with the Exec package allows one to simply drop JSON pre- RDGs into the hotbox directory to stand-up semantic web services.

Author:
Damian Gessler

Nested Class Summary
private  class HotboxPollerImpl.DaemonThread
           
private  class HotboxPollerImpl.JSONFilenameFilter
           
private static class HotboxPollerImpl.SingletonHolder
           
 
Field Summary
(package private)  HotboxPollerImpl.DaemonThread daemonThread
           
(package private)  long defaultSleepMilliSeconds
           
private  java.lang.String fileNameExtensionFilter
           
private  java.lang.String fileNameExtensionProperty
           
private  HotboxPollerImpl.JSONFilenameFilter filenameFilter
           
private static java.io.File hotboxDir
           
private static java.lang.String hotboxPath
           
private static org.apache.log4j.Logger LOGGER
           
private static java.lang.String publicPath
           
(package private)  long sleepMilliSeconds
           
(package private)  java.lang.String sleepSecondsSystemProperty
           
 
Constructor Summary
private HotboxPollerImpl()
           
 
Method Summary
static HotboxPoller getInstance(java.lang.String hotboxPathStr, java.lang.String publicPathStr)
           
 boolean isRunning()
          Check if the hotbox poller is running.
 void setInterval(int sleepSeconds)
          Set the delay interval between directory scans.
 void start()
          Start the hotbox directory polling.
 void stop()
          Stop the hotbox directory polling.
private  void updatePublic(java.io.File[] jsonFiles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.apache.log4j.Logger LOGGER

hotboxDir

private static java.io.File hotboxDir

hotboxPath

private static java.lang.String hotboxPath

publicPath

private static java.lang.String publicPath

fileNameExtensionFilter

private java.lang.String fileNameExtensionFilter

fileNameExtensionProperty

private java.lang.String fileNameExtensionProperty

filenameFilter

private HotboxPollerImpl.JSONFilenameFilter filenameFilter

sleepMilliSeconds

long sleepMilliSeconds

defaultSleepMilliSeconds

long defaultSleepMilliSeconds

sleepSecondsSystemProperty

java.lang.String sleepSecondsSystemProperty

daemonThread

HotboxPollerImpl.DaemonThread daemonThread
Constructor Detail

HotboxPollerImpl

private HotboxPollerImpl()
Method Detail

getInstance

public static HotboxPoller getInstance(java.lang.String hotboxPathStr,
                                       java.lang.String publicPathStr)
                                throws java.io.IOException
Throws:
java.io.IOException

setInterval

public void setInterval(int sleepSeconds)
Description copied from interface: HotboxPoller
Set the delay interval between directory scans.

Specified by:
setInterval in interface HotboxPoller
Parameters:
sleepSeconds - number of seconds to wait between polling

start

public void start()
Description copied from interface: HotboxPoller
Start the hotbox directory polling.

Specified by:
start in interface HotboxPoller

stop

public void stop()
Description copied from interface: HotboxPoller
Stop the hotbox directory polling.

Specified by:
stop in interface HotboxPoller

isRunning

public boolean isRunning()
Description copied from interface: HotboxPoller
Check if the hotbox poller is running.

Specified by:
isRunning in interface HotboxPoller
Returns:
true if running; false if stopped; e.g., because it was never started or because it was stopped (interrupted).

updatePublic

private void updatePublic(java.io.File[] jsonFiles)


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.