xmlBlaster 2.2.0 API

org.xmlBlaster.contrib.filewatcher
Class Publisher

java.lang.Object
  extended by org.xmlBlaster.contrib.filewatcher.Publisher
All Implemented Interfaces:
I_Timeout

public class Publisher
extends java.lang.Object
implements I_Timeout

Publisher

Author:
Michele Laghi

Nested Class Summary
 class Publisher.ReplSource
           
 class Publisher.ReplSourceData
           
 
Field Summary
private  I_XmlBlasterAccess access
           
private  ConnectQos connectQos
           
private  boolean copyOnMove
           
private  long delaySinceLastFileChange
           
private  DirectoryManager[] directoryManagers
           
private  java.lang.String directoryName
           
private  java.lang.String discarded
           
private  java.lang.String fileFilter
           
private  java.lang.String filterType
           
private  boolean forceShutdown
          used to break the loop in doPublish when shutting down
private  Global global
           
private  I_Info info_
           
private  boolean isActive
           
private  boolean isShutdown
          used to identify if it has shut down (to get a new global)
private  java.lang.String lockExtention
           
private static java.util.logging.Logger log
           
private  int maximumChunkSize
           
private  long maximumFileSize
           
private  java.lang.String ME
           
private  java.lang.String name
          only used as a default login name and logging
private  long pollInterval
           
private  XmlBlasterPublisher publisher
           
private  java.lang.String publishKey
           
private  java.lang.String publishQos
           
private  boolean recursive
           
private  java.lang.String replPrefix
           
private  Publisher.ReplSource replSource
           
private  ReplSourceEngine replSourceEngine
           
private  java.lang.String sent
           
private static Timeout timeout
           
private  Timestamp timeoutHandle
           
static java.lang.String USE_REGEX
           
 
Constructor Summary
Publisher(Global globOrig, java.lang.String name, I_Info info)
           
 
Method Summary
 void activate()
           
private  void activatePoller()
           
private  void createDirectoryManagers()
          Create the file checker instance with the current configuration.
 void deActivate()
           
private  FileInfo[] doPublish(DirectoryManager directoryManager)
          Publish file or files to xmlBlaster.
private  java.lang.String[] getChildDirectories(boolean isRecursive, DirectoryManager rootDirManager)
           
 long getDelaySinceLastFileChange()
           
 java.lang.String getDirectoryName()
           
 java.lang.String getDiscarded()
           
 java.lang.String getFileFilter()
           
 java.lang.String getFilterType()
           
 java.lang.String getLockExtention()
           
 long getMaximumFileSize()
           
 long getPollInterval()
           
 java.lang.String getSent()
           
private  java.lang.String getSubDir(DirectoryManager root, java.lang.String base, java.lang.String subDir)
           
 void init()
          Connects to the xmlBlaster.
 boolean isActive()
           
 boolean isCopyOnMove()
           
 boolean isRecursive()
           
private  java.lang.String preparePubQos(java.lang.String origQos)
           
private  void prepareReplSource(boolean doFill)
           
 void publish()
          Fail-safe sending files.
private  void reCreateDirectoryManagers()
          Useful for JMX invocations
 void setCopyOnMove(boolean copyOnMove)
           
 void setDelaySinceLastFileChange(long delaySinceLastFileChange)
           
 void setDirectoryName(java.lang.String directoryName)
           
 void setDiscarded(java.lang.String discarded)
           
 void setFileFilter(java.lang.String fileFilter)
           
 void setFilterType(java.lang.String filterType)
           
 void setLockExtention(java.lang.String lockExtention)
           
 void setMaximumFileSize(long maximumFileSize)
           
 void setPollInterval(long pollInterval)
           
 void setRecursive(boolean rec)
           
 void setSent(java.lang.String sent)
           
 void shutdown()
          If an exception occurs it means it could not publish the entry
 void timeout(java.lang.Object userData)
          You will be notified about the timeout through this method.
 java.lang.String toString()
           
 java.lang.String toString(FileInfo[] infos, int max)
          Create a comma separated list of file names.
 java.lang.String triggerScan()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

global

private Global global

log

private static java.util.logging.Logger log

directoryManagers

private DirectoryManager[] directoryManagers

access

private I_XmlBlasterAccess access

publishKey

private java.lang.String publishKey

publishQos

private java.lang.String publishQos

connectQos

private ConnectQos connectQos

pollInterval

private long pollInterval

maximumFileSize

private long maximumFileSize

fileFilter

private java.lang.String fileFilter

filterType

private java.lang.String filterType

directoryName

private java.lang.String directoryName

copyOnMove

private boolean copyOnMove

sent

private java.lang.String sent

discarded

private java.lang.String discarded

lockExtention

private java.lang.String lockExtention

delaySinceLastFileChange

private long delaySinceLastFileChange

recursive

private boolean recursive

USE_REGEX

public static final java.lang.String USE_REGEX
See Also:
Constant Field Values

timeoutHandle

private Timestamp timeoutHandle

timeout

private static Timeout timeout

isShutdown

private boolean isShutdown
used to identify if it has shut down (to get a new global)


forceShutdown

