org.eclipse.osgi.framework.adaptor
Interface BundleOperation


public interface BundleOperation

Bundle Storage interface for managing a persistent storage life cycle operation upon a bundle.

This class is used to provide methods to manage a life cycle operation on a bundle in persistent storage. BundleOperation objects are returned by the FrameworkAdaptor object and are called by OSGi to complete the persistent storage life cycle operation.

For example

      Bundle bundle;
      BundleOperation storage = adaptor.installBundle(location, source);
      try {
          bundle = storage.begin();

          // Perform some implementation specific work
          // which may fail.

          storage.commit(false);
          // bundle has been successfully installed
      } catch (BundleException e) {
          storage.undo();
          throw e; // rethrow the error
      }
      return bundle;
 

Clients may implement this interface.

Since:
3.1

Method Summary
 BundleData begin()
          Begin the operation on the bundle (install, update, uninstall).
 void commit(boolean postpone)
          Commit the operation performed.
 void undo()
          Undo the change to persistent storage.
 

Method Detail

begin

BundleData begin()
                 throws BundleException
Begin the operation on the bundle (install, update, uninstall).

Returns:
BundleData object for the target bundle.
Throws:
BundleException - If a failure occured modifiying peristent storage.

commit

void commit(boolean postpone)
            throws BundleException
Commit the operation performed.

Parameters:
postpone - If true, the bundle's persistent storage cannot be immediately reclaimed. This may occur if the bundle is still exporting a package.
Throws:
BundleException - If a failure occured modifiying peristent storage.

undo

void undo()
          throws BundleException
Undo the change to persistent storage.

This method can be called before calling commit or if commit throws an exception to undo any changes in progress.

Throws:
BundleException - If a failure occured modifiying peristent storage.