KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > service > resolver > PlatformAdmin


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.osgi.service.resolver;
12
13 import org.osgi.framework.BundleException;
14
15 /**
16  * Framework service which allows bundle programmers to inspect the bundles and
17  * packages known to the Framework. The PlatformAdmin service also allows bundles
18  * with sufficient privileges to update the state of the framework by committing a new
19  * configuration of bundles and packages.
20  *
21  * If present, there will only be a single instance of this service
22  * registered with the Framework.
23  * <p>
24  * Clients may implement this interface.
25  * </p>
26  * @since 3.1
27  */

28 public interface PlatformAdmin {
29
30     /**
31      * Returns a mutable state representing the current system.
32      * <p>
33      * This is a convenience method, fully equivalent to
34      * <code>getState(true)</code>.
35      * </p>
36      * @return a state representing the current framework.
37      */

38     public State getState();
39
40     /**
41      * Returns a state representing the current system. If there is need to make
42      * changes to the returned state, a mutable state must be requested.
43      * Otherwise, an immutable state should be requested. In this case, invoking
44      * any of the operations that could cause the state to be changed will throw
45      * an <code>java.lang.UnsupportedOperationException</code>.
46      * <p>
47      * If a mutable state is requested, the resulting state will <strong>not</strong>
48      * be resolved.
49      * </p>
50      * @param mutable whether the returned state should mutable
51      * @return a state representing the current framework.
52      */

53     public State getState(boolean mutable);
54
55     /**
56      * Returns a state helper object. State helpers provide convenience methods
57      * for manipulating states.
58      * <p>
59      * A possible implementation for this
60      * method would provide the same single StateHelper instance to all clients.
61      * </p>
62      *
63      * @return a state helper
64      * @see StateHelper
65      */

66     public StateHelper getStateHelper();
67
68     /**
69      * Commit the differences between the current state and the given state.
70      * The given state must return true from State.isResolved() or an exception
71      * is thrown. The resolved state is committed verbatim, as-is.
72      *
73      * @param state the future state of the framework
74      * @throws BundleException if the id of the given state does not match that of the
75      * current state or if the given state is not resolved.
76      */

77     public void commit(State state) throws BundleException;
78     
79     /**
80      * Returns a resolver supplied by the system. The returned resolver
81      * will not be associated with any state.
82      * @return a system resolver
83      */

84     public Resolver getResolver();
85
86     /**
87      * Returns a factory that knows how to create state objects, such as bundle
88      * descriptions and the different types of version constraints.
89      * @return a state object factory
90      */

91     public StateObjectFactory getFactory();
92 }
93
Popular Tags