org.apache.felix.fileinstall.internal
Class DirectoryWatcher
java.lang.Object
java.lang.Thread
org.apache.felix.fileinstall.internal.DirectoryWatcher
- All Implemented Interfaces:
- java.lang.Runnable, java.util.EventListener, org.osgi.framework.BundleListener
public class DirectoryWatcher
- extends java.lang.Thread
- implements org.osgi.framework.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
| Nested classes/interfaces inherited from class java.lang.Thread |
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
|
Constructor Summary |
DirectoryWatcher(java.util.Dictionary properties,
org.osgi.framework.BundleContext context)
|
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FILENAME
public static final java.lang.String FILENAME
- See Also:
- Constant Field Values
POLL
public static final java.lang.String POLL
- See Also:
- Constant Field Values
DIR
public static final java.lang.String DIR
- See Also:
- Constant Field Values
LOG_LEVEL
public static final java.lang.String LOG_LEVEL
- See Also:
- Constant Field Values
TMPDIR
public static final java.lang.String TMPDIR
- See Also:
- Constant Field Values
FILTER
public static final java.lang.String FILTER
- See Also:
- Constant Field Values
START_NEW_BUNDLES
public static final java.lang.String START_NEW_BUNDLES
- See Also:
- Constant Field Values
USE_START_TRANSIENT
public static final java.lang.String USE_START_TRANSIENT
- See Also:
- Constant Field Values
USE_START_ACTIVATION_POLICY
public static final java.lang.String USE_START_ACTIVATION_POLICY
- See Also:
- Constant Field Values
NO_INITIAL_DELAY
public static final java.lang.String NO_INITIAL_DELAY
- See Also:
- Constant Field Values
DISABLE_CONFIG_SAVE
public static final java.lang.String DISABLE_CONFIG_SAVE
- See Also:
- Constant Field Values
ENABLE_CONFIG_SAVE
public static final java.lang.String ENABLE_CONFIG_SAVE
- See Also:
- Constant Field Values
START_LEVEL
public static final java.lang.String START_LEVEL
- See Also:
- Constant Field Values
ACTIVE_LEVEL
public static final java.lang.String ACTIVE_LEVEL
- See Also:
- Constant Field Values
UPDATE_WITH_LISTENERS
public static final java.lang.String UPDATE_WITH_LISTENERS
- See Also:
- Constant Field Values
DirectoryWatcher
public DirectoryWatcher(java.util.Dictionary properties,
org.osgi.framework.BundleContext context)
getThreadName
public static java.lang.String getThreadName(java.util.Dictionary properties)
getProperties
public java.util.Dictionary getProperties()
start
public void start()
- Overrides:
start in class java.lang.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 java.lang.Runnable- Overrides:
run in class java.lang.Thread
bundleChanged
public void bundleChanged(org.osgi.framework.BundleEvent bundleEvent)
- Specified by:
bundleChanged in interface org.osgi.framework.BundleListener
close
public void close()
findBundlesWithFragmentsToRefresh
protected void findBundlesWithFragmentsToRefresh(java.util.Set toRefresh)
findBundlesWithOptionalPackagesToRefresh
protected void findBundlesWithOptionalPackagesToRefresh(java.util.Set toRefresh)
getOptionalImports
protected java.util.List getOptionalImports(java.lang.String importsStr)
addListener
public void addListener(ArtifactListener listener,
long stamp)
removeListener
public void removeListener(ArtifactListener listener)
Copyright © 2012 FuseSource, Corp.. All Rights Reserved.