org.apache.felix.fileinstall.internal
Class DirectoryWatcher

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.felix.fileinstall.internal.DirectoryWatcher
All Implemented Interfaces:
Runnable, EventListener, BundleListener

public class DirectoryWatcher
extends Thread
implements BundleListener

-DirectoryWatcher- This class runs a background task that checks a directory for new files or removed files. These files can be configuration files or jars. For jar files, its behavior is defined below: - If there are new jar files, it installs them and optionally starts them. - If it fails to install a jar, it does not try to install it again until the jar has been modified. - If it fail to start a bundle, it attempts to start it in following iterations until it succeeds or the corresponding jar is uninstalled. - If some jar files have been deleted, it uninstalls them. - If some jar files have been updated, it updates them. - If it fails to update a bundle, it tries to update it in following iterations until it is successful. - If any bundle gets updated or uninstalled, it refreshes the framework for the changes to take effect. - If it detects any new installations, uninstallations or updations, it tries to start all the managed bundle unless it has been configured to only install bundles.

Author:
Felix Project Team

Field Summary
static String DIR
           
static String DISABLE_CONFIG_SAVE
           
static String FILENAME
           
static String FILTER
           
static String LOG_LEVEL
           
static String NO_INITIAL_DELAY
           
static String POLL
           
static String START_LEVEL
           
static String START_NEW_BUNDLES
           
static String TMPDIR
           
static String USE_START_ACTIVATION_POLICY
           
static String USE_START_TRANSIENT
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DirectoryWatcher(Dictionary properties, BundleContext context)
           
 
Method Summary
 void bundleChanged(BundleEvent bundleEvent)
          Receives notification that a bundle has had a lifecycle change.
 void close()
           
 Dictionary getProperties()
           
static String getThreadName(Dictionary properties)
           
 void run()
          Main run loop, will traverse the directory, and then handle the delta between installed and newly found/lost bundles and configurations.
 void start()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILENAME

public static final String FILENAME
See Also:
Constant Field Values

POLL

public static final String POLL
See Also:
Constant Field Values

DIR

public static final String DIR
See Also:
Constant Field Values

LOG_LEVEL

public static final String LOG_LEVEL
See Also:
Constant Field Values

TMPDIR

public static final String TMPDIR
See Also:
Constant Field Values

FILTER

public static final String FILTER
See Also:
Constant Field Values

START_NEW_BUNDLES

public static final String START_NEW_BUNDLES
See Also:
Constant Field Values

USE_START_TRANSIENT

public static final String USE_START_TRANSIENT
See Also:
Constant Field Values

USE_START_ACTIVATION_POLICY

public static final String USE_START_ACTIVATION_POLICY
See Also:
Constant Field Values

NO_INITIAL_DELAY

public static final String NO_INITIAL_DELAY
See Also:
Constant Field Values

DISABLE_CONFIG_SAVE

public static final String DISABLE_CONFIG_SAVE
See Also:
Constant Field Values

START_LEVEL

public static final String START_LEVEL
See Also:
Constant Field Values
Constructor Detail

DirectoryWatcher

public DirectoryWatcher(Dictionary properties,
                        BundleContext context)
Method Detail

getThreadName

public static String getThreadName(Dictionary properties)

getProperties

public Dictionary getProperties()

start

public void start()
Overrides:
start in class Thread

run

public void run()
Main run loop, will traverse the directory, and then handle the delta between installed and newly found/lost bundles and configurations.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

bundleChanged

public void bundleChanged(BundleEvent bundleEvent)
Description copied from interface: BundleListener
Receives notification that a bundle has had a lifecycle change.

Specified by:
bundleChanged in interface BundleListener
Parameters:
bundleEvent - The BundleEvent.

close

public void close()


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.