org.eclipse.osgi.internal.composite
Class CompositeBase

java.lang.Object
  extended by org.eclipse.osgi.framework.internal.core.AbstractBundle
      extended by org.eclipse.osgi.framework.internal.core.BundleHost
          extended by org.eclipse.osgi.internal.composite.CompositeBase
All Implemented Interfaces:
java.lang.Comparable<Bundle>, KeyedElement, CompositeResolveHelper, CompositeModule, Bundle, BundleReference, BundleStartLevel, BundleRevisions
Direct Known Subclasses:
CompositeImpl, SurrogateImpl

public abstract class CompositeBase
extends BundleHost
implements CompositeResolveHelper, CompositeModule

This is a base class for both composite and surrogate bundles.


Field Summary
protected  Framework companionFramework
           
protected static java.lang.String PROP_COMPOSITE
           
protected static java.lang.String PROP_PARENTFRAMEWORK
           
protected  java.lang.ThreadLocal resolving
           
 
Fields inherited from class org.eclipse.osgi.framework.internal.core.BundleHost
context, fragments, LAZY_TRIGGER
 
Fields inherited from class org.eclipse.osgi.framework.internal.core.AbstractBundle
bundledata, domain, framework, manifestLocalization, state, statechangeLock, stateChanging
 
Fields inherited from interface org.osgi.framework.Bundle
ACTIVE, INSTALLED, RESOLVED, SIGNERS_ALL, SIGNERS_TRUSTED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED
 
Constructor Summary
CompositeBase(BundleData bundledata, Framework framework)
           
 
Method Summary
protected abstract  Framework findCompanionFramework(Framework thisFramework, BundleData thisData)
           
protected abstract  Bundle getCompanionBundle()
           
 BundleDescription getCompositeDescription()
           
 ClassLoaderDelegate getDelegate()
           
protected  boolean isSurrogate()
           
 void refreshContent()
           
 boolean resolveContent()
           
 void started(CompositeModule surrogate)
           
 void stopped(CompositeModule surrogate)
           
 void update()
          Updates this bundle.
 void update(java.io.InputStream in)
          Updates this bundle from an InputStream.
 void updateContent(java.io.InputStream content)
           
 
Methods inherited from class org.eclipse.osgi.framework.internal.core.BundleHost
attachFragment, createContext, getBundleLoader, getClassLoader, getContext, getFragments, getLoaderProxy, getRegisteredServices, getResource, getResources, getServicesInUse, load, loadClass, readyToResume, refresh, reload, startHook, startWorker, stopHook, stopWorker, unload
 
Methods inherited from class org.eclipse.osgi.framework.internal.core.AbstractBundle
adapt, adapt0, beginStateChange, checkValid, close, compare, compareTo, completeStateChange, createBundle, findEntries, getBundle, getBundleContext, getBundleData, getBundleDescription, getBundleId, getDataFile, getEntry, getEntryPaths, getFramework, getHeaders, getHeaders, getKey, getKeyHashCode, getLastModified, getLocation, getProtectionDomain, getResolutionFailureException, getResourceBundle, getRevisions, getSignerCertificates, getStartLevel, getState, getStateChanging, getSymbolicName, getVersion, hasPermission, isActivationPolicyUsed, isActive, isFragment, isPersistentlyStarted, isResolved, loadBundleActivator, loadClass, resolve, resume, setStartLevel, setStatus, start, start, stop, stop, suspend, testStateChanging, toString, uninstall, uninstallWorker, uninstallWorkerPrivileged, updateWorker, updateWorkerPrivileged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.osgi.internal.module.CompositeResolveHelper
giveExports
 

Field Detail

PROP_COMPOSITE

protected static java.lang.String PROP_COMPOSITE

PROP_PARENTFRAMEWORK

protected static java.lang.String PROP_PARENTFRAMEWORK

companionFramework

protected final Framework companionFramework

resolving

protected final java.lang.ThreadLocal resolving
Constructor Detail

CompositeBase

public CompositeBase(BundleData bundledata,
                     Framework framework)
              throws BundleException
Throws:
BundleException
Method Detail

findCompanionFramework

protected abstract Framework findCompanionFramework(Framework thisFramework,
                                                    BundleData thisData)
                                             throws BundleException
Throws:
BundleException

getCompanionBundle

protected abstract Bundle getCompanionBundle()

isSurrogate

protected boolean isSurrogate()

getCompositeDescription

public BundleDescription getCompositeDescription()
Specified by:
getCompositeDescription in interface CompositeModule

getDelegate

public ClassLoaderDelegate getDelegate()
Specified by:
getDelegate in interface CompositeModule

refreshContent

public void refreshContent()
Specified by:
refreshContent in interface CompositeModule

resolveContent

public boolean resolveContent()
Specified by:
resolveContent in interface CompositeModule

started

public void started(CompositeModule surrogate)
Specified by:
started in interface CompositeModule

stopped

public void stopped(CompositeModule surrogate)
Specified by:
stopped in interface CompositeModule

updateContent

public void updateContent(java.io.InputStream content)
                   throws BundleException
Specified by:
updateContent in interface CompositeModule
Throws:
BundleException

update

public void update()
            throws BundleException
Description copied from interface: Bundle
Updates this bundle.

This method performs the same function as calling Bundle.update(InputStream) with a null InputStream.

Specified by:
update in interface Bundle
Overrides:
update in class AbstractBundle
Throws:
BundleException - If this bundle could not be updated. BundleException types thrown by this method include: BundleException.READ_ERROR, BundleException.DUPLICATE_BUNDLE_ERROR, BundleException.MANIFEST_ERROR, BundleException.NATIVECODE_ERROR, BundleException.RESOLVE_ERROR, BundleException.STATECHANGE_ERROR, and BundleException.ACTIVATOR_ERROR.
See Also:
Bundle.update(InputStream)

update

public void update(java.io.InputStream in)
            throws BundleException
Description copied from interface: Bundle
Updates this bundle from an InputStream.

If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting, in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.

If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes.

If this bundle has exported any packages that are imported by another bundle, these packages must remain exported until the FrameworkWiring.refreshBundles method has been has been called or the Framework is relaunched.

The following steps are required to update a bundle:

  1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
  2. If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped as described in the Bundle.stop method. If Bundle.stop throws an exception, the exception is rethrown terminating the update.
  3. The updated version of this bundle is read from the input stream and installed. If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored and a BundleException must be thrown after completion of the remaining steps.
  4. This bundle's state is set to INSTALLED.
  5. If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired.
  6. If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method. If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception.
Preconditions Postconditions, no exceptions thrown Postconditions, when an exception is thrown

Specified by:
update in interface Bundle
Overrides:
update in class AbstractBundle
Parameters:
in - The InputStream from which to read the new bundle or null to indicate the Framework must create the input stream from this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location. The input stream must always be closed when this method completes, even if an exception is thrown.
Throws:
BundleException - If this bundle could not be updated. BundleException types thrown by this method include: BundleException.READ_ERROR, BundleException.DUPLICATE_BUNDLE_ERROR, BundleException.MANIFEST_ERROR, BundleException.NATIVECODE_ERROR, BundleException.RESOLVE_ERROR, BundleException.STATECHANGE_ERROR, and BundleException.ACTIVATOR_ERROR.
See Also:
Bundle.stop(), Bundle.start()


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.