Bug 106057 [osgi] org.osgi API needs updated to latest OSGi R4
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java
index 3c6323b..6a38935 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java
@@ -307,7 +307,7 @@
}
}
state = STARTING;
-
+ framework.publishBundleEvent(BundleEvent.STARTING, this);
context = createContext();
try {
context.start();
@@ -389,7 +389,7 @@
}
state = STOPPING;
-
+ framework.publishBundleEvent(BundleEvent.STOPPING, this);
try {
context.stop();
} finally {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java
index 7d1cf15..634b47e 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java
@@ -11,10 +11,9 @@
package org.eclipse.osgi.framework.internal.core;
import java.util.ArrayList;
-import org.eclipse.osgi.service.resolver.*;
+import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.osgi.framework.*;
-import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.service.packageadmin.ExportedPackage;
@@ -68,6 +67,10 @@
return specVersion;
}
+ public Version getVersion() {
+ return exportedPackage.getVersion();
+ }
+
public boolean isRemovalPending() {
BundleDescription exporter = exportedPackage.getExporter();
if (exporter != null)
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
index 5210a4b..b230ec1 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
@@ -1450,9 +1450,9 @@
contexts.dispatchEventSynchronous(BUNDLEEVENTSYNC, listenersSync);
}
}
- /* Collect snapshot of BundleListeners */
+ /* Collect snapshot of BundleListeners; only if the event is NOT STARTING or STOPPING */
ListenerQueue listenersAsync = null;
- if (bundleEvent != null) {
+ if (bundleEvent != null && (event.getType() & (BundleEvent.STARTING | BundleEvent.STOPPING)) == 0) {
/* queue to hold set of listeners */
listenersAsync = new ListenerQueue(eventManager);
/* queue to hold set of BundleContexts w/ listeners */
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
index 17c4dd8..b9be015 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AdminPermission.java,v 1.12 2005/05/13 20:32:54 hargrave Exp $
+ * $Header: /home/eclipse/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java,v 1.18 2005/08/08 14:33:11 twatson Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -11,138 +11,107 @@
package org.osgi.framework;
import java.io.IOException;
-import java.io.InputStream;
import java.security.*;
import java.util.*;
-import org.eclipse.osgi.framework.internal.core.FilterImpl;
import org.eclipse.osgi.framework.internal.core.AbstractBundle;
-import org.osgi.service.permissionadmin.PermissionInfo;
+import org.eclipse.osgi.framework.internal.core.FilterImpl;
/**
- * Indicates the caller's authority to perform specific privileged administrative
- * operations on or to get sensitive information about a bundle.
+ * Indicates the caller's authority to perform specific privileged
+ * administrative operations on or to get sensitive information about a bundle.
+ * The actions for this permission are:
*
+ * <pre>
+ * Action Methods
+ * class Bundle.loadClass
+ * execute Bundle.start
+ * Bundle.stop
+ * StartLevel.setBundleStartLevel
+ * extensionLifecycle BundleContext.installBundle for extension bundles
+ * Bundle.update for extension bundles
+ * Bundle.uninstall for extension bundles
+ * lifecycle BundleContext.installBundle
+ * Bundle.update
+ * Bundle.uninstall
+ * listener BundleContext.addBundleListener for SynchronousBundleListener
+ * BundleContext.removeBundleListener for SynchronousBundleListener
+ * metadata Bundle.getHeaders
+ * Bundle.getLocation
+ * resolve PackageAdmin.refreshPackages
+ * PackageAdmin.resolveBundles
+ * resource Bundle.getResource
+ * Bundle.getResources
+ * Bundle.getEntry
+ * Bundle.getEntryPaths
+ * Bundle.findEntries
+ * Bundle resource/entry URL creation
+ * startlevel StartLevel.setStartLevel
+ * StartLevel.setInitialBundleStartLevel
+ * </pre>
+ *
+ * <p>
+ * The special action "*" will represent all actions.
+ * <p>
+ * The name of this permission is a filter expression. The filter gives access
+ * to the following parameters:
* <ul>
- * <li>The <code>{@link AdminPermission#METADATA}</code> action allows calls to
- * <ul>
- * <li>{@link Bundle#getHeaders()}
- * <li>{@link Bundle#getHeaders(String)}
- * <li>{@link Bundle#getLocation()}
- * </ul>
- * <li>The <code>{@link AdminPermission#RESOURCE}</code> action allows calls to
- * <ul>
- * <li>{@link Bundle#getResource(String)}
- * <li>{@link Bundle#getEntry(String)}
- * <li>{@link Bundle#getEntryPaths(String)}
- * <li>Bundle resource/entry URL creation
- * </ul>
- * <li>The <code>{@link AdminPermission#METADATA}</code> action allows calls to
- * <ul>
- * <li>{@link Bundle#loadClass(String)}
- * </ul>
- * <li>The <code>{@link AdminPermission#LIFECYCLE}</code> action allows calls to
- * <ul>
- * <li>{@link BundleContext#installBundle(String)}
- * <li>{@link BundleContext#installBundle(String, InputStream)}
- * <li>{@link Bundle#update()}
- * <li>{@link Bundle#update(InputStream)}
- * <li>{@link Bundle#uninstall()}
- * </ul>
- * <li>The <code>{@link AdminPermission#EXECUTE}</code> action allows calls to
- * <ul>
- * <li>{@link Bundle#start()}
- * <li>{@link Bundle#stop()}
- * <li>{@link org.osgi.service.startlevel.StartLevel#setBundleStartLevel(Bundle, int)}
- * </ul>
- * <li>The <code>{@link AdminPermission#LISTENER}</code> action allows calls to
- * <ul>
- * <li>{@link BundleContext#addBundleListener(BundleListener)} for
- * <code>SynchronousBundleListener</code>
- * <li>{@link BundleContext#removeBundleListener(BundleListener)} for
- * <code>SynchronousBundleListener</code>
- * </ul>
- * <li>The <code>{@link AdminPermission#PERMISSION}</code> action allows calls to
- * <ul>
- * <li>{@link org.osgi.service.permissionadmin.PermissionAdmin#setPermissions(String, PermissionInfo[])}
- * <li>{@link org.osgi.service.permissionadmin.PermissionAdmin#setDefaultPermissions(PermissionInfo[])}
- * </ul>
- * <li>The <code>{@link AdminPermission#RESOLVE}</code> action allows calls to
- * <ul>
- * <li>{@link org.osgi.service.packageadmin.PackageAdmin#refreshPackages(Bundle[])}</code>
- * <li>{@link org.osgi.service.packageadmin.PackageAdmin#resolveBundles(Bundle[])}</code>
- * </ul>
- * <li>The <code>{@link AdminPermission#STARTLEVEL}</code> action allows calls to
- * <ul>
- * <li>{@link org.osgi.service.startlevel.StartLevel#setStartLevel(int)}
- * <li>{@link org.osgi.service.startlevel.StartLevel#setInitialBundleStartLevel(int)}
- * </ul>
+ * <li>signer - A Distinguished Name chain used to sign a 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 a bundle.</li>
+ * <li>id - The bundle ID of the designated bundle.</li>
+ * <li>name - The symbolic name of a bundle.</li>
* </ul>
*
- * The special action "*" will represent all actions.
- *
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.18 $
*/
-public final class AdminPermission extends Permission
-{
+public final class AdminPermission extends Permission {
static final long serialVersionUID = 207051004521261705L;
- /**
- * The action string <code>class</code> (Value is "class").
- */
- public final static String CLASS = "class"; //$NON-NLS-1$
-
- /**
- * The action string <code>execute</code> (Value is "execute").
- */
- public final static String EXECUTE = "execute"; //$NON-NLS-1$
-
- /**
- * The action string <code>lifecycle</code> (Value is "lifecycle").
- */
- public final static String LIFECYCLE = "lifecycle"; //$NON-NLS-1$
-
- /**
- * The action string <code>listener</code> (Value is "listener").
- */
- public final static String LISTENER = "listener"; //$NON-NLS-1$
-
- /**
- * The action string <code>metadata</code> (Value is "metadata").
- */
- public final static String METADATA = "metadata"; //$NON-NLS-1$
-
- /**
- * The action string <code>permission</code> (Value is "permission").
- */
- public final static String PERMISSION = "permission"; //$NON-NLS-1$
-
- /**
- * The action string <code>resolve</code> (Value is "resolve").
- */
- public final static String RESOLVE = "resolve"; //$NON-NLS-1$
-
- /**
- * The action string <code>resource</code> (Value is "resource").
- */
- public final static String RESOURCE = "resource"; //$NON-NLS-1$
-
- /**
- * The action string <code>startlevel</code> (Value is "startlevel").
- */
- public final static String STARTLEVEL = "startlevel"; //$NON-NLS-1$
-
- /**
- * The action string <code>extensionLifecycle</code> (Value is "extensionLifecycle").
- */
- public final static String EXTENSIONLIFECYCLE = "extensionLifecycle"; //$NON-NLS-1$
+ /**
+ * The action string <code>class</code> (Value is "class").
+ */
+ public final static String CLASS = "class";
+ /**
+ * The action string <code>execute</code> (Value is "execute").
+ */
+ public final static String EXECUTE = "execute";
+ /**
+ * The action string <code>extensionLifecycle</code> (Value is
+ * "extensionLifecycle").
+ */
+ public final static String EXTENSIONLIFECYCLE = "extensionLifecycle";
+ /**
+ * The action string <code>lifecycle</code> (Value is "lifecycle").
+ */
+ public final static String LIFECYCLE = "lifecycle";
+ /**
+ * The action string <code>listener</code> (Value is "listener").
+ */
+ public final static String LISTENER = "listener";
+ /**
+ * The action string <code>metadata</code> (Value is "metadata").
+ */
+ public final static String METADATA = "metadata";
+ /**
+ * The action string <code>resolve</code> (Value is "resolve").
+ */
+ public final static String RESOLVE = "resolve";
+ /**
+ * The action string <code>resource</code> (Value is "resource").
+ */
+ public final static String RESOURCE = "resource";
+ /**
+ * The action string <code>startlevel</code> (Value is "startlevel").
+ */
+ public final static String STARTLEVEL = "startlevel";
private final static int ACTION_CLASS = 0x00000001;
private final static int ACTION_EXECUTE = 0x00000002;
private final static int ACTION_LIFECYCLE = 0x00000004;
private final static int ACTION_LISTENER = 0x00000008;
private final static int ACTION_METADATA = 0x00000010;
- private final static int ACTION_PERMISSION = 0x00000020;
private final static int ACTION_RESOLVE = 0x00000040;
private final static int ACTION_RESOURCE = 0x00000080;
private final static int ACTION_STARTLEVEL = 0x00000100;
@@ -153,7 +122,6 @@
ACTION_LIFECYCLE |
ACTION_LISTENER |
ACTION_METADATA |
- ACTION_PERMISSION |
ACTION_RESOLVE |
ACTION_RESOURCE |
ACTION_STARTLEVEL |
@@ -206,53 +174,259 @@
private transient Filter filterImpl;
/**
- * Creates a new <code>AdminPermission</code> object that matches
- * all bundles and has all actions. Equivalent to
- * AdminPermission("*","*");
- */
- public AdminPermission()
- {
- this("*",AdminPermission.ACTION_ALL); //$NON-NLS-1$
- }
-
- /**
- * Creates a new <code>AdminPermission</code> object for use by the <code>Policy</code>
- * object to instantiate new <code>Permission</code> objects.
- *
- * Null arguments are equivalent to "*"
- *
- * @param filter an X.500 Distinguished Name suffix or "*" to match all bundles
- * @param actions <code>class</code>, <code>execute</code>, <code>lifecycle</code>,
- * <code>listener</code>, <code>metadata</code>, <code>permission</code>, <code>resolve</code>,
- * <code>resource</code>, <code>startlevel</code>, or "*" to indicate all actions
- */
- public AdminPermission(String filter, String actions)
- {
+ * Creates a new <code>AdminPermission</code> object that matches all
+ * bundles and has all actions. Equivalent to AdminPermission("*","*");
+ */
+ public AdminPermission() {
+ this("*",AdminPermission.ACTION_ALL); //$NON-NLS-1$
+ }
+
+ /**
+ * Create a new AdminPermission.
+ *
+ * This constructor must only be used to create a permission that is going
+ * to be checked.
+ * <p>
+ * Examples:
+ *
+ * <pre>
+ * (signer=\*,o=ACME,c=US)
+ * (&(signer=\*,o=ACME,c=US)(name=com.acme.*)(location=http://www.acme.com/bundles/*))
+ * (id>=1)
+ * </pre>
+ *
+ * <p>
+ * When a signer key is used within the filter expression the signer value
+ * must escape the special filter chars ('*', '(', ')').
+ * <p>
+ * 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</code> matches
+ * all bundle.
+ * @param actions <code>class</code>, <code>execute</code>,
+ * <code>extensionLifecycle</code>, <code>lifecycle</code>,
+ * <code>listener</code>, <code>metadata</code>,
+ * <code>resolve</code>, <code>resource</code>, or
+ * <code>startlevel</code>. A value of "*" or <code>null</code>
+ * indicates all actions
+ */
+ public AdminPermission(String filter, String actions) {
//arguments will be null if called from a PermissionInfo defined with
//no args
this(
(filter == null ? "*" : filter), //$NON-NLS-1$
getMask((actions == null ? "*" : actions)) //$NON-NLS-1$
);
- }
+ }
- /**
- * Creates a new <code>AdminPermission</code> object for use by the <code>Policy</code>
- * object to instantiate new <code>Permission</code> objects.
- *
- * @param bundle A bundle
- * @param actions <code>class</code>, <code>execute</code>, <code>lifecycle</code>,
- * <code>listener</code>, <code>metadata</code>, <code>permission</code>, <code>resolve</code>,
- * <code>resource</code>, <code>startlevel</code>, or "*" to indicate all actions
- */
- public AdminPermission(Bundle bundle, String actions) {
- super(bundle.toString());
+ /**
+ * Creates a new <code>AdminPermission</code> object to be used by the
+ * code that must check a <code>Permission</code> object.
+ *
+ * @param bundle A bundle
+ * @param actions <code>class</code>, <code>execute</code>,
+ * <code>extensionLifecycle</code>, <code>lifecycle</code>,
+ * <code>listener</code>, <code>metadata</code>,
+ * <code>resolve</code>, <code>resource</code>,
+ * <code>startlevel</code>
+ */
+ public AdminPermission(Bundle bundle, String actions) {
+ super(createName(bundle));
this.bundle = bundle;
this.wildcard = false;
this.filter = null;
this.action_mask = getMask(actions);
- }
-
+ }
+
+ /**
+ * Create a permission name from a Bundle
+ *
+ * @param bundle Bundle to use to create permission name.
+ * @return permission name.
+ */
+ private static String createName(Bundle bundle) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("(id=");
+ sb.append(bundle.getBundleId());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ /**
+ * Determines the equality of two <code>AdminPermission</code> objects.
+ *
+ * @param obj The object being compared for equality with this object.
+ * @return <code>true</code> if <code>obj</code> is equivalent to this
+ * <code>AdminPermission</code>; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (!(obj instanceof AdminPermission))
+ {
+ return false;
+ }
+
+ AdminPermission a = (AdminPermission) obj;
+
+ return (action_mask == a.action_mask) &&
+ (wildcard == a.wildcard) &&
+ (bundle == null ? a.bundle == null : (a.bundle == null ? false : bundle.getBundleId() == a.bundle.getBundleId())) &&
+ (filter == null ? a.filter == null : filter.equals(a.filter));
+ }
+
+ /**
+ * Returns the hash code value for this object.
+ *
+ * @return Hash code value for this object.
+ */
+ public int hashCode() {
+ return getName().hashCode() ^ getActions().hashCode();
+ }
+
+ /**
+ * Returns the canonical string representation of the
+ * <code>AdminPermission</code> actions.
+ *
+ * <p>
+ * Always returns present <code>AdminPermission</code> actions in the
+ * following order: <code>class</code>, <code>execute</code>,
+ * <code>extensionLifecycle</code>, <code>lifecycle</code>,
+ * <code>listener</code>, <code>metadata</code>, <code>resolve</code>,
+ * <code>resource</code>, <code>startlevel</code>.
+ *
+ * @return Canonical string representation of the
+ * <code>AdminPermission</code> actions.
+ */
+ public String getActions() {
+ if (actions == null) {
+ StringBuffer sb = new StringBuffer();
+
+ if ((action_mask & ACTION_CLASS) == ACTION_CLASS) {
+ sb.append(CLASS);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_EXECUTE) == ACTION_EXECUTE) {
+ sb.append(EXECUTE);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_EXTENSIONLIFECYCLE) == ACTION_EXTENSIONLIFECYCLE) {
+ sb.append(EXTENSIONLIFECYCLE);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_LIFECYCLE) == ACTION_LIFECYCLE) {
+ sb.append(LIFECYCLE);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_LISTENER) == ACTION_LISTENER) {
+ sb.append(LISTENER);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_METADATA) == ACTION_METADATA) {
+ sb.append(METADATA);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_RESOLVE) == ACTION_RESOLVE) {
+ sb.append(RESOLVE);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_RESOURCE) == ACTION_RESOURCE) {
+ sb.append(RESOURCE);
+ sb.append(',');
+ }
+
+ if ((action_mask & ACTION_STARTLEVEL) == ACTION_STARTLEVEL) {
+ sb.append(STARTLEVEL);
+ sb.append(',');
+ }
+
+ //remove trailing comma
+ if (sb.length() > 0) {
+ sb.setLength(sb.length()-1);
+ }
+
+ actions = sb.toString();
+ }
+ return actions;
+ }
+
+ /**
+ * Determines if the specified permission is implied by this object. This
+ * method throws an exception if the specified permission was not
+ * constructed with a bundle.
+ *
+ * <p>
+ * This method returns <code>true</code> if the specified permission is an
+ * AdminPermission AND
+ * <ul>
+ * <li>this object's filter matches the specified permission's bundle ID,
+ * bundle symbolic name, bundle location and bundle signer distinguished
+ * name chain OR</li>
+ * <li>this object's filter is "*"</li>
+ * </ul>
+ * AND this object's actions include all of the specified permission's
+ * actions.
+ * <p>
+ * Special case: if the specified permission was constructed with "*"
+ * filter, then this method returns <code>true</code> if this object's
+ * filter is "*" and this object's actions include all of the specified
+ * permission's actions
+ *
+ * @param p The permission to interrogate.
+ *
+ * @return <code>true</code> if the specified permission is implied by
+ * this object; <code>false</code> otherwise.
+ * @throws RuntimeException if specified permission was not constructed with
+ * a bundle or "*"
+ */
+ public boolean implies(Permission p) {
+ if (!(p instanceof AdminPermission))
+ return false;
+ AdminPermission target = (AdminPermission)p;
+ //check actions first - much faster
+ if ((action_mask & target.action_mask)!=target.action_mask)
+ return false;
+ //if passed in a filter, puke
+ if (target.filter != null)
+ throw new RuntimeException("Cannot imply a filter"); //$NON-NLS-1$
+ //special case - only wildcard implies wildcard
+ if (target.wildcard)
+ return wildcard;
+
+ //check our name
+ if (filter != null) {
+ //it's a filter
+ Filter filterImpl = getFilterImpl();
+ return filterImpl != null && filterImpl.match(target.getProperties());
+ } else if (wildcard) {
+ //it's "*"
+ return true;
+ } else {
+ //it's a bundle id
+ return bundle.equals(target.bundle);
+ }
+ }
+
+ /**
+ * Returns a new <code>PermissionCollection</code> object suitable for
+ * storing <code>AdminPermission</code>s.
+ *
+ * @return A new <code>PermissionCollection</code> object.
+ */
+ public PermissionCollection newPermissionCollection() {
+ return(new AdminPermissionCollection());
+ }
+
/**
* Package private constructor used by AdminPermissionCollection.
*
@@ -395,21 +569,6 @@
matchlen = 8;
mask |= ACTION_METADATA;
- } else if (i >= 9 &&
- (a[i-9] == 'p' || a[i-9] == 'P') &&
- (a[i-8] == 'e' || a[i-8] == 'E') &&
- (a[i-7] == 'r' || a[i-7] == 'R') &&
- (a[i-6] == 'm' || a[i-6] == 'M') &&
- (a[i-5] == 'i' || a[i-5] == 'I') &&
- (a[i-4] == 's' || a[i-4] == 'S') &&
- (a[i-3] == 's' || a[i-3] == 'S') &&
- (a[i-2] == 'i' || a[i-2] == 'I') &&
- (a[i-1] == 'o' || a[i-1] == 'O') &&
- (a[i] == 'n' || a[i] == 'N'))
- {
- matchlen = 10;
- mask |= ACTION_PERMISSION;
-
} else if (i >= 6 &&
(a[i-6] == 'r' || a[i-6] == 'R') &&
(a[i-5] == 'e' || a[i-5] == 'E') &&
@@ -459,7 +618,7 @@
} else {
// parse error
throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ "invalid permission: " + actions); //$NON-NLS-1$
}
// make sure we didn't just match the tail of a word
@@ -475,7 +634,7 @@
break;
default:
throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ "invalid permission: " + actions); //$NON-NLS-1$
}
i--;
}
@@ -485,7 +644,7 @@
}
if (seencomma) {
- throw new IllegalArgumentException("invalid permission: " +
+ throw new IllegalArgumentException("invalid permission: " + //$NON-NLS-1$
actions);
}
@@ -630,175 +789,16 @@
}
return filterImpl;
}
-
- /**
- * Determines if the specified permission is implied by this object.
- * This method throws an exception if the specified permission was not
- * constructed with a bundle.
- *
- * <p>This method returns <code>true</code> if
- * The specified permission is an AdminPermission AND
- * <ul>
- * <li>this object's filter is an X.500 Distinguished name suffix that
- * matches the specified permission's bundle OR
- * <li>this object's filter is "*" OR
- * <li>this object's bundle is a equal to the specified permission's
- * bundle
- * </ul>
- * AND this object's actions include all of the specified permission's actions
- *
- * Special case: if the specified permission was constructed with "*", then this method
- * returns <code>true</code> if this object's filter is "*" and this object's actions include
- * all of the specified permission's actions
- *
- * @param p The permission to interrogate.
- *
- * @return <code>true</code> if the specified permission is implied by
- * this object; <code>false</code> otherwise.
- * @throws RuntimeException if specified permission was not constructed with
- * a bundle or "*"
- */
- public boolean implies(Permission p)
- {
- if (!(p instanceof AdminPermission))
- return false;
- AdminPermission target = (AdminPermission)p;
- //check actions first - much faster
- if ((action_mask & target.action_mask)!=target.action_mask)
- return false;
- //if passed in a filter, puke
- if (target.filter != null)
- throw new RuntimeException("Cannot imply a filter");
- //special case - only wildcard implies wildcard
- if (target.wildcard)
- return wildcard;
- //check our name
- if (filter != null) {
- //it's a filter
- Filter filterImpl = getFilterImpl();
- return filterImpl != null && filterImpl.match(target.getProperties());
- } else if (wildcard) {
- //it's "*"
- return true;
- } else {
- //it's a bundle id
- return bundle.equals(target.bundle);
- }
-
- }
-
- /**
- * Returns the canonical string representation of the <code>AdminPermission</code> actions.
- *
- * <p>Always returns present <code>AdminPermission</code> actions in the following order:
- * <code>CLASS</code>, <code>EXECUTE</code>, <code>LIFECYCLE</code>, <code>LISTENER</code>,
- * <code>METADATA</code>, <code>PERMISSION</code>, <code>RESOLVE</code>, <code>RESOURCE</code>,
- * <code>STARTLEVEL</code>.
- * @return Canonical string representation of the <code>AdminPermission</code> actions.
- */
- public String getActions() {
- if (actions == null) {
- if (action_mask == ACTION_ALL) {
- actions = "*"; //$NON-NLS-1$
- } else {
- StringBuffer sb = new StringBuffer();
-
- if ((action_mask & ACTION_CLASS) == ACTION_CLASS) {
- sb.append(CLASS);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_EXECUTE) == ACTION_EXECUTE) {
- sb.append(EXECUTE);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_LIFECYCLE) == ACTION_LIFECYCLE) {
- sb.append(LIFECYCLE);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_LISTENER) == ACTION_LISTENER) {
- sb.append(LISTENER);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_METADATA) == ACTION_METADATA) {
- sb.append(METADATA);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_PERMISSION) == ACTION_PERMISSION) {
- sb.append(PERMISSION);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_RESOLVE) == ACTION_RESOLVE) {
- sb.append(RESOLVE);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_RESOURCE) == ACTION_RESOURCE) {
- sb.append(RESOURCE);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_STARTLEVEL) == ACTION_STARTLEVEL) {
- sb.append(STARTLEVEL);
- sb.append(',');
- }
-
- if ((action_mask & ACTION_EXTENSIONLIFECYCLE) == ACTION_EXTENSIONLIFECYCLE) {
- sb.append(EXTENSIONLIFECYCLE);
- sb.append(',');
- }
-
- //remove trailing comma
- if (sb.length() > 0) {
- sb.deleteCharAt(sb.length()-1);
- }
-
- actions = sb.toString();
- }
- }
- return actions;
- }
-
- /**
- * Determines the equality of two <code>AdminPermission</code> objects. <p>Two
- * <code>AdminPermission</code> objects are equal.
- *
- * @param obj The object being compared for equality with this object.
- * @return <code>true</code> if <code>obj</code> is equivalent to this
- * <code>AdminPermission</code>; <code>false</code> otherwise.
- */
- public boolean equals(Object obj)
- {
- if (obj == this) {
- return true;
- }
-
- if (!(obj instanceof AdminPermission))
- {
- return false;
- }
-
- AdminPermission a = (AdminPermission) obj;
-
- return (action_mask == a.action_mask) &&
- (wildcard == a.wildcard) &&
- (bundle == null ? a.bundle == null : (a.bundle == null ? false : bundle.getBundleId() == a.bundle.getBundleId())) &&
- (filter == null ? a.filter == null : filter.equals(a.filter));
- }
-
- /**
- * Returns the hash code value for this object.
- *
- * @return Hash code value for this object.
- */
- public int hashCode() {
- return getName().hashCode() ^ getActions().hashCode();
+ /**
+ * Returns the current action mask.
+ * <p>
+ * Used by the AdminPermissionCollection class.
+ *
+ * @return Current action mask.
+ */
+ int getMask() {
+ return action_mask;
}
private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
@@ -807,7 +807,7 @@
if (actions == null)
getActions();
if (filter == null && !wildcard)
- throw new UnsupportedOperationException("cannot serialize");
+ throw new UnsupportedOperationException("cannot serialize"); //$NON-NLS-1$
s.defaultWriteObject();
}
@@ -820,114 +820,103 @@
s.defaultReadObject();
action_mask = getMask(actions);
}
+}
+
+/**
+ * Stores a collection of <code>AdminPermission</code>s.
+ */
+final class AdminPermissionCollection extends PermissionCollection
+{
+ private static final long serialVersionUID = 3906372644575328048L;
+ /**
+ * Collection of permissions.
+ *
+ * @serial
+ */
+ private Hashtable permissions;
/**
- * Returns a new <code>PermissionCollection</code> object suitable for storing
- * <code>AdminPermission</code>s.
- *
- * @return A new <code>PermissionCollection</code> object.
+ * Create an empty AdminPermissions object.
+ *
*/
- public PermissionCollection newPermissionCollection()
+
+ public AdminPermissionCollection()
{
- return(new AdminPermissionCollection());
+ permissions = new Hashtable();
}
- /**
- * Stores a collection of <code>AdminPermission</code>s.
- */
- private final class AdminPermissionCollection extends PermissionCollection
- {
- private static final long serialVersionUID = 3906372644575328048L;
- /**
- * Collection of permissions.
- *
- * @serial
- */
- private Hashtable permissions;
-
- /**
- * Create an empty AdminPermissions object.
- *
- */
-
- public AdminPermissionCollection()
- {
- permissions = new Hashtable();
- }
+ /**
+ * Adds a permission to the <code>AdminPermission</code> objects. The key for
+ * the hashtable is the name
+ *
+ * @param permission The <code>AdminPermission</code> object to add.
+ *
+ * @exception IllegalArgumentException If the permission is not an
+ * <code>AdminPermission</code> instance.
+ *
+ * @exception SecurityException If this <code>AdminPermissionCollection</code>
+ * object has been marked read-only.
+ */
+ public void add(Permission permission)
+ {
+ if (! (permission instanceof AdminPermission))
+ throw new IllegalArgumentException("invalid permission: "+ //$NON-NLS-1$
+ permission);
+ if (isReadOnly())
+ throw new SecurityException("attempt to add a Permission to a " + //$NON-NLS-1$
+ "readonly AdminCollection"); //$NON-NLS-1$
+ AdminPermission ap = (AdminPermission) permission;
+ AdminPermission existing = (AdminPermission) permissions.get(ap.getName());
+ if (existing != null){
+ int oldMask = existing.getMask();
+ int newMask = ap.getMask();
+
+ if (oldMask != newMask) {
+ permissions.put(existing.getName(),
+ new AdminPermission(existing.getName(), oldMask | newMask));
+ }
+ } else {
+ permissions.put(ap.getName(), ap);
+ }
+ }
- /**
- * Adds a permission to the <code>AdminPermission</code> objects. The key for
- * the hashtable is the name
- *
- * @param permission The <code>AdminPermission</code> object to add.
- *
- * @exception IllegalArgumentException If the permission is not an
- * <code>AdminPermission</code> instance.
- *
- * @exception SecurityException If this <code>AdminPermissionCollection</code>
- * object has been marked read-only.
- */
- public void add(Permission permission)
- {
- if (! (permission instanceof AdminPermission))
- throw new IllegalArgumentException("invalid permission: "+
- permission);
- if (isReadOnly())
- throw new SecurityException("attempt to add a Permission to a " +
- "readonly AdminCollection");
- AdminPermission ap = (AdminPermission) permission;
- AdminPermission existing = (AdminPermission) permissions.get(ap.getName());
- if (existing != null){
- int oldMask = existing.action_mask;
- int newMask = ap.action_mask;
-
- if (oldMask != newMask) {
- permissions.put(existing.getName(),
- new AdminPermission(existing.getName(), oldMask | newMask));
- }
- } else {
- permissions.put(ap.getName(), ap);
- }
- }
-
-
- /**
- * Determines if the specified permissions implies the permissions
- * expressed in <code>permission</code>.
- *
- * @param permission The Permission object to compare with the <code>AdminPermission</code>
- * objects in this collection.
- *
- * @return <code>true</code> if <code>permission</code> is implied by an
- * <code>AdminPermission</code> in this collection, <code>false</code> otherwise.
- */
- public boolean implies(Permission permission)
- {
- if (!(permission instanceof AdminPermission))
- return(false);
-
- AdminPermission target = (AdminPermission) permission;
-
- //just iterate one by one
- Iterator permItr = permissions.values().iterator();
-
- while(permItr.hasNext())
- if (((AdminPermission)permItr.next()).implies(target))
- return true;
- return false;
- }
-
-
- /**
- * Returns an enumeration of all <code>AdminPermission</code> objects in the
- * container.
- *
- * @return Enumeration of all <code>AdminPermission</code> objects.
- */
-
- public Enumeration elements()
- {
- return(Collections.enumeration(permissions.values()));
- }
- }
+
+ /**
+ * Determines if the specified permissions implies the permissions
+ * expressed in <code>permission</code>.
+ *
+ * @param permission The Permission object to compare with the <code>AdminPermission</code>
+ * objects in this collection.
+ *
+ * @return <code>true</code> if <code>permission</code> is implied by an
+ * <code>AdminPermission</code> in this collection, <code>false</code> otherwise.
+ */
+ public boolean implies(Permission permission)
+ {
+ if (!(permission instanceof AdminPermission))
+ return(false);
+
+ AdminPermission target = (AdminPermission) permission;
+
+ //just iterate one by one
+ Iterator permItr = permissions.values().iterator();
+
+ while(permItr.hasNext())
+ if (((AdminPermission)permItr.next()).implies(target))
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Returns an enumeration of all <code>AdminPermission</code> objects in the
+ * container.
+ *
+ * @return Enumeration of all <code>AdminPermission</code> objects.
+ */
+
+ public Enumeration elements()
+ {
+ return(Collections.enumeration(permissions.values()));
+ }
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java
index 6de64bc..8a626fd 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AllServiceListener.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AllServiceListener.java,v 1.5 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AllServiceListener.java,v 1.6 2005/07/30 02:22:41 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2005). All Rights Reserved.
*
@@ -12,37 +12,40 @@
/**
* A <code>ServiceEvent</code> listener.
- *
- * <p><code>AllServiceListener</code> is a listener interface that may be implemented by a bundle
- * developer.
- * <p>An <code>AllServiceListener</code> object is registered with the Framework using the
- * <code>BundleContext.addServiceListener</code> method.
- * <code>AllServiceListener</code> objects are called with a <code>ServiceEvent</code> object when
- * a service is registered, modified, or is in the process of unregistering.
- *
- * <p><code>ServiceEvent</code> object delivery to <code>AllServiceListener</code> objects is filtered by the
- * filter specified when the listener was registered. If the Java Runtime Environment
- * supports permissions, then additional filtering is done.
- * <code>ServiceEvent</code> objects are only delivered to the listener if the bundle which defines
- * the listener object's class has the appropriate <code>ServicePermission</code> to get the service
- * using at least one of the named classes the service was registered under.
+ *
+ * <p>
+ * <code>AllServiceListener</code> is a listener interface that may be
+ * implemented by a bundle developer.
+ * <p>
+ * An <code>AllServiceListener</code> object is registered with the Framework
+ * using the <code>BundleContext.addServiceListener</code> method.
+ * <code>AllServiceListener</code> objects are called with a
+ * <code>ServiceEvent</code> object when a service is registered, modified, or
+ * is in the process of unregistering.
+ *
+ * <p>
+ * <code>ServiceEvent</code> object delivery to
+ * <code>AllServiceListener</code> objects is filtered by the filter specified
+ * when the listener was registered. If the Java Runtime Environment supports
+ * permissions, then additional filtering is done. <code>ServiceEvent</code>
+ * objects are only delivered to the listener if the bundle which defines the
+ * listener object's class has the appropriate <code>ServicePermission</code>
+ * to get the service using at least one of the named classes the service was
+ * registered under.
*
* <p>
* Unlike normal <code>ServiceListener</code> objects,
- * <code>AllServiceListener</code> objects receive all ServiceEvent objects regardless of the
- * whether the package source of the listening bundle is equal to the package source of
- * the bundle that registered the service. This means that the listener may not be able to
- * cast the service object to any of its corresponding service interfaces if the service
- * object is retrieved.
+ * <code>AllServiceListener</code> objects receive all ServiceEvent objects
+ * regardless of the whether the package source of the listening bundle is equal
+ * to the package source of the bundle that registered the service. This means
+ * that the listener may not be able to cast the service object to any of its
+ * corresponding service interfaces if the service object is retrieved.
*
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @see ServiceEvent
* @see ServicePermission
*/
-public abstract interface AllServiceListener extends ServiceListener
-{
- //This is a marker interface
+public interface AllServiceListener extends ServiceListener {
+ // This is a marker interface
}
-
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
index de19d9f..eb52f00 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Bundle.java,v 1.27 2005/06/21 16:37:35 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Bundle.java,v 1.31 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -56,9 +56,9 @@
* <code>Bundle</code> objects, and these objects are only valid within the
* Framework that created them.
*
- * @version $Revision: 1.27 $
+ * @version $Revision: 1.31 $
*/
-public abstract interface Bundle {
+public interface Bundle {
/**
* This bundle is uninstalled and may not be used.
*
@@ -99,17 +99,17 @@
* <li>The bundle's class path from its {@link Constants#BUNDLE_CLASSPATH}
* Manifest header.
* <li>The bundle's package dependencies from its
- * {@link Constants#EXPORT_PACKAGE}and {@link Constants#IMPORT_PACKAGE}
+ * {@link Constants#EXPORT_PACKAGE} and {@link Constants#IMPORT_PACKAGE}
* Manifest headers.
* <li>The bundle's required bundle dependencies from its
- * {@link Constants#REQUIRE_BUNDLE}Manifest header.
+ * {@link Constants#REQUIRE_BUNDLE} Manifest header.
* <li>A fragment bundle's host dependency from its
- * {@link Constants#FRAGMENT_HOST}Manifest header.
+ * {@link Constants#FRAGMENT_HOST} Manifest header.
* </ul>
* <p>
* Note that the bundle is not active yet. A bundle must be put in the
* <code>RESOLVED</code> state before it can be started. The Framework may
- * attempt to resolve a bundle at any time.
+ * attempt to resolve a bundle at any time.
* <p>
* The value of <code>RESOLVED</code> is 0x00000004.
*/
@@ -121,7 +121,7 @@
* <p>
* A bundle is in the <code>STARTING</code> state when the {@link #start}
* method is active. A bundle must be in this state when the bundle's
- * {@link BundleActivator#start}is called. If this method completes without
+ * {@link BundleActivator#start} is called. If this method completes without
* exception, then the bundle has successfully started and must move to the
* <code>ACTIVE</code> state.
* <p>
@@ -135,7 +135,7 @@
* <p>
* A bundle is in the <code>STOPPING</code> state when the {@link #stop}
* method is active. A bundle must be in this state when the bundle's
- * {@link BundleActivator#stop}method is called. When this method completes
+ * {@link BundleActivator#stop} method is called. When this method completes
* the bundle is stopped and must move to the <code>RESOLVED</code> state.
* <p>
* The value of <code>STOPPING</code> is 0x00000010.
@@ -163,7 +163,7 @@
* <code>RESOLVED</code>,<code>STARTING</code>,
* <code>STOPPING</code>,<code>ACTIVE</code>.
*/
- public abstract int getState();
+ public int getState();
/**
* Starts this bundle.
@@ -198,7 +198,10 @@
*
* <li>This bundle's state is set to <code>STARTING</code>.
*
- * <li>The {@link BundleActivator#start}method of this bundle's
+ * <li>A bundle event of type {@link BundleEvent#STARTING} is fired. This event is only delivered to
+ * <code>SynchronousBundleListener</code>s. It is not delivered to <code>BundleListener</code>s.
+ *
+ * <li>The {@link BundleActivator#start} method of this bundle's
* <code>BundleActivator</code>, if one is specified, is called. If the
* <code>BundleActivator</code> is invalid or throws an exception, this
* bundle's state is set back to <code>RESOLVED</code>.<br>
@@ -213,7 +216,7 @@
*
* <li>This bundle's state is set to <code>ACTIVE</code>.
*
- * <li>A bundle event of type {@link BundleEvent#STARTED}is broadcast.
+ * <li>A bundle event of type {@link BundleEvent#STARTED} is fired.
* </ol>
*
* <b>Preconditions </b>
@@ -236,17 +239,17 @@
* <code>ACTIVE</code>}.
* </ul>
*
- * @exception BundleException If this bundle could not be started. This
- * could be because a code dependency could not be resolved or
- * the specified <code>BundleActivator</code> could not be
- * loaded or threw an exception.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled or this bundle tries to change its own state.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[bundle, EXECUTE]</code>,
- * and the Java Runtime Environment supports permissions.
+ * @throws BundleException If this bundle could not be started. This could
+ * be because a code dependency could not be resolved or the
+ * specified <code>BundleActivator</code> could not be loaded or
+ * threw an exception.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,EXECUTE]</code>, and the
+ * Java Runtime Environment supports permissions.
*/
- public abstract void start() throws BundleException;
+ public void start() throws BundleException;
/**
* Stops this bundle.
@@ -271,7 +274,10 @@
*
* <li>This bundle's state is set to <code>STOPPING</code>.
*
- * <li>The {@link BundleActivator#stop}method of this bundle's
+ * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired. This event is only delivered to
+ * <code>SynchronousBundleListener</code>s. It is not delivered to <code>BundleListener</code>s.
+ *
+ * <li>The {@link BundleActivator#stop} method of this bundle's
* <code>BundleActivator</code>, if one is specified, is called. If that
* method throws an exception, this method must continue to stop this
* bundle. A <code>BundleException</code> must be thrown after completion
@@ -287,7 +293,7 @@
*
* <li>This bundle's state is set to <code>RESOLVED</code>.
*
- * <li>A bundle event of type {@link BundleEvent#STOPPED}is broadcast.
+ * <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.
* </ol>
*
* <b>Preconditions </b>
@@ -307,15 +313,15 @@
* <li>Bundle persistent state is marked as stopped.
* </ul>
*
- * @exception BundleException If this bundle's <code>BundleActivator</code>
- * could not be loaded or threw an exception.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled or this bundle tries to change its own state.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[bundle, EXECUTE]</code>,
- * and the Java Runtime Environment supports permissions.
+ * @throws BundleException If this bundle's <code>BundleActivator</code>
+ * could not be loaded or threw an exception.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,EXECUTE]</code>, and the
+ * Java Runtime Environment supports permissions.
*/
- public abstract void stop() throws BundleException;
+ public void stop() throws BundleException;
/**
* Updates this bundle.
@@ -344,7 +350,7 @@
*
* <li>The download location of the new version of this bundle is
* determined from either the bundle's
- * {@link Constants#BUNDLE_UPDATELOCATION}Manifest header (if available) or
+ * {@link Constants#BUNDLE_UPDATELOCATION} Manifest header (if available) or
* the bundle's original location.
*
* <li>The location is interpreted in an implementation dependent manner,
@@ -366,12 +372,12 @@
* <li>This bundle's state is set to <code>INSTALLED</code>.
*
* <li>If the new version of this bundle was successfully installed, a
- * bundle event of type {@link BundleEvent#UPDATED}is broadcast.
+ * bundle event of type {@link BundleEvent#UPDATED} is fired.
*
* <li>If this bundle's state was originally <code>ACTIVE</code>, the
* updated bundle is started as described in the <code>Bundle.start</code>
* method. If <code>Bundle.start</code> throws an exception, a Framework
- * event of type {@link FrameworkEvent#ERROR}is broadcast containing the
+ * event of type {@link FrameworkEvent#ERROR} is fired containing the
* exception.
* </ol>
*
@@ -392,17 +398,17 @@
* <li>Original bundle is still used; no update occurred.
* </ul>
*
- * @exception BundleException If the update fails.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled or this bundle tries to change its own state.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[bundle, LIFECYCLE]</code> for both
- * the current bundle and the updated bundle,
- * and the Java Runtime Environment supports permissions.
+ * @throws BundleException If the update fails.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,LIFECYCLE]</code> for both
+ * the current bundle and the updated bundle, and the Java Runtime
+ * Environment supports permissions.
* @see #stop()
* @see #start()
*/
- public abstract void update() throws BundleException;
+ public void update() throws BundleException;
/**
* Updates this bundle from an <code>InputStream</code>.
@@ -417,17 +423,17 @@
*
* @param in The <code>InputStream</code> from which to read the new
* bundle.
- * @exception BundleException If the provided stream cannot be read or the
- * update fails.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled or this bundle tries to change its own state.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[bundle, LIFECYCLE]</code> for both
- * the current bundle and the updated bundle,
- * and the Java Runtime Environment supports permissions.
+ * @throws BundleException If the provided stream cannot be read or the
+ * update fails.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,LIFECYCLE]</code> for both
+ * the current bundle and the updated bundle, and the Java Runtime
+ * Environment supports permissions.
* @see #update()
*/
- public abstract void update(InputStream in) throws BundleException;
+ public void update(InputStream in) throws BundleException;
/**
* Uninstalls this bundle.
@@ -454,11 +460,11 @@
* <code>STARTING</code> or <code>STOPPING</code>, this bundle is
* stopped as described in the <code>Bundle.stop</code> method. If
* <code>Bundle.stop</code> throws an exception, a Framework event of type
- * {@link FrameworkEvent#ERROR}is broadcast containing the exception.
+ * {@link FrameworkEvent#ERROR} is fired containing the exception.
*
* <li>This bundle's state is set to <code>UNINSTALLED</code>.
*
- * <li>A bundle event of type {@link BundleEvent#UNINSTALLED}is broadcast.
+ * <li>A bundle event of type {@link BundleEvent#UNINSTALLED} is fired.
*
* <li>This bundle and any persistent storage area provided for this bundle
* by the Framework are removed.
@@ -479,17 +485,17 @@
* <li>This Bundle has not been uninstalled.
* </ul>
*
- * @exception BundleException If the uninstall failed. This can occur if
- * another thread is attempting to change the bundle's state and
- * does not complete in a timely manner.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled or this bundle tries to change its own state.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[bundle, LIFECYCLE]</code>,
- * and the Java Runtime Environment supports permissions.
+ * @throws BundleException If the uninstall failed. This can occur if
+ * another thread is attempting to change the bundle's state and
+ * does not complete in a timely manner.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,LIFECYCLE]</code>, and the
+ * Java Runtime Environment supports permissions.
* @see #stop()
*/
- public abstract void uninstall() throws BundleException;
+ public void uninstall() throws BundleException;
/**
* Returns this bundle's Manifest headers and values. This method returns
@@ -509,12 +515,12 @@
* they are present in the Manifest file:
*
* <pre>
- * Bundle-Name
- * Bundle-Vendor
- * Bundle-Version
- * Bundle-Description
- * Bundle-DocURL
- * Bundle-ContactAddress
+ * Bundle-Name
+ * Bundle-Vendor
+ * Bundle-Version
+ * Bundle-Description
+ * Bundle-DocURL
+ * Bundle-ContactAddress
* </pre>
*
* <p>
@@ -524,13 +530,13 @@
* @return A <code>Dictionary</code> object containing this bundle's
* Manifest headers and values.
*
- * @exception java.lang.SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[bundle, METADATA]</code>, and the
- * Java Runtime Environment supports permissions.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,METADATA]</code>, and the
+ * Java Runtime Environment supports permissions.
*
* @see Constants#BUNDLE_LOCALIZATION
*/
- public abstract Dictionary getHeaders();
+ public Dictionary getHeaders();
/**
* Returns this bundle's identifier. The bundle is assigned a unique
@@ -553,7 +559,7 @@
*
* @return The unique identifier of this bundle.
*/
- public abstract long getBundleId();
+ public long getBundleId();
/**
* Returns this bundle's location identifier.
@@ -569,11 +575,11 @@
* while this bundle is in the <code>UNINSTALLED</code> state.
*
* @return The string representation of this bundle's location identifier.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[bundle, METADATA]</code>,
- * and the Java Runtime Environment supports permissions.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,METADATA]</code>, and the
+ * Java Runtime Environment supports permissions.
*/
- public abstract String getLocation();
+ public String getLocation();
/**
* Returns this bundle's <code>ServiceReference</code> list for all
@@ -593,13 +599,13 @@
*
* @return An array of <code>ServiceReference</code> objects or
* <code>null</code>.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
* @see ServiceRegistration
* @see ServiceReference
* @see ServicePermission
*/
- public abstract ServiceReference[] getRegisteredServices();
+ public ServiceReference[] getRegisteredServices();
/**
* Returns this bundle's <code>ServiceReference</code> list for all
@@ -620,12 +626,12 @@
*
* @return An array of <code>ServiceReference</code> objects or
* <code>null</code>.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
* @see ServiceReference
* @see ServicePermission
*/
- public abstract ServiceReference[] getServicesInUse();
+ public ServiceReference[] getServicesInUse();
/**
* Determines if this bundle has the specified permissions.
@@ -653,10 +659,10 @@
* specified permission or <code>permission</code> is not an
* <code>instanceof</code> <code>java.security.Permission</code>.
*
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
*/
- public abstract boolean hasPermission(Object permission);
+ public boolean hasPermission(Object permission);
/**
* Find the specified resource from this bundle.
@@ -670,17 +676,17 @@
* @param name The name of the resource. See
* <code>java.lang.ClassLoader.getResource</code> for a description
* of the format of a resource name.
- * @return a URL to the named resource, or <code>null</code> if the
+ * @return A URL to the named resource, or <code>null</code> if the
* resource could not be found or if this bundle is a fragment
* bundle or if the caller does not have the appropriate
- * <code>AdminPermission[bundle, RESOURCE]</code>, and the Java
- * Runtime Environment supports permissions.
+ * <code>AdminPermission[this,RESOURCE]</code>, and the Java Runtime
+ * Environment supports permissions.
*
* @since 1.1
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
*/
- public abstract URL getResource(String name);
+ public URL getResource(String name);
/**
* Returns this bundle's Manifest headers and values localized to the
@@ -717,9 +723,9 @@
* @return A <code>Dictionary</code> object containing this bundle's
* Manifest headers and values.
*
- * @exception java.lang.SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[bundle, METADATA]</code>, and the
- * Java Runtime Environment supports permissions.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,METADATA]</code>, and the
+ * Java Runtime Environment supports permissions.
*
* @see #getHeaders()
* @see Constants#BUNDLE_LOCALIZATION
@@ -757,7 +763,7 @@
*
* <p>
* If the bundle cannot be resolved, a Framework event of type
- * {@link FrameworkEvent#ERROR}is broadcast containing a
+ * {@link FrameworkEvent#ERROR} is fired containing a
* <code>BundleException</code> with details of the reason the bundle
* could not be resolved. This method must then throw a
* <code>ClassNotFoundException</code>.
@@ -768,12 +774,12 @@
*
* @param name The name of the class to load.
* @return The Class object for the requested class.
- * @exception java.lang.ClassNotFoundException If no such class can be found
- * or if this bundle is a fragment bundle or if the caller does
- * not have the appropriate <code>AdminPermission[bundle, CLASS]</code>,
- * and the Java Runtime Environment supports permissions.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.ClassNotFoundException If no such class can be found or
+ * if this bundle is a fragment bundle or if the caller does not
+ * have the appropriate <code>AdminPermission[this,CLASS]</code>, and
+ * the Java Runtime Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
* @since 1.3
*/
public Class loadClass(String name) throws ClassNotFoundException;
@@ -790,43 +796,38 @@
* @param name The name of the resource. See
* <code>java.lang.ClassLoader.getResources</code> for a
* description of the format of a resource name.
- * @return an Enumeration of URLs to the named resources, or
+ * @return An enumeration of URLs to the named resources, or
* <code>null</code> if the resource could not be found or if this
- * bundle is a fragment bundle or if the caller does not have the appropriate
- * <code>AdminPermission[bundle, RESOURCE]</code>, and the Java
- * Runtime Environment supports permissions.
+ * bundle is a fragment bundle or if the caller does not have the
+ * appropriate <code>AdminPermission[this,RESOURCE]</code>, and the
+ * Java Runtime Environment supports permissions.
*
* @since 1.3
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
* @throws java.io.IOException If there is an I/O error.
*/
public Enumeration getResources(String name) throws IOException;
/**
- * Returns an Enumeration of all the paths (<code>String</code>) objects) to
- * entries within the bundle whose longest sub-path matches the supplied path
- * argument. The bundle's classloader is not used to search for entries. Only
- * the contents of the bundle is searched. A specified path of "/"
- * indicates the root of the bundle.
+ * Returns an Enumeration of all the paths (<code>String</code> objects)
+ * to entries within the bundle whose longest sub-path matches the supplied
+ * path argument. The bundle's classloader is not used to search for
+ * entries. Only the contents of the bundle is searched. A specified path of
+ * "/" indicates the root of the bundle.
*
* <p>
* Returned paths indicating subdirectory paths end with a "/".
* The returned paths are all relative to the root of the bundle.
*
- * <p>
- * This method returns <code>null</code> if no entries could be found that
- * match the specified path or if the caller does not have the appropriate
- * <code>AdminPermission[bundle, RESOURCE]</code> and the Java
- * Runtime Environment supports permissions.
- *
- * @param path the path name to get the entry path for.
- * @return An Enumeration of the entry paths (<code>String</code> objects)
- * or <code>null</code> if an entry could not be found or if the
- * caller does not have the appropriate <code>AdminPermission[bundle, RESOURCE]</code>
- * and the Java Runtime Environment supports permissions.
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @param path The path name for which to return entry paths.
+ * @return An Enumeration of the entry paths (<code>String</code>
+ * objects) or <code>null</code> if no entry could be found or if
+ * the caller does not have the appropriate
+ * <code>AdminPermission[this,RESOURCE]</code> and the Java Runtime
+ * Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
* @since 1.3
*/
public Enumeration getEntryPaths(String path);
@@ -837,22 +838,16 @@
* contents of the bundle is searched for the specified entry. A specified
* path of "/" indicates the root of the bundle.
*
- * <p>
- * This method returns a URL to the specified entry, or <code>null</code>
- * if the entry could not be found or if the caller does not have the appropriate
- * <code>AdminPermission[bundle, RESOURCE]</code> and the Java Runtime
- * Environment supports permissions.
- *
* @param name The name of the entry. See
* <code>java.lang.ClassLoader.getResource</code> for a description
* of the format of a resource name.
- * @return A URL to the specified entry, or <code>null</code> if the entry
- * could not be found or if the caller does not have the appropriate
- * <code>AdminPermission[bundle, RESOURCE]</code> and the Java
- * Runtime Environment supports permissions.
+ * @return A URL to the specified entry, or <code>null</code> if no entry
+ * could be found or if the caller does not have the appropriate
+ * <code>AdminPermission[this,RESOURCE]</code> and the Java Runtime
+ * Environment supports permissions.
*
- * @exception java.lang.IllegalStateException If this bundle has been
- * uninstalled.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
* @since 1.3
*/
public URL getEntry(String name);
@@ -873,12 +868,12 @@
/**
* Returns entries in this bundle and its attached fragments. The bundle's
* classloader is not used to search for entries. Only the contents of the
- * bundle and its attached fragments are searched for the specified
- * entries.
+ * bundle and its attached fragments are searched for the specified entries.
*
* If this bundle's state is <code>INSTALLED</code>, this method must
- * attempt to resolve the bundle before attempting to find entries.<p>
+ * attempt to resolve the bundle before attempting to find entries.
*
+ * <p>
* This method is intended to be used to obtain configuration, setup,
* localization and other information from this bundle. This method takes
* into account that the "contents" of this bundle can be extended
@@ -894,13 +889,15 @@
* returned.
* <p>
* Examples:
+ *
* <pre>
* // List all XML files in the OSGI-INF directory and below
- * Enumeration e = b.findEntries("OSGI-INF", "*.xml", true);
+ * Enumeration e = b.findEntries("OSGI-INF", "*.xml", true);
*
* // Find a specific localization file
* Enumeration e = b.findEntries("OSGI-INF/l10n",
- * "bundle_nl_DU.properties", false);
+ * "bundle_nl_DU.properties",
+ * false);
* if (e.hasMoreElements())
* return (URL) e.nextElement();
* </pre>
@@ -919,11 +916,11 @@
* @return An enumeration of URL objects for each matching entry, or
* <code>null</code> if an entry could not be found or if the
* caller does not have the appropriate
- * <code>AdminPermission[bundle, RESOURCE]</code>, and the Java
- * Runtime Environment supports permissions. The URLs are sorted
- * such that entries from this bundle are returned first followed by
- * the entries from attached fragments in ascending bundle id order.
- * If this bundle is a fragment, then only matching entries in this
+ * <code>AdminPermission[this,RESOURCE]</code>, and the Java Runtime
+ * Environment supports permissions. The URLs are sorted such that
+ * entries from this bundle are returned first followed by the
+ * entries from attached fragments in ascending bundle id order. If
+ * this bundle is a fragment, then only matching entries in this
* fragment are returned.
* @since 1.3
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java
index 8be4194..7eecc98 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleActivator.java,v 1.8 2005/06/21 16:22:12 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleActivator.java,v 1.9 2005/07/30 02:22:40 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -17,29 +17,30 @@
* bundle is started or stopped. The Framework can create instances of a
* bundle's <code>BundleActivator</code> as required. If an instance's
* <code>BundleActivator.start</code> method executes successfully, it is
- * guaranteed that the same instance's <code>BundleActivator.stop</code> method
- * will be called when the bundle is to be stopped.
+ * guaranteed that the same instance's <code>BundleActivator.stop</code>
+ * method will be called when the bundle is to be stopped.
*
* <p>
- * <code>BundleActivator</code> is specified through the <code>Bundle-Activator</code>
- * Manifest header. A bundle can only specify a single <code>BundleActivator</code>
- * in the Manifest file. Fragment bundles must not have a <code>BundleActivator</code>.
- * The form of the Manifest header is:
+ * <code>BundleActivator</code> is specified through the
+ * <code>Bundle-Activator</code> Manifest header. A bundle can only specify a
+ * single <code>BundleActivator</code> in the Manifest file. Fragment bundles
+ * must not have a <code>BundleActivator</code>. The form of the Manifest
+ * header is:
*
* <pre>
- * Bundle-Activator: <i>class-name</i>
+ * Bundle-Activator: <i>class-name</i>
* </pre>
*
* where <code>class-name</code> is a fully qualified Java classname.
* <p>
- * The specified <code>BundleActivator</code> class must have a public constructor
- * that takes no parameters so that a <code>BundleActivator</code> object can be
- * created by <code>Class.newInstance()</code>.
+ * The specified <code>BundleActivator</code> class must have a public
+ * constructor that takes no parameters so that a <code>BundleActivator</code>
+ * object can be created by <code>Class.newInstance()</code>.
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
-public abstract interface BundleActivator {
+public interface BundleActivator {
/**
* Called when this bundle is started so the Framework can perform the
* bundle-specific activities necessary to start this bundle. This method
@@ -50,33 +51,31 @@
* This method must complete and return to its caller in a timely manner.
*
* @param context The execution context of the bundle being started.
- * @exception java.lang.Exception If this method throws an exception, this
- * bundle is marked as stopped and the Framework will remove this
- * bundle's listeners, unregister all services registered by this
- * bundle, and release all services used by this bundle.
+ * @throws java.lang.Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will remove this
+ * bundle's listeners, unregister all services registered by this
+ * bundle, and release all services used by this bundle.
* @see Bundle#start
*/
- public abstract void start(BundleContext context) throws Exception;
+ public void start(BundleContext context) throws Exception;
/**
* Called when this bundle is stopped so the Framework can perform the
* bundle-specific activities necessary to stop the bundle. In general, this
* method should undo the work that the <code>BundleActivator.start</code>
* method started. There should be no active threads that were started by
- * this bundle when this bundle returns. A stopped bundle must
- * not call any Framework objects.
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
*
* <p>
* This method must complete and return to its caller in a timely manner.
*
* @param context The execution context of the bundle being stopped.
- * @exception java.lang.Exception If this method throws an exception, the
- * bundle is still marked as stopped, and the Framework will
- * remove the bundle's listeners, unregister all services
- * registered by the bundle, and release all services used by the
- * bundle.
+ * @throws java.lang.Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework will remove
+ * the bundle's listeners, unregister all services registered by the
+ * bundle, and release all services used by the bundle.
* @see Bundle#stop
*/
- public abstract void stop(BundleContext context) throws Exception;
+ public void stop(BundleContext context) throws Exception;
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java
index 91fa559..88fd2b8 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleContext.java,v 1.13 2005/06/21 16:22:12 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleContext.java,v 1.16 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -30,40 +30,41 @@
* <li>Install new bundles in the Framework.
* <li>Get the list of bundles installed in the Framework.
* <li>Get the {@link Bundle} object for a bundle.
- * <li>Create <code>File</code> objects for files in a persistent storage area
- * provided for the bundle by the Framework.
+ * <li>Create <code>File</code> objects for files in a persistent storage
+ * area provided for the bundle by the Framework.
* </ul>
*
* <p>
- * A <code>BundleContext</code> object will be created and provided to the bundle
- * associated with this context when it is started using the
+ * A <code>BundleContext</code> object will be created and provided to the
+ * bundle associated with this context when it is started using the
* {@link BundleActivator#start} method. The same <code>BundleContext</code>
* object will be passed to the bundle associated with this context when it is
- * stopped using the {@link BundleActivator#stop} method. A <code>BundleContext</code>
- * object is generally for the private use of its associated bundle and is not
- * meant to be shared with other bundles in the OSGi environment.
+ * stopped using the {@link BundleActivator#stop} method. A
+ * <code>BundleContext</code> object is generally for the private use of its
+ * associated bundle and is not meant to be shared with other bundles in the
+ * OSGi environment.
*
* <p>
- * The <code>Bundle</code> object associated with a <code>BundleContext</code> object
- * is called the <em>context bundle</em>.
- *
+ * The <code>Bundle</code> object associated with a <code>BundleContext</code>
+ * object is called the <em>context bundle</em>.
+ *
* <p>
- * The <code>BundleContext</code> object is only valid during the execution
- * of its context bundle; that is, during the period from when the context
- * bundle is in the <code>STARTING</code>, <code>STOPPING</code>, and
- * <code>ACTIVE</code> bundle states. If the <code>BundleContext</code> object
- * is used subsequently, an <code>IllegalStateException</code> must be thrown.
- * The <code>BundleContext</code> object must never be reused after its
- * context bundle is stopped.
+ * The <code>BundleContext</code> object is only valid during the execution of
+ * its context bundle; that is, during the period from when the context bundle
+ * is in the <code>STARTING</code>, <code>STOPPING</code>, and
+ * <code>ACTIVE</code> bundle states. If the <code>BundleContext</code>
+ * object is used subsequently, an <code>IllegalStateException</code> must be
+ * thrown. The <code>BundleContext</code> object must never be reused after
+ * its context bundle is stopped.
*
* <p>
* The Framework is the only entity that can create <code>BundleContext</code>
* objects and they are only valid within the Framework that created them.
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.16 $
*/
-public abstract interface BundleContext {
+public interface BundleContext {
/**
* Returns the value of the specified property. If the key is not found in
* the Framework properties, the system properties are then searched. The
@@ -73,17 +74,17 @@
* The Framework defines the following standard property keys:
* </p>
* <ul>
- * <li>{@link Constants#FRAMEWORK_VERSION}- The OSGi Framework version.
+ * <li>{@link Constants#FRAMEWORK_VERSION} - The OSGi Framework version.
* </li>
- * <li>{@link Constants#FRAMEWORK_VENDOR}- The Framework implementation
+ * <li>{@link Constants#FRAMEWORK_VENDOR} - The Framework implementation
* vendor.</li>
- * <li>{@link Constants#FRAMEWORK_LANGUAGE}- The language being used. See
+ * <li>{@link Constants#FRAMEWORK_LANGUAGE} - The language being used. See
* ISO 639 for possible values.</li>
- * <li>{@link Constants#FRAMEWORK_OS_NAME}- The host computer operating
+ * <li>{@link Constants#FRAMEWORK_OS_NAME} - The host computer operating
* system.</li>
- * <li>{@link Constants#FRAMEWORK_OS_VERSION}- The host computer operating
- * system version number.</li>
- * <li>{@link Constants#FRAMEWORK_PROCESSOR}- The host computer processor
+ * <li>{@link Constants#FRAMEWORK_OS_VERSION} - The host computer
+ * operating system version number.</li>
+ * <li>{@link Constants#FRAMEWORK_PROCESSOR} - The host computer processor
* name.</li>
* </ul>
* <p>
@@ -91,34 +92,33 @@
*
* <p>
* Note: The last four standard properties are used by the
- * {@link Constants#BUNDLE_NATIVECODE} <code>Manifest</code> header's matching
- * algorithm for selecting native language code.
+ * {@link Constants#BUNDLE_NATIVECODE} <code>Manifest</code> header's
+ * matching algorithm for selecting native language code.
*
* @param key The name of the requested property.
- * @return The value of the requested property, or <code>null</code> if the
- * property is undefined.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>PropertyPermission</code> to read the
- * property, and the Java Runtime Environment supports
- * permissions.
+ * @return The value of the requested property, or <code>null</code> if
+ * the property is undefined.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>PropertyPermission</code> to read the
+ * property, and the Java Runtime Environment supports permissions.
*/
- public abstract String getProperty(String key);
+ public String getProperty(String key);
/**
* Returns the <code>Bundle</code> object associated with this
* <code>BundleContext</code>. This bundle is called the context bundle.
*
* @return The <code>Bundle</code> object associated with this
- * <code>BundleContext</code>.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * <code>BundleContext</code>.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract Bundle getBundle();
+ public Bundle getBundle();
/**
* Installs a bundle from the specified location string. A bundle is
- * obtained from <code>location</code> as interpreted by the Framework in an
- * implementation dependent manner.
+ * obtained from <code>location</code> as interpreted by the Framework in
+ * an implementation dependent manner.
* <p>
* Every installed bundle is uniquely identified by its location string,
* typically in the form of a URL.
@@ -132,8 +132,8 @@
* <li>The bundle's content is read from the location string. If this
* fails, a {@link BundleException} is thrown.
*
- * <li>The bundle's <code>Bundle-NativeCode</code> dependencies are resolved.
- * If this fails, a <code>BundleException</code> is thrown.
+ * <li>The bundle's <code>Bundle-NativeCode</code> dependencies are
+ * resolved. If this fails, a <code>BundleException</code> is thrown.
*
* <li>The bundle's associated resources are allocated. The associated
* resources minimally consist of a unique identifier and a persistent
@@ -147,10 +147,10 @@
*
* <li>The bundle's state is set to <code>INSTALLED</code>.
*
- * <li>A bundle event of type {@link BundleEvent#INSTALLED} is broadcast.
+ * <li>A bundle event of type {@link BundleEvent#INSTALLED} is fired.
*
- * <li>The <code>Bundle</code> object for the newly or previously installed
- * bundle is returned.
+ * <li>The <code>Bundle</code> object for the newly or previously
+ * installed bundle is returned.
* </ol>
*
* <b>Postconditions, no exceptions thrown </b>
@@ -165,14 +165,14 @@
*
* @param location The location identifier of the bundle to install.
* @return The <code>Bundle</code> object of the installed bundle.
- * @exception BundleException If the installation failed.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission</code>, and the Java Runtime
- * Environment supports permissions.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws BundleException If the installation failed.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the
+ * Java Runtime Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract Bundle installBundle(String location)
+ public Bundle installBundle(String location)
throws BundleException;
/**
@@ -180,39 +180,39 @@
*
* <p>
* This method performs all of the steps listed in
- * <code>BundleContext.installBundle(String location)</code>, except that the
- * bundle's content will be read from the <code>InputStream</code> object. The
- * location identifier string specified will be used as the identity of the
- * bundle.
+ * <code>BundleContext.installBundle(String location)</code>, except that
+ * the bundle's content will be read from the <code>InputStream</code>
+ * object. The location identifier string specified will be used as the
+ * identity of the bundle.
*
* <p>
- * This method must always close the <code>InputStream</code> object, even if
- * an exception is thrown.
+ * This method must always close the <code>InputStream</code> object, even
+ * if an exception is thrown.
*
* @param location The location identifier of the bundle to install.
* @param input The <code>InputStream</code> object from which this bundle
* will be read.
* @return The <code>Bundle</code> object of the installed bundle.
- * @exception BundleException If the provided stream cannot be read or the
- * installation failed.
- * @exception java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission</code>, and the Java Runtime
- * Environment supports permissions.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws BundleException If the provided stream cannot be read or the
+ * installation failed.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the
+ * Java Runtime Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
* @see #installBundle(java.lang.String)
*/
- public abstract Bundle installBundle(String location, InputStream input)
+ public Bundle installBundle(String location, InputStream input)
throws BundleException;
/**
* Returns the bundle with the specified identifier.
*
* @param id The identifier of the bundle to retrieve.
- * @return A <code>Bundle</code> object or <code>null</code> if the identifier
- * does not match any installed bundle.
+ * @return A <code>Bundle</code> object or <code>null</code> if the
+ * identifier does not match any installed bundle.
*/
- public abstract Bundle getBundle(long id);
+ public Bundle getBundle(long id);
/**
* Returns a list of all installed bundles.
@@ -222,23 +222,23 @@
* Framework is a very dynamic environment, bundles can be installed or
* uninstalled at anytime.
*
- * @return An array of <code>Bundle</code> objects, one object per installed
- * bundle.
+ * @return An array of <code>Bundle</code> objects, one object per
+ * installed bundle.
*/
- public abstract Bundle[] getBundles();
+ public Bundle[] getBundles();
/**
- * Adds the specified <code>ServiceListener</code> object with the specified
- * <code>filter</code> to the context bundle's list of listeners.
- * See {@link Filter} for a description of the filter syntax.
+ * Adds the specified <code>ServiceListener</code> object with the
+ * specified <code>filter</code> to the context bundle's list of
+ * listeners. See {@link Filter} for a description of the filter syntax.
* <code>ServiceListener</code> objects are notified when a service has a
* lifecycle state change.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * <code>l</code> such that <code>(l==listener)</code>, then this method replaces
- * that listener's filter (which may be <code>null</code>) with the specified
- * one (which may be <code>null</code>).
+ * <code>l</code> such that <code>(l==listener)</code>, then this
+ * method replaces that listener's filter (which may be <code>null</code>)
+ * with the specified one (which may be <code>null</code>).
*
* <p>
* The listener is called if the filter criteria is met. To filter based
@@ -248,14 +248,15 @@
*
* <p>
* When using a <code>filter</code>, it is possible that the
- * <code>ServiceEvent</code>s for the complete lifecycle of a service will
- * not be delivered to the listener. For example, if the <code>filter</code>
- * only matches when the property <code>x</code> has the value <code>1</code>,
- * the listener will not be called if the service is registered with the
- * property <code>x</code> not set to the value <code>1</code>. Subsequently,
- * when the service is modified setting property <code>x</code> to the value
- * <code>1</code>, the filter will match and the listener will be called with
- * a <code>ServiceEvent</code> of type <code>MODIFIED</code>. Thus, the
+ * <code>ServiceEvent</code>s for the complete lifecycle of a service
+ * will not be delivered to the listener. For example, if the
+ * <code>filter</code> only matches when the property <code>x</code> has
+ * the value <code>1</code>, the listener will not be called if the
+ * service is registered with the property <code>x</code> not set to the
+ * value <code>1</code>. Subsequently, when the service is modified
+ * setting property <code>x</code> to the value <code>1</code>, the
+ * filter will match and the listener will be called with a
+ * <code>ServiceEvent</code> of type <code>MODIFIED</code>. Thus, the
* listener will not be called with a <code>ServiceEvent</code> of type
* <code>REGISTERED</code>.
*
@@ -263,22 +264,22 @@
* If the Java Runtime Environment supports permissions, the
* <code>ServiceListener</code> object will be notified of a service event
* only if the bundle that is registering it has the
- * <code>ServicePermission</code> to get the service using at least one of the
- * named classes the service was registered under.
+ * <code>ServicePermission</code> to get the service using at least one of
+ * the named classes the service was registered under.
*
* @param listener The <code>ServiceListener</code> object to be added.
* @param filter The filter criteria.
*
- * @exception InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an
+ * invalid filter string that cannot be parsed.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*
* @see ServiceEvent
* @see ServiceListener
* @see ServicePermission
*/
- public abstract void addServiceListener(ServiceListener listener,
+ public void addServiceListener(ServiceListener listener,
String filter) throws InvalidSyntaxException;
/**
@@ -292,92 +293,101 @@
* with <code>filter</code> set to <code>null</code>.
*
* @param listener The <code>ServiceListener</code> object to be added.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*
* @see #addServiceListener(ServiceListener, String)
*/
- public abstract void addServiceListener(ServiceListener listener);
+ public void addServiceListener(ServiceListener listener);
/**
- * Removes the specified <code>ServiceListener</code> object from the context
- * bundle's list of listeners.
+ * Removes the specified <code>ServiceListener</code> object from the
+ * context bundle's list of listeners.
*
* <p>
- * If <code>listener</code> is not contained in this context bundle's list of
- * listeners, this method does nothing.
+ * If <code>listener</code> is not contained in this context bundle's list
+ * of listeners, this method does nothing.
*
* @param listener The <code>ServiceListener</code> to be removed.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract void removeServiceListener(ServiceListener listener);
+ public void removeServiceListener(ServiceListener listener);
/**
* Adds the specified <code>BundleListener</code> object to the context
- * bundle's list of listeners if not already present. BundleListener
- * objects are notified when a bundle has a lifecycle state change.
+ * bundle's list of listeners if not already present. BundleListener objects
+ * are notified when a bundle has a lifecycle state change.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * <code>l</code> such that <code>(l==listener)</code>, this method does
- * nothing.
+ * <code>l</code> such that <code>(l==listener)</code>, this method
+ * does nothing.
*
* @param listener The <code>BundleListener</code> to be added.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
+ * @throws java.lang.SecurityException If listener is a
+ * <code>SynchronousBundleListener</code> and the caller does not
+ * have the appropriate <code>AdminPermission[context bundle,LISTENER]</code>,
+ * and the Java Runtime Environment supports permissions.
*
* @see BundleEvent
* @see BundleListener
*/
- public abstract void addBundleListener(BundleListener listener);
+ public void addBundleListener(BundleListener listener);
/**
- * Removes the specified <code>BundleListener</code> object from the context
- * bundle's list of listeners.
+ * Removes the specified <code>BundleListener</code> object from the
+ * context bundle's list of listeners.
*
* <p>
- * If <code>listener</code> is not contained in the context bundle's list of
- * listeners, this method does nothing.
+ * If <code>listener</code> is not contained in the context bundle's list
+ * of listeners, this method does nothing.
*
* @param listener The <code>BundleListener</code> object to be removed.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
+ * @throws java.lang.SecurityException If listener is a
+ * <code>SynchronousBundleListener</code> and the caller does not
+ * have the appropriate <code>AdminPermission[context bundle,LISTENER]</code>,
+ * and the Java Runtime Environment supports permissions.
*/
- public abstract void removeBundleListener(BundleListener listener);
+ public void removeBundleListener(BundleListener listener);
/**
* Adds the specified <code>FrameworkListener</code> object to the context
- * bundle's list of listeners if not already present.
- * FrameworkListeners are notified of general Framework events.
+ * bundle's list of listeners if not already present. FrameworkListeners are
+ * notified of general Framework events.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * <code>l</code> such that <code>(l==listener)</code>, this method does
- * nothing.
+ * <code>l</code> such that <code>(l==listener)</code>, this method
+ * does nothing.
*
* @param listener The <code>FrameworkListener</code> object to be added.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*
* @see FrameworkEvent
* @see FrameworkListener
*/
- public abstract void addFrameworkListener(FrameworkListener listener);
+ public void addFrameworkListener(FrameworkListener listener);
/**
* Removes the specified <code>FrameworkListener</code> object from the
* context bundle's list of listeners.
*
* <p>
- * If <code>listener</code> is not contained in the context bundle's list of
- * listeners, this method does nothing.
+ * If <code>listener</code> is not contained in the context bundle's list
+ * of listeners, this method does nothing.
*
- * @param listener The <code>FrameworkListener</code> object to be removed.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @param listener The <code>FrameworkListener</code> object to be
+ * removed.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract void removeFrameworkListener(FrameworkListener listener);
+ public void removeFrameworkListener(FrameworkListener listener);
/**
* Registers the specified service object with the specified properties
@@ -397,20 +407,21 @@
* <p>
* The following steps are required to register a service:
* <ol>
- * <li>If <code>service</code> is not a <code>ServiceFactory</code>, an
- * <code>IllegalArgumentException</code> is thrown if <code>service</code> is
- * not an <code>instanceof</code> all the classes named.
+ * <li>If <code>service</code> is not a <code>ServiceFactory</code>,
+ * an <code>IllegalArgumentException</code> is thrown if
+ * <code>service</code> is not an <code>instanceof</code> all the
+ * classes named.
* <li>The Framework adds these service properties to the specified
- * <code>Dictionary</code> (which may be <code>null</code>): a property named
- * {@link Constants#SERVICE_ID} identifying the registration number of the
- * service and a property named {@link Constants#OBJECTCLASS} containing
+ * <code>Dictionary</code> (which may be <code>null</code>): a property
+ * named {@link Constants#SERVICE_ID} identifying the registration number of
+ * the service and a property named {@link Constants#OBJECTCLASS} containing
* all the specified classes. If any of these properties have already been
* specified by the registering bundle, their values will be overwritten by
* the Framework.
* <li>The service is added to the Framework service registry and may now
* be used by other bundles.
* <li>A service event of type {@link ServiceEvent#REGISTERED} is
- * synchronously sent.
+ * fired.
* <li>A <code>ServiceRegistration</code> object for this registration is
* returned.
* </ol>
@@ -418,43 +429,44 @@
* @param clazzes The class names under which the service can be located.
* The class names in this array will be stored in the service's
* properties under the key {@link Constants#OBJECTCLASS}.
- * @param service The service object or a <code>ServiceFactory</code> object.
+ * @param service The service object or a <code>ServiceFactory</code>
+ * object.
* @param properties The properties for this service. The keys in the
* properties object must all be <code>String</code> objects. See
* {@link Constants} for a list of standard service property keys.
* Changes should not be made to this object after calling this
* method. To update the service's properties the
* {@link ServiceRegistration#setProperties} method must be called.
- * The set of properties may be <code>null</code> if the service has no
- * properties.
+ * The set of properties may be <code>null</code> if the service
+ * has no properties.
*
* @return A <code>ServiceRegistration</code> object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
*
- * @exception java.lang.IllegalArgumentException If one of the following is
- * true:
- * <ul>
- * <li><code>service</code> is <code>null</code>.
- * <li><code>service</code> is not a <code>ServiceFactory</code>
- * object and is not an instance of all the named classes in
- * <code>clazzes</code>.
- * <li><code>properties</code> contains case variants of the same
- * key name.
- * </ul>
+ * @throws java.lang.IllegalArgumentException If one of the following is
+ * true:
+ * <ul>
+ * <li><code>service</code> is <code>null</code>.
+ * <li><code>service</code> is not a <code>ServiceFactory</code>
+ * object and is not an instance of all the named classes in
+ * <code>clazzes</code>.
+ * <li><code>properties</code> contains case variants of the same
+ * key name.
+ * </ul>
*
- * @exception java.lang.SecurityException If the caller does not have the
- * <code>ServicePermission</code> to register the service for all
- * the named classes and the Java Runtime Environment supports
- * permissions.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * <code>ServicePermission</code> to register the service for all
+ * the named classes and the Java Runtime Environment supports
+ * permissions.
*
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*
* @see ServiceRegistration
* @see ServiceFactory
*/
- public abstract ServiceRegistration registerService(String[] clazzes,
+ public ServiceRegistration registerService(String[] clazzes,
Object service, Dictionary properties);
/**
@@ -470,12 +482,12 @@
* {@link Constants#OBJECTCLASS} property will be an array of strings,
* rather than just a single string.
*
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
* @see #registerService(java.lang.String[], java.lang.Object,
* java.util.Dictionary)
*/
- public abstract ServiceRegistration registerService(String clazz,
+ public ServiceRegistration registerService(String clazz,
Object service, Dictionary properties);
/**
@@ -487,8 +499,8 @@
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
*
* <p>
- * The list is valid at the time of the call to this method, however since the
- * Framework is a very dynamic environment, services can be modified or
+ * The list is valid at the time of the call to this method, however since
+ * the Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
*
* <p>
@@ -497,69 +509,69 @@
* {@link Filter} for a description of the filter string syntax.
*
* <p>
- * If <code>filter</code> is <code>null</code>, all registered services are
- * considered to match the filter.
- * If <code>filter</code> cannot be parsed, an {@link InvalidSyntaxException}
- * will be thrown with a human readable message where the filter became
- * unparsable.
+ * If <code>filter</code> is <code>null</code>, all registered services
+ * are considered to match the filter. If <code>filter</code> cannot be
+ * parsed, an {@link InvalidSyntaxException} will be thrown with a human
+ * readable message where the filter became unparsable.
*
* <p>
- * The following steps are required to select a set of
+ * The following steps are required to select a set of
* <code>ServiceReference</code> objects:
* <ol>
- * <li>If the filter string is not <code>null</code>, the filter string is
- * parsed and the set <code>ServiceReference</code> objects of registered
- * services that satisfy the filter is produced. If the filter string is
- * <code>null</code>, then all registered
- * services are considered to satisfy the filter.
- * <li>If the Java Runtime Environment supports permissions, the
- * set of <code>ServiceReference</code> objects produced by the
- * previous step is reduced by checking that the caller has
- * the <code>ServicePermission</code> to get at least one
- * of the class names under which the service was registered. If the caller
- * does not have the correct permission for a particular
- * <code>ServiceReference</code> object, then it is removed from the set.
- * <li>If <code>clazz</code> is not <code>null</code>, the set is further
- * reduced to those services that are an <code>instanceof</code> and were
- * registered under the specified class. The complete list of classes of
- * which a service is an instance and which were specified when the service
- * was registered is available from the service's
+ * <li>If the filter string is not <code>null</code>, the filter string
+ * is parsed and the set <code>ServiceReference</code> objects of
+ * registered services that satisfy the filter is produced. If the filter
+ * string is <code>null</code>, then all registered services are
+ * considered to satisfy the filter.
+ * <li>If the Java Runtime Environment supports permissions, the set of
+ * <code>ServiceReference</code> objects produced by the previous step is
+ * reduced by checking that the caller has the
+ * <code>ServicePermission</code> to get at least one of the class names
+ * under which the service was registered. If the caller does not have the
+ * correct permission for a particular <code>ServiceReference</code>
+ * object, then it is removed from the set.
+ * <li>If <code>clazz</code> is not <code>null</code>, the set is
+ * further reduced to those services that are an <code>instanceof</code>
+ * and were registered under the specified class. The complete list of
+ * classes of which a service is an instance and which were specified when
+ * the service was registered is available from the service's
* {@link Constants#OBJECTCLASS} property.
* <li>The set is reduced one final time by cycling through each
* <code>ServiceReference</code> object and calling
- * {@link ServiceReference#isAssignableTo(Bundle, String)} with the
- * context bundle and each class name under which the
- * <code>ServiceReference</code> object was registered. For any
- * given <code>ServiceReference</code> object, if any call to
+ * {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
+ * bundle and each class name under which the <code>ServiceReference</code>
+ * object was registered. For any given <code>ServiceReference</code>
+ * object, if any call to
* {@link ServiceReference#isAssignableTo(Bundle, String)} returns
* <code>false</code>, then it is removed from the set of
* <code>ServiceReference</code> objects.
- * <li>An array of the remaining <code>ServiceReference</code> objects
- * is returned.
+ * <li>An array of the remaining <code>ServiceReference</code> objects is
+ * returned.
* </ol>
*
* @param clazz The class name with which the service was registered or
* <code>null</code> for all services.
* @param filter The filter criteria.
- * @return An array of <code>ServiceReference</code> objects or <code>null</code>
- * if no services are registered which satisfy the search.
- * @exception InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @return An array of <code>ServiceReference</code> objects or
+ * <code>null</code> if no services are registered which satisfy
+ * the search.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an
+ * invalid filter string that cannot be parsed.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract ServiceReference[] getServiceReferences(String clazz,
+ public ServiceReference[] getServiceReferences(String clazz,
String filter) throws InvalidSyntaxException;
/**
* Returns an array of <code>ServiceReference</code> objects. The returned
* array of <code>ServiceReference</code> objects contains services that
- * were registered under the specified class and match the
- * specified filter criteria.
+ * were registered under the specified class and match the specified filter
+ * criteria.
*
* <p>
- * The list is valid at the time of the call to this method, however since the
- * Framework is a very dynamic environment, services can be modified or
+ * The list is valid at the time of the call to this method, however since
+ * the Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
*
* <p>
@@ -568,49 +580,49 @@
* {@link Filter} for a description of the filter string syntax.
*
* <p>
- * If <code>filter</code> is <code>null</code>, all registered services are
- * considered to match the filter.
- * If <code>filter</code> cannot be parsed, an {@link InvalidSyntaxException}
- * will be thrown with a human readable message where the filter became
- * unparsable.
+ * If <code>filter</code> is <code>null</code>, all registered services
+ * are considered to match the filter. If <code>filter</code> cannot be
+ * parsed, an {@link InvalidSyntaxException} will be thrown with a human
+ * readable message where the filter became unparsable.
*
* <p>
- * The following steps are required to select a set of
+ * The following steps are required to select a set of
* <code>ServiceReference</code> objects:
* <ol>
- * <li>If the filter string is not <code>null</code>, the filter string is
- * parsed and the set <code>ServiceReference</code> objects of registered
- * services that satisfy the filter is produced. If the filter string is
- * <code>null</code>, then all registered
- * services are considered to satisfy the filter.
- * <li>If the Java Runtime Environment supports permissions, the
- * set of <code>ServiceReference</code> objects produced by the
- * previous step is reduced by checking that the caller has
- * the <code>ServicePermission</code> to get at least one
- * of the class names under which the service was registered. If the caller
- * does not have the correct permission for a particular
- * <code>ServiceReference</code> object, then it is removed from the set.
- * <li>If <code>clazz</code> is not <code>null</code>, the set is further
- * reduced to those services that are an <code>instanceof</code> and were
- * registered under the specified class. The complete list of classes of
- * which a service is an instance and which were specified when the service
- * was registered is available from the service's
+ * <li>If the filter string is not <code>null</code>, the filter string
+ * is parsed and the set <code>ServiceReference</code> objects of
+ * registered services that satisfy the filter is produced. If the filter
+ * string is <code>null</code>, then all registered services are
+ * considered to satisfy the filter.
+ * <li>If the Java Runtime Environment supports permissions, the set of
+ * <code>ServiceReference</code> objects produced by the previous step is
+ * reduced by checking that the caller has the
+ * <code>ServicePermission</code> to get at least one of the class names
+ * under which the service was registered. If the caller does not have the
+ * correct permission for a particular <code>ServiceReference</code>
+ * object, then it is removed from the set.
+ * <li>If <code>clazz</code> is not <code>null</code>, the set is
+ * further reduced to those services that are an <code>instanceof</code>
+ * and were registered under the specified class. The complete list of
+ * classes of which a service is an instance and which were specified when
+ * the service was registered is available from the service's
* {@link Constants#OBJECTCLASS} property.
- * <li>An array of the remaining <code>ServiceReference</code> objects
- * is returned.
+ * <li>An array of the remaining <code>ServiceReference</code> objects is
+ * returned.
* </ol>
*
* @param clazz The class name with which the service was registered or
* <code>null</code> for all services.
* @param filter The filter criteria.
- * @return An array of <code>ServiceReference</code> objects or <code>null</code>
- * if no services are registered which satisfy the search.
- * @exception InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @return An array of <code>ServiceReference</code> objects or
+ * <code>null</code> if no services are registered which satisfy
+ * the search.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an
+ * invalid filter string that cannot be parsed.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract ServiceReference[] getAllServiceReferences(String clazz,
+ public ServiceReference[] getAllServiceReferences(String clazz,
String filter) throws InvalidSyntaxException;
/**
@@ -618,16 +630,16 @@
* implements and was registered under the specified class.
*
* <p>
- * This <code>ServiceReference</code> object is valid at the time of the call
- * to this method, however as the Framework is a very dynamic environment,
- * services can be modified or unregistered at anytime.
+ * This <code>ServiceReference</code> object is valid at the time of the
+ * call to this method, however as the Framework is a very dynamic
+ * environment, services can be modified or unregistered at anytime.
*
* <p>
* This method is the same as calling
* {@link BundleContext#getServiceReferences(String, String)} with a
- * <code>null</code> filter string. It is provided as a convenience for when
- * the caller is interested in any service that implements the specified
- * class.
+ * <code>null</code> filter string. It is provided as a convenience for
+ * when the caller is interested in any service that implements the
+ * specified class.
* <p>
* If multiple such services exist, the service with the highest ranking (as
* specified in its {@link Constants#SERVICE_RANKING} property) is returned.
@@ -637,13 +649,13 @@
* service that was registered first is returned.
*
* @param clazz The class name with which the service was registered.
- * @return A <code>ServiceReference</code> object, or <code>null</code> if no
- * services are registered which implement the named class.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @return A <code>ServiceReference</code> object, or <code>null</code>
+ * if no services are registered which implement the named class.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
* @see #getServiceReferences(String, String)
*/
- public abstract ServiceReference getServiceReference(String clazz);
+ public ServiceReference getServiceReference(String clazz);
/**
* Returns the specified service object for a service.
@@ -665,48 +677,49 @@
* <p>
* The following steps are required to get the service object:
* <ol>
- * <li>If the service has been unregistered, <code>null</code> is returned.
+ * <li>If the service has been unregistered, <code>null</code> is
+ * returned.
* <li>The context bundle's use count for this service is incremented by
* one.
* <li>If the context bundle's use count for the service is currently one
* and the service was registered with an object implementing the
* <code>ServiceFactory</code> interface, the
- * {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method
- * is called to create a service object for the context bundle. This service
+ * {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method is
+ * called to create a service object for the context bundle. This service
* object is cached by the Framework. While the context bundle's use count
* for the service is greater than zero, subsequent calls to get the
* services's service object for the context bundle will return the cached
- * service object.
- * <br>
- * If the service object returned by the <code>ServiceFactory</code> object is
- * not an <code>instanceof</code> all the classes named when the service was
- * registered or the <code>ServiceFactory</code> object throws an exception,
- * <code>null</code> is returned and a Framework event of type
- * {@link FrameworkEvent#ERROR} is broadcast.
+ * service object. <br>
+ * If the service object returned by the <code>ServiceFactory</code>
+ * object is not an <code>instanceof</code> all the classes named when the
+ * service was registered or the <code>ServiceFactory</code> object throws
+ * an exception, <code>null</code> is returned and a Framework event of
+ * type {@link FrameworkEvent#ERROR} is fired.
* <li>The service object for the service is returned.
* </ol>
*
* @param reference A reference to the service.
* @return A service object for the service associated with
- * <code>reference</code> or <code>null</code> if the service is not
- * registered or does not implement the classes under which it was
- * registered in the case of a <code>ServiceFactory</code>.
- * @exception java.lang.SecurityException If the caller does not have the
- * <code>ServicePermission</code> to get the service using at least
- * one of the named classes the service was registered under and
- * the Java Runtime Environment supports permissions.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * <code>reference</code> or <code>null</code> if the service is
+ * not registered or does not implement the classes under which it
+ * was registered in the case of a <code>ServiceFactory</code>.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * <code>ServicePermission</code> to get the service using at
+ * least one of the named classes the service was registered under
+ * and the Java Runtime Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
* @see #ungetService(ServiceReference)
* @see ServiceFactory
*/
- public abstract Object getService(ServiceReference reference);
+ public Object getService(ServiceReference reference);
/**
* Releases the service object referenced by the specified
- * <code>ServiceReference</code> object. If the context bundle's use count for
- * the service is zero, this method returns <code>false</code>. Otherwise,
- * the context bundle's use count for the service is decremented by one.
+ * <code>ServiceReference</code> object. If the context bundle's use count
+ * for the service is zero, this method returns <code>false</code>.
+ * Otherwise, the context bundle's use count for the service is decremented
+ * by one.
*
* <p>
* The service's service object should no longer be used and all references
@@ -721,8 +734,9 @@
* <li>The context bundle's use count for this service is decremented by
* one.
* <li>If the context bundle's use count for the service is currently zero
- * and the service was registered with a <code>ServiceFactory</code> object,
- * the {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
+ * and the service was registered with a <code>ServiceFactory</code>
+ * object, the
+ * {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
* method is called to release the service object for the context bundle.
* <li><code>true</code> is returned.
* </ol>
@@ -731,12 +745,12 @@
* @return <code>false</code> if the context bundle's use count for the
* service is zero or if the service has been unregistered;
* <code>true</code> otherwise.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
* @see #getService
* @see ServiceFactory
*/
- public abstract boolean ungetService(ServiceReference reference);
+ public boolean ungetService(ServiceReference reference);
/**
* Creates a <code>File</code> object for a file in the persistent storage
@@ -744,30 +758,31 @@
* <code>null</code> if the platform does not have file system support.
*
* <p>
- * A <code>File</code> object for the base directory of the persistent storage
- * area provided for the context bundle by the Framework can be obtained by
- * calling this method with an empty string as <code>filename</code>.
+ * A <code>File</code> object for the base directory of the persistent
+ * storage area provided for the context bundle by the Framework can be
+ * obtained by calling this method with an empty string as
+ * <code>filename</code>.
*
* <p>
* If the Java Runtime Environment supports permissions, the Framework will
* ensure that the bundle has the <code>java.io.FilePermission</code> with
- * actions <code>read</code>,<code>write</code>,<code>delete</code> for all
- * files (recursively) in the persistent storage area provided for the
- * context bundle.
+ * actions <code>read</code>,<code>write</code>,<code>delete</code>
+ * for all files (recursively) in the persistent storage area provided for
+ * the context bundle.
*
* @param filename A relative name to the file to be accessed.
- * @return A <code>File</code> object that represents the requested file or
- * <code>null</code> if the platform does not have file system
+ * @return A <code>File</code> object that represents the requested file
+ * or <code>null</code> if the platform does not have file system
* support.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- public abstract File getDataFile(String filename);
+ public File getDataFile(String filename);
/**
- * Creates a <code>Filter</code> object. This <code>Filter</code> object may be
- * used to match a <code>ServiceReference</code> object or a
- * <code>Dictionary</code> object.
+ * Creates a <code>Filter</code> object. This <code>Filter</code> object
+ * may be used to match a <code>ServiceReference</code> object or a
+ * <code>Dictionary</code> object.
*
* <p>
* If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
@@ -775,16 +790,16 @@
*
* @param filter The filter string.
* @return A <code>Filter</code> object encapsulating the filter string.
- * @exception InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
- * @exception NullPointerException If <code>filter</code> is null.
- * @exception java.lang.IllegalStateException If this BundleContext is no
- * longer valid.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an
+ * invalid filter string that cannot be parsed.
+ * @throws NullPointerException If <code>filter</code> is null.
+ * @throws java.lang.IllegalStateException If this BundleContext is no
+ * longer valid.
*
* @since 1.1
* @see "Framework specification for a description of the filter string syntax."
+ * @see FrameworkUtil#createFilter(String)
*/
- public abstract Filter createFilter(String filter)
+ public Filter createFilter(String filter)
throws InvalidSyntaxException;
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java
index dcd6e8e..13abbd8 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleEvent.java,v 1.10 2005/05/13 20:32:54 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleEvent.java,v 1.13 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -13,16 +13,17 @@
import java.util.EventObject;
/**
- * A Framework event describing a bundle lifecycle change.
+ * An event from the Framework describing a bundle lifecycle change.
* <p>
- * <code>BundleEvent</code> objects are delivered to <code>BundleListener</code>
- * objects when a change occurs in a bundle's lifecycle. A type code is used to
- * identify the event type for future extendability.
+ * <code>BundleEvent</code> objects are delivered to
+ * <code>BundleListener</code> objects when a change occurs in a bundle's
+ * lifecycle. A type code is used to identify the event type for future
+ * extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.13 $
*/
public class BundleEvent extends EventObject {
@@ -90,7 +91,7 @@
* @see Bundle#RESOLVED
* @since 1.3
*/
- public final static int RESOLVED = 0x00000020;
+ public final static int RESOLVED = 0x00000020;
/**
* The bundle has been unresolved.
@@ -100,7 +101,27 @@
* @see Bundle#INSTALLED
* @since 1.3
*/
- public final static int UNRESOLVED = 0x00000040;
+ public final static int UNRESOLVED = 0x00000040;
+
+ /**
+ * The bundle is about to start.
+ * <p>
+ * The value of <code>STARTING</code> is 0x00000080.
+ *
+ * @see Bundle#start()
+ * @since 1.3
+ */
+ public final static int STARTING = 0x00000080;
+
+ /**
+ * The bundle is about to stop.
+ * <p>
+ * The value of <code>STOPPING</code> is 0x00000100.
+ *
+ * @see Bundle#stop()
+ * @since 1.3
+ */
+ public final static int STOPPING = 0x00000100;
/**
* Creates a bundle event of the specified type.
@@ -129,12 +150,14 @@
* Returns the type of lifecyle event. The type values are:
* <ul>
* <li>{@link #INSTALLED}
+ * <li>{@link #RESOLVED}
+ * <li>{@link #STARTING}
* <li>{@link #STARTED}
+ * <li>{@link #STOPPING}
* <li>{@link #STOPPED}
* <li>{@link #UPDATED}
- * <li>{@link #UNINSTALLED}
- * <li>{@link #RESOLVED}
* <li>{@link #UNRESOLVED}
+ * <li>{@link #UNINSTALLED}
* </ul>
*
* @return The type of lifecycle event.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java
index c6cade1..ddc7555 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleException.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleException.java,v 1.10 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleException.java,v 1.11 2005/07/30 02:22:40 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -15,15 +15,15 @@
* occurred.
*
* <p>
- * <code>BundleException</code> object is created by the Framework to denote an
- * exception condition in the lifecycle of a bundle. <code>BundleException</code>s
- * should not be created by bundle developers.
+ * <code>BundleException</code> object is created by the Framework to denote
+ * an exception condition in the lifecycle of a bundle.
+ * <code>BundleException</code>s should not be created by bundle developers.
*
* <p>
* This exception is updated to conform to the general purpose exception
* chaining mechanism.
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public class BundleException extends Exception {
@@ -45,7 +45,8 @@
}
/**
- * Creates a <code>BundleException</code> object with the specified message.
+ * Creates a <code>BundleException</code> object with the specified
+ * message.
*
* @param msg The message.
*/
@@ -70,11 +71,11 @@
}
/**
- * Returns the cause of this exception or <code>null</code> if no cause was
- * specified when this exception was created.
+ * Returns the cause of this exception or <code>null</code> if no cause
+ * was specified when this exception was created.
*
- * @return The cause of this exception or <code>null</code> if no cause was
- * specified.
+ * @return The cause of this exception or <code>null</code> if no cause
+ * was specified.
* @since 1.3
*/
public Throwable getCause() {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java
index 88c38aa..4798c23 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleListener.java,v 1.7 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleListener.java,v 1.9 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -13,26 +13,28 @@
import java.util.EventListener;
/**
- * A <code>BundleEvent</code> listener.
+ * A <code>BundleEvent</code> listener. When a <code>BundleEvent</code> is
+ * fired, it is asynchronously delivered to a <code>BundleListener</code>.
*
* <p>
- * <code>BundleListener</code> is a listener interface that may be implemented by
- * a bundle developer.
+ * <code>BundleListener</code> is a listener interface that may be implemented
+ * by a bundle developer.
* <p>
- * A <code>BundleListener</code> object is registered with the Framework using the
- * {@link BundleContext#addBundleListener} method. <code>BundleListener</code>s
- * are called with a <code>BundleEvent</code> object when a bundle has been
- * installed, resolved, started, stopped, updated, unresolved, or uninstalled.
+ * A <code>BundleListener</code> object is registered with the Framework using
+ * the {@link BundleContext#addBundleListener} method.
+ * <code>BundleListener</code>s are called with a <code>BundleEvent</code>
+ * object when a bundle has been installed, resolved, started, stopped, updated,
+ * unresolved, or uninstalled.
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.9 $
* @see BundleEvent
*/
-public abstract interface BundleListener extends EventListener {
+public interface BundleListener extends EventListener {
/**
* Receives notification that a bundle has had a lifecycle change.
*
* @param event The <code>BundleEvent</code>.
*/
- public abstract void bundleChanged(BundleEvent event);
+ public void bundleChanged(BundleEvent event);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
index 62b2113..1aae005 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundlePermission.java,v 1.10 2005/06/21 16:22:12 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundlePermission.java,v 1.13 2005/08/03 01:31:53 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -71,8 +71,6 @@
| ACTION_HOST
| ACTION_FRAGMENT;
private final static int ACTION_NONE = 0;
- private final static int ACTION_ERROR = 0x80000000;
-
/**
* The actions mask.
*/
@@ -255,10 +253,10 @@
* named symbolic name.
*
* <pre>
- * x.y.*,"provide" -> x.y.z,"provide" is true
- * *,"require" -> x.y, "require" is true
- * *,"provide" -> x.y, "require" is true
- * x.y,"provide" -> x.y.z, "provide" is false
+ * x.y.*,"provide" -> x.y.z,"provide" is true
+ * *,"require" -> x.y, "require" is true
+ * *,"provide" -> x.y, "require" is true
+ * x.y,"provide" -> x.y.z, "provide" is false
* </pre>
*
* @param p The target permission to interrogate.
@@ -310,6 +308,7 @@
if (comma)
sb.append(',');
sb.append(HOST);
+ comma = true;
}
if ((action_mask & ACTION_FRAGMENT) == ACTION_FRAGMENT) {
@@ -455,12 +454,10 @@
*
* @param permission The <code>BundlePermission</code> object to add.
*
- * @exception IllegalArgumentException If the permission is not a
- * <code>BundlePermission</code> instance.
- *
- * @exception SecurityException If this
- * <code>BundlePermissionCollection</code> object has been
- * marked read-only.
+ * @throws IllegalArgumentException If the permission is not a
+ * <code>BundlePermission</code> instance.
+ * @throws SecurityException If this <code>BundlePermissionCollection</code>
+ * object has been marked read-only.
*/
public void add(Permission permission) {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java
index 27f5ec2..2955156 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Configurable.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Configurable.java,v 1.7 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Configurable.java,v 1.8 2005/07/30 02:22:41 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -12,33 +12,34 @@
/**
* Supports a configuration object.
- *
- * <p><code>Configurable</code> is an interface that should be used by a bundle developer in support
- * of a configurable service.
- * Bundles that need to configure a service may test to determine
- * if the service object is an <code>instanceof Configurable</code>.
- *
- * @version $Revision: 1.7 $
- * @deprecated Please use the Configuration Admin
+ *
+ * <p>
+ * <code>Configurable</code> is an interface that should be used by a bundle
+ * developer in support of a configurable service. Bundles that need to
+ * configure a service may test to determine if the service object is an
+ * <code>instanceof Configurable</code>.
+ *
+ * @version $Revision: 1.8 $
+ * @deprecated Since 1.2. Please use Configuration Admin service.
*/
-public abstract interface Configurable
-{
- /**
- * Returns this service's configuration object.
- *
- * <p>Services implementing <code>Configurable</code> should take care when returning a
- * service configuration object since this object is probably sensitive.
- * <p>If the Java Runtime Environment supports permissions, it is recommended that
- * the caller is checked for the appropriate permission before returning the configuration object.
- * It is recommended that callers possessing the appropriate
- * {@link AdminPermission} always be allowed to get the configuration object.
- *
- * @return The configuration object for this service.
- * @exception java.lang.SecurityException If the caller does not have
- * an appropriate permission and the Java Runtime Environment supports permissions.
- * @deprecated Please use the Configuration Admin
- */
- public abstract Object getConfigurationObject();
+public interface Configurable {
+ /**
+ * Returns this service's configuration object.
+ *
+ * <p>
+ * Services implementing <code>Configurable</code> should take care when
+ * returning a service configuration object since this object is probably
+ * sensitive.
+ * <p>
+ * If the Java Runtime Environment supports permissions, it is recommended
+ * that the caller is checked for some appropriate permission before
+ * returning the configuration object.
+ *
+ * @return The configuration object for this service.
+ * @throws java.lang.SecurityException If the caller does not have an
+ * appropriate permission and the Java Runtime Environment supports
+ * permissions.
+ * @deprecated Since 1.2. Please use Configuration Admin service.
+ */
+ public Object getConfigurationObject();
}
-
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
index d4b012f..618b448 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Constants.java,v 1.18 2005/06/21 15:45:08 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Constants.java,v 1.20 2005/08/05 14:43:17 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -10,21 +10,16 @@
package org.osgi.framework;
-import java.util.Dictionary;
-
/**
* Defines standard names for the OSGi environment property, service property,
* and Manifest header attribute keys.
*
* <p>
- * The values associated with these keys are of type <code>java.lang.String</code>,
- * unless otherwise indicated.
+ * The values associated with these keys are of type
+ * <code>java.lang.String</code>, unless otherwise indicated.
*
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.20 $
* @since 1.1
- * @see Bundle#getHeaders()
- * @see BundleContext#getProperty
- * @see BundleContext#registerService(String[],Object,Dictionary)
*/
public interface Constants {
@@ -35,8 +30,9 @@
public static final String SYSTEM_BUNDLE_LOCATION = "System Bundle";
/**
- * Alias for the symbolic name of the OSGi <i>system bundle </i>. It is defined
- * to be "system.bundle".
+ * Alias for the symbolic name of the OSGi <i>system bundle </i>. It is
+ * defined to be "system.bundle".
+ *
* @since 1.3
*/
public static final String SYSTEM_BUNDLE_SYMBOLICNAME = "system.bundle";
@@ -52,8 +48,8 @@
/**
* Manifest header (named "Bundle-ClassPath") identifying a list
- * of directories and embedded JAR files, which are bundle resources used
- * to extend the bundle's classpath.
+ * of directories and embedded JAR files, which are bundle resources used to
+ * extend the bundle's classpath.
*
* <p>
* The attribute value may be retrieved from the <code>Dictionary</code>
@@ -100,8 +96,8 @@
public static final String BUNDLE_NATIVECODE = "Bundle-NativeCode";
/**
- * Manifest header (named "Export-Package") identifying
- * the packages that the bundle offers to the Framework for export.
+ * Manifest header (named "Export-Package") identifying the
+ * packages that the bundle offers to the Framework for export.
*
* <p>
* The attribute value may be retrieved from the <code>Dictionary</code>
@@ -121,8 +117,8 @@
public static final String EXPORT_SERVICE = "Export-Service";
/**
- * Manifest header (named "Import-Package") identifying
- * the packages on which the bundle depends.
+ * Manifest header (named "Import-Package") identifying the
+ * packages on which the bundle depends.
*
* <p>
* The attribute value may be retrieved from the <code>Dictionary</code>
@@ -131,9 +127,8 @@
public static final String IMPORT_PACKAGE = "Import-Package";
/**
- * Manifest header (named "DynamicImport-Package") identifying
- * the packages that the bundle may dynamically import during
- * execution.
+ * Manifest header (named "DynamicImport-Package") identifying the
+ * packages that the bundle may dynamically import during execution.
*
* <p>
* The attribute value may be retrieved from the <code>Dictionary</code>
@@ -203,8 +198,8 @@
* <p>
* If present, this header specifies the name of the bundle resource class
* that implements the <code>BundleActivator</code> interface and whose
- * <code>start</code> and <code>stop</code> methods are called by the Framework
- * when the bundle is started and stopped, respectively.
+ * <code>start</code> and <code>stop</code> methods are called by the
+ * Framework when the bundle is started and stopped, respectively.
*
* <p>
* The attribute value may be retrieved from the <code>Dictionary</code>
@@ -233,9 +228,11 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework ; specification-version="1.1"
+ * Import-Package: org.osgi.framework ; specification-version="1.1"
* </pre>
- * @deprecated Since 1.3, this has been replaced by {@link #VERSION_ATTRIBUTE}.
+ *
+ * @deprecated Since 1.3. This has been replaced by
+ * {@link #VERSION_ATTRIBUTE}.
*/
public static final String PACKAGE_SPECIFICATION_VERSION = "specification-version";
@@ -249,7 +246,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; processor=x86 ...
+ * Bundle-NativeCode: http.so ; processor=x86 ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_PROCESSOR = "processor";
@@ -263,7 +260,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; osname=Linux ...
+ * Bundle-NativeCode: http.so ; osname=Linux ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_OSNAME = "osname";
@@ -277,7 +274,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; osversion="2.34" ...
+ * Bundle-NativeCode: http.so ; osversion="2.34" ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_OSVERSION = "osversion";
@@ -291,7 +288,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; language=nl_be ...
+ * Bundle-NativeCode: http.so ; language=nl_be ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_LANGUAGE = "language";
@@ -394,35 +391,34 @@
/**
* Framework environment property (named
- * "org.osgi.framework.bootdelegation") identifying
- * packages for which the Framework must delegate class loading to the boot class path.
+ * "org.osgi.framework.bootdelegation") identifying packages for
+ * which the Framework must delegate class loading to the boot class path.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
*
* @since 1.3
*/
- public static final String FRAMEWORK_BOOTDELEGATION = "org.osgi.framework.bootdelegation";
+ public static final String FRAMEWORK_BOOTDELEGATION = "org.osgi.framework.bootdelegation";
/**
* Framework environment property (named
- * "org.osgi.framework.system.packages") identifying
- * package which the system bundle must export.
+ * "org.osgi.framework.system.packages") identifying package which
+ * the system bundle must export.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
*
* @since 1.3
*/
- public static final String FRAMEWORK_SYSTEMPACKAGES = "org.osgi.framework.system.packages";
+ public static final String FRAMEWORK_SYSTEMPACKAGES = "org.osgi.framework.system.packages";
/**
* Framework environment property (named
- * "org.osgi.supports.framework.extension") identifying
- * whether the Framework supports framework extension bundles.
- * If the value of this property is <code>true</code>, then the Framework
- * supports framework extension bundles.
- * The default value is <code>false</code>.
+ * "org.osgi.supports.framework.extension") identifying whether
+ * the Framework supports framework extension bundles. If the value of this
+ * property is <code>true</code>, then the Framework supports framework
+ * extension bundles. The default value is <code>false</code>.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
@@ -434,10 +430,10 @@
/**
* Framework environment property (named
* "org.osgi.supports.bootclasspath.extension") identifying
- * whether the Framework supports bootclasspath extension bundles.
- * If the value of this property is <code>true</code>, then the Framework
- * supports bootclasspath extension bundles.
- * The default value is <code>false</code>.
+ * whether the Framework supports bootclasspath extension bundles. If the
+ * value of this property is <code>true</code>, then the Framework
+ * supports bootclasspath extension bundles. The default value is
+ * <code>false</code>.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
@@ -448,33 +444,32 @@
/**
* Framework environment property (named
- * "org.osgi.supports.framework.fragment") identifying
- * whether the Framework supports fragment bundles.
- * If the value of this property is <code>true</code>, then the Framework
- * supports fragment bundles.
- * The default value is <code>false</code>.
+ * "org.osgi.supports.framework.fragment") identifying whether the
+ * Framework supports fragment bundles. If the value of this property is
+ * <code>true</code>, then the Framework supports fragment bundles. The
+ * default value is <code>false</code>.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
*
* @since 1.3
*/
- public static final String SUPPORTS_FRAMEWORK_FRAGMENT = "org.osgi.supports.framework.fragment";
+ public static final String SUPPORTS_FRAMEWORK_FRAGMENT = "org.osgi.supports.framework.fragment";
/**
* Framework environment property (named
* "org.osgi.supports.framework.requirebundle") identifying
- * whether the Framework supports the <code>Require-Bundle</code> manifest header.
- * If the value of this property is <code>true</code>, then the Framework
- * supports the <code>Require-Bundle</code> manifest header.
- * The default value is <code>false</code>.
+ * whether the Framework supports the <code>Require-Bundle</code> manifest
+ * header. If the value of this property is <code>true</code>, then the
+ * Framework supports the <code>Require-Bundle</code> manifest header. The
+ * default value is <code>false</code>.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
*
* @since 1.3
*/
- public static final String SUPPORTS_FRAMEWORK_REQUIREBUNDLE = "org.osgi.supports.framework.requirebundle";
+ public static final String SUPPORTS_FRAMEWORK_REQUIREBUNDLE = "org.osgi.supports.framework.requirebundle";
/*
* Service properties.
@@ -535,19 +530,20 @@
* <p>
* The service ranking is used by the Framework to determine the <i>default
* </i> service to be returned from a call to the
- * {@link BundleContext#getServiceReference}method: If more than one
+ * {@link BundleContext#getServiceReference} method: If more than one
* service implements the specified class, the <code>ServiceReference</code>
* object with the highest ranking is returned.
*
* <p>
* The default ranking is zero (0). A service with a ranking of
- * <code>Integer.MAX_VALUE</code> is very likely to be returned as the default
- * service, whereas a service with a ranking of <code>Integer.MIN_VALUE</code>
- * is very unlikely to be returned.
+ * <code>Integer.MAX_VALUE</code> is very likely to be returned as the
+ * default service, whereas a service with a ranking of
+ * <code>Integer.MIN_VALUE</code> is very unlikely to be returned.
*
* <p>
- * If the supplied property value is not of type <code>java.lang.Integer</code>,
- * it is deemed to have a ranking value of zero.
+ * If the supplied property value is not of type
+ * <code>java.lang.Integer</code>, it is deemed to have a ranking value
+ * of zero.
*/
public static final String SERVICE_RANKING = "service.ranking";
@@ -591,7 +587,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; singleton:=true
+ * Bundle-SymbolicName: com.acme.module.test; singleton:=true
* </pre>
*
* @since 1.3
@@ -608,7 +604,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_ALWAYS
@@ -630,7 +626,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="always"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="always"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -650,7 +646,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="resolve-time"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="resolve-time"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -669,7 +665,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -719,8 +715,8 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; bundle-version="1.1"
- * Require-Bundle: com.acme.module.test; bundle-version="[1.0,2.0)"
+ * Require-Bundle: com.acme.module.test; bundle-version="1.1"
+ * Require-Bundle: com.acme.module.test; bundle-version="[1.0,2.0)"
* </pre>
*
* <p>
@@ -754,7 +750,7 @@
* The directive value is encoded in the Fragment-Host manifest header like:
*
* <pre>
- * Fragment-Host: com.acme.module.test; multiple-hosts:="false"
+ * Fragment-Host: com.acme.module.test; multiple-hosts:="false"
* </pre>
*
* @since 1.3
@@ -769,7 +765,7 @@
* The attribute value is encoded in manifest headers like:
*
* <pre>
- * Bundle-NativeCode: libgtk.so; selection-filter="(ws=gtk)"; ...
+ * Bundle-NativeCode: libgtk.so; selection-filter="(ws=gtk)"; ...
* </pre>
*
* @since 1.3
@@ -804,7 +800,7 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; version="1.1"
+ * Import-Package: org.osgi.framework; version="1.1"
* </pre>
*
* @since 1.3
@@ -821,7 +817,7 @@
* like:
*
* <pre>
- * Import-Package: org.osgi.framework; bundle-symbolic-name="com.acme.module.test"
+ * Import-Package: org.osgi.framework; bundle-symbolic-name="com.acme.module.test"
* </pre>
*
* @since 1.3
@@ -837,8 +833,8 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; resolution:="optional"
- * Require-Bundle: com.acme.module.test; resolution:="optional"
+ * Import-Package: org.osgi.framework; resolution:="optional"
+ * Require-Bundle: com.acme.module.test; resolution:="optional"
* </pre>
*
* @see Constants#RESOLUTION_MANDATORY
@@ -859,8 +855,8 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; resolution:="manditory"
- * Require-Bundle: com.acme.module.test; resolution:="manditory"
+ * Import-Package: org.osgi.framework; resolution:="manditory"
+ * Require-Bundle: com.acme.module.test; resolution:="manditory"
* </pre>
*
* @see Constants#RESOLUTION_DIRECTIVE
@@ -881,8 +877,8 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; resolution:="optional"
- * Require-Bundle: com.acme.module.test; resolution:="optional"
+ * Import-Package: org.osgi.framework; resolution:="optional"
+ * Require-Bundle: com.acme.module.test; resolution:="optional"
* </pre>
*
* @see Constants#RESOLUTION_DIRECTIVE
@@ -895,15 +891,16 @@
* packages that an exported package uses.
*
* <p>
- * The directive value is encoded in the Export-Package manifest header like:
+ * The directive value is encoded in the Export-Package manifest header
+ * like:
*
* <pre>
- * Export-Package: org.osgi.util.tracker; uses:="org.osgi.framework"
+ * Export-Package: org.osgi.util.tracker; uses:="org.osgi.framework"
* </pre>
*
* @since 1.3
*/
- public final static String USES_DIRECTIVE = "uses";
+ public final static String USES_DIRECTIVE = "uses";
/**
* Manifest header directive (named "include") identifying a list
@@ -915,7 +912,7 @@
* like:
*
* <pre>
- * Export-Package: org.osgi.framework; include:="MyStuff*"
+ * Export-Package: org.osgi.framework; include:="MyStuff*"
* </pre>
*
* @since 1.3
@@ -932,7 +929,7 @@
* like:
*
* <pre>
- * Export-Package: org.osgi.framework; exclude:="MyStuff*"
+ * Export-Package: org.osgi.framework; exclude:="MyStuff*"
* </pre>
*
* @since 1.3
@@ -949,7 +946,7 @@
* like:
*
* <pre>
- * Export-Package: org.osgi.framework; mandatory:="bundle-symbolic-name"
+ * Export-Package: org.osgi.framework; mandatory:="bundle-symbolic-name"
* </pre>
*
* @since 1.3
@@ -965,7 +962,7 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; visibility:="reexport"
+ * Require-Bundle: com.acme.module.test; visibility:="reexport"
* </pre>
*
* @see Constants#VISIBILITY_PRIVATE
@@ -985,7 +982,7 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; visibility:="private"
+ * Require-Bundle: com.acme.module.test; visibility:="private"
* </pre>
*
* @see Constants#VISIBILITY_DIRECTIVE
@@ -1005,7 +1002,7 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; visibility:="reexport"
+ * Require-Bundle: com.acme.module.test; visibility:="reexport"
* </pre>
*
* @see Constants#VISIBILITY_DIRECTIVE
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java
index 262675f..6d73039 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.11 2005/05/13 20:32:56 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.12 2005/07/30 02:22:41 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -24,13 +24,13 @@
* Some examples of LDAP filters are:
*
* <pre>
- * "(cn=Babs Jensen)"
- * "(!(cn=Tim Howes))"
- * "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))"
- * "(o=univ*of*mich*)"
+ * "(cn=Babs Jensen)"
+ * "(!(cn=Tim Howes))"
+ * "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))"
+ * "(o=univ*of*mich*)"
* </pre>
*
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.12 $
* @since 1.1
* @see "Framework specification for a description of the filter string syntax."
*/
@@ -38,30 +38,32 @@
/**
* Filter using a service's properties.
* <p>
- * The filter is executed using the keys and values of the referenced service's
- * properties. The keys are case insensitively matched with the filter.
+ * The filter is executed using the keys and values of the referenced
+ * service's properties. The keys are case insensitively matched with the
+ * filter.
*
* @param reference The reference to the service whose properties are used
* in the match.
*
- * @return <code>true</code> if the service's properties match this filter;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the service's properties match this
+ * filter; <code>false</code> otherwise.
*/
public boolean match(ServiceReference reference);
/**
- * Filter using a <code>Dictionary</code> object. The Filter is executed using
- * the <code>Dictionary</code> object's keys and values.
- * The keys are case insensitively matched with the filter.
+ * Filter using a <code>Dictionary</code> object. The Filter is executed
+ * using the <code>Dictionary</code> object's keys and values. The keys
+ * are case insensitively matched with the filter.
*
- * @param dictionary The <code>Dictionary</code> object whose keys are used in
- * the match.
+ * @param dictionary The <code>Dictionary</code> object whose keys are
+ * used in the match.
*
- * @return <code>true</code> if the <code>Dictionary</code> object's keys and
- * values match this filter; <code>false</code> otherwise.
+ * @return <code>true</code> if the <code>Dictionary</code> object's
+ * keys and values match this filter; <code>false</code>
+ * otherwise.
*
- * @exception IllegalArgumentException If <code>dictionary</code> contains
- * case variants of the same key name.
+ * @throws IllegalArgumentException If <code>dictionary</code> contains
+ * case variants of the same key name.
*/
public boolean match(Dictionary dictionary);
@@ -78,10 +80,11 @@
/**
* Compares this <code>Filter</code> object to another object.
*
- * @param obj The object to compare against this <code>Filter</code> object.
+ * @param obj The object to compare against this <code>Filter</code>
+ * object.
*
- * @return If the other object is a <code>Filter</code> object, then returns
- * <code>this.toString().equals(obj.toString()</code>;<code>false</code>
+ * @return If the other object is a <code>Filter</code> object, then
+ * returns <code>this.toString().equals(obj.toString()</code>;<code>false</code>
* otherwise.
*/
public boolean equals(Object obj);
@@ -95,15 +98,16 @@
public int hashCode();
/**
- * Filter with case sensitivity using a <code>Dictionary</code> object. The
- * Filter is executed using the <code>Dictionary</code> object's keys and
- * values. The keys are case sensitively matched with the filter.
+ * Filter with case sensitivity using a <code>Dictionary</code> object.
+ * The Filter is executed using the <code>Dictionary</code> object's keys
+ * and values. The keys are case sensitively matched with the filter.
*
- * @param dictionary The <code>Dictionary</code> object whose keys are used in
- * the match.
+ * @param dictionary The <code>Dictionary</code> object whose keys are
+ * used in the match.
*
- * @return <code>true</code> if the <code>Dictionary</code> object's keys and
- * values match this filter; <code>false</code> otherwise.
+ * @return <code>true</code> if the <code>Dictionary</code> object's
+ * keys and values match this filter; <code>false</code>
+ * otherwise.
*
* @since 1.3
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java
index b226dab..a2902d9 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.9 2005/05/13 20:32:56 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.11 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -13,17 +13,17 @@
import java.util.EventObject;
/**
- * A general Framework event.
+ * A general event from the Framework.
*
* <p>
- * <code>FrameworkEvent</code> is the event class used when notifying listeners of
- * general events occuring within the OSGI environment. A type code is used to
- * identify the event type for future extendability.
+ * <code>FrameworkEvent</code> is the event class used when notifying
+ * listeners of general events occuring within the OSGI environment. A type code
+ * is used to identify the event type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of event types.
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.11 $
*/
public class FrameworkEvent extends EventObject {
@@ -47,7 +47,7 @@
* The Framework has started.
*
* <p>
- * This event is broadcast when the Framework has started after all
+ * This event is fired when the Framework has started after all
* installed bundles that are marked to be started have been started and the
* Framework has reached the intitial start level.
*
@@ -73,7 +73,7 @@
* A PackageAdmin.refreshPackage operation has completed.
*
* <p>
- * This event is broadcast when the Framework has completed the refresh
+ * This event is fired when the Framework has completed the refresh
* packages operation initiated by a call to the
* PackageAdmin.refreshPackages method.
*
@@ -89,7 +89,7 @@
* A StartLevel.setStartLevel operation has completed.
*
* <p>
- * This event is broadcast when the Framework has completed changing the
+ * This event is fired when the Framework has completed changing the
* active start level initiated by a call to the StartLevel.setStartLevel
* method.
*
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java
index e97b4e4..62abac9 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkListener.java,v 1.6 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkListener.java,v 1.8 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -13,27 +13,28 @@
import java.util.EventListener;
/**
- * A <code>FrameworkEvent</code> listener.
+ * A <code>FrameworkEvent</code> listener. When a <code>FrameworkEvent</code> is
+ * fired, it is asynchronously delivered to a <code>FrameworkListener</code>.
*
* <p>
- * <code>FrameworkListener</code> is a listener interface that may be implemented
- * by a bundle developer. A <code>FrameworkListener</code> object is registered
- * with the Framework using the {@link BundleContext#addFrameworkListener}
- * method. <code>FrameworkListener</code> objects are called with a
+ * <code>FrameworkListener</code> is a listener interface that may be
+ * implemented by a bundle developer. A <code>FrameworkListener</code> object
+ * is registered with the Framework using the
+ * {@link BundleContext#addFrameworkListener} method.
+ * <code>FrameworkListener</code> objects are called with a
* <code>FrameworkEvent</code> objects when the Framework starts and when
* asynchronous errors occur.
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.8 $
* @see FrameworkEvent
*/
-public abstract interface FrameworkListener extends EventListener {
+public interface FrameworkListener extends EventListener {
/**
* Receives notification of a general <code>FrameworkEvent</code> object.
*
* @param event The <code>FrameworkEvent</code> object.
*/
- public abstract void frameworkEvent(FrameworkEvent event);
+ public void frameworkEvent(FrameworkEvent event);
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
index 747c6f5..9d5a57f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkUtil.java,v 1.1 2005/07/14 20:32:46 hargrave Exp $
+ * $Header: /home/eclipse/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java,v 1.3 2005/08/04 15:15:04 twatson Exp $
*
* Copyright (c) OSGi Alliance (2005). All Rights Reserved.
*
@@ -19,7 +19,7 @@
* This class contains utility methods which access Framework functions that may
* be useful to bundles.
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.3 $
* @since 1.3
*/
public class FrameworkUtil {
@@ -36,7 +36,7 @@
* @param filter The filter string.
* @return A <code>Filter</code> object encapsulating the filter string.
* @throws InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
+ * invalid filter string that cannot be parsed.
* @throws NullPointerException If <code>filter</code> is null.
*
* @see Filter
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java
index 8d1782d..d08beab 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/InvalidSyntaxException.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/InvalidSyntaxException.java,v 1.10 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/InvalidSyntaxException.java,v 1.11 2005/07/30 02:22:41 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -14,13 +14,13 @@
* A Framework exception.
*
* <p>
- * An <code>InvalidSyntaxException</code> object indicates that a filter string
- * parameter has an invalid syntax and cannot be parsed.
+ * An <code>InvalidSyntaxException</code> object indicates that a filter
+ * string parameter has an invalid syntax and cannot be parsed.
*
* <p>
* See {@link Filter} for a description of the filter string syntax.
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public class InvalidSyntaxException extends Exception {
@@ -38,8 +38,9 @@
* Creates an exception of type <code>InvalidSyntaxException</code>.
*
* <p>
- * This method creates an <code>InvalidSyntaxException</code> object with the
- * specified message and the filter string which generated the exception.
+ * This method creates an <code>InvalidSyntaxException</code> object with
+ * the specified message and the filter string which generated the
+ * exception.
*
* @param msg The message.
* @param filter The invalid filter string.
@@ -54,8 +55,9 @@
* Creates an exception of type <code>InvalidSyntaxException</code>.
*
* <p>
- * This method creates an <code>InvalidSyntaxException</code> object with the
- * specified message and the filter string which generated the exception.
+ * This method creates an <code>InvalidSyntaxException</code> object with
+ * the specified message and the filter string which generated the
+ * exception.
*
* @param msg The message.
* @param filter The invalid filter string.
@@ -81,11 +83,11 @@
}
/**
- * Returns the cause of this exception or <code>null</code> if no cause was
- * specified when this exception was created.
+ * Returns the cause of this exception or <code>null</code> if no cause
+ * was specified when this exception was created.
*
- * @return The cause of this exception or <code>null</code> if no cause was
- * specified.
+ * @return The cause of this exception or <code>null</code> if no cause
+ * was specified.
* @since 1.3
*/
public Throwable getCause() {
@@ -104,4 +106,3 @@
throw new IllegalStateException();
}
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
index 29d2980..4f0ae8d 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/PackagePermission.java,v 1.10 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/PackagePermission.java,v 1.12 2005/07/30 02:22:41 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -32,10 +32,10 @@
*
* <p>
* <code>PackagePermission</code> has two actions: <code>EXPORT</code> and
- * <code>IMPORT</code>. The <code>EXPORT</code> action implies the <code>IMPORT</code>
- * action.
+ * <code>IMPORT</code>. The <code>EXPORT</code> action implies the
+ * <code>IMPORT</code> action.
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.12 $
*/
public final class PackagePermission extends BasicPermission {
@@ -55,8 +55,6 @@
private final static int ACTION_ALL = ACTION_EXPORT
| ACTION_IMPORT;
private final static int ACTION_NONE = 0;
- private final static int ACTION_ERROR = 0x80000000;
-
/**
* The actions mask.
*/
@@ -77,25 +75,24 @@
* string. Wildcards may be used. For example:
*
* <pre>
- *
- * org.osgi.service.http
- * javax.servlet.*
- * *
- *
+ * org.osgi.service.http
+ * javax.servlet.*
+ * *
* </pre>
*
* <p>
* Package Permissions are granted over all possible versions of a package.
*
* A bundle that needs to export a package must have the appropriate
- * <code>PackagePermission</code> for that package; similarly, a bundle that
- * needs to import a package must have the appropriate
+ * <code>PackagePermission</code> for that package; similarly, a bundle
+ * that needs to import a package must have the appropriate
* <code>PackagePermssion</code> for that package.
* <p>
* Permission is granted for both classes and resources.
*
* @param name Package name.
- * @param actions <code>EXPORT</code>,<code>IMPORT</code> (canonical order).
+ * @param actions <code>EXPORT</code>,<code>IMPORT</code> (canonical
+ * order).
*/
public PackagePermission(String name, String actions) {
@@ -231,15 +228,16 @@
* named package.
*
* <pre>
- * x.y.*,"export" -> x.y.z,"export" is true
- * *,"import" -> x.y, "import" is true
- * *,"export" -> x.y, "import" is true
- * x.y,"export" -> x.y.z, "export" is false
+ * x.y.*,"export" -> x.y.z,"export" is true
+ * *,"import" -> x.y, "import" is true
+ * *,"export" -> x.y, "import" is true
+ * x.y,"export" -> x.y.z, "export" is false
* </pre>
*
* @param p The target permission to interrogate.
- * @return <code>true</code> if the specified <code>PackagePermission</code>
- * action is implied by this object; <code>false</code> otherwise.
+ * @return <code>true</code> if the specified
+ * <code>PackagePermission</code> action is implied by this
+ * object; <code>false</code> otherwise.
*/
public boolean implies(Permission p) {
@@ -261,8 +259,8 @@
* Always returns present <code>PackagePermission</code> actions in the
* following order: <code>EXPORT</code>,<code>IMPORT</code>.
*
- * @return Canonical string representation of the <code>PackagePermission</code>
- * actions.
+ * @return Canonical string representation of the
+ * <code>PackagePermission</code> actions.
*/
public String getActions() {
@@ -288,8 +286,8 @@
}
/**
- * Returns a new <code>PermissionCollection</code> object suitable for storing
- * <code>PackagePermission</code> objects.
+ * Returns a new <code>PermissionCollection</code> object suitable for
+ * storing <code>PackagePermission</code> objects.
*
* @return A new <code>PermissionCollection</code> object.
*/
@@ -301,14 +299,15 @@
* Determines the equality of two <code>PackagePermission</code> objects.
*
* This method checks that specified package has the same package name and
- * <code>PackagePermission</code> actions as this <code>PackagePermission</code>
- * object.
+ * <code>PackagePermission</code> actions as this
+ * <code>PackagePermission</code> object.
*
* @param obj The object to test for equality with this
* <code>PackagePermission</code> object.
- * @return <code>true</code> if <code>obj</code> is a <code>PackagePermission</code>,
- * and has the same package name and actions as this
- * <code>PackagePermission</code> object; <code>false</code> otherwise.
+ * @return <code>true</code> if <code>obj</code> is a
+ * <code>PackagePermission</code>, and has the same package name
+ * and actions as this <code>PackagePermission</code> object;
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -398,7 +397,6 @@
/**
* Create an empty PackagePermissions object.
- *
*/
public PackagePermissionCollection() {
@@ -407,16 +405,17 @@
}
/**
- * Adds a permission to the <code>PackagePermission</code> objects. The key
- * for the hash is the name.
+ * Adds a permission to the <code>PackagePermission</code> objects. The
+ * key for the hash is the name.
*
* @param permission The <code>PackagePermission</code> object to add.
*
- * @exception IllegalArgumentException If the permission is not a
- * <code>PackagePermission</code> instance.
+ * @throws IllegalArgumentException If the permission is not a
+ * <code>PackagePermission</code> instance.
*
- * @exception SecurityException If this <code>PackagePermissionCollection</code>
- * object has been marked read-only.
+ * @throws SecurityException If this
+ * <code>PackagePermissionCollection</code> object has been marked
+ * read-only.
*/
public void add(Permission permission) {
@@ -458,8 +457,9 @@
* @param permission The Permission object to compare with this
* <code>PackagePermission</code> object.
*
- * @return <code>true</code> if <code>permission</code> is a proper subset of a
- * permission in the set; <code>false</code> otherwise.
+ * @return <code>true</code> if <code>permission</code> is a proper
+ * subset of a permission in the set; <code>false</code>
+ * otherwise.
*/
public boolean implies(Permission permission) {
@@ -521,8 +521,8 @@
}
/**
- * Returns an enumeration of all <code>PackagePermission</code> objects in the
- * container.
+ * Returns an enumeration of all <code>PackagePermission</code> objects in
+ * the container.
*
* @return Enumeration of all <code>PackagePermission</code> objects.
*/
@@ -531,4 +531,3 @@
return (permissions.elements());
}
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java
index 29d3650..13c61db 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceEvent.java,v 1.9 2005/05/13 20:32:56 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceEvent.java,v 1.12 2005/08/05 14:50:04 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -10,20 +10,20 @@
package org.osgi.framework;
-import java.util.Dictionary;
import java.util.EventObject;
/**
- * A service lifecycle change event.
+ * An event from the Framework describing a service lifecycle change.
* <p>
- * <code>ServiceEvent</code> objects are delivered to a <code>ServiceListener</code>
- * objects when a change occurs in this service's lifecycle. A type code is used
- * to identify the event type for future extendability.
+ * <code>ServiceEvent</code> objects are delivered to a
+ * <code>ServiceListener</code> objects when a change occurs in this service's
+ * lifecycle. A type code is used to identify the event type for future
+ * extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.12 $
* @see ServiceListener
*/
@@ -42,20 +42,20 @@
/**
* This service has been registered.
* <p>
- * This event is synchronously delivered <strong>after </strong> the service
+ * This event is synchronously delivered <strong>after</strong> the service
* has been registered with the Framework.
*
* <p>
* The value of <code>REGISTERED</code> is 0x00000001.
*
- * @see BundleContext#registerService(String[],Object,Dictionary)
+ * @see BundleContext#registerService(String[],Object,java.util.Dictionary)
*/
public final static int REGISTERED = 0x00000001;
/**
* The properties of a registered service have been modified.
* <p>
- * This event is synchronously delivered <strong>after </strong> the service
+ * This event is synchronously delivered <strong>after</strong> the service
* properties have been modified.
*
* <p>
@@ -68,7 +68,7 @@
/**
* This service is in the process of being unregistered.
* <p>
- * This event is synchronously delivered <strong>before </strong> the
+ * This event is synchronously delivered <strong>before</strong> the
* service has completed unregistering.
*
* <p>
@@ -90,8 +90,8 @@
* Creates a new service event object.
*
* @param type The event type.
- * @param reference A <code>ServiceReference</code> object to the service that
- * had a lifecycle change.
+ * @param reference A <code>ServiceReference</code> object to the service
+ * that had a lifecycle change.
*/
public ServiceEvent(int type, ServiceReference reference) {
super(reference);
@@ -108,7 +108,7 @@
* @return Reference to the service that had a lifecycle change.
*/
public ServiceReference getServiceReference() {
- return (reference);
+ return reference;
}
/**
@@ -123,7 +123,6 @@
*/
public int getType() {
- return (type);
+ return type;
}
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java
index 04041c3..f0c7f08 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceFactory.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceFactory.java,v 1.6 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceFactory.java,v 1.7 2005/07/30 02:22:40 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -15,16 +15,18 @@
* environment.
*
* <p>
- * When registering a service, a <code>ServiceFactory</code> object can be used
- * instead of a service object, so that the bundle developer can gain control of
- * the specific service object granted to a bundle that is using the service.
+ * When registering a service, a <code>ServiceFactory</code> object can be
+ * used instead of a service object, so that the bundle developer can gain
+ * control of the specific service object granted to a bundle that is using the
+ * service.
*
* <p>
- * When this happens, the <code>BundleContext.getService(ServiceReference)</code>
- * method calls the <code>ServiceFactory.getService</code> method to create a
- * service object specifically for the requesting bundle. The service object
- * returned by the <code>ServiceFactory</code> object is cached by the Framework
- * until the bundle releases its use of the service.
+ * When this happens, the
+ * <code>BundleContext.getService(ServiceReference)</code> method calls the
+ * <code>ServiceFactory.getService</code> method to create a service object
+ * specifically for the requesting bundle. The service object returned by the
+ * <code>ServiceFactory</code> object is cached by the Framework until the
+ * bundle releases its use of the service.
*
* <p>
* When the bundle's use count for the service equals zero (including the bundle
@@ -32,22 +34,23 @@
* <code>ServiceFactory.ungetService</code> method is called.
*
* <p>
- * <code>ServiceFactory</code> objects are only used by the Framework and are not
- * made available to other bundles in the OSGi environment.
+ * <code>ServiceFactory</code> objects are only used by the Framework and are
+ * not made available to other bundles in the OSGi environment.
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @see BundleContext#getService
*/
-public abstract interface ServiceFactory {
+public interface ServiceFactory {
/**
* Creates a new service object.
*
* <p>
* The Framework invokes this method the first time the specified
* <code>bundle</code> requests a service object using the
- * <code>BundleContext.getService(ServiceReference)</code> method. The service
- * factory can then return a specific service object for each bundle.
+ * <code>BundleContext.getService(ServiceReference)</code> method. The
+ * service factory can then return a specific service object for each
+ * bundle.
*
* <p>
* The Framework caches the value returned (unless it is <code>null</code>),
@@ -66,7 +69,7 @@
* all the classes named when the service was registered.
* @see BundleContext#getService
*/
- public abstract Object getService(Bundle bundle,
+ public Object getService(Bundle bundle,
ServiceRegistration registration);
/**
@@ -83,7 +86,6 @@
* <code>ServiceFactory.getService</code> method.
* @see BundleContext#ungetService
*/
- public abstract void ungetService(Bundle bundle,
+ public void ungetService(Bundle bundle,
ServiceRegistration registration, Object service);
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java
index 699c888..9e03ef6 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceListener.java,v 1.8 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceListener.java,v 1.10 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -13,39 +13,43 @@
import java.util.EventListener;
/**
- * A <code>ServiceEvent</code> listener.
- *
- * <p><code>ServiceListener</code> is a listener interface that may be implemented by a bundle
- * developer.
- * <p>A <code>ServiceListener</code> object is registered with the Framework using the
- * <code>BundleContext.addServiceListener</code> method.
- * <code>ServiceListener</code> objects are called with a <code>ServiceEvent</code> object when
- * a service is registered, modified, or is in the process of unregistering.
- *
- * <p><code>ServiceEvent</code> object delivery to <code>ServiceListener</code> objects is filtered by the
- * filter specified when the listener was registered. If the Java Runtime Environment
- * supports permissions, then additional filtering is done.
- * <code>ServiceEvent</code> objects are only delivered to the listener if the bundle which defines
- * the listener object's class has the appropriate <code>ServicePermission</code> to get the service
- * using at least one of the named classes the service was registered under.
- *
- * <p><code>ServiceEvent</code> object delivery to <code>ServiceListener</code> objects is
- * further filtered according to package sources as defined in
+ * A <code>ServiceEvent</code> listener. When a <code>ServiceEvent</code> is
+ * fired, it is synchronously delivered to a <code>BundleListener</code>.
+ *
+ * <p>
+ * <code>ServiceListener</code> is a listener interface that may be
+ * implemented by a bundle developer.
+ * <p>
+ * A <code>ServiceListener</code> object is registered with the Framework
+ * using the <code>BundleContext.addServiceListener</code> method.
+ * <code>ServiceListener</code> objects are called with a
+ * <code>ServiceEvent</code> object when a service is registered, modified, or
+ * is in the process of unregistering.
+ *
+ * <p>
+ * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
+ * objects is filtered by the filter specified when the listener was registered.
+ * If the Java Runtime Environment supports permissions, then additional
+ * filtering is done. <code>ServiceEvent</code> objects are only delivered to
+ * the listener if the bundle which defines the listener object's class has the
+ * appropriate <code>ServicePermission</code> to get the service using at
+ * least one of the named classes the service was registered under.
+ *
+ * <p>
+ * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
+ * objects is further filtered according to package sources as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.10 $
* @see ServiceEvent
* @see ServicePermission
*/
-public abstract interface ServiceListener extends EventListener
-{
- /**
- * Receives notification that a service has had a lifecycle change.
- *
- * @param event The <code>ServiceEvent</code> object.
- */
- public abstract void serviceChanged(ServiceEvent event);
+public interface ServiceListener extends EventListener {
+ /**
+ * Receives notification that a service has had a lifecycle change.
+ *
+ * @param event The <code>ServiceEvent</code> object.
+ */
+ public void serviceChanged(ServiceEvent event);
}
-
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
index 49242ea..b652d27 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServicePermission.java,v 1.10 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServicePermission.java,v 1.12 2005/07/30 02:22:40 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -20,15 +20,15 @@
* <ul>
* <li>The <code>ServicePermission.REGISTER</code> action allows a bundle to
* register a service on the specified names.
- * <li>The <code>ServicePermission.GET</code> action allows a bundle to detect a
- * service and get it.
+ * <li>The <code>ServicePermission.GET</code> action allows a bundle to
+ * detect a service and get it.
* </ul>
* Permission to get a service is required in order to detect events regarding
* the service. Untrusted bundles should not be able to detect the presence of
- * certain services unless they have the appropriate <code>ServicePermission</code>
- * to get the specific service.
+ * certain services unless they have the appropriate
+ * <code>ServicePermission</code> to get the specific service.
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.12 $
*/
final public class ServicePermission extends BasicPermission {
@@ -47,8 +47,6 @@
private final static int ACTION_ALL = ACTION_GET
| ACTION_REGISTER;
private final static int ACTION_NONE = 0;
- private final static int ACTION_ERROR = 0x80000000;
-
/**
* The actions mask.
*/
@@ -68,27 +66,27 @@
* The name of the service is specified as a fully qualified class name.
*
* <pre>
- *
- * ClassName ::= <class name> | <class name ending in ".*">
- *
+ * ClassName ::= <class name> | <class name ending in ".*">
* </pre>
*
* Examples:
*
* <pre>
- * org.osgi.service.http.HttpService
- * org.osgi.service.http.*
- * org.osgi.service.snmp.*
+ * org.osgi.service.http.HttpService
+ * org.osgi.service.http.*
+ * org.osgi.service.snmp.*
* </pre>
*
* <p>
- * There are two possible actions: <code>get</code> and <code>register</code>.
- * The <code>get</code> permission allows the owner of this permission to
- * obtain a service with this name. The <code>register</code> permission
- * allows the bundle to register a service under that name.
+ * There are two possible actions: <code>get</code> and
+ * <code>register</code>. The <code>get</code> permission allows the
+ * owner of this permission to obtain a service with this name. The
+ * <code>register</code> permission allows the bundle to register a
+ * service under that name.
*
* @param name class name
- * @param actions <code>get</code>,<code>register</code> (canonical order)
+ * @param actions <code>get</code>,<code>register</code> (canonical
+ * order)
*/
public ServicePermission(String name, String actions) {
@@ -216,8 +214,8 @@
* specified permission.
*
* @param p The target permission to check.
- * @return <code>true</code> if the specified permission is implied by this
- * object; <code>false</code> otherwise.
+ * @return <code>true</code> if the specified permission is implied by
+ * this object; <code>false</code> otherwise.
*/
public boolean implies(Permission p) {
@@ -278,9 +276,10 @@
* <code>ServicePermission</code>.
*
* @param obj The object to test for equality.
- * @return true if obj is a <code>ServicePermission</code>, and has the same
- * class name and actions as this <code>ServicePermission</code>
- * object; <code>false</code> otherwise.
+ * @return true if obj is a <code>ServicePermission</code>, and has the
+ * same class name and actions as this
+ * <code>ServicePermission</code> object; <code>false</code>
+ * otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -368,7 +367,6 @@
/**
* Creates an empty ServicePermissions object.
- *
*/
public ServicePermissionCollection() {
@@ -377,16 +375,16 @@
}
/**
- * Adds a permission to the <code>ServicePermission</code> objects using the
- * key for the hash as the name.
+ * Adds a permission to the <code>ServicePermission</code> objects using
+ * the key for the hash as the name.
*
* @param permission The Permission object to add.
*
- * @exception IllegalArgumentException If the permission is not a
- * ServicePermission object.
- *
- * @exception SecurityException If this <code>ServicePermissionCollection</code>
- * object has been marked read-only.
+ * @throws IllegalArgumentException If the permission is not a
+ * ServicePermission object.
+ * @throws SecurityException If this
+ * <code>ServicePermissionCollection</code> object has been marked
+ * read-only.
*/
public void add(Permission permission) {
@@ -426,8 +424,9 @@
*
* @param permission The Permission object to compare.
*
- * @return <code>true</code> if <code>permission</code> is a proper subset of a
- * permission in the set; <code>false</code> otherwise.
+ * @return <code>true</code> if <code>permission</code> is a proper
+ * subset of a permission in the set; <code>false</code>
+ * otherwise.
*/
public boolean implies(Permission permission) {
@@ -489,8 +488,8 @@
}
/**
- * Returns an enumeration of all the <code>ServicePermission</code> objects in
- * the container.
+ * Returns an enumeration of all the <code>ServicePermission</code>
+ * objects in the container.
*
* @return Enumeration of all the ServicePermission objects.
*/
@@ -499,4 +498,3 @@
return (permissions.elements());
}
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
index 87b16e5..028e6d6 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.11 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.13 2005/08/05 14:43:17 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -10,8 +10,6 @@
package org.osgi.framework;
-import java.util.Dictionary;
-
/**
* A reference to a service.
*
@@ -20,8 +18,9 @@
* <code>BundleContext.getServiceReference</code> and
* <code>BundleContext.getServiceReferences</code> methods.
* <p>
- * A <code>ServiceReference</code> object may be shared between bundles and can be
- * used to examine the properties of the service and to get the service object.
+ * A <code>ServiceReference</code> object may be shared between bundles and
+ * can be used to examine the properties of the service and to get the service
+ * object.
* <p>
* Every service registered in the Framework has a unique
* <code>ServiceRegistration</code> object and may have multiple, distinct
@@ -35,13 +34,13 @@
* <code>ServiceReference</code> objects associated with different
* <code>ServiceRegistration</code> objects are not equal.
*
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.13 $
* @see BundleContext#getServiceReference
* @see BundleContext#getServiceReferences
* @see BundleContext#getService
*/
-public abstract interface ServiceReference {
+public interface ServiceReference {
/**
* Returns the property value to which the specified property key is mapped
* in the properties <code>Dictionary</code> object of the service
@@ -60,7 +59,7 @@
* @return The property value to which the key is mapped; <code>null</code>
* if there is no property named after the key.
*/
- public abstract Object getProperty(String key);
+ public Object getProperty(String key);
/**
* Returns an array of the keys in the properties <code>Dictionary</code>
@@ -77,28 +76,28 @@
* This method is <i>case-preserving </i>; this means that every key in the
* returned array must have the same case as the corresponding key in the
* properties <code>Dictionary</code> that was passed to the
- * {@link BundleContext#registerService(String[],Object,Dictionary)}or
- * {@link ServiceRegistration#setProperties}methods.
+ * {@link BundleContext#registerService(String[],Object,java.util.Dictionary)} or
+ * {@link ServiceRegistration#setProperties} methods.
*
* @return An array of property keys.
*/
- public abstract String[] getPropertyKeys();
+ public String[] getPropertyKeys();
/**
* Returns the bundle that registered the service referenced by this
* <code>ServiceReference</code> object.
*
* <p>
- * This method must return <code>null</code> when the service has
- * been unregistered. This can be used to determine if the service has been
+ * This method must return <code>null</code> when the service has been
+ * unregistered. This can be used to determine if the service has been
* unregistered.
*
* @return The bundle that registered the service referenced by this
* <code>ServiceReference</code> object; <code>null</code> if
* that service has already been unregistered.
- * @see BundleContext#registerService(String[],Object,Dictionary)
+ * @see BundleContext#registerService(String[],Object,java.util.Dictionary)
*/
- public abstract Bundle getBundle();
+ public Bundle getBundle();
/**
* Returns the bundles that are using the service referenced by this
@@ -112,19 +111,19 @@
*
* @since 1.1
*/
- public abstract Bundle[] getUsingBundles();
+ public Bundle[] getUsingBundles();
/**
* Tests if the bundle that registered the service referenced by this
- * <code>ServiceReference</code> and the specified bundle use the same source
- * for the package of the specified class name.
+ * <code>ServiceReference</code> and the specified bundle use the same
+ * source for the package of the specified class name.
* <p>
* This method performs the following checks:
* <ol>
* <li>Get the package name from the specified class name.</li>
* <li>For the bundle that registered the service referenced by this
- * <code>ServiceReference</code> (registrant bundle); find the source for the
- * package. If no source is found then return <code>true</code> if the
+ * <code>ServiceReference</code> (registrant bundle); find the source for
+ * the package. If no source is found then return <code>true</code> if the
* registrant bundle is equal to the specified bundle; otherwise return
* <code>false</code>.</li>
* <li>If the package source of the registrant bundle is equal to the
@@ -135,12 +134,12 @@
* @param bundle The <code>Bundle</code> object to check.
* @param className The class name to check.
* @return <code>true</code> if the bundle which registered the service
- * referenced by this <code>ServiceReference</code> and the specified
- * bundle use the same source for the package of the specified class
- * name. Otherwise <code>false</code> is returned.
+ * referenced by this <code>ServiceReference</code> and the
+ * specified bundle use the same source for the package of the
+ * specified class name. Otherwise <code>false</code> is returned.
*
* @since 1.3
*/
- public abstract boolean isAssignableTo(Bundle bundle, String className);
+ public boolean isAssignableTo(Bundle bundle, String className);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java
index 5b4f026..53a2e5c 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceRegistration.java,v 1.8 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceRegistration.java,v 1.10 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2000, 2005). All Rights Reserved.
*
@@ -24,23 +24,24 @@
* The <code>ServiceRegistration</code> object may be used to update the
* properties of the service or to unregister the service.
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.10 $
* @see BundleContext#registerService(String[],Object,Dictionary)
*/
-public abstract interface ServiceRegistration {
+public interface ServiceRegistration {
/**
* Returns a <code>ServiceReference</code> object for a service being
* registered.
* <p>
- * The <code>ServiceReference</code> object may be shared with other bundles.
+ * The <code>ServiceReference</code> object may be shared with other
+ * bundles.
*
- * @exception java.lang.IllegalStateException If this
- * <code>ServiceRegistration</code> object has already been
- * unregistered.
+ * @throws java.lang.IllegalStateException If this
+ * <code>ServiceRegistration</code> object has already been
+ * unregistered.
* @return <code>ServiceReference</code> object.
*/
- public abstract ServiceReference getReference();
+ public ServiceReference getReference();
/**
* Updates the properties associated with a service.
@@ -55,7 +56,7 @@
* <ol>
* <li>The service's properties are replaced with the provided properties.
* <li>A service event of type {@link ServiceEvent#MODIFIED} is
- * synchronously sent.
+ * fired.
* </ol>
*
* @param properties The properties for this service. See {@link Constants}
@@ -63,19 +64,18 @@
* be made to this object after calling this method. To update the
* service's properties this method should be called again.
*
- * @exception IllegalStateException If this <code>ServiceRegistration</code>
- * object has already been unregistered.
- *
- * @exception IllegalArgumentException If <code>properties</code> contains
- * case variants of the same key name.
+ * @throws IllegalStateException If this <code>ServiceRegistration</code>
+ * object has already been unregistered.
+ * @throws IllegalArgumentException If <code>properties</code> contains
+ * case variants of the same key name.
*/
- public abstract void setProperties(Dictionary properties);
+ public void setProperties(Dictionary properties);
/**
* Unregisters a service. Remove a <code>ServiceRegistration</code> object
* from the Framework service registry. All <code>ServiceReference</code>
- * objects associated with this <code>ServiceRegistration</code> object can no
- * longer be used to interact with the service.
+ * objects associated with this <code>ServiceRegistration</code> object
+ * can no longer be used to interact with the service.
*
* <p>
* The following steps are required to unregister a service:
@@ -84,22 +84,21 @@
* it can no longer be used. <code>ServiceReference</code> objects for the
* service may no longer be used to get a service object for the service.
* <li>A service event of type {@link ServiceEvent#UNREGISTERING} is
- * synchronously sent so that bundles using this service can release their
+ * fired so that bundles using this service can release their
* use of it.
* <li>For each bundle whose use count for this service is greater than
* zero: <br>
* The bundle's use count for this service is set to zero. <br>
* If the service was registered with a {@link ServiceFactory} object, the
- * <code>ServiceFactory.ungetService</code> method is called to release the
- * service object for the bundle.
+ * <code>ServiceFactory.ungetService</code> method is called to release
+ * the service object for the bundle.
* </ol>
*
- * @exception java.lang.IllegalStateException If this
- * <code>ServiceRegistration</code> object has already been
- * unregistered.
+ * @throws java.lang.IllegalStateException If this
+ * <code>ServiceRegistration</code> object has already been
+ * unregistered.
* @see BundleContext#ungetService
* @see ServiceFactory#ungetService
*/
- public abstract void unregister();
+ public void unregister();
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java
index edbe0b3..e325b0d 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SynchronousBundleListener.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/SynchronousBundleListener.java,v 1.8 2005/05/13 20:32:54 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/SynchronousBundleListener.java,v 1.12 2005/08/05 03:22:00 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
*
@@ -11,7 +11,8 @@
package org.osgi.framework;
/**
- * A synchronous <code>BundleEvent</code> listener.
+ * A synchronous <code>BundleEvent</code> listener. When a <code>BundleEvent</code> is
+ * fired, it is synchronously delivered to a <code>BundleListener</code>.
*
* <p>
* <code>SynchronousBundleListener</code> is a listener interface that may be
@@ -20,24 +21,24 @@
* A <code>SynchronousBundleListener</code> object is registered with the
* Framework using the {@link BundleContext#addBundleListener} method.
* <code>SynchronousBundleListener</code> objects are called with a
- * <code>BundleEvent</code> object when a bundle has been installed,
- * resolved, started, stopped, updated, unresolved, or uninstalled.
+ * <code>BundleEvent</code> object when a bundle has been installed, resolved,
+ * starting, started, stopping, stopped, updated, unresolved, or uninstalled.
* <p>
* Unlike normal <code>BundleListener</code> objects,
- * <code>SynchronousBundleListener</code>s are synchronously called during bundle
- * lifecycle processing. The bundle lifecycle processing will not proceed
+ * <code>SynchronousBundleListener</code>s are synchronously called during
+ * bundle lifecycle processing. The bundle lifecycle processing will not proceed
* until all <code>SynchronousBundleListener</code>s have completed.
* <code>SynchronousBundleListener</code> objects will be called prior to
* <code>BundleListener</code> objects.
* <p>
- * <code>AdminPermission</code> is required to add or remove a
+ * <code>AdminPermission[bundle,LISTENER]</code> is required to add or remove a
* <code>SynchronousBundleListener</code> object.
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.12 $
* @since 1.1
* @see BundleEvent
*/
-public abstract interface SynchronousBundleListener extends BundleListener {
+public interface SynchronousBundleListener extends BundleListener {
+ // This is a marker interface
}
-
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java
index 93e3173..2bc2a63 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Version.java,v 1.13 2005/05/13 20:32:55 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Version.java,v 1.14 2005/07/30 02:22:40 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -29,7 +29,7 @@
* <p>
* <code>Version</code> objects are immutable.
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
* @since 1.3
*/
@@ -93,14 +93,15 @@
* Here is the grammar for version strings.
*
* <pre>
- * version ::= major('.'minor('.'micro('.'qualifier)?)?)?
- * major ::= digit+
- * minor ::= digit+
- * micro ::= digit+
- * qualifier ::= (alpha|digit|'_'|'-')+
- * digit ::= [0..9]
- * alpha ::= [a..zA..Z]
+ * version ::= major('.'minor('.'micro('.'qualifier)?)?)?
+ * major ::= digit+
+ * minor ::= digit+
+ * micro ::= digit+
+ * qualifier ::= (alpha|digit|'_'|'-')+
+ * digit ::= [0..9]
+ * alpha ::= [a..zA..Z]
* </pre>
+ *
* There must be no whitespace in version.
*
* @param version String representation of the version identifier.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
index 62962dd..686cec1 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleLocationCondition.java,v 1.9 2005/05/25 16:22:46 twatson Exp $
+ * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleLocationCondition.java,v 1.15 2005/08/05 01:36:21 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2005). All Rights Reserved.
*
@@ -7,43 +7,103 @@
* terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
*/
+
package org.osgi.service.condpermadmin;
-import java.io.FilePermission;
-import org.osgi.framework.Bundle;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Hashtable;
+
+import org.osgi.framework.*;
/**
+ * Condition to test if the location of a bundle matches a pattern. Pattern
+ * matching is done according to the filter string matching rules.
*
- * Checks to see if a Bundle matches the given location pattern. Pattern matching
- * is done using FilePermission style patterns.
- *
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.15 $
*/
public class BundleLocationCondition {
- private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleLocationCondition";
+ private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleLocationCondition";
+
/**
* Constructs a condition that tries to match the passed Bundle's location
* to the location pattern.
*
- * @param bundle the Bundle being evaluated.
- * @param info the ConditionInfo to construct the condition for. The args of the
- * ConditionInfo specify the location to match the Bundle
- * location to. Matching is done according to the patterns documented
- * in FilePermission.
+ * @param bundle The Bundle being evaluated.
+ * @param info The ConditionInfo to construct the condition for. The args of
+ * the ConditionInfo must be a single String which specifies the
+ * location pattern to match against the Bundle location. Matching is
+ * done according to the filter string matching rules. Any '*'
+ * characters in the location argument are used as wildcards when
+ * matching bundle locations unless they are escaped with a '\'
+ * character.
*/
- static public Condition getCondition(Bundle bundle, ConditionInfo info) {
+ static public Condition getCondition(final Bundle bundle, ConditionInfo info) {
if (!CONDITION_TYPE.equals(info.getType()))
- throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
+ throw new IllegalArgumentException(
+ "ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
String[] args = info.getArgs();
if (args.length != 1)
- throw new IllegalArgumentException("Illegal number of args: " + args.length);
- String location = args[0];
- FilePermission locationPat = new FilePermission(location, "read");
- FilePermission sourcePat = new FilePermission(bundle.getLocation().toString(), "read");
- return locationPat.implies(sourcePat) ? Condition.TRUE : Condition.FALSE;
+ throw new IllegalArgumentException("Illegal number of args: "
+ + args.length);
+ String bundleLocation = (String) AccessController
+ .doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return bundle.getLocation();
+ }
+ });
+ Filter filter = null;
+ try {
+ filter = FrameworkUtil.createFilter("(location="
+ + escapeLocation(args[0]) + ")");
+ }
+ catch (InvalidSyntaxException e) {
+ // this should never happen, but just incase
+ throw new RuntimeException("Invalid filter: " + e.getFilter());
+ }
+ Hashtable matchProps = new Hashtable(2);
+ matchProps.put("location", bundleLocation);
+ return filter.match(matchProps) ? Condition.TRUE : Condition.FALSE;
}
private BundleLocationCondition() {
// private constructor to prevent objects of this type
}
+
+ /**
+ * Escape the value string such that '(', ')' and '\' are escaped. The '\'
+ * char is only escaped if it is not followed by a '*'.
+ *
+ * @param value unescaped value string.
+ * @return escaped value string.
+ */
+ private static String escapeLocation(String value) {
+ boolean escaped = false;
+ int inlen = value.length();
+ int outlen = inlen << 1; /* inlen * 2 */
+
+ char[] output = new char[outlen];
+ value.getChars(0, inlen, output, inlen);
+
+ int cursor = 0;
+ for (int i = inlen; i < outlen; i++) {
+ char c = output[i];
+ switch (c) {
+ case '\\' :
+ if (i + 1 < outlen && output[i + 1] == '*')
+ break;
+ case '(' :
+ case ')' :
+ output[cursor] = '\\';
+ cursor++;
+ escaped = true;
+ break;
+ }
+
+ output[cursor] = c;
+ cursor++;
+ }
+
+ return escaped ? new String(output, 0, cursor) : value;
+ }
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
index ad3c707..2e8e8cb 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleSignerCondition.java,v 1.4 2005/05/25 16:22:46 twatson Exp $
+ * $Header: /home/eclipse/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java,v 1.6 2005/05/25 18:55:17 twatson Exp $
*
* Copyright (c) OSGi Alliance (2005). All Rights Reserved.
*
@@ -14,37 +14,42 @@
import org.osgi.framework.Bundle;
/**
- * This condition checks the signer of a bundle. Since the bundle's signer can only change
- * when the bundle is updated, this condition is immutable.
+ * Condition to test if the signer of a bundle matches a pattern. Since the bundle's signer can
+ * only change when the bundle is updated, this condition is immutable.
* <p>
- * The condition expressed using a single String that specifies a Distinguished Name (DN)
- * chain to match bundle signers against. DN's are encoded using IETF RFC 2253. Usually
- * signers use certificates that are issued by certificate authorities, which also have a
- * corresponding DN and certificate. The certificate authorities can form a chain of trust
- * where the last DN and certificate is known by the framework. The signer of a bundle is
- * expressed as signers DN followed by the DN of its issuer followed by the DN of the next
- * issuer until the DN of the root certificate authority. Each DN is separated by a semicolon.
+ * The condition expressed using a single String that specifies a Distinguished
+ * Name (DN) chain to match bundle signers against. DN's are encoded using IETF
+ * RFC 2253. Usually signers use certificates that are issued by certificate
+ * authorities, which also have a corresponding DN and certificate. The
+ * certificate authorities can form a chain of trust where the last DN and
+ * certificate is known by the framework. The signer of a bundle is expressed as
+ * signers DN followed by the DN of its issuer followed by the DN of the next
+ * issuer until the DN of the root certificate authority. Each DN is separated
+ * by a semicolon.
* <p>
- * A bundle can satisfy this condition if one of its signers has a DN chain that matches the
- * DN chain used to construct this condition.
- * Wildcards (`*') can be used to allow greater flexibility in specifying the DN chains.
- * Wildcards can be used in place of DNs, RDNs, or the value in an RDN. If a wildcard is
- * used for a value of an RDN, the value must be exactly "*" and will match any value for
- * the corresponding type in that RDN. If a wildcard is used for a RDN, it must be the
- * first RDN and will match any number of RDNs (including zero RDNs).
+ * A bundle can satisfy this condition if one of its signers has a DN chain that
+ * matches the DN chain used to construct this condition. Wildcards (`*') can be
+ * used to allow greater flexibility in specifying the DN chains. Wildcards can
+ * be used in place of DNs, RDNs, or the value in an RDN. If a wildcard is used
+ * for a value of an RDN, the value must be exactly "*" and will match any value
+ * for the corresponding type in that RDN. If a wildcard is used for a RDN, it
+ * must be the first RDN and will match any number of RDNs (including zero
+ * RDNs).
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.8 $
*/
public class BundleSignerCondition {
private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleSignerCondition";
/**
- * Constructs a condition that tries to match the passed Bundle's location
+ * Constructs a Condition that tries to match the passed Bundle's location
* to the location pattern.
*
- * @param bundle the Bundle being evaluated.
- * @param info the ConditionInfo to construct the condition for. The args of the
- * ConditionInfo specify the chain of distinguished names pattern to match
- * against the signer of the Bundle
+ * @param bundle The Bundle being evaluated.
+ * @param info The ConditionInfo to construct the condition for. The args of
+ * the ConditionInfo specify a single String specifying the chain of
+ * distinguished names pattern to match against the signer of the
+ * Bundle.
+ * @return A Condition which checks the signers of the specified bundle.
*/
static public Condition getCondition(Bundle bundle, ConditionInfo info) {
if (!CONDITION_TYPE.equals(info.getType()))
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java
index 76dba1c..bc77204 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/Condition.java,v 1.9 2005/05/25 16:22:46 twatson Exp $
+ * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/Condition.java,v 1.10 2005/08/05 01:36:21 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -13,85 +13,108 @@
import java.util.Dictionary;
/**
- * This interface is used to implement Conditions that are bound to Permissions
- * using ConditionalPermissionCollection. The Permissions of the
- * ConditionalPermissionCollection can only be used if the associated Condition
- * is satisfied.
+ * The interface implemented by a Condition. Conditions are bound to Permissions
+ * using Conditional Permission Info. The Permissions of a ConditionalPermission
+ * Info can only be used if the associated Conditions are satisfied.
+ *
+ * @version $Revision: 1.10 $
*/
public interface Condition {
/**
- * A condition object that will always evaluate to true and that is never postponed.
+ * A Condition object that will always evaluate to true and that is never
+ * postponed.
*/
- public final static Condition TRUE = new BooleanCondition(true);
+ public final static Condition TRUE = new BooleanCondition(true);
/**
- * A condition object that will always evaluate to false and that is never postponed.
+ * A Condition object that will always evaluate to false and that is never
+ * postponed.
*/
- public final static Condition FALSE = new BooleanCondition(false);
+ public final static Condition FALSE = new BooleanCondition(false);
/**
- * This method returns true if the evaluation of the Condition must be postponed
- * until the end of the permission check. If it returns false, it must be able
- * to directly answer the isSatisfied method. In other
- * words, isSatisfied() will return very quickly since no external sources,
- * such as for example users, need to be consulted.
+ * Returns whether the evaluation must be postponed until the end of the
+ * permission check. This method returns <code>true</code> if the
+ * evaluation of the Condition must be postponed until the end of the
+ * permission check. If this method returns <code>false</code>, this
+ * Condition must be able to directly answer the {@link #isSatisfied()}
+ * method. In other words, isSatisfied() will return very quickly since no
+ * external sources, such as for example users, need to be consulted.
*
- * @return false if evaluation is immediate, otherwise true to indicate the evaluation must be postponed.
+ * @return <code>true</code> to indicate the evaluation must be postponed.
+ * Otherwise, <code>false</code> if the evaluation can be
+ * immediately performed.
*/
boolean isPostponed();
/**
- * This method returns true if the Condition is satisfied.
+ * Returns whether the Condition is satisfied.
+ *
+ * @return <code>true</code> to indicate the Conditions is satisfied. must
+ * be postponed. Otherwise, <code>false</code> if the Condition is
+ * not satisfied.
*/
boolean isSatisfied();
/**
- * This method returns true if the satisfiability may change.
+ * Returns whether the Condition is mutable.
+ *
+ * @return <code>true</code> to indicate the value returned by
+ * {@link #isSatisfied()} can change. Otherwise, <code>false</code>
+ * if the value returned by {@link #isSatisfied()} will not change.
*/
boolean isMutable();
/**
- * This method returns true if the set of Conditions are satisfied. Although
- * this method is not static, it should be implemented as if it were static.
- * All of the passed Conditions will have the same type and will correspond
- * to the class type of the object on which this method is invoked.
- *
- * @param conds the array of Conditions that must be satisfied
- * @param context a Dictionary object that implementors can use to track
- * state. If this method is invoked multiple times in the same permission
- * evaluation, the same Dictionary will be passed multiple times. The
- * SecurityManager treats this Dictionary as an opaque object simply
- * creates an empty dictionary and passes it to subsequent invocations
- * if multiple invocatios are needed.
- * @return true if all the Conditions are satisfied.
+ * Returns whether a the set of Conditions are satisfied. Although this
+ * method is not static, it must be implemented as if it were static. All of
+ * the passed Conditions will be of the same type and will correspond to the
+ * class type of the object on which this method is invoked.
+ *
+ * @param conditions The array of Conditions.
+ * @param context A Dictionary object that implementors can use to track
+ * state. If this method is invoked multiple times in the same
+ * permission evaluation, the same Dictionary will be passed multiple
+ * times. The SecurityManager treats this Dictionary as an opaque
+ * object and simply creates an empty dictionary and passes it to
+ * subsequent invocations if multiple invocatios are needed.
+ * @return <code>true</code> if all the Conditions are satisfied.
+ * Otherwise, <code>false</code> if one of the Conditions is not
+ * satisfied.
*/
- boolean isSatisfied(Condition conds[], Dictionary context);
+ boolean isSatisfied(Condition conditions[], Dictionary context);
- /**
- * Package internal class used to define the {@link Condition#FALSE} and
- * {@link Condition#TRUE} constants.
- */
- final static class BooleanCondition implements Condition {
- boolean satisfied;
- BooleanCondition(boolean satisfied) {
- this.satisfied = satisfied;
- }
- public boolean isPostponed() {
- return false;
- }
- public boolean isSatisfied() {
- return satisfied;
- }
- public boolean isMutable() {
- return false;
- }
- public boolean isSatisfied(Condition[] conds, Dictionary context) {
- for(int i = 0; i < conds.length; i++) {
- if (!conds[i].isSatisfied())
- return false;
- }
- return true;
- }
-
+}
+
+/**
+ * Package internal class used to define the {@link Condition#FALSE} and
+ * {@link Condition#TRUE} constants.
+ */
+final class BooleanCondition implements Condition {
+ final boolean satisfied;
+
+ BooleanCondition(boolean satisfied) {
+ this.satisfied = satisfied;
}
+
+ public boolean isPostponed() {
+ return false;
+ }
+
+ public boolean isSatisfied() {
+ return satisfied;
+ }
+
+ public boolean isMutable() {
+ return false;
+ }
+
+ public boolean isSatisfied(Condition[] conds, Dictionary context) {
+ for (int i = 0; i < conds.length; i++) {
+ if (!conds[i].isSatisfied())
+ return false;
+ }
+ return true;
+ }
+
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
index 6207c4f..40fd968 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionInfo.java,v 1.6 2005/05/13 20:33:31 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionInfo.java,v 1.11 2005/08/05 01:36:21 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -10,153 +10,175 @@
package org.osgi.service.condpermadmin;
-import java.util.Vector;
+import java.util.ArrayList;
/**
* Condition representation used by the Conditional Permission Admin service.
*
* <p>
* This class encapsulates two pieces of information: a Condition <i>type</i>
- * (class name), which must implement <tt>Condition</tt>, and the arguments
- * passed to its constructor.
+ * (class name), which must implement <code>Condition</code>, and the
+ * arguments passed to its constructor.
*
* <p>
- * In order for a Condition represented by a <tt>ConditionInfo</tt> to be
+ * In order for a Condition represented by a <code>ConditionInfo</code> to be
* instantiated and considered during a permission check, its Condition class
* must be available from the system classpath.
*
+ * <p>
+ * The Condition class must either:
+ * <ul>
+ * <li>Declare a public static <code>getCondition</code> method that takes a
+ * <code>Bundle</code> object and a <code>ConditionInfo</code> object as
+ * arguments. That method must return an object that implements the
+ * <code>Condition</code> interface.</li>
+ * <li>Implement the <code>Condition</code> interface and define a public
+ * constructor that takes a <code>Bundle</code> object and a
+ * <code>ConditionInfo</code> object as arguments.
+ * </ul>
+ *
+ * @version $Revision: 1.11 $
*/
-
public class ConditionInfo {
-
- private String type;
-
- private String args[];
+ private String type;
+ private String[] args;
/**
- * Constructs a <tt>ConditionInfo</tt> from the given type and args.
+ * Constructs a <code>ConditionInfo</code> from the specified type and
+ * args.
*
- * @param type
- * The fully qualified class name of the condition represented by
- * this <tt>ConditionInfo</tt>. The class must implement
- * <tt>Condition</tt> and must define a constructor that takes
- * a <tt>Bundle</tt> and the correct number of argument
- * strings.
- *
- * @param args
- * The arguments that will be passed to the constructor of the
- * <tt>Conditon</tt> class identified by <tt>type</tt>.
- *
- * @exception java.lang.NullPointerException
- * if <tt>type</tt> is <tt>null</tt>.
+ * @param type The fully qualified class name of the Condition represented
+ * by this <code>ConditionInfo</code>.
+ * @param args The arguments for the Condition. These arguments are
+ * available to the newly created Condition by calling the
+ * {@link #getArgs()} method.
+ * @throws java.lang.NullPointerException If <code>type</code> is
+ * <code>null</code>.
*/
- public ConditionInfo(String type, String args[]) {
+ public ConditionInfo(String type, String[] args) {
this.type = type;
- this.args = args;
+ this.args = args != null ? args : new String[0];
if (type == null) {
throw new NullPointerException("type is null");
}
}
/**
- * Constructs a <tt>ConditionInfo</tt> object from the given encoded
- * <tt>ConditionInfo</tt> string.
+ * Constructs a <code>ConditionInfo</code> object from the specified
+ * encoded <code>ConditionInfo</code> string. White space in the encoded
+ * <code>ConditionInfo</code> string is ignored.
*
- * @param encodedCondition
- * The encoded <tt>ConditionInfo</tt>.
+ * @param encodedCondition The encoded <code>ConditionInfo</code>.
* @see #getEncoded
- * @exception java.lang.IllegalArgumentException
- * if <tt>encodedCondition</tt> is not properly formatted.
+ * @throws java.lang.IllegalArgumentException If the
+ * <code>encodedCondition</code> is not properly formatted.
*/
public ConditionInfo(String encodedCondition) {
if (encodedCondition == null) {
- throw new NullPointerException("missing encoded permission");
+ throw new NullPointerException("missing encoded condition");
}
if (encodedCondition.length() == 0) {
- throw new IllegalArgumentException("empty encoded permission");
+ throw new IllegalArgumentException("empty encoded condition");
}
-
try {
char[] encoded = encodedCondition.toCharArray();
+ int length = encoded.length;
+ int pos = 0;
+
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
/* the first character must be '[' */
- if (encoded[0] != '[') {
- throw new IllegalArgumentException(
- "first character not open bracket");
+ if (encoded[pos] != '[') {
+ throw new IllegalArgumentException("expecting open bracket");
+ }
+ pos++;
+
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
}
/* type is not quoted or encoded */
- int end = 1;
- int begin = end;
-
- while ((encoded[end] != ' ') && (encoded[end] != ')')) {
- end++;
+ int begin = pos;
+ while (!Character.isWhitespace(encoded[pos])
+ && (encoded[pos] != ']')) {
+ pos++;
}
-
- if (end == begin) {
+ if (pos == begin || encoded[begin] == '"') {
throw new IllegalArgumentException("expecting type");
}
+ this.type = new String(encoded, begin, pos - begin);
- this.type = new String(encoded, begin, end - begin);
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
- Vector args = new Vector();
- /* type may be followed by name which is quoted and encoded */
- while (encoded[end] == ' ') {
- end++;
-
- if (encoded[end] != '"') {
- throw new IllegalArgumentException("expecting quoted name");
- }
-
- end++;
- begin = end;
-
- while (encoded[end] != '"') {
- if (encoded[end] == '\\') {
- end++;
+ /* type may be followed by args which are quoted and encoded */
+ ArrayList argsList = new ArrayList();
+ while (encoded[pos] == '"') {
+ pos++;
+ begin = pos;
+ while (encoded[pos] != '"') {
+ if (encoded[pos] == '\\') {
+ pos++;
}
-
- end++;
+ pos++;
}
+ argsList.add(unescapeString(encoded, begin, pos));
+ pos++;
- args.add(decodeString(encoded, begin, end));
- end++;
+ if (Character.isWhitespace(encoded[pos])) {
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
+ }
}
- this.args = (String[]) args.toArray(new String[0]);
- /* the final character must be ')' */
- if ((encoded[end] != ']') || (end + 1 != encoded.length)) {
- throw new IllegalArgumentException("last character not "
- + "close bracket");
+ this.args = (String[]) argsList
+ .toArray(new String[argsList.size()]);
+
+ /* the final character must be ']' */
+ char c = encoded[pos];
+ pos++;
+ while ((pos < length) && Character.isWhitespace(encoded[pos])) {
+ pos++;
}
- } catch (ArrayIndexOutOfBoundsException e) {
+ if ((c != ']') || (pos != length)) {
+ throw new IllegalArgumentException("expecting close bracket");
+ }
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
throw new IllegalArgumentException("parsing terminated abruptly");
}
}
/**
- * Returns the string encoding of this <tt>ConditionInfo</tt> in a form
- * suitable for restoring this <tt>ConditionInfo</tt>.
+ * Returns the string encoding of this <code>ConditionInfo</code> in a
+ * form suitable for restoring this <code>ConditionInfo</code>.
*
* <p>
* The encoding format is:
*
* <pre>
- *
- * [type "arg0" "arg1" ...]
- *
+ * [type "arg0" "arg1" ...]
* </pre>
*
- * where <i>argX</i> are strings that are encoded for proper parsing.
- * Specifically, the <tt>"</tt>, <tt>\</tt>, carriage return, and
- * linefeed characters are escaped using <tt>\"</tt>, <tt>\\</tt>,
- * <tt>\r</tt>, and <tt>\n</tt>, respectively.
+ * where <i>argN</i> are strings that are encoded for proper parsing.
+ * Specifically, the <code>"</code>, <code>\</code>, carriage return,
+ * and linefeed characters are escaped using <code>\"</code>,
+ * <code>\\</code>, <code>\r</code>, and <code>\n</code>,
+ * respectively.
*
* <p>
- * The encoded string must contain no leading or trailing whitespace
- * characters. A single space character must be used between type and "<i>arg0</i>"
- * and between all arguments.
+ * The encoded string contains no leading or trailing whitespace characters.
+ * A single space character is used between type and "<i>arg0</i>" and
+ * between the arguments.
*
- * @return The string encoding of this <tt>ConditionInfo</tt>.
+ * @return The string encoding of this <code>ConditionInfo</code>.
*/
public final String getEncoded() {
StringBuffer output = new StringBuffer();
@@ -165,66 +187,68 @@
for (int i = 0; i < args.length; i++) {
output.append(" \"");
- encodeString(args[i], output);
+ escapeString(args[i], output);
output.append('\"');
}
output.append(']');
- return (output.toString());
+ return output.toString();
}
/**
- * Returns the string representation of this <tt>ConditionInfo</tt>. The
- * string is created by calling the <tt>getEncoded</tt> method on this
- * <tt>ConditionInfo</tt>.
+ * Returns the string representation of this <code>ConditionInfo</code>.
+ * The string is created by calling the <code>getEncoded</code> method on
+ * this <code>ConditionInfo</code>.
*
- * @return The string representation of this <tt>ConditionInfo</tt>.
+ * @return The string representation of this <code>ConditionInfo</code>.
*/
public String toString() {
- return (getEncoded());
+ return getEncoded();
}
/**
* Returns the fully qualified class name of the condition represented by
- * this <tt>ConditionInfo</tt>.
+ * this <code>ConditionInfo</code>.
*
* @return The fully qualified class name of the condition represented by
- * this <tt>ConditionInfo</tt>.
+ * this <code>ConditionInfo</code>.
*/
public final String getType() {
- return (type);
+ return type;
}
/**
- * Returns arguments of this <tt>ConditionInfo</tt>.
+ * Returns arguments of this <code>ConditionInfo</code>.
*
- * @return The arguments of this <tt>ConditionInfo</tt>. have a name.
+ * @return The arguments of this <code>ConditionInfo</code>. An empty
+ * array is returned if the <code>ConditionInfo</code> has no
+ * arguments.
*/
public final String[] getArgs() {
- return (args);
+ return args;
}
/**
- * Determines the equality of two <tt>ConditionInfo</tt> objects.
+ * Determines the equality of two <code>ConditionInfo</code> objects.
*
* This method checks that specified object has the same type and args as
- * this <tt>ConditionInfo</tt> object.
+ * this <code>ConditionInfo</code> object.
*
- * @param obj
- * The object to test for equality with this
- * <tt>ConditionInfo</tt> object.
- * @return <tt>true</tt> if <tt>obj</tt> is a <tt>ConditionInfo</tt>,
- * and has the same type and args as this <tt>ConditionInfo</tt>
- * object; <tt>false</tt> otherwise.
+ * @param obj The object to test for equality with this
+ * <code>ConditionInfo</code> object.
+ * @return <code>true</code> if <code>obj</code> is a
+ * <code>ConditionInfo</code>, and has the same type and args as
+ * this <code>ConditionInfo</code> object; <code>false</code>
+ * otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
- return (true);
+ return true;
}
if (!(obj instanceof ConditionInfo)) {
- return (false);
+ return false;
}
ConditionInfo other = (ConditionInfo) obj;
@@ -251,34 +275,32 @@
for (int i = 0; i < args.length; i++) {
hash ^= args[i].hashCode();
}
- return (hash);
+ return hash;
}
/**
* This escapes the quotes, backslashes, \n, and \r in the string using a
* backslash and appends the newly escaped string to a StringBuffer.
*/
- private static void encodeString(String str, StringBuffer output) {
+ private static void escapeString(String str, StringBuffer output) {
int len = str.length();
-
for (int i = 0; i < len; i++) {
char c = str.charAt(i);
-
switch (c) {
- case '"':
- case '\\':
- output.append('\\');
- output.append(c);
- break;
- case '\r':
- output.append("\\r");
- break;
- case '\n':
- output.append("\\n");
- break;
- default:
- output.append(c);
- break;
+ case '"' :
+ case '\\' :
+ output.append('\\');
+ output.append(c);
+ break;
+ case '\r' :
+ output.append("\\r");
+ break;
+ case '\n' :
+ output.append("\\n");
+ break;
+ default :
+ output.append(c);
+ break;
}
}
}
@@ -286,29 +308,34 @@
/**
* Takes an encoded character array and decodes it into a new String.
*/
- private static String decodeString(char[] str, int begin, int end) {
+ private static String unescapeString(char[] str, int begin, int end) {
StringBuffer output = new StringBuffer(end - begin);
-
for (int i = begin; i < end; i++) {
char c = str[i];
-
if (c == '\\') {
i++;
-
if (i < end) {
c = str[i];
-
- if (c == 'n') {
- c = '\n';
- } else if (c == 'r') {
- c = '\r';
+ switch (c) {
+ case '"' :
+ case '\\' :
+ break;
+ case 'r' :
+ c = '\r';
+ break;
+ case 'n' :
+ c = '\n';
+ break;
+ default :
+ c = '\\';
+ i--;
+ break;
}
}
}
-
output.append(c);
}
- return (output.toString());
+ return output.toString();
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
index 16fd7da..f870262 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java,v 1.6 2005/07/14 10:47:13 pkriens Exp $
+ * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java,v 1.8 2005/08/05 01:36:21 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2005). All Rights Reserved.
*
@@ -12,78 +12,84 @@
import java.security.AccessControlContext;
import java.util.Enumeration;
+
import org.osgi.service.permissionadmin.PermissionInfo;
/**
- * This is a framework service that allows ConditionalPermissionInfos to be
- * added to, retrieved from, and removed from the framework.
+ * Framework service to administer Conditional Permissions. Conditional
+ * Permissions can be added to, retrieved from, and removed from the framework.
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.8 $
*/
public interface ConditionalPermissionAdmin {
/**
- * Add a new Conditional Permission Info to the repository.
+ * Create a new Conditional Permission Info.
*
- * The Conditional Permission Info will be given a unique, never reused name.
+ * The Conditional Permission Info will be given a unique, never reused
+ * name.
*
- * @param conds the Conditions that need to be satisfied to enable the
+ * @param conds The Conditions that need to be satisfied to enable the
* corresponding Permissions.
- * @param perms the Permissions that are enable when the corresponding
+ * @param perms The Permissions that are enable when the corresponding
* Conditions are satisfied.
- * @return the ConditionalPermissionInfo that for the newly added Conditions
- * and Permissions.
+ * @return The ConditionalPermissionInfo for the specified Conditions and
+ * Permissions.
+ * @throws SecurityException If the caller does not have
+ * <code>AllPermission</code>.
*/
- ConditionalPermissionInfo addConditionalPermissionInfo(
+ public ConditionalPermissionInfo addConditionalPermissionInfo(
ConditionInfo conds[], PermissionInfo perms[]);
/**
- * Set or create a Conditional Permission Info with conditions and
- * permissions.
+ * Set or create a Conditional Permission Info with a specified name.
*
- * If the given <code>name</code> is null or not used in the repository
- * yet, a new Conditional Permission Info must be created, otherwise the
- * existing Conditional Permission Info must be reused.
+ * If the specified name is <code>null</code>, a new Conditional
+ * Permission Info must be created and will be given a unique, never reused
+ * name. If there is currently no Conditional Permission Info with the
+ * specified name, a new Conditional Permission Info must be created with
+ * the specified name. Otherwise, the Conditional Permission Info with the
+ * specified name must be updated with the specified Conditions and
+ * Permissions.
*
- * @param name the name of this Conditional Permission Info, or
+ * @param name The name of the Conditional Permission Info, or
* <code>null</code>.
- * @param conds the Conditions that need to be satisfied to enable the
+ * @param conds The Conditions that need to be satisfied to enable the
* corresponding Permissions.
- * @param perms the Permissions that are enable when the corresponding
+ * @param perms The Permissions that are enable when the corresponding
* Conditions are satisfied.
- * @return the ConditionalPermissionInfo that for the newly added Conditions
- * and Permissions.
+ * @return The ConditionalPermissionInfo that for the specified name,
+ * Conditions and Permissions.
+ * @throws SecurityException If the caller does not have
+ * <code>AllPermission</code>.
*/
- ConditionalPermissionInfo setConditionalPermissionInfo(String name,
+ public ConditionalPermissionInfo setConditionalPermissionInfo(String name,
ConditionInfo conds[], PermissionInfo perms[]);
/**
- * Returns the ConditionalPermissionInfos that are currently managed by
- * ConditionalPermissionAdmin. The Enumeration is made up of
- * ConditionalPermissionInfos. Calling ConditionalPermissionInfo.delete()
- * will remove the ConditionalPermissionInfo from
- * ConditionalPermissionAdmin.
+ * Returns the Conditional Permission Infos that are currently managed by
+ * Conditional Permission Admin. Calling
+ * {@link ConditionalPermissionInfo#delete()} will remove the Conditional
+ * Permission Info from Conditional Permission Admin.
*
- * @return the ConditionalPermissionInfos that are currently managed by
- * ConditionalPermissionAdmin. The Enumeration is made up of
- * ConditionalPermissionInfos.
+ * @return An enumeration of the Conditional Permission Infos that are
+ * currently managed by Conditional Permission Admin.
*/
- Enumeration getConditionalPermissionInfos();
+ public Enumeration getConditionalPermissionInfos();
/**
- * Return the the Conditional Permission Info with the given name.
+ * Return the the Conditional Permission Info with the specified name.
*
- * @param name the name of the Conditional Permission Info that must be
- * returned
+ * @param name The name of the Conditional Permission Info to be returned.
*/
- ConditionalPermissionInfo getConditionalPermissionInfo(String name);
+ public ConditionalPermissionInfo getConditionalPermissionInfo(String name);
/**
- * Returns the AccessControlContext that corresponds to the given signers.
+ * Returns the Access Control Context that corresponds to the specified
+ * signers.
*
- * @param signers the signers that will be checked agains
- * BundleSignerCondition.
- * @return an AccessControlContext that has the Permissions associated with
- * the signer.
+ * @param signers The signers for which to return an Access Control Context.
+ * @return An <code>AccessControlContext</code> that has the Permissions
+ * associated with the signer.
*/
- AccessControlContext getAccessControlContext(String signers[]);
+ public AccessControlContext getAccessControlContext(String[] signers);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
index c39e4f5..c9aca9f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java,v 1.7 2005/07/14 10:47:13 pkriens Exp $
+ * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java,v 1.9 2005/08/05 01:36:21 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -7,39 +7,49 @@
* terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
*/
-
+
package org.osgi.service.condpermadmin;
import org.osgi.service.permissionadmin.PermissionInfo;
/**
- * This interface describes a binding of a set of Conditions to a set of
- * Permissions. Instances of this interface are obtained from the
- * ConditionalPermissionAdmin service. This interface is also used to remove
- * ConditionalPermissionCollections from ConditionPermissionAdmin.
+ * A binding of a set of Conditions to a set of Permissions. Instances of this
+ * interface are obtained from the Conditional Permission Admin service.
+ *
+ * @version $Revision: 1.9 $
*/
public interface ConditionalPermissionInfo {
/**
- * Returns the ConditionInfos for the Conditions that must be satisfied to
- * enable this ConditionalPermissionCollection.
- */
- ConditionInfo[] getConditionInfos();
-
- /**
- * Returns the PermissionInfos for the Permission in this
- * ConditionalPermissionCollection.
- */
- PermissionInfo[] getPermissionInfos();
-
- /**
- * Removes the ConditionalPermissionCollection from the
- * ConditionalPermissionAdmin.
- */
- void delete();
-
- /**
- * Return the name of this Conditional Permission Info object.
+ * Returns the Condition Infos for the Conditions that must be satisfied to
+ * enable the Permissions.
*
+ * @return The Condition Infos for the Conditions in this Conditional
+ * Permission Info.
*/
- String getName();
+ public ConditionInfo[] getConditionInfos();
+
+ /**
+ * Returns the Permission Infos for the Permission in this Conditional
+ * Permission Info.
+ *
+ * @return The Permission Infos for the Permission in this Conditional
+ * Permission Info.
+ */
+ public PermissionInfo[] getPermissionInfos();
+
+ /**
+ * Removes this Conditional Permission Info from the Conditional Permission
+ * Admin.
+ *
+ * @throws SecurityException If the caller does not have
+ * <code>AllPermission</code>.
+ */
+ public void delete();
+
+ /**
+ * Returns the name of this Conditional Permission Info.
+ *
+ * @return The name of this Conditional Permission Info.
+ */
+ public String getName();
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java
index ac6f362..7685593 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/ExportedPackage.java,v 1.8 2005/05/13 20:32:34 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/ExportedPackage.java,v 1.11 2005/07/30 01:58:30 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
*
@@ -11,38 +11,43 @@
package org.osgi.service.packageadmin;
import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
/**
* An exported package.
*
- * Instances implementing this interface are created by the Package Admin
- * service.
+ * Objects implementing this interface are created by the Package Admin service.
*
* <p>
- * The information about an exported package provided by this object is valid
- * only until the next time <code>PackageAdmin.refreshPackages()</code> is called.
- * If an <code>ExportedPackage</code> object becomes stale (that is, the package
- * it references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>), its <code>getName()</code> and
- * <code>getSpecificationVersion()</code> continue to return their old values,
- * <code>isRemovalPending()</code> returns <code>true</code>, and
- * <code>getExportingBundle()</code> and <code>getImportingBundles()</code> return
- * <code>null</code>.
+ * The term <i>exported package</i> refers to a package that has been exported
+ * from a resolved bundle. This package may or may not be currently wired to
+ * other bundles.
*
- * @version $Revision: 1.8 $
+ * <p>
+ * The information about an exported package provided by this object may change.
+ * An <code>ExportedPackage</code> object becomes stale if the package it
+ * references has been updated or removed as a result of calling
+ * <code>PackageAdmin.refreshPackages()</code>.
+ *
+ * If this object becomes stale, its <code>getName()</code> and
+ * <code>getVersion()</code> methods continue to return their original values,
+ * <code>isRemovalPending()</code> returns <code>true</code>, and
+ * <code>getExportingBundle()</code> and <code>getImportingBundles()</code>
+ * return <code>null</code>.
+ *
+ * @version $Revision: 1.11 $
*/
public interface ExportedPackage {
/**
- * Returns the name of the package associated with this
- * <code>ExportedPackage</code> object.
+ * Returns the name of the package associated with this exported package.
*
- * @return The name of this <code>ExportedPackage</code> object.
+ * @return The name of this exported package.
*/
public String getName();
/**
- * Returns the bundle exporting the package associated with this
- * <code>ExportedPackage</code> object.
+ * Returns the bundle exporting the package associated with this exported
+ * package.
*
* @return The exporting bundle, or <code>null</code> if this
* <code>ExportedPackage</code> object has become stale.
@@ -50,39 +55,47 @@
public Bundle getExportingBundle();
/**
- * Returns the resolved bundles that are currently importing the package
- * associated with this <code>ExportedPackage</code> object.
+ * Returns the resolved bundles that are currently wired to this exported
+ * package.
*
* <p>
- * Bundles which require the exporting bundle associated with this
- * <code>ExportedPackage</code> object are considered to be importing bundles
- * and are included in the returned array. See
- * {@link RequiredBundle#getRequiringBundles()}
+ * Bundles which require the exporting bundle associated with this exported
+ * package are considered to be wired to this exported package are included
+ * in the returned array. See {@link RequiredBundle#getRequiringBundles()}.
*
- * @return The array of resolved bundles currently importing the package
- * associated with this <code>ExportedPackage</code> object, or
- * <code>null</code> if this <code>ExportedPackage</code> object has
- * become stale.
+ * @return The array of resolved bundles currently wired to this exported
+ * package, or <code>null</code> if this
+ * <code>ExportedPackage</code> object has become stale.
*/
public Bundle[] getImportingBundles();
/**
- * Returns the specification version of this <code>ExportedPackage</code>, as
- * specified in the exporting bundle's manifest file.
+ * Returns the version of this exported package.
*
- * @return The specification version of this <code>ExportedPackage</code>
- * object, or <code>null</code> if no version information is
- * available.
+ * @return The version of this exported package, or <code>null</code> if
+ * no version information is available.
+ * @deprecated Since 1.2. This method has been replaced by
+ * {@link #getVersion}.
*/
public String getSpecificationVersion();
/**
- * Returns <code>true</code> if the package associated with this
- * <code>ExportedPackage</code> object has been exported by a bundle that has
- * been updated or uninstalled.
+ * Returns the version of this exported package.
*
- * @return <code>true</code> if the associated package is being exported by a
- * bundle that has been updated or uninstalled, or if this
+ * @return The version of this exported package, or
+ * {@link Version#emptyVersion} if no version information is
+ * available.
+ * @since 1.2
+ */
+ public Version getVersion();
+
+ /**
+ * Returns <code>true</code> if the package associated with this
+ * <code>ExportedPackage</code> object has been exported by a bundle that
+ * has been updated or uninstalled.
+ *
+ * @return <code>true</code> if the associated package is being exported
+ * by a bundle that has been updated or uninstalled, or if this
* <code>ExportedPackage</code> object has become stale;
* <code>false</code> otherwise.
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java
index 6c5307c..32568bc 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/PackageAdmin.java,v 1.10 2005/05/13 20:32:34 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/PackageAdmin.java,v 1.16 2005/08/05 20:32:55 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
*
@@ -13,66 +13,59 @@
import org.osgi.framework.Bundle;
/**
- * Framework service which allows bundle programmers to inspect the packages
- * exported in the Framework and eagerly update or uninstall bundles.
+ * Framework service which allows bundle programmers to inspect the package
+ * wiring state of bundles in the Framework as well as other functions related
+ * to the class loader network among bundles.
*
+ * <p>
* If present, there will only be a single instance of this service registered
* with the Framework.
*
- * <p>
- * The term <i>exported package </i> (and the corresponding interface
- * {@link ExportedPackage})refers to a package that has actually been exported
- * (as opposed to one that is available for export).
- *
- * <p>
- * The information about exported packages returned by this service is valid
- * only until the next time {@link #refreshPackages}is called. If an
- * <code>ExportedPackage</code> object becomes stale, (that is, the package it
- * references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>), its <code>getName()</code> and
- * <code>getSpecificationVersion()</code> continue to return their old values,
- * <code>isRemovalPending()</code> returns <code>true</code>, and
- * <code>getExportingBundle()</code> and <code>getImportingBundles()</code> return
- * <code>null</code>.
- *
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.16 $
+ * @see org.osgi.service.packageadmin.ExportedPackage
+ * @see org.osgi.service.packageadmin.RequiredBundle
*/
public interface PackageAdmin {
/**
- * Gets the packages exported by the specified bundle.
+ * Gets the exported packages for the specified bundle.
*
* @param bundle The bundle whose exported packages are to be returned, or
- * <code>null</code> if all the packages currently exported in the
- * Framework are to be returned. If the specified bundle is the
- * system bundle (that is, the bundle with id zero), this method
- * returns all the packages on the system classpath whose name does
- * not start with "java.". In an environment where the exhaustive
- * list of packages on the system classpath is not known in advance,
- * this method will return all currently known packages on the system
- * classpath, that is, all packages on the system classpath that
- * contains one or more classes that have been loaded.
+ * <code>null</code> if all exported packages are to be returned.
+ * If the specified bundle is the system bundle (that is, the bundle
+ * with id zero), this method returns all the packages known to be
+ * exported by the system bundle. This will include the package
+ * specified by the <code>org.osgi.framework.system.packages</code>
+ * system property as well as any other package exported by the
+ * framework implementation.
*
- * @return The array of packages exported by the specified bundle, or
- * <code>null</code> if the specified bundle has not exported any
- * packages.
+ * @return An array of exported packages, or <code>null</code> if the
+ * specified bundle has no exported packages.
*/
public ExportedPackage[] getExportedPackages(Bundle bundle);
/**
- * Gets the <code>ExportedPackage</code> object with the specified package
- * name. All exported packages will be checked for the specified name. The
- * exported package with the highest version will be returned.
+ * Gets the exported packages for the specified package name.
+ *
+ * @param name The name of the exported packages to be returned.
+ *
+ * @return An array of the exported packages, or <code>null</code> if no
+ * exported packages with the specified name exists.
+ * @since 1.2
+ */
+ public ExportedPackage[] getExportedPackages(String name);
+
+ /**
+ * Gets the exported package for the specified package name.
+ *
* <p>
- * In an environment where the exhaustive list of packages on the system
- * classpath is not known in advance, this method attempts to see if the
- * named package is on the system classpath. This means that this method may
- * discover an <code>ExportedPackage</code> object that was not present in the
- * list returned by a prior call to <code>getExportedPackages()</code>.
+ * If there are multiple exported packages with specified name, the exported
+ * package with the highest version will be returned.
*
* @param name The name of the exported package to be returned.
*
- * @return The exported package with the specified name, or <code>null</code>
- * if no exported packages with that name exists.
+ * @return The exported package, or <code>null</code> if no exported
+ * package with the specified name exists.
+ * @see #getExportedPackages(String)
*/
public ExportedPackage getExportedPackage(String name);
@@ -89,27 +82,28 @@
*
* <p>
* This method returns to the caller immediately and then performs the
- * following steps in its own thread:
+ * following steps on a separate thread:
*
* <ol>
* <li>Compute a graph of bundles starting with the specified bundles. If
- * no bundles are specified, compute a graph of bundles starting with
- * previously updated or uninstalled ones. Add to the graph any bundle that
- * imports a package that is currently exported by a bundle in the graph.
- * The graph is fully constructed when there is no bundle outside the graph
- * that imports a package from a bundle in the graph. The graph may contain
- * <code>UNINSTALLED</code> bundles that are currently still exporting
- * packages.
+ * no bundles are specified, compute a graph of bundles starting with bundle
+ * updated or uninstalled since the last call to this method. Add to the
+ * graph any bundle that is wired to a package that is currently exported by
+ * a bundle in the graph. The graph is fully constructed when there is no
+ * bundle outside the graph that is wired to a bundle in the graph. The
+ * graph may contain <code>UNINSTALLED</code> bundles that are currently
+ * still exporting packages.
*
- * <li>Each bundle in the graph that is in the <code>ACTIVE</code> state will
- * be stopped as described in the <code>Bundle.stop</code> method.
+ * <li>Each bundle in the graph that is in the <code>ACTIVE</code> state
+ * will be stopped as described in the <code>Bundle.stop</code> method.
*
- * <li>Each bundle in the graph that is in the <code>RESOLVED</code> state is
- * moved to the <code>INSTALLED</code> state. The effect of this step is that
- * bundles in the graph are no longer <code>RESOLVED</code>.
+ * <li>Each bundle in the graph that is in the <code>RESOLVED</code>
+ * state is unresolved and thus moved to the <code>INSTALLED</code> state.
+ * The effect of this step is that bundles in the graph are no longer
+ * <code>RESOLVED</code>.
*
- * <li>Each bundle in the graph that is in the <code>UNINSTALLED</code> state
- * is removed from the graph and is now completely removed from the
+ * <li>Each bundle in the graph that is in the <code>UNINSTALLED</code>
+ * state is removed from the graph and is now completely removed from the
* Framework.
*
* <li>Each bundle in the graph that was in the <code>ACTIVE</code> state
@@ -119,48 +113,28 @@
* previously exported no longer are. Therefore, some bundles may be
* unresolvable until another bundle offering a compatible package for
* export has been installed in the Framework.
- * <li>A framework event of type <code>FrameworkEvent.PACKAGES_REFRESHED</code>
- * is broadcast.
+ * <li>A framework event of type
+ * <code>FrameworkEvent.PACKAGES_REFRESHED</code> is fired.
* </ol>
*
* <p>
* For any exceptions that are thrown during any of these steps, a
- * <code>FrameworkEvent</code> of type <code>ERROR</code> is broadcast,
+ * <code>FrameworkEvent</code> of type <code>ERROR</code> is fired
* containing the exception. The source bundle for these events should be
* the specific bundle to which the exception is related. If no specific
* bundle can be associated with the exception then the System Bundle must
* be used as the source bundle for the event.
*
- * @param bundles the bundles whose exported packages are to be updated or
- * removed, or <code>null</code> for all previously updated or
- * uninstalled bundles.
- *
- * @exception SecurityException if the caller does not have the
- * <code>AdminPermission</code> and the Java runtime environment
- * supports permissions.
+ * @param bundles The bundles whose exported packages are to be updated or
+ * removed, or <code>null</code> for all bundles updated or
+ * uninstalled since the last call to this method.
+ * @throws SecurityException If the caller does not have
+ * <code>AdminPermission[System Bundle,RESOLVE]</code> and the
+ * Java runtime environment supports permissions.
*/
public void refreshPackages(Bundle[] bundles);
/**
- * Get the <code>ExportedPackage</code> objects with the specified
- * package name. All exported packages will be checked for the specified
- * name.
- * <p>
- * In an environment where the exhaustive list of packages on the system
- * classpath is not known in advance, this method attempts to see if the
- * named package is on the system classpath. This means that this method may
- * discover an <code>ExportedPackage</code> object that was not present in the
- * list returned by a prior call to <code>getExportedPackages()</code>.
- *
- * @param name The name of the exported packages to be returned.
- *
- * @return An array of the exported packages with the specified name, or
- * <code>null</code> if no exported packages with that name exists.
- * @since 1.2
- */
- public ExportedPackage[] getExportedPackages(String name);
-
- /**
* Resolve the specified bundles. The Framework must attempt to resolve the
* specified bundles that are unresolved. Additional bundles that are not
* included in the specified bundles may be resolved as a result of calling
@@ -173,35 +147,40 @@
* be refreshed, stopped, or started. This method will not return until the
* operation has completed.
*
- * @param bundles The bundles to resolve or <code>null</code> to resolve all
- * unresolved bundles installed in the Framework.
+ * @param bundles The bundles to resolve or <code>null</code> to resolve
+ * all unresolved bundles installed in the Framework.
* @return <code>true</code> if all specified bundles are resolved;
+ * @throws SecurityException If the caller does not have
+ * <code>AdminPermission[System Bundle,RESOLVE]</code> and the
+ * Java runtime environment supports permissions.
* @since 1.2
*/
public boolean resolveBundles(Bundle[] bundles);
/**
- * Returns an array of RequiredBundles with the specified symbolic name. If
- * the symbolic name argument is <code>null</code> then all RequiredBundles
- * are returned.
+ * Returns an array of required bundles having the specified symbolic name.
*
- * @param symbolicName The symbolic name of the RequiredBundle or
- * <code>null</code> for all RequiredBundles in the Framework.
- * @return An array of RequiredBundles with the specified symbolic name or
- * <code>null</code> if no RequiredBundles exist with that symbolic
- * name.
+ * <p>
+ * If <code>null</code> is specified, then all required bundles will be
+ * returned.
+ *
+ * @param symbolicName The bundle symbolic name or <code>null</code> for
+ * all required bundles.
+ * @return An array of required bundles or <code>null</code> if no
+ * required bundles exist for the specified symbolic name.
* @since 1.2
*/
public RequiredBundle[] getRequiredBundles(String symbolicName);
/**
- * Returns the bundles with the specified symbolic name within the specified
- * version range. If no bundles are installed that have the specified
- * symbolic name, then <code>null</code> is returned. If a version range is
- * specified, then only the bundles that have the specified symbolic name
- * and belong to the specified version range are returned. The returned
- * bundles are ordered by version in descending version order so that the
- * first element of the array contains the bundle with the highest version.
+ * Returns the bundles with the specified symbolic name whose bundle version
+ * is within the specified version range. If no bundles are installed that
+ * have the specified symbolic name, then <code>null</code> is returned.
+ * If a version range is specified, then only the bundles that have the
+ * specified symbolic name and whose bundle versions belong to the specified
+ * version range are returned. The returned bundles are ordered by version
+ * in descending version order so that the first element of the array
+ * contains the bundle with the highest version.
*
* @see org.osgi.framework.Constants#BUNDLE_VERSION_ATTRIBUTE
* @param symbolicName The symbolic name of the desired bundles.
@@ -216,12 +195,12 @@
/**
* Returns an array of attached fragment bundles for the specified bundle.
- * If the specified bundle is a fragment then <code>null</code> is returned.
- * If no fragments are attached to the specified bundle then <code>null</code>
- * is returned.
+ * If the specified bundle is a fragment then <code>null</code> is
+ * returned. If no fragments are attached to the specified bundle then
+ * <code>null</code> is returned.
* <p>
- * This method does not attempt to resolve the specified bundle. If the
- * specified bundle is not resolved then <code>null</code> is returned.
+ * This method does not attempt to resolve the specified bundle. If the
+ * specified bundle is not resolved then <code>null</code> is returned.
*
* @param bundle The bundle whose attached fragment bundles are to be
* returned.
@@ -233,33 +212,34 @@
public Bundle[] getFragments(Bundle bundle);
/**
- * Returns an array of host bundles to which the specified fragment bundle
- * is attached or <code>null</code> if the specified bundle is not attached to
- * a host or is not a fragment bundle.
+ * Returns an array containing the host bundle to which the specified
+ * fragment bundle is attached or <code>null</code> if the specified
+ * bundle is not attached to a host or is not a fragment bundle. A fragment
+ * may only be attached to a single host bundle.
*
- * @param bundle The bundle whose host bundles are to be returned.
- * @return An array of host bundles or <code>null</code> if the bundle does
- * not have any host bundles.
+ * @param bundle The bundle whose host bundle is to be returned.
+ * @return An array containing the host bundle or <code>null</code> if the
+ * bundle does not have a host bundle.
* @since 1.2
*/
public Bundle[] getHosts(Bundle bundle);
/**
- * Returns the bundle for which the specified class is loaded from. The
- * classloader of the bundle returned must have been used to load the
- * specified class. If the class was not loaded by a bundle classloader then
+ * Returns the bundle from which the specified class is loaded. The class
+ * loader of the returned bundle must have been used to load the specified
+ * class. If the class was not loaded by a bundle class loader then
* <code>null</code> is returned.
*
- * @param clazz the class object to get a bundle for
- * @return the bundle from which the specified class is loaded or
- * <code>null</code> if the class was not loaded by a bundle
- * classloader
+ * @param clazz The class object from which to locate the bundle.
+ * @return The bundle from which the specified class is loaded or
+ * <code>null</code> if the class was not loaded by a bundle class
+ * loader.
* @since 1.2
*/
public Bundle getBundle(Class clazz);
/**
- * The bundle is a fragment bundle.
+ * Bundle type indicating the bundle is a fragment bundle.
*
* <p>
* The value of <code>BUNDLE_TYPE_FRAGMENT</code> is 0x00000001.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/RequiredBundle.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/RequiredBundle.java
index 0da07c4..cf62fc4 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/RequiredBundle.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/RequiredBundle.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/RequiredBundle.java,v 1.5 2005/05/13 20:32:34 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/RequiredBundle.java,v 1.8 2005/07/27 18:11:04 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). All Rights Reserved.
*
@@ -16,62 +16,73 @@
/**
* A required bundle.
*
- * Instances implementing this interface are created by the Package Admin
- * service.
+ * Objects implementing this interface are created by the Package Admin service.
*
* <p>
- * The information about a <code>RequiredBundle</code> provided by this object is
- * valid only until the next time <code>PackageAdmin.refreshPackages()</code>
- * called. If a <code>RequiredBundle</code> object becomes stale (that is, the
- * bundle it references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>), its <code>getSymbolicName()</code>
- * and <code>getVersion()</code> continue to return their old values,
- * <code>isRemovalPending()</code> returns true, and <code>getBundle()</code> and
- * <code>getRequiringBundles()</code> return <code>null</code>.
+ * The term <i>required bundle</i> refers to a resolved bundle that has a
+ * bundle symbolic name and is not a fragment. That is, a bundle that may be
+ * required by other bundles. This bundle may or may not be currently required
+ * by other bundles.
+ *
+ * <p>
+ * The information about a required bundle provided by this object may change. A
+ * <code>RequiredBundle</code> object becomes stale if an exported package of
+ * the bundle it references has been updated or removed as a result of calling
+ * <code>PackageAdmin.refreshPackages()</code>).
+ *
+ * If this object becomes stale, its <code>getSymbolicName()</code> and
+ * <code>getVersion()</code> methods continue to return their original values,
+ * <code>isRemovalPending()</code> returns true, and <code>getBundle()</code>
+ * and <code>getRequiringBundles()</code> return <code>null</code>.
*
* @since 1.2
*/
public interface RequiredBundle {
/**
- * Returns the bundle which defines this RequiredBundle.
+ * Returns the symbolic name of this required bundle.
*
- * @return The bundle, or <code>null</code> if this <code>RequiredBundle</code>
- * object has become stale.
- */
- public Bundle getBundle();
-
- /**
- * Returns the resolved bundles that currently require this bundle. If this
- * <code>RequiredBundle</code> object is required and re-exported by another
- * bundle then all the requiring bundles of the re-exporting bundle are
- * included in the returned array.
- *
- * @return An array of resolved bundles currently requiring this bundle, or
- * <code>null</code> if this <code>RequiredBundle</code> object has
- * become stale.
- */
- public Bundle[] getRequiringBundles();
-
- /**
- * Returns the symbolic name of the bundle.
- *
- * @return The symbolic name of the bundle.
+ * @return The symbolic name of this required bundle.
*/
public String getSymbolicName();
/**
- * Returns the version of the bundle.
+ * Returns the bundle associated with this required bundle.
*
- * @return The version of the bundle.
+ * @return The bundle, or <code>null</code> if this
+ * <code>RequiredBundle</code> object has become stale.
+ */
+ public Bundle getBundle();
+
+ /**
+ * Returns the bundles that currently require this required bundle.
+ *
+ * <p>
+ * If this required bundle is required and then re-exported by another
+ * bundle then all the requiring bundles of the re-exporting bundle are
+ * included in the returned array.
+ *
+ * @return An array of bundles currently requiring this required bundle, or
+ * <code>null</code> if this <code>RequiredBundle</code> object
+ * has become stale.
+ */
+ public Bundle[] getRequiringBundles();
+
+ /**
+ * Returns the version of this required bundle.
+ *
+ * @return The version of this required bundle, or
+ * {@link Version#emptyVersion} if no version information is
+ * available.
*/
public Version getVersion();
/**
- * Returns <code>true</code> if the bundle has been updated or uninstalled.
+ * Returns <code>true</code> if the bundle associated with this
+ * <code>RequiredBundle</code> object has been updated or uninstalled.
*
- * @return <code>true</code> if the bundle has been updated or uninstalled, or
- * if the <code>RequiredBundle</code> object has become stale;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the reqiured bundle has been updated or
+ * uninstalled, or if the <code>RequiredBundle</code> object has
+ * become stale; <code>false</code> otherwise.
*/
public boolean isRemovalPending();
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java
index 904b318..933b415 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionAdmin.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionAdmin.java,v 1.7 2005/05/13 20:33:46 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionAdmin.java,v 1.10 2005/08/04 03:34:57 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
*
@@ -48,7 +48,7 @@
* not reflected in the permissions returned by <code>getPermissions</code> and
* <code>getDefaultPermissions</code>.
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.10 $
*/
public interface PermissionAdmin {
/**
@@ -71,8 +71,8 @@
* permissions.
* @param permissions The permissions to be assigned, or <code>null</code> if
* the specified location is to be removed from the permission table.
- * @exception SecurityException if the caller does not have the
- * <code>AdminPermission</code>.
+ * @throws SecurityException If the caller does not have
+ * <code>AllPermission</code>.
*/
void setPermissions(String location, PermissionInfo[] permissions);
@@ -106,8 +106,8 @@
*
* @param permissions The default permissions, or <code>null</code> if the
* default permissions are to be removed from the permission table.
- * @exception SecurityException if the caller does not have the
- * <code>AdminPermission</code>.
+ * @throws SecurityException If the caller does not have
+ * <code>AllPermission</code>.
*/
void setDefaultPermissions(PermissionInfo[] permissions);
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java
index 3502e89..905c992 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionInfo.java,v 1.8 2005/06/21 15:41:57 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionInfo.java,v 1.14 2005/08/05 01:35:43 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2001, 2005). All Rights Reserved.
*
@@ -27,7 +27,7 @@
* <code>PermissionInfo</code> may be delayed until the package containing its
* Permission class has been exported by a bundle.
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.14 $
*/
public class PermissionInfo {
private String type;
@@ -35,7 +35,7 @@
private String actions;
/**
- * Constructs a <code>PermissionInfo</code> from the given type, name, and
+ * Constructs a <code>PermissionInfo</code> from the specified type, name, and
* actions.
*
* @param type The fully qualified class name of the permission represented
@@ -52,9 +52,9 @@
* argument to the constructor of the <code>Permission</code> class
* identified by <code>type</code>.
*
- * @exception java.lang.NullPointerException if <code>type</code> is
+ * @throws java.lang.NullPointerException if <code>type</code> is
* <code>null</code>.
- * @exception java.lang.IllegalArgumentException if <code>action</code> is not
+ * @throws java.lang.IllegalArgumentException if <code>action</code> is not
* <code>null</code> and <code>name</code> is <code>null</code>.
*/
public PermissionInfo(String type, String name, String actions) {
@@ -70,12 +70,14 @@
}
/**
- * Constructs a <code>PermissionInfo</code> object from the given encoded
- * <code>PermissionInfo</code> string.
+ * Constructs a <code>PermissionInfo</code> object from the specified encoded
+ * <code>PermissionInfo</code> string. White space in the encoded
+ * <code>PermissionInfo</code> string is ignored.
+ *
*
* @param encodedPermission The encoded <code>PermissionInfo</code>.
* @see #getEncoded
- * @exception java.lang.IllegalArgumentException if
+ * @throws java.lang.IllegalArgumentException If the
* <code>encodedPermission</code> is not properly formatted.
*/
public PermissionInfo(String encodedPermission) {
@@ -87,62 +89,89 @@
}
try {
char[] encoded = encodedPermission.toCharArray();
+ int length = encoded.length;
+ int pos = 0;
+
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
+
/* the first character must be '(' */
- if (encoded[0] != '(') {
+ if (encoded[pos] != '(') {
throw new IllegalArgumentException(
- "first character not open parenthesis");
+ "expecting open parenthesis");
}
+ pos++;
+
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
+
/* type is not quoted or encoded */
- int end = 1;
- int begin = end;
- while ((encoded[end] != ' ') && (encoded[end] != ')')) {
- end++;
+ int begin = pos;
+ while (!Character.isWhitespace(encoded[pos]) && (encoded[pos] != ')')) {
+ pos++;
}
- if (end == begin) {
+ if (pos == begin || encoded[begin] == '"') {
throw new IllegalArgumentException("expecting type");
}
- this.type = new String(encoded, begin, end - begin);
+ this.type = new String(encoded, begin, pos - begin);
+
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
+
/* type may be followed by name which is quoted and encoded */
- // TODO Need to support multiple spaces
- if (encoded[end] == ' ') {
- end++;
- if (encoded[end] != '"') {
- throw new IllegalArgumentException("expecting quoted name");
- }
- end++;
- begin = end;
- while (encoded[end] != '"') {
- if (encoded[end] == '\\') {
- end++;
+ if (encoded[pos] == '"') {
+ pos++;
+ begin = pos;
+ while (encoded[pos] != '"') {
+ if (encoded[pos] == '\\') {
+ pos++;
}
- end++;
+ pos++;
}
- this.name = decodeString(encoded, begin, end);
- end++;
- /* name may be followed by actions which is quoted and encoded */
- // TODO Need to support multiple spaces
- if (encoded[end] == ' ') {
- end++;
- if (encoded[end] != '"') {
- throw new IllegalArgumentException(
- "expecting quoted actions");
+ this.name = unescapeString(encoded, begin, pos);
+ pos++;
+
+ if (Character.isWhitespace(encoded[pos])) {
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
}
- end++;
- begin = end;
- while (encoded[end] != '"') {
- if (encoded[end] == '\\') {
- end++;
+
+ /* name may be followed by actions which is quoted and encoded */
+ if (encoded[pos] == '"') {
+ pos++;
+ begin = pos;
+ while (encoded[pos] != '"') {
+ if (encoded[pos] == '\\') {
+ pos++;
+ }
+ pos++;
}
- end++;
+ this.actions = unescapeString(encoded, begin, pos);
+ pos++;
+
+ /* skip whitespace */
+ while (Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
}
- this.actions = decodeString(encoded, begin, end);
- end++;
}
}
+
/* the final character must be ')' */
- if ((encoded[end] != ')') || (end + 1 != encoded.length)) {
- throw new IllegalArgumentException("last character not "
- + "close parenthesis");
+ char c = encoded[pos];
+ pos++;
+ while ((pos < length) && Character.isWhitespace(encoded[pos])) {
+ pos++;
+ }
+ if ((c != ')') || (pos != length)) {
+ throw new IllegalArgumentException("expecting close parenthesis");
}
}
catch (ArrayIndexOutOfBoundsException e) {
@@ -179,8 +208,8 @@
* <code>\\</code>,<code>\r</code>, and <code>\n</code>, respectively.
*
* <p>
- * The encoded string must contain no leading or trailing whitespace
- * characters. A single space character must be used between <i>type</i> and
+ * The encoded string contains no leading or trailing whitespace
+ * characters. A single space character is used between <i>type</i> and
* "<i>name</i>" and between "<i>name</i>" and "<i>actions</i>".
*
* @return The string encoding of this <code>PermissionInfo</code>.
@@ -195,15 +224,15 @@
output.append(type);
if (name != null) {
output.append(" \"");
- encodeString(name, output);
+ escapeString(name, output);
if (actions != null) {
output.append("\" \"");
- encodeString(actions, output);
+ escapeString(actions, output);
}
output.append('\"');
}
output.append(')');
- return (output.toString());
+ return output.toString();
}
/**
@@ -214,7 +243,7 @@
* @return The string representation of this <code>PermissionInfo</code>.
*/
public String toString() {
- return (getEncoded());
+ return getEncoded();
}
/**
@@ -225,7 +254,7 @@
* this <code>PermissionInfo</code>.
*/
public final String getType() {
- return (type);
+ return type;
}
/**
@@ -237,7 +266,7 @@
* does not have a name.
*/
public final String getName() {
- return (name);
+ return name;
}
/**
@@ -249,7 +278,7 @@
* does not have any actions associated with it.
*/
public final String getActions() {
- return (actions);
+ return actions;
}
/**
@@ -266,27 +295,27 @@
*/
public boolean equals(Object obj) {
if (obj == this) {
- return (true);
+ return true;
}
if (!(obj instanceof PermissionInfo)) {
- return (false);
+ return false;
}
PermissionInfo other = (PermissionInfo) obj;
if (!type.equals(other.type) || ((name == null) ^ (other.name == null))
|| ((actions == null) ^ (other.actions == null))) {
- return (false);
+ return false;
}
if (name != null) {
if (actions != null) {
- return (name.equals(other.name) && actions
- .equals(other.actions));
+ return name.equals(other.name) && actions
+ .equals(other.actions);
}
else {
- return (name.equals(other.name));
+ return name.equals(other.name);
}
}
else {
- return (true);
+ return true;
}
}
@@ -303,14 +332,14 @@
hash ^= actions.hashCode();
}
}
- return (hash);
+ return hash;
}
/**
* This escapes the quotes, backslashes, \n, and \r in the string using a
* backslash and appends the newly escaped string to a StringBuffer.
*/
- private static void encodeString(String str, StringBuffer output) {
+ private static void escapeString(String str, StringBuffer output) {
int len = str.length();
for (int i = 0; i < len; i++) {
char c = str.charAt(i);
@@ -336,7 +365,7 @@
/**
* Takes an encoded character array and decodes it into a new String.
*/
- private static String decodeString(char[] str, int begin, int end) {
+ private static String unescapeString(char[] str, int begin, int end) {
StringBuffer output = new StringBuffer(end - begin);
for (int i = begin; i < end; i++) {
char c = str[i];
@@ -344,17 +373,26 @@
i++;
if (i < end) {
c = str[i];
- if (c == 'n') {
- c = '\n';
- }
- else
- if (c == 'r') {
+ switch (c) {
+ case '"' :
+ case '\\' :
+ break;
+ case 'r' :
c = '\r';
- }
+ break;
+ case 'n' :
+ c = '\n';
+ break;
+ default :
+ c = '\\';
+ i--;
+ break;
+ }
}
}
output.append(c);
}
- return (output.toString());
+
+ return output.toString();
}
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java
index e2421cd..a89940e 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/StartLevel.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/StartLevel.java,v 1.6 2005/05/13 20:34:03 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/StartLevel.java,v 1.9 2005/08/05 03:22:04 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2002, 2005). All Rights Reserved.
*
@@ -25,8 +25,8 @@
* higher start level than 1.
* <p>
* Access to the StartLevel service is protected by corresponding
- * <code>ServicePermission</code>. In addition the <code>AdminPermission</code>
- * that is required to actually modify start level information.
+ * <code>ServicePermission</code>. In addition <code>AdminPermission</code>
+ * is required to actually modify start level information.
* <p>
* Start Level support in the Framework includes the ability to control the
* beginning start level of the Framework, to modify the active start level of
@@ -41,19 +41,20 @@
*
* When the Framework is launched, the Framework will enter start level one and
* all bundles which are assigned to start level one and are persistently marked
- * to be started are started as described in the <code>Bundle.start</code> method.
- * Within a start level, bundles are started in ascending order by
- * <code>Bundle.getBundleId</code>. The Framework will continue to increase the
- * start level, starting bundles at each start level, until the Framework has
- * reached a beginning start level. At this point the Framework has completed
- * starting bundles and will then broadcast a Framework event of type
- * <code>FrameworkEvent.STARTED</code> to announce it has completed its launch.
+ * to be started are started as described in the <code>Bundle.start</code>
+ * method. Within a start level, bundles are started in ascending order by
+ * <code>Bundle.getBundleId</code>. The Framework will continue to increase
+ * the start level, starting bundles at each start level, until the Framework
+ * has reached a beginning start level. At this point the Framework has
+ * completed starting bundles and will then fire a Framework event of type
+ * <code>FrameworkEvent.STARTED</code> to announce it has completed its
+ * launch.
*
* <p>
* The StartLevel service can be used by management bundles to alter the active
* start level of the framework.
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.9 $
*/
public interface StartLevel {
/**
@@ -90,17 +91,17 @@
* <code>Bundle.getBundleId</code>.
* </ol>
* When this process completes after the specified start level is reached,
- * the Framework will broadcast a Framework event of type
- * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved to
- * the specified start level.
+ * the Framework will fire a Framework event of type
+ * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved
+ * to the specified start level.
*
* <p>
* If the specified start level is lower than the active start level, the
* Framework will continue to decrease the start level until the Framework
* has reached the specified start level stopping bundles at each start
- * level as described in the <code>Bundle.stop</code> method except that their
- * persistently recorded state indicates that they must be restarted in the
- * future.
+ * level as described in the <code>Bundle.stop</code> method except that
+ * their persistently recorded state indicates that they must be restarted
+ * in the future.
*
* At each intermediate start level value on the way to and including the
* specified start level, the framework must:
@@ -110,23 +111,23 @@
* <li>Change the active start level to the intermediate start level value.
* </ol>
* When this process completes after the specified start level is reached,
- * the Framework will broadcast a Framework event of type
- * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved to
- * the specified start level.
+ * the Framework will fire a Framework event of type
+ * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved
+ * to the specified start level.
*
* <p>
* If the specified start level is equal to the active start level, then no
- * bundles are started or stopped, however, the Framework must broadcast a
- * Framework event of type <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to
- * announce it has finished moving to the specified start level. This event
- * may arrive before the this method return.
+ * bundles are started or stopped, however, the Framework must fire a
+ * Framework event of type <code>FrameworkEvent.STARTLEVEL_CHANGED</code>
+ * to announce it has finished moving to the specified start level. This
+ * event may arrive before the this method return.
*
* @param startlevel The requested start level for the Framework.
* @throws IllegalArgumentException If the specified start level is less
* than or equal to zero.
- * @throws SecurityException If the caller does not have the
- * <code>AdminPermission</code> and the Java runtime environment
- * supports permissions.
+ * @throws SecurityException If the caller does not have
+ * <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the Java runtime
+ * environment supports permissions.
*/
public abstract void setStartLevel(int startlevel);
@@ -135,8 +136,8 @@
*
* @param bundle The target bundle.
* @return The start level value of the specified Bundle.
- * @exception java.lang.IllegalArgumentException If the specified bundle has
- * been uninstalled.
+ * @throws java.lang.IllegalArgumentException If the specified bundle has
+ * been uninstalled.
*/
public abstract int getBundleStartLevel(Bundle bundle);
@@ -150,9 +151,9 @@
*
* If the new start level for the bundle is lower than or equal to the
* active start level of the Framework, the Framework will start the
- * specified bundle as described in the <code>Bundle.start</code> method if
- * the bundle is persistently marked to be started. The actual starting of
- * this bundle must occur asynchronously.
+ * specified bundle as described in the <code>Bundle.start</code> method
+ * if the bundle is persistently marked to be started. The actual starting
+ * of this bundle must occur asynchronously.
*
* If the new start level for the bundle is higher than the active start
* level of the Framework, the Framework will stop the specified bundle as
@@ -166,9 +167,9 @@
* @throws IllegalArgumentException If the specified bundle has been
* uninstalled or if the specified start level is less than or equal
* to zero, or the specified bundle is the system bundle.
- * @throws SecurityException if the caller does not have the
- * <code>AdminPermission</code> and the Java runtime environment
- * supports permissions.
+ * @throws SecurityException If the caller does not have
+ * <code>AdminPermission[bundle,EXECUTE]</code> and the Java runtime
+ * environment supports permissions.
*/
public abstract void setBundleStartLevel(Bundle bundle, int startlevel);
@@ -204,9 +205,9 @@
* @param startlevel The initial start level for newly installed bundles.
* @throws IllegalArgumentException If the specified start level is less
* than or equal to zero.
- * @throws SecurityException if the caller does not have the
- * <code>AdminPermission</code> and the Java runtime environment
- * supports permissions.
+ * @throws SecurityException If the caller does not have
+ * <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the Java runtime
+ * environment supports permissions.
*/
public abstract void setInitialBundleStartLevel(int startlevel);
@@ -221,8 +222,8 @@
* @return <code>true</code> if the bundle is persistently marked to be
* started, <code>false</code> if the bundle is not persistently
* marked to be started.
- * @exception java.lang.IllegalArgumentException If the specified bundle has
- * been uninstalled.
+ * @throws java.lang.IllegalArgumentException If the specified bundle has
+ * been uninstalled.
*/
public abstract boolean isBundlePersistentlyStarted(Bundle bundle);
}
\ No newline at end of file