You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2012/05/11 22:19:07 UTC
svn commit: r1337360 [1/7] - in /felix/trunk/framework: ./
src/main/java/org/apache/felix/framework/
src/main/java/org/apache/felix/framework/resolver/
src/main/java/org/apache/felix/framework/wiring/
src/main/java/org/osgi/framework/ src/main/java/org...
Author: rickhall
Date: Fri May 11 20:19:02 2012
New Revision: 1337360
URL: http://svn.apache.org/viewvc?rev=1337360&view=rev
Log:
Move framework to OSGi R5 API. (FELIX-3504)
Added:
felix/trunk/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
felix/trunk/framework/src/main/java/org/osgi/framework/VersionRange.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
felix/trunk/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
felix/trunk/framework/src/main/java/org/osgi/resource/
felix/trunk/framework/src/main/java/org/osgi/resource/Capability.java
felix/trunk/framework/src/main/java/org/osgi/resource/Namespace.java
felix/trunk/framework/src/main/java/org/osgi/resource/Requirement.java
felix/trunk/framework/src/main/java/org/osgi/resource/Resource.java
felix/trunk/framework/src/main/java/org/osgi/resource/Wire.java
felix/trunk/framework/src/main/java/org/osgi/resource/Wiring.java
felix/trunk/framework/src/main/resources/org/osgi/framework/namespace/
felix/trunk/framework/src/main/resources/org/osgi/framework/namespace/packageinfo
felix/trunk/framework/src/main/resources/org/osgi/resource/
felix/trunk/framework/src/main/resources/org/osgi/resource/packageinfo
Modified:
felix/trunk/framework/pom.xml
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java
felix/trunk/framework/src/main/java/org/osgi/framework/AdaptPermission.java
felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java
felix/trunk/framework/src/main/java/org/osgi/framework/AllServiceListener.java
felix/trunk/framework/src/main/java/org/osgi/framework/Bundle.java
felix/trunk/framework/src/main/java/org/osgi/framework/BundleActivator.java
felix/trunk/framework/src/main/java/org/osgi/framework/BundleContext.java
felix/trunk/framework/src/main/java/org/osgi/framework/BundleEvent.java
felix/trunk/framework/src/main/java/org/osgi/framework/BundleException.java
felix/trunk/framework/src/main/java/org/osgi/framework/BundleListener.java
felix/trunk/framework/src/main/java/org/osgi/framework/BundlePermission.java
felix/trunk/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
felix/trunk/framework/src/main/java/org/osgi/framework/Configurable.java
felix/trunk/framework/src/main/java/org/osgi/framework/Constants.java
felix/trunk/framework/src/main/java/org/osgi/framework/Filter.java
felix/trunk/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
felix/trunk/framework/src/main/java/org/osgi/framework/FrameworkListener.java
felix/trunk/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
felix/trunk/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
felix/trunk/framework/src/main/java/org/osgi/framework/PackagePermission.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServiceEvent.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServiceException.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServiceFactory.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServiceListener.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java
felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java
felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
felix/trunk/framework/src/main/java/org/osgi/framework/Version.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java
felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
felix/trunk/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
felix/trunk/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
felix/trunk/framework/src/main/java/org/osgi/service/url/URLConstants.java
felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
felix/trunk/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
felix/trunk/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
felix/trunk/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
felix/trunk/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
felix/trunk/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
felix/trunk/framework/src/main/resources/default.properties
felix/trunk/framework/src/main/resources/org/osgi/framework/hooks/bundle/packageinfo
felix/trunk/framework/src/main/resources/org/osgi/framework/launch/packageinfo
felix/trunk/framework/src/main/resources/org/osgi/framework/packageinfo
felix/trunk/framework/src/main/resources/org/osgi/framework/wiring/packageinfo
felix/trunk/framework/src/main/resources/org/osgi/util/tracker/packageinfo
Modified: felix/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/framework/pom.xml?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/pom.xml (original)
+++ felix/trunk/framework/pom.xml Fri May 11 20:19:02 2012
@@ -60,7 +60,7 @@
<Bundle-Name>Apache Felix Framework</Bundle-Name>
<Bundle-Description>OSGi R4 framework implementation.</Bundle-Description>
<Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
- <Export-Package>org.osgi.framework.*;-split-package:=merge-first,org.osgi.service.packageadmin,org.osgi.service.url,org.osgi.service.startlevel,org.osgi.util.tracker</Export-Package>
+ <Export-Package>org.osgi.framework.*;-split-package:=merge-first,org.osgi.resource,org.osgi.service.*,org.osgi.util.tracker</Export-Package>
<Private-Package>org.apache.felix.framework.*</Private-Package>
<Import-Package>!*</Import-Package>
</instructions>
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java Fri May 11 20:19:02 2012
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URLStreamHandler;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collections;
@@ -43,8 +42,11 @@ import org.osgi.framework.wiring.BundleC
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
-public class BundleRevisionImpl implements BundleRevision
+public class BundleRevisionImpl implements BundleRevision, Resource
{
public final static int EAGER_ACTIVATION = 0;
public final static int LAZY_ACTIVATION = 1;
@@ -189,6 +191,16 @@ public class BundleRevisionImpl implemen
return m_version;
}
+ public List<Capability> getCapabilities(String namespace)
+ {
+ return asCapabilityList(getDeclaredCapabilities(namespace));
+ }
+
+ static List<Capability> asCapabilityList(List reqs)
+ {
+ return (List<Capability>) reqs;
+ }
+
public List<BundleCapability> getDeclaredCapabilities(String namespace)
{
List<BundleCapability> result = m_declaredCaps;
@@ -206,6 +218,16 @@ public class BundleRevisionImpl implemen
return result;
}
+ public List<Requirement> getRequirements(String namespace)
+ {
+ return asRequirementList(getDeclaredRequirements(namespace));
+ }
+
+ static List<Requirement> asRequirementList(List reqs)
+ {
+ return (List<Requirement>) reqs;
+ }
+
public List<BundleRequirement> getDeclaredRequirements(String namespace)
{
List<BundleRequirement> result = m_declaredReqs;
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java Fri May 11 20:19:02 2012
@@ -68,6 +68,9 @@ import org.osgi.framework.wiring.BundleR
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Wire;
public class BundleWiringImpl implements BundleWiring
{
@@ -496,6 +499,11 @@ public class BundleWiringImpl implements
return !m_isDisposed;
}
+ public List<Capability> getResourceCapabilities(String namespace)
+ {
+ return BundleRevisionImpl.asCapabilityList(getCapabilities(namespace));
+ }
+
public List<BundleCapability> getCapabilities(String namespace)
{
if (isInUse())
@@ -517,6 +525,11 @@ public class BundleWiringImpl implements
return null;
}
+ public List<Requirement> getResourceRequirements(String namespace)
+ {
+ return BundleRevisionImpl.asRequirementList(getRequirements(namespace));
+ }
+
public List<BundleRequirement> getRequirements(String namespace)
{
if (isInUse())
@@ -553,6 +566,16 @@ public class BundleWiringImpl implements
return m_resolvedNativeLibs;
}
+ private static List<Wire> asWireList(List wires)
+ {
+ return (List<Wire>) wires;
+ }
+
+ public List<Wire> getProvidedResourceWires(String namespace)
+ {
+ return asWireList(getProvidedWires(namespace));
+ }
+
public List<BundleWire> getProvidedWires(String namespace)
{
if (isInUse())
@@ -563,6 +586,11 @@ public class BundleWiringImpl implements
return null;
}
+ public List<Wire> getRequiredResourceWires(String namespace)
+ {
+ return asWireList(getRequiredWires(namespace));
+ }
+
public List<BundleWire> getRequiredWires(String namespace)
{
if (isInUse())
@@ -603,6 +631,11 @@ public class BundleWiringImpl implements
m_importedPkgs = importedPkgs;
}
+ public BundleRevision getResource()
+ {
+ return null;
+ }
+
public BundleRevision getRevision()
{
return m_revision;
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java Fri May 11 20:19:02 2012
@@ -33,6 +33,11 @@ class SimpleHostedCapability implements
m_cap = cap;
}
+ public BundleRevision getResource()
+ {
+ return m_host;
+ }
+
public BundleRevision getRevision()
{
return m_host;
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java Fri May 11 20:19:02 2012
@@ -20,6 +20,7 @@ import java.util.Map;
import org.apache.felix.framework.wiring.BundleCapabilityImpl;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Resource;
public class WrappedCapability extends BundleCapabilityImpl implements HostedCapability
{
@@ -71,6 +72,12 @@ public class WrappedCapability extends B
}
@Override
+ public BundleRevision getResource()
+ {
+ return m_host;
+ }
+
+ @Override
public BundleRevision getRevision()
{
return m_host;
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java Fri May 11 20:19:02 2012
@@ -29,6 +29,8 @@ import org.osgi.framework.wiring.BundleC
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
class WrappedRevision implements BundleRevision
{
@@ -63,6 +65,16 @@ class WrappedRevision implements BundleR
throw new UnsupportedOperationException("Not supported yet.");
}
+ public List<Capability> getCapabilities(String namespace)
+ {
+ return asCapabilityList(getDeclaredCapabilities(namespace));
+ }
+
+ private static List<Capability> asCapabilityList(List caps)
+ {
+ return (List<Capability>) caps;
+ }
+
public List<BundleCapability> getDeclaredCapabilities(String namespace)
{
if (m_cachedCapabilities == null)
@@ -93,6 +105,16 @@ class WrappedRevision implements BundleR
return m_cachedCapabilities;
}
+ public List<Requirement> getRequirements(String namespace)
+ {
+ return asRequirementList(getDeclaredRequirements(namespace));
+ }
+
+ private static List<Requirement> asRequirementList(List reqs)
+ {
+ return (List<Requirement>) reqs;
+ }
+
public List<BundleRequirement> getDeclaredRequirements(String namespace)
{
if (m_cachedRequirements == null)
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java Fri May 11 20:19:02 2012
@@ -19,11 +19,11 @@
package org.apache.felix.framework.wiring;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Collections;
-import java.util.Set;
-import java.util.Map;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import org.apache.felix.framework.capabilityset.SimpleFilter;
import org.apache.felix.framework.util.ImmutableMap;
@@ -32,6 +32,7 @@ import org.apache.felix.framework.util.m
import org.osgi.framework.Constants;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Resource;
public class BundleCapabilityImpl implements BundleCapability
{
@@ -126,6 +127,11 @@ public class BundleCapabilityImpl implem
m_mandatory = mandatory;
}
+ public BundleRevision getResource()
+ {
+ return m_revision;
+ }
+
public BundleRevision getRevision()
{
return m_revision;
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java Fri May 11 20:19:02 2012
@@ -27,6 +27,7 @@ import org.osgi.framework.Constants;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Resource;
public class BundleRequirementImpl implements BundleRequirement
{
@@ -79,6 +80,11 @@ public class BundleRequirementImpl imple
return m_attrs;
}
+ public BundleRevision getResource()
+ {
+ return m_revision;
+ }
+
public BundleRevision getRevision()
{
return m_revision;
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/AdaptPermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/AdaptPermission.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/AdaptPermission.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/AdaptPermission.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.osgi.framework;
import java.io.IOException;
@@ -40,9 +41,9 @@ import java.util.Map;
* {@code AdaptPermission} has one action: {@code adapt}.
*
* @ThreadSafe
- * @version $Id: bc4c5d392d2534a7744f6fc00f4665502f82033c $
+ * @version $Id: 3bc095bd294db2d8ea25971a3d71991de1495b1a $
*/
-public class AdaptPermission extends BasicPermission {
+public final class AdaptPermission extends BasicPermission {
private static final long serialVersionUID = 1L;
@@ -137,8 +138,7 @@ public class AdaptPermission extends Bas
* adapted.
* @param actions {@code adapt}.
*/
- public AdaptPermission(String adaptClass, Bundle adaptableBundle,
- String actions) {
+ public AdaptPermission(String adaptClass, Bundle adaptableBundle, String actions) {
super(adaptClass);
setTransients(null, parseActions(actions));
this.bundle = adaptableBundle;
@@ -201,9 +201,7 @@ public class AdaptPermission extends Bas
char c;
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
// check for the known strings
@@ -217,11 +215,9 @@ public class AdaptPermission extends Bas
matchlen = 5;
mask |= ACTION_ADAPT;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException("invalid actions: "
- + actions);
+ throw new IllegalArgumentException("invalid actions: " + actions);
}
// make sure we didn't just match the tail of a word
@@ -239,8 +235,7 @@ public class AdaptPermission extends Bas
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
@@ -270,10 +265,8 @@ public class AdaptPermission extends Bas
}
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
@@ -387,10 +380,7 @@ public class AdaptPermission extends Bas
AdaptPermission cp = (AdaptPermission) obj;
- return (action_mask == cp.action_mask)
- && getName().equals(cp.getName())
- && ((bundle == cp.bundle) || ((bundle != null) && bundle
- .equals(cp.bundle)));
+ return (action_mask == cp.action_mask) && getName().equals(cp.getName()) && ((bundle == cp.bundle) || ((bundle != null) && bundle.equals(cp.bundle)));
}
/**
@@ -412,8 +402,7 @@ public class AdaptPermission extends Bas
* stream. The actions are serialized, and the superclass takes care of the
* name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (bundle != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -428,8 +417,7 @@ public class AdaptPermission extends Bas
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the action, then initialize the rest
s.defaultReadObject();
setTransients(parseFilter(getName()), parseActions(actions));
@@ -516,18 +504,15 @@ final class AdaptPermissionCollection ex
*/
public void add(final Permission permission) {
if (!(permission instanceof AdaptPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final AdaptPermission ap = (AdaptPermission) permission;
if (ap.bundle != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + ap);
+ throw new IllegalArgumentException("cannot add to collection: " + ap);
}
final String name = ap.getName();
@@ -538,12 +523,10 @@ final class AdaptPermissionCollection ex
final int oldMask = existing.action_mask;
final int newMask = ap.action_mask;
if (oldMask != newMask) {
- pc.put(name, new AdaptPermission(existing.filter, oldMask
- | newMask));
+ pc.put(name, new AdaptPermission(existing.filter, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, ap);
}
@@ -613,23 +596,18 @@ final class AdaptPermissionCollection ex
}
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", HashMap.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE) };
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", HashMap.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", permissions);
pfields.put("all_allowed", all_allowed);
out.writeFields();
}
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- permissions = (HashMap<String, AdaptPermission>) gfields.get(
- "permissions", null);
+ permissions = (HashMap<String, AdaptPermission>) gfields.get("permissions", null);
all_allowed = gfields.get("all_allowed", false);
}
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,34 +41,34 @@ import java.util.Map;
* permission are:
*
* <pre>
- * Action Methods
- * class Bundle.loadClass
- * execute Bundle.start
- * Bundle.stop
- * BundleStartLevel.setStartLevel
- * 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 FrameworkWiring.refreshBundles
- * FrameworkWiring.resolveBundles
- * resource Bundle.getResource
- * Bundle.getResources
- * Bundle.getEntry
- * Bundle.getEntryPaths
- * Bundle.findEntries
- * Bundle resource/entry URL creation
- * startlevel FrameworkStartLevel.setStartLevel
- * FrameworkStartLevel.setInitialBundleStartLevel
- * context Bundle.getBundleContext
- * weave WovenClass.setBytes
- * WovenClass.getDynamicImports for modification
+ * Action Methods
+ * class Bundle.loadClass
+ * execute Bundle.start
+ * Bundle.stop
+ * BundleStartLevel.setStartLevel
+ * 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 FrameworkWiring.refreshBundles
+ * FrameworkWiring.resolveBundles
+ * resource Bundle.getResource
+ * Bundle.getResources
+ * Bundle.getEntry
+ * Bundle.getEntryPaths
+ * Bundle.findEntries
+ * Bundle resource/entry URL creation
+ * startlevel FrameworkStartLevel.setStartLevel
+ * FrameworkStartLevel.setInitialBundleStartLevel
+ * context Bundle.getBundleContext
+ * weave WovenClass.setBytes
+ * WovenClass.getDynamicImports for modification
* </pre>
*
* <p>
@@ -89,78 +89,77 @@ import java.util.Map;
* Filter attribute names are processed in a case sensitive manner.
*
* @ThreadSafe
- * @version $Id: 43baf9a6d7ce5e6108507834e841e340fd91c513 $
+ * @version $Id: cd883e81fde210ce8f0cabaebea377378d672818 $
*/
public final class AdminPermission extends BasicPermission {
- static final long serialVersionUID = 307051004521261705L;
+ static final long serialVersionUID = 307051004521261705L;
/**
- * The action string {@code class}. The {@code class} action
- * implies the {@code resolve} action.
+ * The action string {@code class}. The {@code class} action implies the
+ * {@code resolve} action.
*
* @since 1.3
*/
- public final static String CLASS = "class";
+ public final static String CLASS = "class";
/**
- * The action string {@code execute}. The {@code execute} action
- * implies the {@code resolve} action.
+ * The action string {@code execute}. The {@code execute} action implies the
+ * {@code resolve} action.
*
* @since 1.3
*/
- public final static String EXECUTE = "execute";
+ public final static String EXECUTE = "execute";
/**
* The action string {@code extensionLifecycle}.
*
* @since 1.3
*/
- public final static String EXTENSIONLIFECYCLE = "extensionLifecycle";
+ public final static String EXTENSIONLIFECYCLE = "extensionLifecycle";
/**
* The action string {@code lifecycle}.
*
* @since 1.3
*/
- public final static String LIFECYCLE = "lifecycle";
+ public final static String LIFECYCLE = "lifecycle";
/**
* The action string {@code listener}.
*
* @since 1.3
*/
- public final static String LISTENER = "listener";
+ public final static String LISTENER = "listener";
/**
* The action string {@code metadata}.
*
* @since 1.3
*/
- public final static String METADATA = "metadata";
+ public final static String METADATA = "metadata";
/**
- * The action string {@code resolve}. The {@code resolve} action
- * is implied by the {@code class}, {@code execute} and
- * {@code resource} actions.
+ * The action string {@code resolve}. The {@code resolve} action is implied
+ * by the {@code class}, {@code execute} and {@code resource} actions.
*
* @since 1.3
*/
- public final static String RESOLVE = "resolve";
+ public final static String RESOLVE = "resolve";
/**
- * The action string {@code resource}. The {@code resource} action
- * implies the {@code resolve} action.
+ * The action string {@code resource}. The {@code resource} action implies
+ * the {@code resolve} action.
*
* @since 1.3
*/
- public final static String RESOURCE = "resource";
+ public final static String RESOURCE = "resource";
/**
* The action string {@code startlevel}.
*
* @since 1.3
*/
- public final static String STARTLEVEL = "startlevel";
+ public final static String STARTLEVEL = "startlevel";
/**
* The action string {@code context}.
*
* @since 1.4
*/
- public final static String CONTEXT = "context";
+ public final static String CONTEXT = "context";
/**
* The action string {@code weave}.
@@ -169,52 +168,43 @@ public final class AdminPermission exten
*/
public final static String WEAVE = "weave";
- private final static int ACTION_CLASS = 0x00000001;
- private final static int ACTION_EXECUTE = 0x00000002;
- private final static int ACTION_LIFECYCLE = 0x00000004;
- private final static int ACTION_LISTENER = 0x00000008;
- private final static int ACTION_METADATA = 0x00000010;
- private final static int ACTION_RESOLVE = 0x00000040;
- private final static int ACTION_RESOURCE = 0x00000080;
- private final static int ACTION_STARTLEVEL = 0x00000100;
- private final static int ACTION_EXTENSIONLIFECYCLE = 0x00000200;
- private final static int ACTION_CONTEXT = 0x00000400;
+ private final static int ACTION_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_RESOLVE = 0x00000040;
+ private final static int ACTION_RESOURCE = 0x00000080;
+ private final static int ACTION_STARTLEVEL = 0x00000100;
+ private final static int ACTION_EXTENSIONLIFECYCLE = 0x00000200;
+ private final static int ACTION_CONTEXT = 0x00000400;
private final static int ACTION_WEAVE = 0x00000800;
- private final static int ACTION_ALL = ACTION_CLASS
- | ACTION_EXECUTE
- | ACTION_LIFECYCLE
- | ACTION_LISTENER
- | ACTION_METADATA
- | ACTION_RESOLVE
- | ACTION_RESOURCE
- | ACTION_STARTLEVEL
- | ACTION_EXTENSIONLIFECYCLE
- | ACTION_CONTEXT
- | ACTION_WEAVE;
- final static int ACTION_NONE = 0;
+ private final static int ACTION_ALL = ACTION_CLASS | ACTION_EXECUTE | ACTION_LIFECYCLE | ACTION_LISTENER | ACTION_METADATA | ACTION_RESOLVE
+ | ACTION_RESOURCE | ACTION_STARTLEVEL | ACTION_EXTENSIONLIFECYCLE | ACTION_CONTEXT | ACTION_WEAVE;
+ final static int ACTION_NONE = 0;
/**
* The actions in canonical form.
*
* @serial
*/
- private volatile String actions = null;
+ private volatile String actions = null;
/**
* The actions mask.
*/
- transient int action_mask;
+ transient int action_mask;
/**
* If this AdminPermission was constructed with a filter, this holds a
* Filter matching object used to evaluate the filter in implies.
*/
- transient Filter filter;
+ transient Filter filter;
/**
* The bundle governed by this AdminPermission - only used if filter == null
*/
- transient final Bundle bundle;
+ transient final Bundle bundle;
/**
* This map holds the properties of the permission, used to match a filter
@@ -227,14 +217,14 @@ public final class AdminPermission exten
* ThreadLocal used to determine if we have recursively called
* getProperties.
*/
- private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>();
+ private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>();
/**
- * Creates a new {@code AdminPermission} object that matches all
- * bundles and has all actions. Equivalent to AdminPermission("*","*");
+ * Creates a new {@code AdminPermission} object that matches all bundles and
+ * has all actions. Equivalent to AdminPermission("*","*");
*/
public AdminPermission() {
- this(null, ACTION_ALL);
+ this(null, ACTION_ALL);
}
/**
@@ -346,29 +336,27 @@ public final class AdminPermission exten
if ((actions == null) || actions.equals("*")) {
return ACTION_ALL;
}
-
+
boolean seencomma = false;
-
+
int mask = ACTION_NONE;
char[] a = actions.toCharArray();
-
+
int i = a.length - 1;
if (i < 0)
return mask;
-
+
while (i != -1) {
char c;
-
+
// skip whitespace
- while ((i != -1)
- && ((c = a[i]) == ' ' || c == '\r' || c == '\n'
- || c == '\f' || c == '\t'))
+ while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
i--;
-
+
// check for the known strings
int matchlen;
-
+
if (i >= 4 && (a[i - 4] == 'c' || a[i - 4] == 'C')
&& (a[i - 3] == 'l' || a[i - 3] == 'L')
&& (a[i - 2] == 'a' || a[i - 2] == 'A')
@@ -376,9 +364,8 @@ public final class AdminPermission exten
&& (a[i] == 's' || a[i] == 'S')) {
matchlen = 5;
mask |= ACTION_CLASS | ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 6 && (a[i - 6] == 'e' || a[i - 6] == 'E')
&& (a[i - 5] == 'x' || a[i - 5] == 'X')
&& (a[i - 4] == 'e' || a[i - 4] == 'E')
@@ -388,9 +375,8 @@ public final class AdminPermission exten
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_EXECUTE | ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 17 && (a[i - 17] == 'e' || a[i - 17] == 'E')
&& (a[i - 16] == 'x' || a[i - 16] == 'X')
&& (a[i - 15] == 't' || a[i - 15] == 'T')
@@ -411,9 +397,8 @@ public final class AdminPermission exten
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 18;
mask |= ACTION_EXTENSIONLIFECYCLE;
-
- }
- else
+
+ } else
if (i >= 8 && (a[i - 8] == 'l' || a[i - 8] == 'L')
&& (a[i - 7] == 'i' || a[i - 7] == 'I')
&& (a[i - 6] == 'f' || a[i - 6] == 'F')
@@ -425,9 +410,8 @@ public final class AdminPermission exten
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 9;
mask |= ACTION_LIFECYCLE;
-
- }
- else
+
+ } else
if (i >= 7 && (a[i - 7] == 'l' || a[i - 7] == 'L')
&& (a[i - 6] == 'i' || a[i - 6] == 'I')
&& (a[i - 5] == 's' || a[i - 5] == 'S')
@@ -438,9 +422,8 @@ public final class AdminPermission exten
&& (a[i] == 'r' || a[i] == 'R')) {
matchlen = 8;
mask |= ACTION_LISTENER;
-
- }
- else
+
+ } else
if (i >= 7
&& (a[i - 7] == 'm' || a[i - 7] == 'M')
&& (a[i - 6] == 'e' || a[i - 6] == 'E')
@@ -452,9 +435,8 @@ public final class AdminPermission exten
&& (a[i] == 'a' || a[i] == 'A')) {
matchlen = 8;
mask |= ACTION_METADATA;
-
- }
- else
+
+ } else
if (i >= 6
&& (a[i - 6] == 'r' || a[i - 6] == 'R')
&& (a[i - 5] == 'e' || a[i - 5] == 'E')
@@ -465,9 +447,8 @@ public final class AdminPermission exten
&& (a[i] == 'e' || a[i] == 'E')) {
matchlen = 7;
mask |= ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 7
&& (a[i - 7] == 'r' || a[i - 7] == 'R')
&& (a[i - 6] == 'e' || a[i - 6] == 'E')
@@ -480,9 +461,8 @@ public final class AdminPermission exten
matchlen = 8;
mask |= ACTION_RESOURCE
| ACTION_RESOLVE;
-
- }
- else
+
+ } else
if (i >= 9
&& (a[i - 9] == 's' || a[i - 9] == 'S')
&& (a[i - 8] == 't' || a[i - 8] == 'T')
@@ -496,9 +476,8 @@ public final class AdminPermission exten
&& (a[i] == 'l' || a[i] == 'L')) {
matchlen = 10;
mask |= ACTION_STARTLEVEL;
-
- }
- else
+
+ } else
if (i >= 6
&& (a[i - 6] == 'c' || a[i - 6] == 'C')
&& (a[i - 5] == 'o' || a[i - 5] == 'O')
@@ -509,9 +488,8 @@ public final class AdminPermission exten
&& (a[i] == 't' || a[i] == 'T')) {
matchlen = 7;
mask |= ACTION_CONTEXT;
-
- }
- else
+
+ } else
if (i >= 4
&& (a[i - 4] == 'w' || a[i - 4] == 'W')
&& (a[i - 3] == 'e' || a[i - 3] == 'E')
@@ -521,21 +499,16 @@ public final class AdminPermission exten
matchlen = 5;
mask |= ACTION_WEAVE;
- }
- else
- if (i >= 0
- && (a[i] == '*')) {
+ } else
+ if (i >= 0 && (a[i] == '*')) {
matchlen = 1;
mask |= ACTION_ALL;
- }
- else {
+ } else {
// parse error
- throw new IllegalArgumentException(
- "invalid permission: "
- + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
-
+
// make sure we didn't just match the tail of a word
// like "ackbarfstartlevel". Also, skip to the comma.
seencomma = false;
@@ -551,21 +524,19 @@ public final class AdminPermission exten
case '\t' :
break;
default :
- throw new IllegalArgumentException(
- "invalid permission: " + actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
i--;
}
-
+
// point i at the location of the comma minus one (or -1).
i -= matchlen;
}
-
+
if (seencomma) {
- throw new IllegalArgumentException("invalid permission: " +
- actions);
+ throw new IllegalArgumentException("invalid permission: " + actions);
}
-
+
return mask;
}
@@ -574,8 +545,8 @@ public final class AdminPermission exten
*
* @param filterString The filter string to parse.
* @return a Filter for this bundle. If the specified filterString is
- * {@code null} or equals "*", then {@code null} is
- * returned to indicate a wildcard.
+ * {@code null} or equals "*", then {@code null} is returned to
+ * indicate a wildcard.
* @throws IllegalArgumentException If the filter syntax is invalid.
*/
private static Filter parseFilter(String filterString) {
@@ -586,13 +557,11 @@ public final class AdminPermission exten
if (filterString.equals("*")) {
return null;
}
-
+
try {
return FrameworkUtil.createFilter(filterString);
- }
- catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException(
- "invalid filter");
+ } catch (InvalidSyntaxException e) {
+ IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
iae.initCause(e);
throw iae;
}
@@ -616,9 +585,9 @@ public final class AdminPermission exten
* actions.
* <p>
* Special case: if the specified permission was constructed with "*"
- * filter, then this method returns {@code true} if this object's
- * filter is "*" and this object's actions include all of the specified
- * permission's actions
+ * filter, then this method returns {@code true} if this object's filter is
+ * "*" and this object's actions include all of the specified permission's
+ * actions
*
* @param p The requested permission.
* @return {@code true} if the specified permission is implied by this
@@ -657,7 +626,7 @@ public final class AdminPermission exten
if ((effective & desired) != desired) {
return false;
}
-
+
/* Get our filter */
Filter f = filter;
if (f == null) {
@@ -668,8 +637,7 @@ public final class AdminPermission exten
if (requested.bundle == null) {
return false;
}
- Map<String, Object> requestedProperties = requested
- .getProperties();
+ Map<String, Object> requestedProperties = requested.getProperties();
if (requestedProperties == null) {
/*
* If the requested properties are null, then we have detected a
@@ -699,53 +667,53 @@ public final class AdminPermission exten
String result = actions;
if (result == null) {
StringBuffer sb = new StringBuffer();
-
+
int mask = action_mask;
if ((mask & ACTION_CLASS) == ACTION_CLASS) {
sb.append(CLASS);
sb.append(',');
}
-
+
if ((mask & ACTION_EXECUTE) == ACTION_EXECUTE) {
sb.append(EXECUTE);
sb.append(',');
}
-
+
if ((mask & ACTION_EXTENSIONLIFECYCLE) == ACTION_EXTENSIONLIFECYCLE) {
sb.append(EXTENSIONLIFECYCLE);
sb.append(',');
}
-
+
if ((mask & ACTION_LIFECYCLE) == ACTION_LIFECYCLE) {
sb.append(LIFECYCLE);
sb.append(',');
}
-
+
if ((mask & ACTION_LISTENER) == ACTION_LISTENER) {
sb.append(LISTENER);
sb.append(',');
}
-
+
if ((mask & ACTION_METADATA) == ACTION_METADATA) {
sb.append(METADATA);
sb.append(',');
}
-
+
if ((mask & ACTION_RESOLVE) == ACTION_RESOLVE) {
sb.append(RESOLVE);
sb.append(',');
}
-
+
if ((mask & ACTION_RESOURCE) == ACTION_RESOURCE) {
sb.append(RESOURCE);
sb.append(',');
}
-
+
if ((mask & ACTION_STARTLEVEL) == ACTION_STARTLEVEL) {
sb.append(STARTLEVEL);
sb.append(',');
}
-
+
if ((mask & ACTION_CONTEXT) == ACTION_CONTEXT) {
sb.append(CONTEXT);
sb.append(',');
@@ -755,20 +723,20 @@ public final class AdminPermission exten
sb.append(WEAVE);
sb.append(',');
}
-
+
// remove trailing comma
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
-
+
actions = result = sb.toString();
}
return result;
}
/**
- * Returns a new {@code PermissionCollection} object suitable for
- * storing {@code AdminPermission}s.
+ * Returns a new {@code PermissionCollection} object suitable for storing
+ * {@code AdminPermission}s.
*
* @return A new {@code PermissionCollection} object.
*/
@@ -794,11 +762,7 @@ public final class AdminPermission exten
AdminPermission ap = (AdminPermission) obj;
- return (action_mask == ap.action_mask)
- && ((bundle == ap.bundle) || ((bundle != null) && bundle
- .equals(ap.bundle)))
- && (filter == null ? ap.filter == null : filter
- .equals(ap.filter));
+ return (action_mask == ap.action_mask) && ((bundle == ap.bundle) || ((bundle != null) && bundle.equals(ap.bundle))) && (filter == null ? ap.filter == null : filter.equals(ap.filter));
}
/**
@@ -820,8 +784,7 @@ public final class AdminPermission exten
* stream. The actions are serialized, and the superclass takes care of the
* name.
*/
- private synchronized void writeObject(java.io.ObjectOutputStream s)
- throws IOException {
+ private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
if (bundle != null) {
throw new NotSerializableException("cannot serialize");
}
@@ -836,8 +799,7 @@ public final class AdminPermission exten
* readObject is called to restore the state of this permission from a
* stream.
*/
- private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
// Read in the data, then initialize the transients
s.defaultReadObject();
setTransients(parseFilter(getName()), parseActions(actions));
@@ -870,8 +832,7 @@ public final class AdminPermission exten
}
recurse.set(bundle);
try {
- final Map<String, Object> map = new HashMap<String, Object>(
- 4);
+ final Map<String, Object> map = new HashMap<String, Object>(4);
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
map.put("id", new Long(bundle.getBundleId()));
@@ -888,8 +849,7 @@ public final class AdminPermission exten
}
});
return properties = map;
- }
- finally {
+ } finally {
recurse.set(null);
}
}
@@ -899,7 +859,7 @@ public final class AdminPermission exten
* Stores a collection of {@code AdminPermission}s.
*/
final class AdminPermissionCollection extends PermissionCollection {
- private static final long serialVersionUID = 3906372644575328048L;
+ private static final long serialVersionUID = 3906372644575328048L;
/**
* Collection of permissions.
*
@@ -913,7 +873,7 @@ final class AdminPermissionCollection ex
* @serial
* @GuardedBy this
*/
- private boolean all_allowed;
+ private boolean all_allowed;
/**
* Create an empty AdminPermissions object.
@@ -928,24 +888,21 @@ final class AdminPermissionCollection ex
*
* @param permission The {@code AdminPermission} object to add.
* @throws IllegalArgumentException If the specified permission is not an
- * {@code AdminPermission} instance or was constructed with a
- * Bundle object.
+ * {@code AdminPermission} instance or was constructed with a Bundle
+ * object.
* @throws SecurityException If this {@code AdminPermissionCollection}
* object has been marked read-only.
*/
public void add(Permission permission) {
if (!(permission instanceof AdminPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
+ throw new IllegalArgumentException("invalid permission: " + permission);
}
if (isReadOnly()) {
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
}
final AdminPermission ap = (AdminPermission) permission;
if (ap.bundle != null) {
- throw new IllegalArgumentException("cannot add to collection: "
- + ap);
+ throw new IllegalArgumentException("cannot add to collection: " + ap);
}
final String name = ap.getName();
synchronized (this) {
@@ -956,11 +913,9 @@ final class AdminPermissionCollection ex
int newMask = ap.action_mask;
if (oldMask != newMask) {
- pc.put(name, new AdminPermission(existing.filter, oldMask
- | newMask));
+ pc.put(name, new AdminPermission(existing.filter, oldMask | newMask));
}
- }
- else {
+ } else {
pc.put(name, ap);
}
if (!all_allowed) {
@@ -978,8 +933,8 @@ final class AdminPermissionCollection ex
* @param permission The Permission object to compare with the
* {@code AdminPermission} objects in this collection.
* @return {@code true} if {@code permission} is implied by an
- * {@code AdminPermission} in this collection,
- * {@code false} otherwise.
+ * {@code AdminPermission} in this collection, {@code false}
+ * otherwise.
*/
public boolean implies(Permission permission) {
if (!(permission instanceof AdminPermission)) {
@@ -1028,28 +983,21 @@ final class AdminPermissionCollection ex
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
}
-
+
/* serialization logic */
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("permissions", Hashtable.class),
- new ObjectStreamField("all_allowed", Boolean.TYPE) };
-
- private synchronized void writeObject(ObjectOutputStream out)
- throws IOException {
- Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(
- permissions);
+ private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
+
+ private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+ Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
out.writeFields();
}
-
- private synchronized void readObject(java.io.ObjectInputStream in)
- throws IOException,
- ClassNotFoundException {
+
+ private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields
- .get("permissions", null);
+ Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields.get("permissions", null);
permissions = new HashMap<String, AdminPermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/AllServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/AllServiceListener.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/AllServiceListener.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/AllServiceListener.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,45 +17,42 @@
package org.osgi.framework;
/**
- * A {@code ServiceEvent} listener that does not filter based upon
- * package wiring. {@code AllServiceListener} is a listener interface
- * that may be implemented by a bundle developer. When a
- * {@code ServiceEvent} is fired, it is synchronously delivered to an
- * {@code AllServiceListener}. The Framework may deliver
- * {@code ServiceEvent} objects to an {@code AllServiceListener}
- * out of order and may concurrently call and/or reenter an
+ * A {@code ServiceEvent} listener that does not filter based upon package
+ * wiring. {@code AllServiceListener} is a listener interface that may be
+ * implemented by a bundle developer. When a {@code ServiceEvent} is fired, it
+ * is synchronously delivered to an {@code AllServiceListener}. The Framework
+ * may deliver {@code ServiceEvent} objects to an {@code AllServiceListener} out
+ * of order and may concurrently call and/or reenter an
* {@code AllServiceListener}.
* <p>
- * An {@code AllServiceListener} object is registered with the Framework
- * using the {@code BundleContext.addServiceListener} method.
- * {@code AllServiceListener} objects are called with a
- * {@code ServiceEvent} object when a service is registered, modified, or
- * is in the process of unregistering.
+ * An {@code AllServiceListener} object is registered with the Framework using
+ * the {@code BundleContext.addServiceListener} method.
+ * {@code AllServiceListener} objects are called with a {@code ServiceEvent}
+ * object when a service is registered, modified, or is in the process of
+ * unregistering.
*
* <p>
- * {@code ServiceEvent} object delivery to
- * {@code AllServiceListener} 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}
- * objects are only delivered to the listener if the bundle which defines the
- * listener object's class has the appropriate {@code ServicePermission}
- * to get the service using at least one of the named classes under which the
- * service was registered.
+ * {@code ServiceEvent} object delivery to {@code AllServiceListener} 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} objects are only delivered to the listener if the
+ * bundle which defines the listener object's class has the appropriate
+ * {@code ServicePermission} to get the service using at least one of the named
+ * classes under which the service was registered.
*
* <p>
- * Unlike normal {@code ServiceListener} objects,
- * {@code AllServiceListener} objects receive all
- * {@code ServiceEvent} objects regardless of 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.
+ * Unlike normal {@code ServiceListener} objects, {@code AllServiceListener}
+ * objects receive all {@code ServiceEvent} objects regardless of 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.
*
* @see ServiceEvent
* @see ServicePermission
* @ThreadSafe
* @since 1.3
- * @version $Id: 35cee8a49e89b7b222aa3f85e1af0b4a4b550ce6 $
+ * @version $Id: 7a0c82db414be7064a06e1868eb41a8c8f8d9d6c $
*/
public interface AllServiceListener extends ServiceListener {
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/Bundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/Bundle.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/Bundle.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/Bundle.java Fri May 11 20:19:02 2012
@@ -1,6 +1,6 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
- *
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -25,7 +25,6 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
-
import org.osgi.framework.wiring.FrameworkWiring;
/**
@@ -59,9 +58,9 @@ import org.osgi.framework.wiring.Framewo
*
* <p>
* A bundle should only have active threads of execution when its state is one
- * of {@code STARTING},{@code ACTIVE}, or {@code STOPPING}. An {@code
- * UNINSTALLED} bundle can not be set to another state; it is a zombie and can
- * only be reached because references are kept somewhere.
+ * of {@code STARTING},{@code ACTIVE}, or {@code STOPPING}. An
+ * {@code UNINSTALLED} bundle can not be set to another state; it is a zombie
+ * and can only be reached because references are kept somewhere.
*
* <p>
* The Framework is the only entity that is allowed to create {@code Bundle}
@@ -76,7 +75,7 @@ import org.osgi.framework.wiring.Framewo
*
* @ThreadSafe
* @noimplement
- * @version $Id: 239108e8d54ff493587b9cdfe1688bdefc5a714c $
+ * @version $Id: 8a58ab72af389b1999b88348e4944203b7096510 $
*/
public interface Bundle extends Comparable<Bundle> {
/**
@@ -139,9 +138,9 @@ public interface Bundle extends Comparab
* <p>
* A bundle is in the {@code STARTING} state when its {@link #start(int)
* start} method is active. A bundle must be in this state when the bundle's
- * {@link BundleActivator#start} is called. If the {@code
- * BundleActivator.start} method completes without exception, then the
- * bundle has successfully started and must move to the {@code ACTIVE}
+ * {@link BundleActivator#start(BundleContext)} is called. If the
+ * {@code BundleActivator.start} method completes without exception, then
+ * the bundle has successfully started and must move to the {@code ACTIVE}
* state.
* <p>
* If the bundle has a {@link Constants#ACTIVATION_LAZY lazy activation
@@ -158,9 +157,9 @@ public interface Bundle extends Comparab
* <p>
* A bundle is in the {@code STOPPING} state when its {@link #stop(int)
* stop} method is active. A bundle must be in this state when the bundle's
- * {@link BundleActivator#stop} method is called. When the {@code
- * BundleActivator.stop} method completes the bundle is stopped and must
- * move to the {@code RESOLVED} state.
+ * {@link BundleActivator#stop(BundleContext)} method is called. When the
+ * {@code BundleActivator.stop} method completes the bundle is stopped and
+ * must move to the {@code RESOLVED} state.
* <p>
* The value of {@code STOPPING} is 0x00000010.
*/
@@ -312,8 +311,8 @@ public interface Bundle extends Comparab
*
* <li>A bundle event of type {@link BundleEvent#STARTING} is fired.
*
- * <li>The {@link BundleActivator#start} method of this bundle's
- * {@code BundleActivator}, if one is specified, is called. If the
+ * <li>The {@link BundleActivator#start(BundleContext)} method of this
+ * bundle's {@code BundleActivator}, if one is specified, is called. If the
* {@code BundleActivator} is invalid or throws an exception then:
* <ul>
* <li>This bundle's state is set to {@code STOPPING}.
@@ -425,11 +424,11 @@ public interface Bundle extends Comparab
* <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
*
* <li>If this bundle's state was {@code ACTIVE} prior to setting the state
- * to {@code STOPPING}, the {@link BundleActivator#stop} method of this
- * bundle's {@code BundleActivator}, if one is specified, is called. If that
- * method throws an exception, this method must continue to stop this bundle
- * and a {@code BundleException} must be thrown after completion of the
- * remaining steps.
+ * to {@code STOPPING}, the {@link BundleActivator#stop(BundleContext)}
+ * method of this bundle's {@code BundleActivator}, if one is specified, is
+ * called. If that method throws an exception, this method must continue to
+ * stop this bundle and a {@code BundleException} must be thrown after
+ * completion of the remaining steps.
*
* <li>Any services registered by this bundle must be unregistered.
* <li>Any services used by this bundle must be released.
@@ -748,10 +747,10 @@ public interface Bundle extends Comparab
* Returns this bundle's location identifier.
*
* <p>
- * The location identifier is the location passed to {@code
- * BundleContext.installBundle} when a bundle is installed. The location
- * identifier does not change while this bundle remains installed, even if
- * this bundle is updated.
+ * The location identifier is the location passed to
+ * {@code BundleContext.installBundle} when a bundle is installed. The
+ * location identifier does not change while this bundle remains installed,
+ * even if this bundle is updated.
*
* <p>
* This method must continue to return this bundle's location identifier
@@ -785,7 +784,7 @@ public interface Bundle extends Comparab
* @see ServiceReference
* @see ServicePermission
*/
- ServiceReference< ? >[] getRegisteredServices();
+ ServiceReference<?>[] getRegisteredServices();
/**
* Returns this bundle's {@code ServiceReference} list for all services it
@@ -794,10 +793,11 @@ public interface Bundle extends Comparab
* for that service is greater than zero.
*
* <p>
- * If the Java Runtime Environment supports permissions, a {@code
- * ServiceReference} object to a service is included in the returned list
- * only if the caller has the {@code ServicePermission} to get the service
- * using at least one of the named classes the service was registered under.
+ * If the Java Runtime Environment supports permissions, a
+ * {@code ServiceReference} object to a service is included in the returned
+ * list only if the caller has the {@code ServicePermission} to get the
+ * service using at least one of the named classes the service was
+ * registered under.
* <p>
* The list 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
@@ -808,7 +808,7 @@ public interface Bundle extends Comparab
* @see ServiceReference
* @see ServicePermission
*/
- ServiceReference< ? >[] getServicesInUse();
+ ServiceReference<?>[] getServicesInUse();
/**
* Determines if this bundle has the specified permissions.
@@ -832,8 +832,8 @@ public interface Bundle extends Comparab
* @return {@code true} if this bundle has the specified permission or the
* permissions possessed by this bundle imply the specified
* permission; {@code false} if this bundle does not have the
- * specified permission or {@code permission} is not an {@code
- * instanceof} {@code java.security.Permission}.
+ * specified permission or {@code permission} is not an
+ * {@code instanceof} {@code java.security.Permission}.
* @throws IllegalStateException If this bundle has been uninstalled.
*/
boolean hasPermission(Object permission);
@@ -857,12 +857,12 @@ public interface Bundle extends Comparab
* for a description of the format of a resource name.
* @return A URL to the named resource, or {@code null} 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[this,RESOURCE]}, and the Java Runtime Environment
- * supports permissions.
+ * the caller does not have the appropriate
+ * {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
+ * Environment supports permissions.
* @throws IllegalStateException If this bundle has been uninstalled.
- * @see #getEntry
- * @see #findEntries
+ * @see #getEntry(String)
+ * @see #findEntries(String, String, boolean)
* @since 1.1
*/
URL getResource(String name);
@@ -926,10 +926,10 @@ public interface Bundle extends Comparab
Dictionary<String, String> getHeaders(String locale);
/**
- * Returns the symbolic name of this bundle as specified by its {@code
- * Bundle-SymbolicName} manifest header. The bundle symbolic name should be
- * based on the reverse domain name naming convention like that used for
- * java packages.
+ * Returns the symbolic name of this bundle as specified by its
+ * {@code Bundle-SymbolicName} manifest header. The bundle symbolic name
+ * should be based on the reverse domain name naming convention like that
+ * used for java packages.
*
* <p>
* This method must continue to return this bundle's symbolic name while
@@ -945,8 +945,8 @@ public interface Bundle extends Comparab
* Loads the specified class using this bundle's class loader.
*
* <p>
- * If this bundle is a fragment bundle then this method must throw a {@code
- * ClassNotFoundException}.
+ * If this bundle is a fragment bundle then this method must throw a
+ * {@code ClassNotFoundException}.
*
* <p>
* If this bundle's state is {@code INSTALLED}, this method must attempt to
@@ -954,13 +954,13 @@ public interface Bundle extends Comparab
*
* <p>
* If this bundle cannot be resolved, a Framework event of type
- * {@link FrameworkEvent#ERROR} is fired containing a {@code
- * BundleException} with details of the reason this bundle could not be
- * resolved. This method must then throw a {@code ClassNotFoundException}.
+ * {@link FrameworkEvent#ERROR} is fired containing a
+ * {@code BundleException} with details of the reason this bundle could not
+ * be resolved. This method must then throw a {@code ClassNotFoundException}.
*
* <p>
- * If this bundle's state is {@code UNINSTALLED}, then an {@code
- * IllegalStateException} is thrown.
+ * If this bundle's state is {@code UNINSTALLED}, then an
+ * {@code IllegalStateException} is thrown.
*
* @param name The name of the class to load.
* @return The Class object for the requested class.
@@ -971,7 +971,7 @@ public interface Bundle extends Comparab
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
- Class< ? > loadClass(String name) throws ClassNotFoundException;
+ Class<?> loadClass(String name) throws ClassNotFoundException;
/**
* Find the specified resources from this bundle's class loader.
@@ -988,14 +988,14 @@ public interface Bundle extends Comparab
* URLs to directory entries will not be returned if the bundle contents do
* not contain directory entries.
*
- * @param name The name of the resource. See {@code
- * ClassLoader.getResources} for a description of the format of a
- * resource name.
+ * @param name The name of the resource. See
+ * {@code ClassLoader.getResources} for a description of the format
+ * of a resource name.
* @return An enumeration of URLs to the named resources, or {@code null} 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[this,RESOURCE]}, and the Java Runtime Environment
- * supports permissions.
+ * bundle or if the caller does not have the appropriate
+ * {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
+ * Environment supports permissions.
* @throws IllegalStateException If this bundle has been uninstalled.
* @throws IOException If there is an I/O error.
* @since 1.3
@@ -1045,9 +1045,9 @@ public interface Bundle extends Comparab
*
* @param path The path name of the entry.
* @return A URL to the entry, or {@code null} if no entry could be found or
- * if the caller does not have the appropriate {@code
- * AdminPermission[this,RESOURCE]} and the Java Runtime Environment
- * supports permissions.
+ * if the caller does not have the appropriate
+ * {@code AdminPermission[this,RESOURCE]} and the Java Runtime
+ * Environment supports permissions.
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
@@ -1059,7 +1059,7 @@ public interface Bundle extends Comparab
*
* <p>
* The time value is the number of milliseconds since January 1, 1970,
- * 00:00:00 GMT.
+ * 00:00:00 UTC.
*
* @return The time when this bundle was last modified.
* @since 1.3
@@ -1078,7 +1078,7 @@ public interface Bundle extends Comparab
* 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
- * with fragments. This "bundle space" is not a name space with
+ * with fragments. This "bundle space" is not a namespace with
* unique members; the same entry name can be present multiple times. This
* method therefore returns an enumeration of URL objects. These URLs can
* come from different JARs but have the same path name. This method can
@@ -1096,13 +1096,15 @@ public interface Bundle extends Comparab
* 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);
+ * Enumeration e = b.findEntries("OSGI-INF/l10n",
+ * "bundle_nl_DU.properties", false);
* if (e.hasMoreElements())
- * return (URL) e.nextElement();
+ * return (URL) e.nextElement();
* </pre>
*
* <p>
+ * URLs for directory entries must have their path end with "/".
+ * <p>
* Note: Jar and zip files are not required to include directory entries.
* URLs to directory entries will not be returned if the bundle contents do
* not contain directory entries.
@@ -1121,8 +1123,8 @@ public interface Bundle extends Comparab
* @param recurse If {@code true}, recurse into subdirectories. Otherwise
* only return entries from the specified path.
* @return An enumeration of URL objects for each matching entry, or
- * {@code null} if no matching entry could not be found or if the
- * caller does not have the appropriate
+ * {@code null} if no matching entry could be found or if the caller
+ * does not have the appropriate
* {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
* Environment supports permissions. The URLs are sorted such that
* entries from this bundle are returned first followed by the
@@ -1132,12 +1134,12 @@ public interface Bundle extends Comparab
* @throws IllegalStateException If this bundle has been uninstalled.
* @since 1.3
*/
- Enumeration<URL> findEntries(String path, String filePattern,
- boolean recurse);
+ Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
/**
- * Returns this bundle's {@link BundleContext}. The returned {@code
- * BundleContext} can be used by the caller to act on behalf of this bundle.
+ * Returns this bundle's {@link BundleContext}. The returned
+ * {@code BundleContext} can be used by the caller to act on behalf of this
+ * bundle.
*
* <p>
* If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
@@ -1176,13 +1178,12 @@ public interface Bundle extends Comparab
* not {@link #SIGNERS_ALL} or {@link #SIGNERS_TRUSTED}.
* @since 1.5
*/
- Map<X509Certificate, List<X509Certificate>> getSignerCertificates(
- int signersType);
+ Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType);
/**
- * Returns the version of this bundle as specified by its {@code
- * Bundle-Version} manifest header. If this bundle does not have a specified
- * version then {@link Version#emptyVersion} is returned.
+ * Returns the version of this bundle as specified by its
+ * {@code Bundle-Version} manifest header. If this bundle does not have a
+ * specified version then {@link Version#emptyVersion} is returned.
*
* <p>
* This method must continue to return this bundle's version while this
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/BundleActivator.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/BundleActivator.java?rev=1337360&r1=1337359&r2=1337360&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/BundleActivator.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/BundleActivator.java Fri May 11 20:19:02 2012
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,20 +19,19 @@ package org.osgi.framework;
/**
* Customizes the starting and stopping of a bundle.
* <p>
- * {@code BundleActivator} is an interface that may be implemented when a
- * bundle is started or stopped. The Framework can create instances of a
- * bundle's {@code BundleActivator} as required. If an instance's
- * {@code BundleActivator.start} method executes successfully, it is
- * guaranteed that the same instance's {@code BundleActivator.stop}
- * method will be called when the bundle is to be stopped. The Framework must
- * not concurrently call a {@code BundleActivator} object.
+ * {@code BundleActivator} is an interface that may be implemented when a bundle
+ * is started or stopped. The Framework can create instances of a bundle's
+ * {@code BundleActivator} as required. If an instance's
+ * {@code BundleActivator.start} method executes successfully, it is guaranteed
+ * that the same instance's {@code BundleActivator.stop} method will be called
+ * when the bundle is to be stopped. The Framework must not concurrently call a
+ * {@code BundleActivator} object.
*
* <p>
- * {@code BundleActivator} is specified through the
- * {@code Bundle-Activator} Manifest header. A bundle can only specify a
- * single {@code BundleActivator} in the Manifest file. Fragment bundles
- * must not have a {@code BundleActivator}. The form of the Manifest
- * header is:
+ * {@code BundleActivator} is specified through the {@code Bundle-Activator}
+ * Manifest header. A bundle can only specify a single {@code BundleActivator}
+ * in the Manifest file. Fragment bundles must not have a
+ * {@code BundleActivator}. The form of the Manifest header is:
*
* <p>
* {@code Bundle-Activator: <i>class-name</i>}
@@ -40,12 +39,12 @@ package org.osgi.framework;
* <p>
* where {@code <i>class-name</i>} is a fully qualified Java classname.
* <p>
- * The specified {@code BundleActivator} class must have a public
- * constructor that takes no parameters so that a {@code BundleActivator}
- * object can be created by {@code Class.newInstance()}.
+ * The specified {@code BundleActivator} class must have a public constructor
+ * that takes no parameters so that a {@code BundleActivator} object can be
+ * created by {@code Class.newInstance()}.
*
* @NotThreadSafe
- * @version $Id: 1b73057bd270ab07f0a16430dba16e5132eea24f $
+ * @version $Id: f5b2debe0064ab60669102d0a087feaeab13dc0e $
*/
public interface BundleActivator {
@@ -59,29 +58,29 @@ public interface BundleActivator {
* This method must complete and return to its caller in a timely manner.
*
* @param context The execution context of the bundle being started.
- * @throws 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 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.
*/
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}
- * 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
+ * method should undo the work that the {@code BundleActivator.start} 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.
*
* <p>
* This method must complete and return to its caller in a timely manner.
*
* @param context The execution context of the bundle being stopped.
- * @throws 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 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.
*/
public void stop(BundleContext context) throws Exception;
}