private boolean forceShutdown
used to break the loop in doPublish when shutting down


name

private java.lang.String name
only used as a default login name and logging


isActive

private boolean isActive

maximumChunkSize

private int maximumChunkSize

replPrefix

private java.lang.String replPrefix

info_

private I_Info info_

replSource

private Publisher.ReplSource replSource

replSourceEngine

private ReplSourceEngine replSourceEngine

publisher

private XmlBlasterPublisher publisher
Constructor Detail

Publisher

public Publisher(Global globOrig,
                 java.lang.String name,
                 I_Info info)
          throws XmlBlasterException
Throws:
XmlBlasterException
Method Detail

prepareReplSource

private void prepareReplSource(boolean doFill)
                        throws XmlBlasterException
Throws:
XmlBlasterException

getSubDir

private java.lang.String getSubDir(DirectoryManager root,
                                   java.lang.String base,
                                   java.lang.String subDir)

getChildDirectories

private java.lang.String[] getChildDirectories(boolean isRecursive,
                                               DirectoryManager rootDirManager)

createDirectoryManagers

private void createDirectoryManagers()
                              throws XmlBlasterException
Create the file checker instance with the current configuration.

Throws:
XmlBlasterException

reCreateDirectoryManagers

private void reCreateDirectoryManagers()
Useful for JMX invocations


toString

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

init

public void init()
          throws XmlBlasterException
Connects to the xmlBlaster.

Throws:
XmlBlasterException

shutdown

public void shutdown()
              throws XmlBlasterException
If an exception occurs it means it could not publish the entry

Throws:
XmlBlasterException

publish

public void publish()
Fail-safe sending files.


toString

public java.lang.String toString(FileInfo[] infos,
                                 int max)
Create a comma separated list of file names.

Parameters:
infos -
max - Max file names to collect
Returns:

preparePubQos

private java.lang.String preparePubQos(java.lang.String origQos)
                                throws XmlBlasterException
Throws:
XmlBlasterException

doPublish

private FileInfo[] doPublish(DirectoryManager directoryManager)
                      throws XmlBlasterException
Publish file or files to xmlBlaster.

Returns:
An empty string if nothing was sent, is never null
Throws:
XmlBlasterException

activatePoller

private void activatePoller()

timeout

public void timeout(java.lang.Object userData)
Description copied from interface: I_Timeout
You will be notified about the timeout through this method.

Specified by:
timeout in interface I_Timeout
Parameters:
userData - You get bounced back your userData which you passed with Timeout.addTimeoutListener()
See Also:
I_Timeout.timeout(java.lang.Object)

activate

public void activate()
              throws java.lang.Exception
Throws:
java.lang.Exception

deActivate

public void deActivate()

isActive

public boolean isActive()

triggerScan

public java.lang.String triggerScan()

getDirectoryName

public java.lang.String getDirectoryName()
Returns:
Returns the directoryName.

setDirectoryName

public void setDirectoryName(java.lang.String directoryName)
Parameters:
directoryName - The directoryName to set.

getFileFilter

public java.lang.String getFileFilter()
Returns:
Returns the fileFilter.

setFileFilter

public void setFileFilter(java.lang.String fileFilter)
Parameters:
fileFilter - The fileFilter to set.

getFilterType

public java.lang.String getFilterType()
Returns:
Returns the filterType.

setFilterType

public void setFilterType(java.lang.String filterType)
Parameters:
filterType - The filterType to set.

getMaximumFileSize

public long getMaximumFileSize()
Returns:
Returns the maximumFileSize.

setMaximumFileSize

public void setMaximumFileSize(long maximumFileSize)
Parameters:
maximumFileSize - The maximumFileSize to set.

getPollInterval

public long getPollInterval()
Returns:
Returns the pollInterval.

setPollInterval

public void setPollInterval(long pollInterval)
Parameters:
pollInterval - The pollInterval to set.

isCopyOnMove

public boolean isCopyOnMove()
Returns:
Returns the copyOnMove.

setCopyOnMove

public void setCopyOnMove(boolean copyOnMove)
Parameters:
copyOnMove - The copyOnMove to set.

getDelaySinceLastFileChange

public long getDelaySinceLastFileChange()
Returns:
Returns the delaySinceLastFileChange.

setDelaySinceLastFileChange

public void setDelaySinceLastFileChange(long delaySinceLastFileChange)
Parameters:
delaySinceLastFileChange - The delaySinceLastFileChange to set.

getDiscarded

public java.lang.String getDiscarded()
Returns:
Returns the discarded.

setDiscarded

public void setDiscarded(java.lang.String discarded)
Parameters:
discarded - The discarded to set.

getLockExtention

public java.lang.String getLockExtention()
Returns:
Returns the lockExtention.

setLockExtention

public void setLockExtention(java.lang.String lockExtention)
Parameters:
lockExtention - The lockExtention to set.

getSent

public java.lang.String getSent()
Returns:
Returns the sent.

setSent

public void setSent(java.lang.String sent)
Parameters:
sent - The sent to set.

isRecursive

public boolean isRecursive()

setRecursive

public void setRecursive(boolean rec)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.