org.apache.sling.installer.core.impl
Class OsgiInstallerImpl

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.sling.installer.core.impl.OsgiInstallerImpl
All Implemented Interfaces:
Runnable, EventListener, OsgiInstaller, org.osgi.framework.BundleListener, org.osgi.framework.FrameworkListener

public class OsgiInstallerImpl
extends Thread
implements org.osgi.framework.BundleListener, org.osgi.framework.FrameworkListener, OsgiInstaller

Worker thread where all OSGi tasks are executed. Runs cycles where the list of RegisteredResources is examined, OsgiTasks are created accordingly and executed. A separate list of RegisteredResources is kept for resources that are updated or removed during a cycle, and merged with the main list at the end of the cycle.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
OsgiInstallerImpl(org.osgi.framework.BundleContext ctx)
          Constructor
 
Method Summary
 void bundleChanged(org.osgi.framework.BundleEvent e)
           
 void deactivate()
          Deactivate
 void frameworkEvent(org.osgi.framework.FrameworkEvent event)
           
 PersistentResourceList getPersistentResourceList()
           
 Object getResourcesLock()
           
static long getTotalEventsCount()
          Used for tasks that wait for a framework or bundle event before retrying their operations
 void registerResources(String scheme, InstallableResource[] resources)
          Provide the installer with the complete list of installable resources for a given client.
 void run()
           
 void updateResources(String scheme, InstallableResource[] resources, String[] ids)
          Inform the installer that resources are available for installation and/or other resources are no longer available.
 void wakeUp()
          Wake up the run cycle.
 
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, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OsgiInstallerImpl

public OsgiInstallerImpl(org.osgi.framework.BundleContext ctx)
Constructor

Method Detail

deactivate

public void deactivate()
Deactivate


run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

getResourcesLock

public Object getResourcesLock()

getPersistentResourceList

public PersistentResourceList getPersistentResourceList()

updateResources

public void updateResources(String scheme,
                            InstallableResource[] resources,
                            String[] ids)
Description copied from interface: OsgiInstaller
Inform the installer that resources are available for installation and/or other resources are no longer available. This method is called if - installed resources have been modified - new resources are available - installed resources should be uninstalled Invalid resources are ignored.

Specified by:
updateResources in interface OsgiInstaller
Parameters:
scheme - identifies the client.
ids - An array of identifiers for removed resources - might be null
See Also:
OsgiInstaller.updateResources(java.lang.String, org.apache.sling.installer.api.InstallableResource[], java.lang.String[])

registerResources

public void registerResources(String scheme,
                              InstallableResource[] resources)
Description copied from interface: OsgiInstaller
Provide the installer with the complete list of installable resources for a given client. Client must call this at startup and/or when the installer service becomes available. The installer stores the list of previously registered/added resources, compares with the new list and removes resources that have disappeared. Invalid resources are ignored.

Specified by:
registerResources in interface OsgiInstaller
Parameters:
scheme - identifies the client.
resources - the list of available resources
See Also:
OsgiInstaller.registerResources(java.lang.String, org.apache.sling.installer.api.InstallableResource[])

bundleChanged

public void bundleChanged(org.osgi.framework.BundleEvent e)
Specified by:
bundleChanged in interface org.osgi.framework.BundleListener
See Also:
BundleListener.bundleChanged(org.osgi.framework.BundleEvent)

getTotalEventsCount

public static long getTotalEventsCount()
Used for tasks that wait for a framework or bundle event before retrying their operations


frameworkEvent

public void frameworkEvent(org.osgi.framework.FrameworkEvent event)
Specified by:
frameworkEvent in interface org.osgi.framework.FrameworkListener
See Also:
FrameworkListener.frameworkEvent(org.osgi.framework.FrameworkEvent)

wakeUp

public void wakeUp()
Wake up the run cycle.



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