Skip to main content
summaryrefslogtreecommitdiffstats
blob: c1f06b8ed20b8233eedc3478be5b7f068317fca8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2003, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.osgi.framework.adaptor;

import org.osgi.framework.BundleException;

/**
 * Bundle Storage interface for managing a persistent storage life
 * cycle operation upon a bundle.
 *
 * <p>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.
 *
 * <p>For example
 * <pre>
 *      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;
 * </pre>
 *
 */
public abstract interface BundleOperation {

	/**
	 * Begin the operation on the bundle (install, update, uninstall).
	 *
	 * @return BundleData object for the target bundle.
	 * @throws BundleException If a failure occured modifiying peristent storage.
	 */
	public abstract BundleData begin() throws BundleException;

	/**
	 * Commit the operation performed.
	 *
	 * @param 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.
	 */
	public abstract void commit(boolean postpone) throws BundleException;

	/**
	 * Undo the change to persistent storage.
	 * <p>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.
	 */
	public abstract void undo() throws BundleException;

}

Back to the top