Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 187534 Details for
Bug 334582
OSGi changes to the wiring API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
334582.txt (text/plain), 81.53 KB, created by
Thomas Watson
on 2011-01-25 11:19:49 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Thomas Watson
Created:
2011-01-25 11:19:49 EST
Size:
81.53 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.osgi >Index: .settings/.api_filters >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/.settings/.api_filters,v >retrieving revision 1.49 >diff -u -r1.49 .api_filters >--- .settings/.api_filters 10 Jan 2011 14:36:17 -0000 1.49 >+++ .settings/.api_filters 25 Jan 2011 16:15:12 -0000 >@@ -419,6 +419,22 @@ > </message_arguments> > </filter> > </resource> >+<resource path="osgi/src/org/osgi/framework/AdaptPermission.java" type="org.osgi.framework.AdaptPermission"> >+<filter comment="Ignore OSGi API" id="1110441988"> >+<message_arguments> >+<message_argument value="org.osgi.framework.AdaptPermission"/> >+</message_arguments> >+</filter> >+</resource> >+<resource path="osgi/src/org/osgi/framework/AdminPermission.java" type="org.osgi.framework.AdminPermission"> >+<filter comment="Ignore OSGi API" id="1141899266"> >+<message_arguments> >+<message_argument value="1.6"/> >+<message_argument value="3.7"/> >+<message_argument value="WEAVE"/> >+</message_arguments> >+</filter> >+</resource> > <resource path="osgi/src/org/osgi/framework/Bundle.java" type="org.osgi.framework.Bundle"> > <filter id="403853384"> > <message_arguments> >@@ -699,6 +715,13 @@ > <message_arguments> > <message_argument value="1.6"/> > <message_argument value="3.7"/> >+<message_argument value="FILTER_DIRECTIVE"/> >+</message_arguments> >+</filter> >+<filter comment="Ignore OSGi API" id="1209008130"> >+<message_arguments> >+<message_argument value="1.6"/> >+<message_argument value="3.7"/> > <message_argument value="FRAMEWORK_BSNVERSION"/> > </message_arguments> > </filter> >@@ -910,6 +933,13 @@ > </message_arguments> > </filter> > </resource> >+<resource path="osgi/src/org/osgi/framework/hooks/service/ListenerHook.java" type="org.osgi.framework.hooks.service.ListenerHook$ListenerInfo"> >+<filter comment="Ignore OSGi API" id="403853384"> >+<message_arguments> >+<message_argument value="org.osgi.framework.hooks.service.ListenerHook.ListenerInfo"/> >+</message_arguments> >+</filter> >+</resource> > <resource path="osgi/src/org/osgi/framework/hooks/weaving/WeavingException.java" type="org.osgi.framework.hooks.weaving.WeavingException"> > <filter comment="Ignore OSGi API" id="1110441988"> > <message_arguments> >@@ -966,17 +996,17 @@ > </message_arguments> > </filter> > </resource> >-<resource path="osgi/src/org/osgi/framework/wiring/BundleWiring.java" type="org.osgi.framework.wiring.BundleWiring"> >+<resource path="osgi/src/org/osgi/framework/wiring/BundleRevisions.java" type="org.osgi.framework.wiring.BundleRevisions"> > <filter comment="Ignore OSGi API" id="1110441988"> > <message_arguments> >-<message_argument value="org.osgi.framework.wiring.BundleWiring"/> >+<message_argument value="org.osgi.framework.wiring.BundleRevisions"/> > </message_arguments> > </filter> > </resource> >-<resource path="osgi/src/org/osgi/framework/wiring/BundleWirings.java" type="org.osgi.framework.wiring.BundleWirings"> >+<resource path="osgi/src/org/osgi/framework/wiring/BundleWiring.java" type="org.osgi.framework.wiring.BundleWiring"> > <filter comment="Ignore OSGi API" id="1110441988"> > <message_arguments> >-<message_argument value="org.osgi.framework.wiring.BundleWirings"/> >+<message_argument value="org.osgi.framework.wiring.BundleWiring"/> > </message_arguments> > </filter> > </resource> >Index: core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java,v >retrieving revision 1.84 >diff -u -r1.84 AbstractBundle.java >--- core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java 4 Jan 2011 16:31:41 -0000 1.84 >+++ core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java 25 Jan 2011 16:15:12 -0000 >@@ -30,8 +30,7 @@ > import org.eclipse.osgi.util.NLS; > import org.osgi.framework.*; > import org.osgi.framework.startlevel.BundleStartLevel; >-import org.osgi.framework.wiring.BundleRevision; >-import org.osgi.framework.wiring.BundleWiring; >+import org.osgi.framework.wiring.*; > > /** > * This object is given out to bundles and wraps the internal Bundle object. It >@@ -1473,7 +1472,28 @@ > BundleDescription description = getBundleDescription(); > return (A) description.getBundleWiring(); > } >+ if (BundleRevisions.class.equals(adapterType)) { >+ return (A) new BundleRevisions() { >+ public Bundle getBundle() { >+ return AbstractBundle.this; >+ } >+ >+ public List<BundleRevision> getRevisions() { >+ List<BundleRevision> revisions = new ArrayList<BundleRevision>(); >+ BundleDescription current = getBundleDescription(); >+ if (current != null) >+ revisions.add(current); >+ BundleDescription[] removals = framework.adaptor.getState().getRemovalPending(); >+ for (BundleDescription removed : removals) { >+ if (removed.getBundleId() == getBundleId() && removed != current) { >+ revisions.add(removed); >+ } >+ } >+ return revisions; >+ } > >+ }; >+ } > if (BundleRevision.class.equals(adapterType)) { > return (A) getBundleDescription(); > } >Index: core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java,v >retrieving revision 1.45 >diff -u -r1.45 BundleFragment.java >--- core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java 10 Dec 2010 19:20:16 -0000 1.45 >+++ core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java 25 Jan 2011 16:15:12 -0000 >@@ -13,16 +13,12 @@ > > import java.io.IOException; > import java.net.URL; >-import java.util.*; >+import java.util.Enumeration; > import org.eclipse.osgi.framework.adaptor.BundleData; > import org.eclipse.osgi.framework.debug.Debug; > import org.eclipse.osgi.internal.loader.BundleLoader; >-import org.eclipse.osgi.service.resolver.BundleDescription; >-import org.eclipse.osgi.service.resolver.HostSpecification; > import org.eclipse.osgi.util.NLS; > import org.osgi.framework.*; >-import org.osgi.framework.wiring.BundleWiring; >-import org.osgi.framework.wiring.BundleWirings; > > public class BundleFragment extends AbstractBundle { > >@@ -335,44 +331,4 @@ > // Fragments cannot have a BundleContext. > return null; > } >- >- @SuppressWarnings("unchecked") >- public <A> A adapt(Class<A> adapterType) { >- if (BundleWirings.class.equals(adapterType)) { >- return (A) new BundleWirings() { >- public Bundle getBundle() { >- return BundleFragment.this; >- } >- >- public List<BundleWiring> getWirings() { >- List<BundleWiring> wirings = new ArrayList<BundleWiring>(); >- BundleDescription current = getBundleDescription(); >- BundleDescription[] removed = framework.adaptor.getState().getRemovalPending(); >- >- int i = -1; >- do { >- HostSpecification hostSpec = null; >- if (i == -1) { >- if (current != null) >- hostSpec = current.getHost(); >- } else if (removed[i] != current && removed[i].getBundleId() == getBundleId()) { >- hostSpec = removed[i].getHost(); >- } >- BundleDescription[] hostDescs = hostSpec == null ? null : hostSpec.getHosts(); >- if (hostDescs != null) { >- for (BundleDescription host : hostDescs) { >- BundleWiring wiring = host.getBundleWiring(); >- if (wiring != null) >- wirings.add(wiring); >- } >- } >- i++; >- } while (i < removed.length); >- return wirings; >- } >- >- }; >- } >- return super.adapt(adapterType); >- } > } >Index: core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java,v >retrieving revision 1.90 >diff -u -r1.90 BundleHost.java >--- core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java 10 Dec 2010 19:20:16 -0000 1.90 >+++ core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java 25 Jan 2011 16:15:12 -0000 >@@ -13,7 +13,7 @@ > > import java.io.IOException; > import java.net.URL; >-import java.util.*; >+import java.util.Enumeration; > import org.eclipse.osgi.framework.adaptor.*; > import org.eclipse.osgi.framework.debug.Debug; > import org.eclipse.osgi.framework.log.FrameworkLogEntry; >@@ -22,8 +22,6 @@ > import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.osgi.util.NLS; > import org.osgi.framework.*; >-import org.osgi.framework.wiring.BundleWiring; >-import org.osgi.framework.wiring.BundleWirings; > > public class BundleHost extends AbstractBundle { > public static final int LAZY_TRIGGER = 0x40000000; >@@ -679,33 +677,4 @@ > return (bcl instanceof ClassLoader) ? (ClassLoader) bcl : null; > } > >- @SuppressWarnings("unchecked") >- public <A> A adapt(Class<A> adapterType) { >- if (BundleWirings.class.equals(adapterType)) { >- return (A) new BundleWirings() { >- public Bundle getBundle() { >- return BundleHost.this; >- } >- >- public List<BundleWiring> getWirings() { >- List<BundleWiring> wirings = new ArrayList<BundleWiring>(); >- BundleWiring current = adapt(BundleWiring.class); >- if (current != null) >- wirings.add(current); >- BundleDescription[] removals = framework.adaptor.getState().getRemovalPending(); >- for (BundleDescription removed : removals) { >- if (removed.getBundleId() == getBundleId()) { >- BundleWiring removedWiring = removed.getBundleWiring(); >- if (removedWiring != null && removedWiring != current) >- wirings.add(removedWiring); >- } >- } >- return wirings; >- } >- >- }; >- } >- return super.adapt(adapterType); >- } >- > } >Index: osgi/src/org/osgi/framework/AdaptPermission.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/AdaptPermission.java >diff -N osgi/src/org/osgi/framework/AdaptPermission.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/AdaptPermission.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,635 @@ >+/* >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+package org.osgi.framework; >+ >+import java.io.IOException; >+import java.io.NotSerializableException; >+import java.io.ObjectInputStream; >+import java.io.ObjectOutputStream; >+import java.io.ObjectStreamField; >+import java.security.AccessController; >+import java.security.BasicPermission; >+import java.security.Permission; >+import java.security.PermissionCollection; >+import java.security.PrivilegedAction; >+import java.util.ArrayList; >+import java.util.Collection; >+import java.util.Collections; >+import java.util.Enumeration; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+/** >+ * A bundle's authority to adapt an object to a type. >+ * >+ * <p> >+ * {@code AdaptPermission} has one action: {@code adapt}. >+ * >+ * @ThreadSafe >+ * @version $Id: bc4c5d392d2534a7744f6fc00f4665502f82033c $ >+ */ >+public class AdaptPermission extends BasicPermission { >+ >+ private static final long serialVersionUID = 1L; >+ >+ /** >+ * The action string {@code initiate}. >+ */ >+ public final static String ADAPT = "adapt"; >+ >+ private final static int ACTION_ADAPT = 0x00000001; >+ private final static int ACTION_ALL = ACTION_ADAPT; >+ final static int ACTION_NONE = 0; >+ >+ /** >+ * The actions mask. >+ */ >+ transient int action_mask; >+ >+ /** >+ * The actions in canonical form. >+ * >+ * @serial >+ */ >+ private volatile String actions = null; >+ >+ /** >+ * The bundle used by this AdaptPermission. >+ */ >+ transient final Bundle bundle; >+ >+ /** >+ * This holds a Filter matching object used to evaluate the filter in >+ * implies. >+ */ >+ transient Filter filter; >+ >+ /** >+ * This map holds the properties of the permission, used to match a filter >+ * in implies. This is not initialized until necessary, and then cached in >+ * this object. >+ */ >+ private transient volatile Map<String, Object> properties; >+ >+ /** >+ * Creates a new granted {@code AdaptPermission} object. >+ * >+ * This constructor must only be used to create a permission that is going >+ * to be checked. >+ * <p> >+ * Examples: >+ * >+ * <pre> >+ * (adaptClass=com.acme.*) >+ * (&(signer=\*,o=ACME,c=US)(adaptClass=com.acme.*)) >+ * (signer=\*,o=ACME,c=US) >+ * </pre> >+ * >+ * <p> >+ * When a signer key is used within the filter expression the signer value >+ * must escape the special filter chars ('*', '(', ')'). >+ * <p> >+ * The name is specified as a filter expression. The filter gives access to >+ * the following attributes: >+ * <ul> >+ * <li>signer - A Distinguished Name chain used to sign the exporting >+ * bundle. Wildcards in a DN are not matched according to the filter string >+ * rules, but according to the rules defined for a DN chain.</li> >+ * <li>location - The location of the exporting bundle.</li> >+ * <li>id - The bundle ID of the exporting bundle.</li> >+ * <li>name - The symbolic name of the exporting bundle.</li> >+ * <li>adaptClass - The name of the type to which an object can be adapted.</li> >+ * </ul> >+ * Filter attribute names are processed in a case sensitive manner. >+ * >+ * @param filter A filter expression. Filter attribute names are processed >+ * in a case sensitive manner. A special value of {@code "*"} can be >+ * used to match all adaptations. >+ * @param actions {@code adapt}. >+ * @throws IllegalArgumentException If the filter has an invalid syntax. >+ */ >+ public AdaptPermission(String filter, String actions) { >+ this(parseFilter(filter), parseActions(actions)); >+ } >+ >+ /** >+ * Creates a new requested {@code AdaptPermission} object to be used by the >+ * code that must perform {@code checkPermission}. {@code AdaptPermission} >+ * objects created with this constructor cannot be added to an >+ * {@code AdaptPermission} permission collection. >+ * >+ * @param adaptClass The name of the type to which an object can be adapted. >+ * @param adaptableBundle The bundle associated with the object being >+ * adapted. >+ * @param actions {@code adapt}. >+ */ >+ public AdaptPermission(String adaptClass, Bundle adaptableBundle, >+ String actions) { >+ super(adaptClass); >+ setTransients(null, parseActions(actions)); >+ this.bundle = adaptableBundle; >+ if (adaptClass == null) { >+ throw new NullPointerException("adaptClass must not be null"); >+ } >+ if (adaptableBundle == null) { >+ throw new NullPointerException("adaptableBundle must not be null"); >+ } >+ } >+ >+ /** >+ * Package private constructor used by AdaptPermissionCollection. >+ * >+ * @param filter name filter >+ * @param mask action mask >+ */ >+ AdaptPermission(Filter filter, int mask) { >+ super((filter == null) ? "*" : filter.toString()); >+ setTransients(filter, mask); >+ this.bundle = null; >+ } >+ >+ /** >+ * Called by constructors and when deserialized. >+ * >+ * @param filter Permission's filter or {@code null} for wildcard. >+ * @param mask action mask >+ */ >+ private void setTransients(Filter filter, int mask) { >+ this.filter = filter; >+ if ((mask == ACTION_NONE) || ((mask & ACTION_ALL) != mask)) { >+ throw new IllegalArgumentException("invalid action string"); >+ } >+ this.action_mask = mask; >+ } >+ >+ /** >+ * Parse action string into action mask. >+ * >+ * @param actions Action string. >+ * @return action mask. >+ */ >+ private static int parseActions(String actions) { >+ boolean seencomma = false; >+ >+ int mask = ACTION_NONE; >+ >+ if (actions == null) { >+ return mask; >+ } >+ >+ char[] a = actions.toCharArray(); >+ >+ int i = a.length - 1; >+ if (i < 0) >+ return mask; >+ >+ while (i != -1) { >+ char c; >+ >+ // skip whitespace >+ while ((i != -1) >+ && ((c = a[i]) == ' ' || c == '\r' || c == '\n' >+ || c == '\f' || c == '\t')) >+ i--; >+ >+ // check for the known strings >+ int matchlen; >+ >+ if (i >= 4 && (a[i - 4] == 'a' || a[i - 4] == 'A') >+ && (a[i - 3] == 'd' || a[i - 3] == 'D') >+ && (a[i - 2] == 'a' || a[i - 2] == 'A') >+ && (a[i - 1] == 'p' || a[i - 1] == 'P') >+ && (a[i] == 't' || a[i] == 'T')) { >+ matchlen = 5; >+ mask |= ACTION_ADAPT; >+ >+ } >+ else { >+ // parse error >+ throw new IllegalArgumentException("invalid actions: " >+ + actions); >+ } >+ >+ // make sure we didn't just match the tail of a word >+ // like "ackbarfadapt". Also, skip to the comma. >+ seencomma = false; >+ while (i >= matchlen && !seencomma) { >+ switch (a[i - matchlen]) { >+ case ',' : >+ seencomma = true; >+ /* FALLTHROUGH */ >+ case ' ' : >+ case '\r' : >+ case '\n' : >+ case '\f' : >+ case '\t' : >+ break; >+ default : >+ throw new IllegalArgumentException( >+ "invalid permission: " + actions); >+ } >+ i--; >+ } >+ >+ // point i at the location of the comma minus one (or -1). >+ i -= matchlen; >+ } >+ >+ if (seencomma) { >+ throw new IllegalArgumentException("invalid actions: " + actions); >+ } >+ >+ return mask; >+ } >+ >+ /** >+ * Parse filter string into a Filter object. >+ * >+ * @param filterString The filter string to parse. >+ * @return a Filter for this bundle. >+ * @throws IllegalArgumentException If the filter syntax is invalid. >+ */ >+ private static Filter parseFilter(String filterString) { >+ filterString = filterString.trim(); >+ if (filterString.equals("*")) { >+ return null; >+ } >+ try { >+ return FrameworkUtil.createFilter(filterString); >+ } >+ catch (InvalidSyntaxException e) { >+ IllegalArgumentException iae = new IllegalArgumentException( >+ "invalid filter"); >+ iae.initCause(e); >+ throw iae; >+ } >+ } >+ >+ /** >+ * Determines if the specified permission is implied by this object. >+ * >+ * <p> >+ * This method checks that the filter of the target is implied by the adapt >+ * class name of this object. The list of {@code AdaptPermission} actions >+ * must either match or allow for the list of the target object to imply the >+ * target {@code AdaptPermission} action. >+ * <p> >+ * >+ * @param p The requested permission. >+ * @return {@code true} if the specified permission is implied by this >+ * object; {@code false} otherwise. >+ */ >+ public boolean implies(Permission p) { >+ if (!(p instanceof AdaptPermission)) { >+ return false; >+ } >+ AdaptPermission requested = (AdaptPermission) p; >+ if (bundle != null) { >+ return false; >+ } >+ // if requested permission has a filter, then it is an invalid argument >+ if (requested.filter != null) { >+ return false; >+ } >+ return implies0(requested, ACTION_NONE); >+ } >+ >+ /** >+ * Internal implies method. Used by the implies and the permission >+ * collection implies methods. >+ * >+ * @param requested The requested AdaptPermission which has already be >+ * validated as a proper argument. The requested AdaptPermission must >+ * not have a filter expression. >+ * @param effective The effective actions with which to start. >+ * @return {@code true} if the specified permission is implied by this >+ * object; {@code false} otherwise. >+ */ >+ boolean implies0(AdaptPermission requested, int effective) { >+ /* check actions first - much faster */ >+ effective |= action_mask; >+ final int desired = requested.action_mask; >+ if ((effective & desired) != desired) { >+ return false; >+ } >+ /* Get filter */ >+ Filter f = filter; >+ if (f == null) { >+ // it's "*" >+ return true; >+ } >+ return f.matches(requested.getProperties()); >+ } >+ >+ /** >+ * Returns the canonical string representation of the >+ * {@code AdaptPermission} actions. >+ * >+ * <p> >+ * Always returns present {@code AdaptPermission} actions in the following >+ * order: {@code adapt}. >+ * >+ * @return Canonical string representation of the {@code AdaptPermission} >+ * actions. >+ */ >+ public String getActions() { >+ String result = actions; >+ if (result == null) { >+ actions = result = ADAPT; >+ } >+ return result; >+ } >+ >+ /** >+ * Returns a new {@code PermissionCollection} object suitable for storing >+ * {@code AdaptPermission} objects. >+ * >+ * @return A new {@code PermissionCollection} object. >+ */ >+ public PermissionCollection newPermissionCollection() { >+ return new AdaptPermissionCollection(); >+ } >+ >+ /** >+ * Determines the equality of two {@code AdaptPermission} objects. >+ * >+ * This method checks that specified permission has the same name and >+ * {@code AdaptPermission} actions as this {@code AdaptPermission} object. >+ * >+ * @param obj The object to test for equality with this >+ * {@code AdaptPermission} object. >+ * @return {@code true} if {@code obj} is a {@code AdaptPermission}, and has >+ * the same name and actions as this {@code AdaptPermission} object; >+ * {@code false} otherwise. >+ */ >+ public boolean equals(Object obj) { >+ if (obj == this) { >+ return true; >+ } >+ >+ if (!(obj instanceof AdaptPermission)) { >+ return false; >+ } >+ >+ AdaptPermission cp = (AdaptPermission) obj; >+ >+ return (action_mask == cp.action_mask) >+ && getName().equals(cp.getName()) >+ && ((bundle == cp.bundle) || ((bundle != null) && bundle >+ .equals(cp.bundle))); >+ } >+ >+ /** >+ * Returns the hash code value for this object. >+ * >+ * @return A hash code value for this object. >+ */ >+ public int hashCode() { >+ int h = 31 * 17 + getName().hashCode(); >+ h = 31 * h + getActions().hashCode(); >+ if (bundle != null) { >+ h = 31 * h + bundle.hashCode(); >+ } >+ return h; >+ } >+ >+ /** >+ * WriteObject is called to save the state of this permission object to a >+ * stream. The actions are serialized, and the superclass takes care of the >+ * name. >+ */ >+ private synchronized void writeObject(java.io.ObjectOutputStream s) >+ throws IOException { >+ if (bundle != null) { >+ throw new NotSerializableException("cannot serialize"); >+ } >+ // Write out the actions. The superclass takes care of the name >+ // call getActions to make sure actions field is initialized >+ if (actions == null) >+ getActions(); >+ s.defaultWriteObject(); >+ } >+ >+ /** >+ * readObject is called to restore the state of this permission from a >+ * stream. >+ */ >+ private synchronized void readObject(java.io.ObjectInputStream s) >+ throws IOException, ClassNotFoundException { >+ // Read in the action, then initialize the rest >+ s.defaultReadObject(); >+ setTransients(parseFilter(getName()), parseActions(actions)); >+ } >+ >+ /** >+ * Called by {@code <@link AdaptPermission#implies(Permission)>}. This >+ * method is only called on a requested permission which cannot have a >+ * filter set. >+ * >+ * @return a map of properties for this permission. >+ */ >+ private Map<String, Object> getProperties() { >+ Map<String, Object> result = properties; >+ if (result != null) { >+ return result; >+ } >+ final Map<String, Object> map = new HashMap<String, Object>(5); >+ map.put("adaptClass", getName()); >+ if (bundle != null) { >+ AccessController.doPrivileged(new PrivilegedAction<Object>() { >+ public Object run() { >+ map.put("id", new Long(bundle.getBundleId())); >+ map.put("location", bundle.getLocation()); >+ String name = bundle.getSymbolicName(); >+ if (name != null) { >+ map.put("name", name); >+ } >+ SignerProperty signer = new SignerProperty(bundle); >+ if (signer.isBundleSigned()) { >+ map.put("signer", signer); >+ } >+ return null; >+ } >+ }); >+ } >+ return properties = map; >+ } >+} >+ >+/** >+ * Stores a set of {@code AdaptPermission} permissions. >+ * >+ * @see java.security.Permission >+ * @see java.security.Permissions >+ * @see java.security.PermissionCollection >+ */ >+ >+final class AdaptPermissionCollection extends PermissionCollection { >+ static final long serialVersionUID = -3350758995234427603L; >+ /** >+ * Collection of permissions. >+ * >+ * @serial >+ * @GuardedBy this >+ */ >+ private Map<String, AdaptPermission> permissions; >+ >+ /** >+ * Boolean saying if "*" is in the collection. >+ * >+ * @serial >+ * @GuardedBy this >+ */ >+ private boolean all_allowed; >+ >+ /** >+ * Create an empty AdaptPermissions object. >+ */ >+ public AdaptPermissionCollection() { >+ permissions = new HashMap<String, AdaptPermission>(); >+ all_allowed = false; >+ } >+ >+ /** >+ * Adds a permission to this permission collection. >+ * >+ * @param permission The {@code AdaptPermission} object to add. >+ * @throws IllegalArgumentException If the specified permission is not a >+ * {@code AdaptPermission} instance or was constructed with a Bundle >+ * object. >+ * @throws SecurityException If this {@code AdaptPermissionCollection} >+ * object has been marked read-only. >+ */ >+ public void add(final Permission permission) { >+ if (!(permission instanceof AdaptPermission)) { >+ throw new IllegalArgumentException("invalid permission: " >+ + permission); >+ } >+ if (isReadOnly()) { >+ throw new SecurityException("attempt to add a Permission to a " >+ + "readonly PermissionCollection"); >+ } >+ >+ final AdaptPermission ap = (AdaptPermission) permission; >+ if (ap.bundle != null) { >+ throw new IllegalArgumentException("cannot add to collection: " >+ + ap); >+ } >+ >+ final String name = ap.getName(); >+ synchronized (this) { >+ Map<String, AdaptPermission> pc = permissions; >+ final AdaptPermission existing = pc.get(name); >+ if (existing != null) { >+ final int oldMask = existing.action_mask; >+ final int newMask = ap.action_mask; >+ if (oldMask != newMask) { >+ pc.put(name, new AdaptPermission(existing.filter, oldMask >+ | newMask)); >+ >+ } >+ } >+ else { >+ pc.put(name, ap); >+ } >+ >+ if (!all_allowed) { >+ if (name.equals("*")) { >+ all_allowed = true; >+ } >+ } >+ } >+ } >+ >+ /** >+ * Determines if the specified permissions implies the permissions expressed >+ * in {@code permission}. >+ * >+ * @param permission The Permission object to compare with this >+ * {@code AdaptPermission} object. >+ * @return {@code true} if {@code permission} is a proper subset of a >+ * permission in the set; {@code false} otherwise. >+ */ >+ public boolean implies(final Permission permission) { >+ if (!(permission instanceof AdaptPermission)) { >+ return false; >+ } >+ final AdaptPermission requested = (AdaptPermission) permission; >+ /* if requested permission has a filter, then it is an invalid argument */ >+ if (requested.filter != null) { >+ return false; >+ } >+ >+ int effective = AdaptPermission.ACTION_NONE; >+ >+ Collection<AdaptPermission> perms; >+ synchronized (this) { >+ Map<String, AdaptPermission> pc = permissions; >+ /* short circuit if the "*" Permission was added */ >+ if (all_allowed) { >+ AdaptPermission ap = pc.get("*"); >+ if (ap != null) { >+ effective |= ap.action_mask; >+ final int desired = requested.action_mask; >+ if ((effective & desired) == desired) { >+ return true; >+ } >+ } >+ } >+ perms = pc.values(); >+ } >+ /* iterate one by one over filteredPermissions */ >+ for (AdaptPermission perm : perms) { >+ if (perm.implies0(requested, effective)) { >+ return true; >+ } >+ } >+ return false; >+ } >+ >+ /** >+ * Returns an enumeration of all {@code AdaptPermission} objects in the >+ * container. >+ * >+ * @return Enumeration of all {@code AdaptPermission} objects. >+ */ >+ public synchronized Enumeration<Permission> elements() { >+ List<Permission> all = new ArrayList<Permission>(permissions.values()); >+ return Collections.enumeration(all); >+ } >+ >+ /* serialization logic */ >+ private static final ObjectStreamField[] serialPersistentFields = { >+ new ObjectStreamField("permissions", HashMap.class), >+ new ObjectStreamField("all_allowed", Boolean.TYPE) }; >+ >+ private synchronized void writeObject(ObjectOutputStream out) >+ throws IOException { >+ ObjectOutputStream.PutField pfields = out.putFields(); >+ pfields.put("permissions", permissions); >+ pfields.put("all_allowed", all_allowed); >+ out.writeFields(); >+ } >+ >+ private synchronized void readObject(java.io.ObjectInputStream in) >+ throws IOException, ClassNotFoundException { >+ ObjectInputStream.GetField gfields = in.readFields(); >+ permissions = (HashMap<String, AdaptPermission>) gfields.get( >+ "permissions", null); >+ all_allowed = gfields.get("all_allowed", false); >+ } >+} >Index: osgi/src/org/osgi/framework/AdminPermission.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java,v >retrieving revision 1.44 >diff -u -r1.44 AdminPermission.java >--- osgi/src/org/osgi/framework/AdminPermission.java 23 Sep 2010 19:26:14 -0000 1.44 >+++ osgi/src/org/osgi/framework/AdminPermission.java 25 Jan 2011 16:15:12 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -45,7 +45,7 @@ > * class Bundle.loadClass > * execute Bundle.start > * Bundle.stop >- * StartLevel.setBundleStartLevel >+ * BundleStartLevel.setStartLevel > * extensionLifecycle BundleContext.installBundle for extension bundles > * Bundle.update for extension bundles > * Bundle.uninstall for extension bundles >@@ -56,23 +56,25 @@ > * BundleContext.removeBundleListener for SynchronousBundleListener > * metadata Bundle.getHeaders > * Bundle.getLocation >- * resolve PackageAdmin.refreshPackages >- * PackageAdmin.resolveBundles >+ * resolve FrameworkWiring.refreshBundles >+ * FrameworkWiring.resolveBundles > * resource Bundle.getResource > * Bundle.getResources > * Bundle.getEntry > * Bundle.getEntryPaths > * Bundle.findEntries > * Bundle resource/entry URL creation >- * startlevel StartLevel.setStartLevel >- * StartLevel.setInitialBundleStartLevel >+ * startlevel FrameworkStartLevel.setStartLevel >+ * FrameworkStartLevel.setInitialBundleStartLevel > * context Bundle.getBundleContext >+ * weave WovenClass.setBytes >+ * WovenClass.getDynamicImports for modification > * </pre> > * > * <p> > * The special action "*" will represent all actions. The >- * {@code resolve} action is implied by the {@code class}, >- * {@code execute} and {@code resource} actions. >+ * {@code resolve} action is implied by the {@code class}, {@code execute} and >+ * {@code resource} actions. > * <p> > * The name of this permission is a filter expression. The filter gives access > * to the following attributes: >@@ -87,7 +89,7 @@ > * Filter attribute names are processed in a case sensitive manner. > * > * @ThreadSafe >- * @version $Id: 8488ac114b71f92331d3a6739b878e4bd55fecdb $ >+ * @version $Id: 43baf9a6d7ce5e6108507834e841e340fd91c513 $ > */ > > public final class AdminPermission extends BasicPermission { >@@ -160,6 +162,13 @@ > */ > public final static String CONTEXT = "context"; > >+ /** >+ * The action string {@code weave}. >+ * >+ * @since 1.6 >+ */ >+ public final static String WEAVE = "weave"; >+ > private final static int ACTION_CLASS = 0x00000001; > private final static int ACTION_EXECUTE = 0x00000002; > private final static int ACTION_LIFECYCLE = 0x00000004; >@@ -170,6 +179,7 @@ > private final static int ACTION_STARTLEVEL = 0x00000100; > private final static int ACTION_EXTENSIONLIFECYCLE = 0x00000200; > private final static int ACTION_CONTEXT = 0x00000400; >+ private final static int ACTION_WEAVE = 0x00000800; > private final static int ACTION_ALL = ACTION_CLASS > | ACTION_EXECUTE > | ACTION_LIFECYCLE >@@ -179,7 +189,8 @@ > | ACTION_RESOURCE > | ACTION_STARTLEVEL > | ACTION_EXTENSIONLIFECYCLE >- | ACTION_CONTEXT; >+ | ACTION_CONTEXT >+ | ACTION_WEAVE; > final static int ACTION_NONE = 0; > > /** >@@ -247,14 +258,13 @@ > * Null arguments are equivalent to "*". > * > * @param filter A filter expression that can use signer, location, id, and >- * name keys. A value of "*" or {@code null} matches >- * all bundle. Filter attribute names are processed in a case >- * sensitive manner. >- * @param actions {@code class}, {@code execute}, >- * {@code extensionLifecycle}, {@code lifecycle}, >- * {@code listener}, {@code metadata}, {@code resolve} >- * , {@code resource}, {@code startlevel} or >- * {@code context}. A value of "*" or {@code null} >+ * name keys. A value of "*" or {@code null} matches all >+ * bundle. Filter attribute names are processed in a case sensitive >+ * manner. >+ * @param actions {@code class}, {@code execute}, {@code extensionLifecycle} >+ * , {@code lifecycle}, {@code listener}, {@code metadata}, >+ * {@code resolve} , {@code resource}, {@code startlevel}, >+ * {@code context} or {@code weave}. A value of "*" or {@code null} > * indicates all actions. > * @throws IllegalArgumentException If the filter has an invalid syntax. > */ >@@ -265,17 +275,16 @@ > } > > /** >- * Creates a new requested {@code AdminPermission} object to be used by >- * the code that must perform {@code checkPermission}. >- * {@code AdminPermission} objects created with this constructor cannot >- * be added to an {@code AdminPermission} permission collection. >+ * Creates a new requested {@code AdminPermission} object to be used by the >+ * code that must perform {@code checkPermission}. {@code AdminPermission} >+ * objects created with this constructor cannot be added to an >+ * {@code AdminPermission} permission collection. > * > * @param bundle A bundle. >- * @param actions {@code class}, {@code execute}, >- * {@code extensionLifecycle}, {@code lifecycle}, >- * {@code listener}, {@code metadata}, {@code resolve} >- * , {@code resource}, {@code startlevel}, >- * {@code context}. A value of "*" or {@code null} >+ * @param actions {@code class}, {@code execute}, {@code extensionLifecycle} >+ * , {@code lifecycle}, {@code listener}, {@code metadata}, >+ * {@code resolve} , {@code resource}, {@code startlevel}, >+ * {@code context}, {@code weave}. A value of "*" or {@code null} > * indicates all actions. > * @since 1.3 > */ >@@ -503,19 +512,29 @@ > > } > else >- if (i >= 0 && >- >- (a[i] == '*')) { >- matchlen = 1; >- mask |= ACTION_ALL; >- >- } >- else { >- // parse error >- throw new IllegalArgumentException( >- "invalid permission: " >- + actions); >+ if (i >= 4 >+ && (a[i - 4] == 'w' || a[i - 4] == 'W') >+ && (a[i - 3] == 'e' || a[i - 3] == 'E') >+ && (a[i - 2] == 'a' || a[i - 2] == 'A') >+ && (a[i - 1] == 'v' || a[i - 1] == 'V') >+ && (a[i] == 'e' || a[i] == 'E')) { >+ matchlen = 5; >+ mask |= ACTION_WEAVE; >+ > } >+ else >+ if (i >= 0 >+ && (a[i] == '*')) { >+ matchlen = 1; >+ mask |= ACTION_ALL; >+ >+ } >+ else { >+ // parse error >+ throw new IllegalArgumentException( >+ "invalid permission: " >+ + actions); >+ } > > // make sure we didn't just match the tail of a word > // like "ackbarfstartlevel". Also, skip to the comma. >@@ -668,14 +687,13 @@ > * {@code AdminPermission} actions. > * > * <p> >- * Always returns present {@code AdminPermission} actions in the >- * following order: {@code class}, {@code execute}, >- * {@code extensionLifecycle}, {@code lifecycle}, >- * {@code listener}, {@code metadata}, {@code resolve}, >- * {@code resource}, {@code startlevel}, {@code context}. >+ * Always returns present {@code AdminPermission} actions in the following >+ * order: {@code class}, {@code execute}, {@code extensionLifecycle}, >+ * {@code lifecycle}, {@code listener}, {@code metadata}, {@code resolve}, >+ * {@code resource}, {@code startlevel}, {@code context}, {@code weave}. > * >- * @return Canonical string representation of the >- * {@code AdminPermission} actions. >+ * @return Canonical string representation of the {@code AdminPermission} >+ * actions. > */ > public String getActions() { > String result = actions; >@@ -732,6 +750,11 @@ > sb.append(CONTEXT); > sb.append(','); > } >+ >+ if ((mask & ACTION_WEAVE) == ACTION_WEAVE) { >+ sb.append(WEAVE); >+ sb.append(','); >+ } > > // remove trailing comma > if (sb.length() > 0) { >Index: osgi/src/org/osgi/framework/Bundle.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java,v >retrieving revision 1.45 >diff -u -r1.45 Bundle.java >--- osgi/src/org/osgi/framework/Bundle.java 10 Jan 2011 14:30:33 -0000 1.45 >+++ osgi/src/org/osgi/framework/Bundle.java 25 Jan 2011 16:15:13 -0000 >@@ -26,6 +26,8 @@ > import java.util.List; > import java.util.Map; > >+import org.osgi.framework.wiring.FrameworkWiring; >+ > /** > * An installed bundle in the Framework. > * >@@ -74,7 +76,7 @@ > * > * @ThreadSafe > * @noimplement >- * @version $Id: 2b49f64e7a633cefc70b438ec9e1f966ff4f8130 $ >+ * @version $Id: 46e30f6a4a403ace9bb2313435562d273900856b $ > */ > public interface Bundle extends Comparable<Bundle> { > /** >@@ -257,8 +259,7 @@ > * If this bundle's state is {@code UNINSTALLED} then an > * {@code IllegalStateException} is thrown. > * <p> >- * If the Framework implements the optional Start Level service and the >- * current start level is less than this bundle's start level: >+ * If the current start level is less than this bundle's start level: > * <ul> > * <li>If the {@link #START_TRANSIENT} option is set, then a > * {@code BundleException} is thrown indicating this bundle cannot be >@@ -512,8 +513,9 @@ > * <p> > * If this bundle has exported any packages that are imported by another > * bundle, these packages must remain exported until the >- * {@code PackageAdmin.refreshPackages} method has been has been called or >- * the Framework is relaunched. >+ * {@link FrameworkWiring#refreshBundles(java.util.Collection, FrameworkListener...) >+ * FrameworkWiring.refreshBundles} method has been has been called or the >+ * Framework is relaunched. > * > * <p> > * The following steps are required to update a bundle: >@@ -624,8 +626,9 @@ > * <p> > * If this bundle has exported any packages, the Framework must continue to > * make these packages available to their importing bundles until the >- * {@code PackageAdmin.refreshPackages} method has been called or the >- * Framework is relaunched. >+ * {@link FrameworkWiring#refreshBundles(java.util.Collection, FrameworkListener...) >+ * FrameworkWiring.refreshBundles} method has been called or the Framework >+ * is relaunched. > * > * <p> > * The following steps are required to uninstall a bundle: >@@ -1204,6 +1207,9 @@ > * @return The object, of the specified type, to which this bundle has been > * adapted or {@code null} if this bundle cannot be adapted to the > * specified type. >+ * @throws SecurityException If the caller does not have the appropriate >+ * {@code AdaptPermission[type,this,ADAPT]}, and the Java Runtime >+ * Environment supports permissions. > * @since 1.6 > */ > <A> A adapt(Class<A> type); >Index: osgi/src/org/osgi/framework/Constants.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java,v >retrieving revision 1.48 >diff -u -r1.48 Constants.java >--- osgi/src/org/osgi/framework/Constants.java 10 Jan 2011 14:30:33 -0000 1.48 >+++ osgi/src/org/osgi/framework/Constants.java 25 Jan 2011 16:15:13 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -28,7 +28,7 @@ > * > * @since 1.1 > * @noimplement >- * @version $Id: bf31cbaceba8df7648e343136ce87da520e7e675 $ >+ * @version $Id: dfc898e60b6825d9b1dada682a6aecc858daa7f4 $ > */ > > public interface Constants { >@@ -1590,21 +1590,21 @@ > String EFFECTIVE_ACTIVE = "active"; > > /** >- * Manifest header attribute identifying the capability filter specified in >+ * Manifest header directive identifying the capability filter specified in > * the Require-Capability manifest header. > * > * <p> >- * The attribute value is encoded in the Require-Capability manifest header >+ * The directive value is encoded in the Require-Capability manifest header > * like: > * > * <pre> >- * Require-Capability: com.acme.capability; filter="(someattr=somevalue)" >+ * Require-Capability: com.acme.capability; filter:="(someattr=somevalue)" > * </pre> > * > * @see #REQUIRE_CAPABILITY > * @since 1.6 > */ >- String FILTER_ATTRIBUTE = "filter"; >+ String FILTER_DIRECTIVE = "filter"; > > /** > * Framework launching property identifying capabilities which the system >Index: osgi/src/org/osgi/framework/FrameworkEvent.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java,v >retrieving revision 1.18 >diff -u -r1.18 FrameworkEvent.java >--- osgi/src/org/osgi/framework/FrameworkEvent.java 6 Aug 2010 19:51:44 -0000 1.18 >+++ osgi/src/org/osgi/framework/FrameworkEvent.java 25 Jan 2011 16:15:13 -0000 >@@ -18,6 +18,9 @@ > > import java.util.EventObject; > >+import org.osgi.framework.startlevel.FrameworkStartLevel; >+import org.osgi.framework.wiring.FrameworkWiring; >+ > /** > * A general event from the Framework. > * >@@ -32,7 +35,7 @@ > * > * @Immutable > * @see FrameworkListener >- * @version $Id: 897075a0bc075c0bb89e77d113f05ca84406a073 $ >+ * @version $Id: e05c6ffd542fa432835961882bf6b15b0620ffb6 $ > */ > > public class FrameworkEvent extends EventObject { >@@ -61,7 +64,7 @@ > * has reached the initial start level. The source of this event is the > * System Bundle. > * >- * @see "The Start Level Service" >+ * @see "The Start Level Specification" > */ > public final static int STARTED = 0x00000001; > >@@ -74,20 +77,21 @@ > public final static int ERROR = 0x00000002; > > /** >- * A PackageAdmin.refreshPackage operation has completed. >+ * A FrameworkWiring.refreshBundles operation has completed. > * > * <p> >- * This event is fired when the Framework has completed the refresh packages >- * operation initiated by a call to the PackageAdmin.refreshPackages method. >- * The source of this event is the System Bundle. >+ * This event is fired when the Framework has completed the refresh bundles >+ * operation initiated by a call to the FrameworkWiring.refreshBundles >+ * method. The source of this event is the System Bundle. > * > * @since 1.2 >- * @see "{@code PackageAdmin.refreshPackages}" >+ * @see FrameworkWiring#refreshBundles(java.util.Collection, >+ * FrameworkListener...) > */ > public final static int PACKAGES_REFRESHED = 0x00000004; > > /** >- * A StartLevel.setStartLevel operation has completed. >+ * A FrameworkStartLevel.setStartLevel operation has completed. > * > * <p> > * This event is fired when the Framework has completed changing the active >@@ -95,7 +99,7 @@ > * The source of this event is the System Bundle. > * > * @since 1.2 >- * @see "The Start Level Service" >+ * @see FrameworkStartLevel#setStartLevel(int, FrameworkListener...) > */ > public final static int STARTLEVEL_CHANGED = 0x00000008; > >Index: osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java,v >retrieving revision 1.5 >diff -u -r1.5 ResolverHook.java >--- osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java 10 Jan 2011 14:30:33 -0000 1.5 >+++ osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java 25 Jan 2011 16:15:13 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2011). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -24,90 +24,107 @@ > import org.osgi.framework.wiring.FrameworkWiring; > > /** >- * OSGi Framework Resolver Hook instances are obtained from the OSGi {@link ResolverHookFactory >- * Framework Resolver Hook Factory} service. >+ * OSGi Framework Resolver Hook instances are obtained from the OSGi >+ * {@link ResolverHookFactory Framework Resolver Hook Factory} service. > * > * <p> >- * A Resolver Hook instance is called by the framework during a resolve >- * process. A resolver hook may influence the outcome of a resolve process by removing entries >- * from shrinkable collections that are passed to the hook during a resolve process. A shrinkable >- * collection is a {@code Collection} that supports all remove operations. Any other attempts to modify >- * a shrinkable collection will result in an {@code UnsupportedOperationException} being thrown. >+ * A Resolver Hook instance is called by the framework during a resolve process. >+ * A resolver hook may influence the outcome of a resolve process by removing >+ * entries from shrinkable collections that are passed to the hook during a >+ * resolve process. A shrinkable collection is a {@code Collection} that >+ * supports all remove operations. Any other attempts to modify a shrinkable >+ * collection will result in an {@code UnsupportedOperationException} being >+ * thrown. > * > * <p> >- * The following steps outline the way a framework uses the resolver hooks during a resolve >- * process. >+ * The following steps outline the way a framework uses the resolver hooks >+ * during a resolve process. > * <ol> >- * <li> Collect a snapshot of registered resolver hook factories that will be called during the >- * current resolve process. Any hook factories registered after the snapshot is taken must not be called >- * during the current resolve process. A resolver hook factory contained in the snapshot may become >- * unregistered during the resolve process. The framework should handle this and stop calling >- * the resolver hook instance provided by the unregistered hook factory for the remainder of the resolve process.</li> >- * <li> For each registered hook factory call the {@link ResolverHookFactory#begin(Collection)} method to inform the >- * hooks about a resolve process beginning and to obtain a Resolver Hook instance that will be used for the duration >- * of the resolve process.</li> >- * <li> Determine the collection of unresolved bundle revisions that may be considered for resolution during >- * the current resolution process and place each of the bundle revisions in a shrinkable collection >- * <b>{@code R}</b>. For each resolver hook call the {@link #filterResolvable(Collection)} method with the >- * shrinkable collection <b>{@code R}</b>.</li> >- * <li> The shrinkable collection <b>{@code R}</b> now contains all the unresolved bundle revisions that may end up >- * as resolved at the end of the current resolve process. Any other bundle revisions that >- * got removed from the shrinkable collection <b>{@code R}</b> must not end up as resolved at the end >- * of the current resolve process.</li> >- * <li> For each bundle revision {@code B} left in the shrinkable collection <b>{@code R}</b> that represents a >- * singleton bundle do the following: >- * <p> >- * Determine the collection of available capabilities that have a name space of >- * {@link Capability#BUNDLE_CAPABILITY osgi.bundle}, are singletons, and have the same >- * symbolic name as the singleton bundle revision <b>{@code B}</b> and place each of the matching >- * capabilities into a shrinkable collection <b>{@code S}</b>. >- >- * Remove the {@link Capability#BUNDLE_CAPABILITY osgi.bundle} capability provided by >- * bundle revision <b>{@code B}</b> from shrinkable collection <b>{@code S}</b>. A singleton bundle >- * cannot collide with itself. >- * >- * For each resovler hook call the {@link #filterSingletonCollisions(Capability, Collection)} >- * with the {@link Capability#BUNDLE_CAPABILITY osgi.bundle} capability provided by bundle revision >- * <b>{@code B}</b> and the shrinkable collection <b>{@code S}</b> >- * >- * The shrinkable collection <b>{@code S}</b> now contains all singleton {@link Capability#BUNDLE_CAPABILITY >- * osgi.bundle} capabilities that can influence the ability of bundle revision <b>{@code B}</b> to resolve. >- * </p> >- * </li> >- * <li> During a resolve process a framework is free to attempt to resolve any or all bundles contained in >- * shrinkable collection <b>{@code R}</b>. For each bundle revision <b>{@code B}</b> left in the shrinkable collection >- * <b>{@code R}</b> which the framework attempts to resolve the following steps must be followed: >- * <p> >- * For each requirement <b>{@code T}</b> specified by bundle revision <b>{@code B}</b> determine the >- * collection of capabilities that satisfy (or match) the requirement and place each matching capability into >- * a shrinkable collection <b>{@code C}</b>. A capability is considered to match a particular requirement >- * if its attributes satisfy a specified requirement and the requirer bundle has permission to access the >- * capability. >+ * <li>Collect a snapshot of registered resolver hook factories that will be >+ * called during the current resolve process. Any hook factories registered >+ * after the snapshot is taken must not be called during the current resolve >+ * process. A resolver hook factory contained in the snapshot may become >+ * unregistered during the resolve process. The framework should handle this and >+ * stop calling the resolver hook instance provided by the unregistered hook >+ * factory and the current resolve process must fail. If possible, an exception >+ * must be thrown to the caller of the API which triggered the resolve process. >+ * In cases where the the caller is not available a framework event of type >+ * error should be fired.</li> >+ * <li>For each registered hook factory call the >+ * {@link ResolverHookFactory#begin(Collection)} method to inform the hooks >+ * about a resolve process beginning and to obtain a Resolver Hook instance that >+ * will be used for the duration of the resolve process.</li> >+ * <li>Determine the collection of unresolved bundle revisions that may be >+ * considered for resolution during the current resolution process and place >+ * each of the bundle revisions in a shrinkable collection {@code R}. For each >+ * resolver hook call the {@link #filterResolvable(Collection)} method with the >+ * shrinkable collection {@code R}.</li> >+ * <li>The shrinkable collection {@code R} now contains all the unresolved >+ * bundle revisions that may end up as resolved at the end of the current >+ * resolve process. Any other bundle revisions that got removed from the >+ * shrinkable collection {@code R} must not end up as resolved at the end of the >+ * current resolve process.</li> >+ * <li>For each bundle revision {@code B} left in the shrinkable collection >+ * {@code R} that represents a singleton bundle do the following:<br/> >+ * Determine the collection of available capabilities that have a name space of >+ * {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle}, are singletons, and >+ * have the same symbolic name as the singleton bundle revision {@code B} and >+ * place each of the matching capabilities into a shrinkable collection >+ * {@code S}. > * >- * For each resolver hook call the {@link #filterMatches(BundleRevision, Collection)} with the >- * bundle revision <b>{@code B}</b> and the shrinkable collection <b>{@code C}</b>. >- * >- * The shrinkable collection <b>{@code C}</b> now contains all the capabilities that may be used to >- * satisfy the requirement <b>{@code T}</b>. Any other capabilities that got removed from the >- * shrinkable collection <b>{@code C}</b> must not be used to satisfy requirement <b>{@code T}</b>. >- * </p> >- * </li> >- * <li> For each resolver hook call the {@link #end()} method to inform the hooks about a resolve >- * process ending.</li> >+ * Remove the {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle} capability >+ * provided by bundle revision {@code B} from shrinkable collection {@code S}. A >+ * singleton bundle cannot collide with itself. >+ * >+ * For each resolver hook call the >+ * {@link #filterSingletonCollisions(Capability, Collection)} with the >+ * {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle} capability provided >+ * by bundle revision {@code B} and the shrinkable collection {@code S} >+ * >+ * The shrinkable collection {@code S} now contains all singleton >+ * {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle} capabilities that can >+ * influence the ability of bundle revision {@code B} to resolve.</li> >+ * <li>During a resolve process a framework is free to attempt to resolve any or >+ * all bundles contained in shrinkable collection {@code R}. For each bundle >+ * revision {@code B} left in the shrinkable collection {@code R} which the >+ * framework attempts to resolve the following steps must be followed: >+ * <p/> >+ * For each requirement {@code T} specified by bundle revision {@code B} >+ * determine the collection of capabilities that satisfy (or match) the >+ * requirement and place each matching capability into a shrinkable collection >+ * {@code C}. A capability is considered to match a particular requirement if >+ * its attributes satisfy a specified requirement and the requirer bundle has >+ * permission to access the capability. >+ * >+ * <p/> >+ * For each resolver hook call the >+ * {@link #filterMatches(BundleRevision, Collection)} with the bundle revision >+ * {@code B} and the shrinkable collection {@code C}. >+ * >+ * <p/> >+ * The shrinkable collection {@code C} now contains all the capabilities that >+ * may be used to satisfy the requirement {@code T}. Any other capabilities that >+ * got removed from the shrinkable collection {@code C} must not be used to >+ * satisfy requirement {@code T}.</li> >+ * <li>For each resolver hook call the {@link #end()} method to inform the hooks >+ * about a resolve process ending.</li> > * </ol> >- * In all cases, the order in which the resolver hooks are called is the reverse compareTo ordering of >- * their Service References. That is, the service with the highest ranking number must be called first. >- * In cases where a shrinkable collection becomes empty the framework is required to call the >- * remaining registered hooks. >+ * In all cases, the order in which the resolver hooks are called is the reverse >+ * compareTo ordering of their Service References. That is, the service with the >+ * highest ranking number must be called first. In cases where a shrinkable >+ * collection becomes empty the framework is required to call the remaining >+ * registered hooks. > * <p> >- * Resolver hooks are low level. Implementations of the resolver hook must be careful not to create an unresolvable state which >- * is very hard for a developer or a provisioner to diagnose. Resolver hooks also must not be allowed to start another synchronous >- * resolve process (e.g. by calling {@link Bundle#start()} or {@link FrameworkWiring#resolveBundles(Collection)}). >- * The framework must detect this and throw an {@link IllegalStateException}. >+ * Resolver hooks are low level. Implementations of the resolver hook must be >+ * careful not to create an unresolvable state which is very hard for a >+ * developer or a provisioner to diagnose. Resolver hooks also must not be >+ * allowed to start another synchronous resolve process (e.g. by calling >+ * {@link Bundle#start()} or {@link FrameworkWiring#resolveBundles(Collection)} >+ * ). The framework must detect this and throw an {@link IllegalStateException}. > * > * @see ResolverHookFactory >- * @ThreadSafe >- * @version $Id: abc1f4bb4fd57b8bb41855b1282fe22cb13a9654 $ >+ * @NotThreadSafe >+ * @version $Id: f2c91d233fd9a4547452e4c3f09d7bcbe8c565fb $ > */ > public interface ResolverHook { > /** >@@ -123,25 +140,29 @@ > void filterResolvable(Collection<BundleRevision> candidates); > > /** >- * Filter singleton collisions hook method. This method is called during the resolve process >- * for the specified singleton. The specified singleton represents a singleton capability >- * and the specified collection represent a collection of singleton capabilities which are >- * considered collision candidates. The singleton capability and the collection of collision >+ * Filter singleton collisions hook method. This method is called during the >+ * resolve process for the specified singleton. The specified singleton >+ * represents a singleton capability and the specified collection represent >+ * a collection of singleton capabilities which are considered collision >+ * candidates. The singleton capability and the collection of collision > * candidates must all use the same name space. > * <p> >- * Currently only capabilities with the name space of {@link Capability#BUNDLE_CAPABILITY >- * osgi.bundle} can be singletons. In that case all the collision candidates >- * have the name space of {@link Capability#BUNDLE_CAPABILITY osgi.bundle}, are singletons, >- * and have the same symbolic name as the specified singleton capability. >+ * Currently only capabilities with the name space of >+ * {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle} can be >+ * singletons. In that case all the collision candidates have the name space >+ * of {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle}, are >+ * singletons, and have the same symbolic name as the specified singleton >+ * capability. > * <p> >- * In the future, capabilities in other name spaces may support the singleton concept. >- * Hook implementations should be prepared to receive calls to this method for >- * capabilities in name spaces other than {@link Capability#BUNDLE_CAPABILITY >- * osgi.bundle}. >+ * In the future, capabilities in other name spaces may support the >+ * singleton concept. Hook implementations should be prepared to receive >+ * calls to this method for capabilities in name spaces other than >+ * {@link Capability#BUNDLE_CAPABILITY osgi.wiring.bundle}. > * <p> >- * This method can filter the list of collision candidates by removing potential collisions. >- * Removing a collision candidate will allow the specified singleton to resolve regardless of >- * the resolution state of the removed collision candidate. >+ * This method can filter the list of collision candidates by removing >+ * potential collisions. Removing a collision candidate will allow the >+ * specified singleton to resolve regardless of the resolution state of the >+ * removed collision candidate. > * > * @param singleton the singleton involved in a resolve process > * @param collisionCandidates a collection of singleton collision candidates >Index: osgi/src/org/osgi/framework/hooks/service/ListenerHook.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/ListenerHook.java,v >retrieving revision 1.11 >diff -u -r1.11 ListenerHook.java >--- osgi/src/org/osgi/framework/hooks/service/ListenerHook.java 6 Aug 2010 19:51:45 -0000 1.11 >+++ osgi/src/org/osgi/framework/hooks/service/ListenerHook.java 25 Jan 2011 16:15:13 -0000 >@@ -28,7 +28,7 @@ > * addition and removal. > * > * @ThreadSafe >- * @version $Id: c64053251939f402bb35b6a69fc3009888420872 $ >+ * @version $Id: c1687e95e568589cf3e6d927b7d372c9f88c5d16 $ > */ > > public interface ListenerHook { >@@ -67,6 +67,7 @@ > * which added the Service Listener and the filter with which it was added. > * > * @ThreadSafe >+ * @noimplement > */ > public interface ListenerInfo { > /** >Index: osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java,v >retrieving revision 1.1 >diff -u -r1.1 WovenClass.java >--- osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java 13 Oct 2010 15:55:38 -0000 1.1 >+++ osgi/src/org/osgi/framework/hooks/weaving/WovenClass.java 25 Jan 2011 16:15:13 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2010). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -35,7 +35,7 @@ > * > * @NotThreadSafe > * @noimplement >- * @version $Id: f54547066bd0632e85242cac434a6bb8a759dff6 $ >+ * @version $Id: c9fdc8cc09e8455b52572c8eb3721a2e1778aa6b $ > */ > public interface WovenClass { > >@@ -75,6 +75,9 @@ > * @throws NullPointerException If newBytes is {@code null}. > * @throws IllegalStateException If weaving is {@link #isWeavingComplete() > * complete}. >+ * @throws SecurityException If the caller does not have >+ * {@code AdminPermission[bundle,WEAVE]} and the Java runtime >+ * environment supports permissions. > */ > public void setBytes(byte[] newBytes); > >@@ -90,6 +93,10 @@ > * After weaving is {@link #isWeavingComplete() complete}, this object > * becomes effectively immutable and the returned list will be unmodifiable. > * >+ * <p> >+ * If the Java runtime environment supports permissions, the caller must >+ * have {@code AdminPermission[bundle,WEAVE]} to modify the returned list. >+ * > * @return A list containing zero or more dynamic import package > * descriptions to add to the bundle wiring for this woven class. > * This list must throw {@code IllegalArgumentException} if a >Index: osgi/src/org/osgi/framework/launch/Framework.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/Framework.java,v >retrieving revision 1.13 >diff -u -r1.13 Framework.java >--- osgi/src/org/osgi/framework/launch/Framework.java 10 Jan 2011 14:30:33 -0000 1.13 >+++ osgi/src/org/osgi/framework/launch/Framework.java 25 Jan 2011 16:15:13 -0000 >@@ -35,7 +35,7 @@ > * > * @ThreadSafe > * @noimplement >- * @version $Id: e403b10bdb5ae9b9e42651ce04003923beacc3d9 $ >+ * @version $Id: 2be857d06f3605a04f701b59f11e127c0f8940dc $ > */ > public interface Framework extends Bundle { > >@@ -51,8 +51,7 @@ > * <li>Have event handling enabled.</li> > * <li>Have reified Bundle objects for all installed bundles.</li> > * <li>Have registered any framework services. For example, >- * {@code PackageAdmin}, {@code ConditionalPermissionAdmin}, >- * {@code StartLevel}.</li> >+ * {@code ConditionalPermissionAdmin}.</li> > * <li>Be {@link #adapt(Class) adaptable} to the OSGi defined types to which > * a system bundle can be adapted.</li> > * </ul> >@@ -134,12 +133,10 @@ > * <li>All installed bundles must be started in accordance with each > * bundle's persistent <i>autostart setting</i>. This means some bundles > * will not be started, some will be started with <i>eager activation</i> >- * and some will be started with their <i>declared activation</i> policy. If >- * this Framework implements the optional <i>Start Level Service >- * Specification</i>, then the start level of this Framework is moved to the >- * start level specified by the >- * {@link Constants#FRAMEWORK_BEGINNING_STARTLEVEL beginning start level} >- * framework property, as described in the <i>Start Level Service >+ * and some will be started with their <i>declared activation</i> policy. >+ * The start level of this Framework is moved to the start level specified >+ * by the {@link Constants#FRAMEWORK_BEGINNING_STARTLEVEL beginning start >+ * level} framework property, as described in the <i>Start Level > * Specification</i>. If this framework property is not specified, then the > * start level of this Framework is moved to start level one (1). Any > * exceptions that occur during bundle starting must be wrapped in a >@@ -153,7 +150,7 @@ > * @throws SecurityException If the caller does not have the appropriate > * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime > * Environment supports permissions. >- * @see "Start Level Service Specification" >+ * @see "Start Level Specification" > */ > void start() throws BundleException; > >@@ -182,12 +179,11 @@ > * <ol> > * <li>This Framework's state is set to {@link #STOPPING}.</li> > * <li>All installed bundles must be stopped without changing each bundle's >- * persistent <i>autostart setting</i>. If this Framework implements the >- * optional <i>Start Level Service Specification</i>, then the start level >- * of this Framework is moved to start level zero (0), as described in the >- * <i>Start Level Service Specification</i>. Any exceptions that occur >- * during bundle stopping must be wrapped in a {@link BundleException} and >- * then published as a framework event of type {@link FrameworkEvent#ERROR}</li> >+ * persistent <i>autostart setting</i>. The start level of this Framework is >+ * moved to start level zero (0), as described in the <i>Start Level >+ * Specification</i>. Any exceptions that occur during bundle stopping must >+ * be wrapped in a {@link BundleException} and then published as a framework >+ * event of type {@link FrameworkEvent#ERROR}</li> > * <li>Unregister all services registered by this Framework.</li> > * <li>Event handling is disabled.</li> > * <li>This Framework's state is set to {@link #RESOLVED}.</li> >@@ -205,7 +201,7 @@ > * @throws SecurityException If the caller does not have the appropriate > * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime > * Environment supports permissions. >- * @see "Start Level Service Specification" >+ * @see "Start Level Specification" > */ > void stop() throws BundleException; > >Index: osgi/src/org/osgi/framework/wiring/BundleRevision.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java,v >retrieving revision 1.2 >diff -u -r1.2 BundleRevision.java >--- osgi/src/org/osgi/framework/wiring/BundleRevision.java 4 Oct 2010 15:01:52 -0000 1.2 >+++ osgi/src/org/osgi/framework/wiring/BundleRevision.java 25 Jan 2011 16:15:13 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2010). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -17,6 +17,7 @@ > > package org.osgi.framework.wiring; > >+import java.util.Collection; > import java.util.List; > > import org.osgi.framework.Bundle; >@@ -24,17 +25,19 @@ > import org.osgi.framework.Version; > > /** >- * Bundle Revision. Since a bundle update can change the entries in a bundle, >- * different bundle wirings for the same bundle can be associated with different >- * bundle revisions. >+ * Bundle Revision. When a bundle is installed and each time a bundle is >+ * updated, a new bundle revision of the bundle is created. Since a bundle >+ * update can change the entries in a bundle, different bundle wirings for the >+ * same bundle can be associated with different bundle revisions. > * > * <p> >- * The current bundle revision for a bundle can be obtained by calling >+ * The current bundle revision is the most recent bundle revision. The current >+ * bundle revision for a bundle can be obtained by calling > * {@link Bundle#adapt(Class) bundle.adapt}(BundleRevision.class). > * > * @ThreadSafe > * @noimplement >- * @version $Id: 1a15861159e7071a1eb504afbc3f75f8af1aff01 $ >+ * @version $Id: 8784ab34979add57e814661e9024f1520e98d924 $ > */ > public interface BundleRevision extends BundleReference { > /** >@@ -93,4 +96,25 @@ > * @see #getTypes() > */ > int TYPE_FRAGMENT = 0x00000001; >+ >+ /** >+ * Returns the bundle wiring which is using this bundle revision. >+ * >+ * @return The bundle wiring which is using this bundle revision or >+ * {@code null} if this bundle revision is a {@link #TYPE_FRAGMENT >+ * fragment} or no bundle wiring is using this bundle revision. >+ * @see BundleWiring#getBundleRevision() >+ */ >+ BundleWiring getBundleWiring(); >+ >+ /** >+ * Returns the bundle wirings to which this fragment revision is attached. >+ * >+ * @return The bundle wirings to which this fragment revision is attached. >+ * The returned collection will be empty if this bundle revision is >+ * not a {@link #TYPE_FRAGMENT fragment} or this fragment revision >+ * is not attached to any bundle wirings. >+ * @see BundleWiring#getFragmentRevisions() >+ */ >+ Collection<BundleWiring> getHostWirings(); > } >Index: osgi/src/org/osgi/framework/wiring/BundleRevisions.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/BundleRevisions.java >diff -N osgi/src/org/osgi/framework/wiring/BundleRevisions.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/wiring/BundleRevisions.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (c) OSGi Alliance (2011). All Rights Reserved. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+ >+package org.osgi.framework.wiring; >+ >+import java.util.List; >+ >+import org.osgi.framework.Bundle; >+import org.osgi.framework.BundleReference; >+ >+/** >+ * The {@link BundleRevision bundle revisions} of a bundle. When a bundle is >+ * installed and each time a bundle is updated, a new bundle revision of the >+ * bundle is created. The current bundle revision is the most recent bundle >+ * revision. An in use bundle revision is associated with an >+ * {@link BundleWiring#isInUse() in use} {@link BundleWiring}. Only the current >+ * bundle revision and all in use bundle revisions are returned. >+ * >+ * <p> >+ * The bundle revisions for a bundle can be obtained by calling >+ * {@link Bundle#adapt(Class) bundle.adapt}({@link BundleRevisions}.class). >+ * {@link #getRevisions()} on the bundle. >+ * >+ * @ThreadSafe >+ * @noimplement >+ * @version $Id: f0d2e2e4e67663d48a82905958d2d7db464ef882 $ >+ */ >+public interface BundleRevisions extends BundleReference { >+ /** >+ * Return the bundle revisions for the {@link BundleReference#getBundle() >+ * referenced} bundle. >+ * >+ * <p> >+ * The result is a list of the current bundle revision and the in use bundle >+ * revisions. The list is ordered in reverse chronological order such that >+ * the first item is the current bundle revision and last item is the oldest >+ * in use bundle revision. >+ * >+ * <p> >+ * Generally the list will have at least one bundle revision for the bundle: >+ * the current bundle revision. However, for an uninstalled bundle with no >+ * in use bundle revisions, the list will be empty. >+ * >+ * @return A list containing a snapshot of the {@link BundleRevision}s for >+ * the referenced bundle. >+ */ >+ List<BundleRevision> getRevisions(); >+} >Index: osgi/src/org/osgi/framework/wiring/BundleWiring.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java,v >retrieving revision 1.5 >diff -u -r1.5 BundleWiring.java >--- osgi/src/org/osgi/framework/wiring/BundleWiring.java 11 Oct 2010 17:43:27 -0000 1.5 >+++ osgi/src/org/osgi/framework/wiring/BundleWiring.java 25 Jan 2011 16:15:13 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2010). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -40,12 +40,6 @@ > * by the framework. > * > * <p> >- * A list of all in use bundle wirings for a bundle can be obtained by calling >- * {@link Bundle#adapt(Class) bundle.adapt}({@link BundleWirings}.class). >- * {@link BundleWirings#getWirings() getWirings()}. For non-fragment bundles, >- * the first item in the returned list is the current bundle wiring. >- * >- * <p> > * The current bundle wiring for a non-fragment bundle can be obtained by > * calling {@link Bundle#adapt(Class) bundle.adapt}(BundleWiring.class). A > * fragment bundle does not itself have bundle wirings. So calling >@@ -54,7 +48,7 @@ > * > * @ThreadSafe > * @noimplement >- * @version $Id: 77da60ad2f9fdeea7bd9465b633b35f8a06c6cdf $ >+ * @version $Id: 2a2dc2113c066c3c591a0e54325272d29fcd6d7b $ > */ > public interface BundleWiring extends BundleReference { > /** >@@ -126,6 +120,7 @@ > * may refer to an older revision of the bundle. > * > * @return The bundle revision for this bundle wiring. >+ * @see BundleRevision#getBundleWiring() > */ > BundleRevision getBundleRevision(); > >@@ -145,6 +140,7 @@ > * empty list if this bundle wiring does not have any attached > * fragments. If this bundle wiring is not {@link #isInUse() in use} > * , {@code null} will be returned. >+ * @see BundleRevision#getHostWirings() > */ > List<BundleRevision> getFragmentRevisions(); > >Index: osgi/src/org/osgi/framework/wiring/BundleWirings.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/BundleWirings.java >diff -N osgi/src/org/osgi/framework/wiring/BundleWirings.java >--- osgi/src/org/osgi/framework/wiring/BundleWirings.java 4 Oct 2010 15:01:52 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,69 +0,0 @@ >-/* >- * Copyright (c) OSGi Alliance (2010). All Rights Reserved. >- * >- * Licensed under the Apache License, Version 2.0 (the "License"); >- * you may not use this file except in compliance with the License. >- * You may obtain a copy of the License at >- * >- * http://www.apache.org/licenses/LICENSE-2.0 >- * >- * Unless required by applicable law or agreed to in writing, software >- * distributed under the License is distributed on an "AS IS" BASIS, >- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >- * See the License for the specific language governing permissions and >- * limitations under the License. >- */ >- >-package org.osgi.framework.wiring; >- >-import java.util.List; >- >-import org.osgi.framework.Bundle; >-import org.osgi.framework.BundleReference; >- >-/** >- * The {@link BundleWiring#isInUse() in use} bundle wirings for a bundle. Each >- * time a bundle is resolved, a new bundle wiring of the bundle is created. A >- * bundle wiring consists of a bundle and its attached fragments and represents >- * the dependencies with other bundle wirings. >- * >- * <p> >- * The in use bundle wirings for a bundle can be obtained by calling >- * {@link Bundle#adapt(Class) bundle.adapt}({@link BundleWirings}.class). >- * {@link BundleWirings#getWirings() getWirings()}. >- * >- * @ThreadSafe >- * @noimplement >- * @version $Id: ecf3e7820319a6710f4dff063577bd052f5dafe2 $ >- */ >-public interface BundleWirings extends BundleReference { >- /** >- * Return the {@link BundleWiring#isInUse() in use} wirings for the >- * {@link BundleReference#getBundle() referenced} bundle. >- * >- * <p> >- * If the referenced bundle is a non-fragment bundle, then the result is a >- * list of in use bundle wirings. The list is ordered in reverse >- * chronological order such that the first bundle wiring is the >- * {@link BundleWiring#isCurrent() current} bundle wiring and last wiring is >- * the oldest in use bundle wiring. >- * >- * <p> >- * If the referenced bundle is a fragment bundle, then the result is a list >- * of in use bundle wirings to which the referenced fragment bundle is >- * attached. The ordering of the list is unspecified. If the fragment bundle >- * is not attached to any bundle wiring, then the returned list will be >- * empty. >- * >- * <p> >- * The list must only contain in use bundle wirings. Generally the list will >- * have at least one bundle wiring for the bundle: the current bundle >- * wiring. However, for an uninstalled bundle with no in use bundle wirings >- * or a newly installed bundle which has not been resolved, the list will be >- * empty. >- * >- * @return A list containing a snapshot of the {@link BundleWiring}s for the >- * referenced bundle. >- */ >- List<BundleWiring> getWirings(); >-} >Index: osgi/src/org/osgi/framework/wiring/Capability.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/Capability.java,v >retrieving revision 1.4 >diff -u -r1.4 Capability.java >--- osgi/src/org/osgi/framework/wiring/Capability.java 10 Dec 2010 21:05:28 -0000 1.4 >+++ osgi/src/org/osgi/framework/wiring/Capability.java 25 Jan 2011 16:15:13 -0000 >@@ -1,5 +1,5 @@ > /* >- * Copyright (c) OSGi Alliance (2010). All Rights Reserved. >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. >@@ -35,7 +35,7 @@ > * > * @ThreadSafe > * @noimplement >- * @version $Id: 6b7ced3912cc0570547c06bb4140b78d36d7ee42 $ >+ * @version $Id: 3ad14a4c94573f8ce5d4ac9d3cb2f96f44e67f72 $ > */ > public interface Capability { > /** >@@ -73,7 +73,7 @@ > * package capabilities required by a bundle wiring may change as the bundle > * wiring may dynamically import additional packages. > */ >- String PACKAGE_CAPABILITY = "osgi.package"; >+ String PACKAGE_CAPABILITY = "osgi.wiring.package"; > > /** > * Capability name space for bundle capabilities. The bundle symbolic name >@@ -98,7 +98,7 @@ > * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion} > * {@literal <} 2) must not provide a bundle capability. > */ >- String BUNDLE_CAPABILITY = "osgi.bundle"; >+ String BUNDLE_CAPABILITY = "osgi.wiring.bundle"; > > /** > * Capability name space for host capabilities. The bundle symbolic name of >@@ -123,7 +123,7 @@ > * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion} > * {@literal <} 2) must not provide a host capability. > */ >- String HOST_CAPABILITY = "osgi.host"; >+ String HOST_CAPABILITY = "osgi.wiring.host"; > > /** > * Returns the name space of this capability. >Index: resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java,v >retrieving revision 1.64 >diff -u -r1.64 BundleDescriptionImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java 14 Dec 2010 22:12:34 -0000 1.64 >+++ resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java 25 Jan 2011 16:15:13 -0000 >@@ -912,6 +912,18 @@ > } > } > >+ public Collection<BundleWiring> getHostWirings() { >+ @SuppressWarnings("unchecked") >+ Collection<BundleWiring> result = Collections.EMPTY_LIST; >+ if (!isResolved() || (getTypes() & BundleRevision.TYPE_FRAGMENT) == 0) >+ return result; >+ BundleDescription[] hosts = host.getHosts(); >+ result = new ArrayList<BundleWiring>(hosts.length); >+ for (BundleDescription hostDesc : hosts) >+ result.add(hostDesc.getBundleWiring()); >+ return result; >+ } >+ > // Note that description wiring are identity equality based > class DescriptionWiring implements BundleWiring { > private volatile boolean valid = true; >Index: resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java,v >retrieving revision 1.70 >diff -u -r1.70 StateBuilder.java >--- resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java 9 Dec 2010 21:42:18 -0000 1.70 >+++ resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java 25 Jan 2011 16:15:13 -0000 >@@ -466,7 +466,7 @@ > > GenericSpecificationImpl spec = new GenericSpecificationImpl(); > spec.setType(namespace); >- String filterSpec = element.getAttribute(Constants.FILTER_ATTRIBUTE); >+ String filterSpec = element.getDirective(Constants.FILTER_DIRECTIVE); > if (filterSpec != null) { > try { > FilterImpl filter = FilterImpl.newInstance(filterSpec);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 334582
:
186947
|
187534