org.opensolaris.opengrok.management
Class AgentIndexRunner

java.lang.Object
  extended by org.opensolaris.opengrok.management.AgentIndexRunner
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.management.NotificationListener, IndexChangedListener, AgentIndexRunnerMBean

public final class AgentIndexRunner
extends java.lang.Object
implements AgentIndexRunnerMBean, javax.management.NotificationListener, javax.management.MBeanRegistration, java.lang.Runnable, IndexChangedListener, javax.management.NotificationEmitter

AgentIndexRunner.


Method Summary
 void addNotificationListener(javax.management.NotificationListener notiflistener, javax.management.NotificationFilter notfilt, java.lang.Object obj)
           
 void disable()
          Disables indexer
 void enable()
          Enables the indexer
 void fileAdded(java.lang.String path, java.lang.String analyzer)
          A file is added to the index database
 void fileRemoved(java.lang.String path)
          A file is being removed from the index database
 void fileUpdated(java.lang.String path)
           
 java.lang.Exception getExceptions()
          Get Exception from last run
static AgentIndexRunner getInstance(boolean enabledParam)
          Static factory method to get an instance of AgentIndexRunner.
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
          Method that the subclass can override, but doesn't have to
 void handleNotification(javax.management.Notification n, java.lang.Object hb)
          Handle timer notifications to the purgatory.
 void index(boolean waitForFinished)
          The index method starts a thread that will start indexing part of the opengrok agent.
 long lastIndexTimeFinished()
          Last index time in System.currentmillis of successful index update
 long lastIndexTimeStarted()
          Last index time in System.currentmillis
 long lastIndexTimeUsed()
          Last index time usage for successful indexing (no exceptions)
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer serverParam, javax.management.ObjectName name)
           
 void removeNotificationListener(javax.management.NotificationListener notiflistener)
           
 void removeNotificationListener(javax.management.NotificationListener notiflistener, javax.management.NotificationFilter filt, java.lang.Object obj)
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AgentIndexRunner getInstance(boolean enabledParam)
Static factory method to get an instance of AgentIndexRunner.

Parameters:
enabledParam - if true, the initial instance of the purgatory will have purging enabled.

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer serverParam,
                                               javax.management.ObjectName name)
Specified by:
preRegister in interface javax.management.MBeanRegistration

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
Specified by:
preDeregister in interface javax.management.MBeanRegistration

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

run

public void run()
Specified by:
run in interface java.lang.Runnable

disable

public void disable()
Disables indexer

Specified by:
disable in interface AgentIndexRunnerMBean

enable

public void enable()
Enables the indexer

Specified by:
enable in interface AgentIndexRunnerMBean

handleNotification

public void handleNotification(javax.management.Notification n,
                               java.lang.Object hb)
Handle timer notifications to the purgatory. Will start the purger if it is enabled and return immediately.

Specified by:
handleNotification in interface javax.management.NotificationListener

index

public void index(boolean waitForFinished)
The index method starts a thread that will start indexing part of the opengrok agent.

Specified by:
index in interface AgentIndexRunnerMBean
Parameters:
waitForFinished - if false the command returns immediately, if true it will return when the indexing is done.

fileAdded

public void fileAdded(java.lang.String path,
                      java.lang.String analyzer)
Description copied from interface: IndexChangedListener
A file is added to the index database

Specified by:
fileAdded in interface IndexChangedListener
Parameters:
path - The path to the file (absolute from source root)
analyzer - The analyzer being used to analyze the file

fileRemoved

public void fileRemoved(java.lang.String path)
Description copied from interface: IndexChangedListener
A file is being removed from the index database

Specified by:
fileRemoved in interface IndexChangedListener
Parameters:
path - The path to the file (absolute from source root)

fileUpdated

public void fileUpdated(java.lang.String path)

lastIndexTimeFinished

public long lastIndexTimeFinished()
Description copied from interface: AgentIndexRunnerMBean
Last index time in System.currentmillis of successful index update

Specified by:
lastIndexTimeFinished in interface AgentIndexRunnerMBean
Returns:
long when last time the indexing finished

lastIndexTimeStarted

public long lastIndexTimeStarted()
Description copied from interface: AgentIndexRunnerMBean
Last index time in System.currentmillis

Specified by:
lastIndexTimeStarted in interface AgentIndexRunnerMBean
Returns:
long when last time indexing started

lastIndexTimeUsed

public long lastIndexTimeUsed()
Description copied from interface: AgentIndexRunnerMBean
Last index time usage for successful indexing (no exceptions)

Specified by:
lastIndexTimeUsed in interface AgentIndexRunnerMBean
Returns:
long how long the last index lasted

getExceptions

public java.lang.Exception getExceptions()
Description copied from interface: AgentIndexRunnerMBean
Get Exception from last run

Specified by:
getExceptions in interface AgentIndexRunnerMBean
Returns:
Exception if any or null if no Exceptions.

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener notiflistener,
                                    javax.management.NotificationFilter notfilt,
                                    java.lang.Object obj)
                             throws java.lang.IllegalArgumentException
Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
java.lang.IllegalArgumentException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener notiflistener)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
javax.management.ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener notiflistener,
                                       javax.management.NotificationFilter filt,
                                       java.lang.Object obj)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationEmitter
Throws:
javax.management.ListenerNotFoundException

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Method that the subclass can override, but doesn't have to

Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster
Returns:
MBeanNotificationInfo array of notification (and types) this class can emitt.