You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2018/02/23 15:11:01 UTC
svn commit: r1825132 [1/2] - in /felix/trunk/osgi-r7/framework: ./
src/main/java/org/apache/felix/framework/ src/main/java/org/osgi/dto/
src/main/java/org/osgi/framework/ src/main/java/org/osgi/framework/dto/
src/main/java/org/osgi/framework/hooks/bund...
Author: pauls
Date: Fri Feb 23 15:11:00 2018
New Revision: 1825132
URL: http://svn.apache.org/viewvc?rev=1825132&view=rev
Log:
Branch the framework for R7 work with updated osgi classes, removed packageinfos, version set to 6.0.0-SNAPSHOT, and adaption to the new R7 resolver api changes.
Added:
felix/trunk/osgi-r7/framework/
- copied from r1825072, felix/trunk/framework/
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/dto/FrameworkWiringDTO.java (with props)
Removed:
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/dto/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/bundle/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/resolver/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/weaving/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/launch/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/startlevel/dto/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/startlevel/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/dto/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/dto/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/packageadmin/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/startlevel/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/url/packageinfo
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/util/tracker/packageinfo
Modified:
felix/trunk/osgi-r7/framework/pom.xml
felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ResolveContextImpl.java
felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/DTO.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/package-info.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdaptPermission.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdminPermission.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AllServiceListener.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Bundle.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleContext.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleListener.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundlePermission.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Constants.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Filter.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkListener.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PackagePermission.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceListener.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceObjects.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServicePermission.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceReference.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Version.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/VersionRange.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/launch/Framework.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/NativeNamespace.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/package-info.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/wiring/dto/package-info.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/Capability.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/Requirement.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/Resource.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/Wire.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/resource/Wiring.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/packageadmin/package-info.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/startlevel/package-info.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
felix/trunk/osgi-r7/framework/src/main/java/org/osgi/util/tracker/package-info.java
felix/trunk/osgi-r7/framework/src/main/resources/default.properties
Modified: felix/trunk/osgi-r7/framework/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/pom.xml?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/pom.xml (original)
+++ felix/trunk/osgi-r7/framework/pom.xml Fri Feb 23 15:11:00 2018
@@ -27,7 +27,7 @@
<packaging>bundle</packaging>
<name>Apache Felix Framework</name>
<artifactId>org.apache.felix.framework</artifactId>
- <version>5.7.0-SNAPSHOT</version>
+ <version>6.0.0-SNAPSHOT</version>
<properties>
<dollar>$</dollar>
<felix.java.version>6</felix.java.version>
@@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>2.5.0</version>
+ <version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -127,7 +127,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.resolver</artifactId>
- <version>1.14.0</version>
+ <version>1.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ResolveContextImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ResolveContextImpl.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ResolveContextImpl.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ResolveContextImpl.java Fri Feb 23 15:11:00 2018
@@ -28,8 +28,7 @@ import java.util.Set;
import org.apache.felix.framework.StatefulResolver.ResolverHookRecord;
import org.apache.felix.framework.resolver.CandidateComparator;
-import org.apache.felix.resolver.FelixResolveContext;
-import org.apache.felix.resolver.ResolverImpl;
+import org.apache.felix.framework.util.Util;
import org.osgi.framework.namespace.HostNamespace;
import org.osgi.framework.namespace.PackageNamespace;
import org.osgi.framework.wiring.BundleCapability;
@@ -46,7 +45,7 @@ import org.osgi.service.resolver.Resolve
/**
*
*/
-public class ResolveContextImpl extends ResolveContext implements FelixResolveContext
+public class ResolveContextImpl extends ResolveContext
{
private final StatefulResolver m_state;
private final Map<Resource, Wiring> m_wirings;
@@ -127,7 +126,7 @@ public class ResolveContextImpl extends
}
@Override
- public Collection<Wire> getSubstitutionWires(Wiring wiring) {
+ public List<Wire> getSubstitutionWires(Wiring wiring) {
// TODO: this is calculating information that probably has been calculated
// already or at least could be calculated quicker taking into account the
// current state. We need to revisit this.
@@ -156,7 +155,7 @@ public class ResolveContextImpl extends
}
}
}
- Collection<Wire> substitutionWires = new ArrayList<Wire>();
+ List<Wire> substitutionWires = new ArrayList<Wire>();
for (Wire wire : wiring.getRequiredResourceWires(null))
{
if (PackageNamespace.PACKAGE_NAMESPACE.equals(
@@ -171,4 +170,15 @@ public class ResolveContextImpl extends
}
return substitutionWires;
}
+
+ @Override
+ public Collection<Resource> findRelatedResources(Resource resource) {
+ return !Util.isFragment(resource) ? getOndemandResources(resource) : Collections.<Resource>emptyList();
+ }
+
+ @Override
+ public void onCancel(Runnable callback) {
+ // TODO: implement session cancel
+ super.onCancel(callback);
+ }
}
\ No newline at end of file
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java Fri Feb 23 15:11:00 2018
@@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
+import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -693,6 +694,11 @@ class ServiceRegistrationImpl implements
// If ranks are equal, then sort by service id in descending order.
return (id.compareTo(otherId) < 0) ? 1 : -1;
}
+
+ @Override
+ public Dictionary<String, Object> getProperties() {
+ return new Hashtable<String, Object>(ServiceRegistrationImpl.this.m_propMap);
+ }
}
private class ServiceReferenceMap implements Map
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java Fri Feb 23 15:11:00 2018
@@ -578,7 +578,7 @@ class StatefulResolver
BundleRevision.PACKAGE_NAMESPACE,
Collections.EMPTY_MAP,
attrs);
- List<BundleCapability> candidates = findProvidersInternal(record, req, false, true);
+ final List<BundleCapability> candidates = findProvidersInternal(record, req, false, true);
// Try to find a dynamic requirement that matches the capabilities.
BundleRequirementImpl dynReq = null;
@@ -619,15 +619,22 @@ class StatefulResolver
candidates.clear();
}
- wireMap = m_resolver.resolve(
+ Map<Resource, Wiring> wirings = getWirings();
+
+ wireMap = wirings.containsKey(revision) ? m_resolver.resolveDynamic(
new ResolveContextImpl(
this,
- getWirings(),
+ wirings,
record,
Collections.<BundleRevision>emptyList(),
Collections.<BundleRevision>emptyList(),
- getFragments()),
- revision, dynReq, new ArrayList<Capability>(candidates));
+ getFragments()) {
+ @Override
+ public List<Capability> findProviders(Requirement br) {
+ return (List) candidates;
+ }
+ },
+ revision.getWiring(), dynReq) : Collections.<Resource, List<Wire>>emptyMap();
}
catch (ResolutionException ex)
{
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/DTO.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/DTO.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/DTO.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/DTO.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2017). 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.
@@ -26,13 +26,11 @@ import java.util.Set;
/**
* Super type for Data Transfer Objects.
- *
* <p>
* A Data Transfer Object (DTO) is easily serializable having only public fields
- * of primitive types and their wrapper classes, Strings, and DTOs. List, Set,
- * Map and array aggregates may also be used. The aggregates must only hold
- * objects of the listed types or aggregates.
- *
+ * of primitive types and their wrapper classes, Strings, enums, Version, and
+ * DTOs. List, Set, Map, and array aggregates may also be used. The aggregates
+ * must only hold objects of the listed types or aggregates.
* <p>
* The object graph from a Data Transfer Object must be a tree to simplify
* serialization and deserialization.
@@ -120,6 +118,12 @@ public abstract class DTO {
if (value instanceof Number || value instanceof Boolean) {
return result.append(value.toString());
}
+ if (value instanceof Enum) {
+ return appendString(result, ((Enum< ? >) value).name());
+ }
+ if ("org.osgi.framework.Version".equals(value.getClass().getName())) {
+ return appendString(result, value.toString());
+ }
// Complex types
final String path = objectRefs.get(value);
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/package-info.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/package-info.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/package-info.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/dto/package-info.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2017). 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.
@@ -15,27 +15,25 @@
*/
/**
- * OSGi Data Transfer Object Package Version 1.0.
- *
+ * OSGi Data Transfer Object Package Version 1.1.
* <p>
* Bundles wishing to use this package must list the package in the
* Import-Package header of the bundle's manifest. This package has two types of
* users: the consumers that use the API in this package and the providers that
* implement the API in this package.
- *
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.dto; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.dto; version="[1.1,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.dto; version="[1.0,1.1)"}
+ * {@code Import-Package: org.osgi.dto; version="[1.1,1.2)"}
*
* @author $Id$
*/
-@Version("1.0")
+@Version("1.1")
package org.osgi.dto;
import org.osgi.annotation.versioning.Version;
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdaptPermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdaptPermission.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdaptPermission.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdaptPermission.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2017). 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,7 +41,7 @@ import java.util.Map;
* {@code AdaptPermission} has one action: {@code adapt}.
*
* @ThreadSafe
- * @author $Id: 9f0866e633ce08566547b4955a2ece54c46944e0 $
+ * @author $Id: a2bc7aac583601ace28b252fdf4ae9a53ce32a9a $
*/
public final class AdaptPermission extends BasicPermission {
@@ -266,9 +266,7 @@ public final class AdaptPermission exten
try {
return FrameworkUtil.createFilter(filterString);
} catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException("invalid filter", e);
}
}
@@ -443,8 +441,9 @@ public final class AdaptPermission exten
map.put("adaptClass", getName());
if (bundle != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
- map.put("id", new Long(bundle.getBundleId()));
+ map.put("id", Long.valueOf(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
if (name != null) {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdminPermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdminPermission.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdminPermission.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AdminPermission.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). 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.
@@ -92,7 +92,7 @@ import java.util.Map;
* Filter attribute names are processed in a case sensitive manner.
*
* @ThreadSafe
- * @author $Id: 2a803b07dcdc9af47ca0cb208d96fcd9c0bcfb0c $
+ * @author $Id: 7906054ba14028f4c0dc21610dfd8b86ae3ffa00 $
*/
public final class AdminPermission extends BasicPermission {
@@ -298,7 +298,7 @@ public final class AdminPermission exten
if (bundle == null) {
throw new IllegalArgumentException("bundle must not be null");
}
- StringBuffer sb = new StringBuffer("(id=");
+ StringBuilder sb = new StringBuilder("(id=");
sb.append(bundle.getBundleId());
sb.append(")");
return sb.toString();
@@ -565,9 +565,7 @@ public final class AdminPermission exten
try {
return FrameworkUtil.createFilter(filterString);
} catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException("invalid filter", e);
}
}
@@ -672,7 +670,7 @@ public final class AdminPermission exten
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int mask = action_mask;
if ((mask & ACTION_CLASS) == ACTION_CLASS) {
@@ -843,8 +841,9 @@ public final class AdminPermission exten
try {
final Map<String, Object> map = new HashMap<String, Object>(4);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
- map.put("id", new Long(bundle.getBundleId()));
+ map.put("id", Long.valueOf(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
if (name != null) {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AllServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AllServiceListener.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AllServiceListener.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/AllServiceListener.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -54,9 +54,10 @@ import org.osgi.annotation.versioning.Co
* @see ServicePermission
* @ThreadSafe
* @since 1.3
- * @author $Id: fc2039183bb7c2117c182949118bb4cdd3b2e6c2 $
+ * @author $Id: 7eba8b2b69fd8e68b793fd09611b6efdc6fdd73c $
*/
@ConsumerType
+@FunctionalInterface
public interface AllServiceListener extends ServiceListener {
// This is a marker interface
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Bundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Bundle.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Bundle.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Bundle.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2018). 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.
@@ -75,7 +75,7 @@ import org.osgi.framework.wiring.Framewo
* bundle id} and is greater if it has a higher bundle id.
*
* @ThreadSafe
- * @author $Id: 81a8f18b2fcc7810817cd19f6d5e0709db1c1d12 $
+ * @author $Id: 545299bc454bb01ef73a14693ffec76a13430eea $
*/
@ProviderType
public interface Bundle extends Comparable<Bundle> {
@@ -399,8 +399,8 @@ public interface Bundle extends Comparab
* before continuing. If this does not occur in a reasonable time, a
* {@code BundleException} is thrown to indicate this bundle was unable to
* be stopped.</li>
- * <li>If the {@link #STOP_TRANSIENT} option is not set then then set this
- * bundle's persistent autostart setting to to <em>Stopped</em>. When the
+ * <li>If the {@link #STOP_TRANSIENT} option is not set then set this
+ * bundle's persistent autostart setting to <em>Stopped</em>. When the
* Framework is restarted and this bundle's autostart setting is
* <em>Stopped</em>, this bundle must not be automatically started.</li>
* <li>If this bundle's state is not {@code STARTING} or {@code ACTIVE} then
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleContext.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleContext.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleContext.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleContext.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2018). 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.
@@ -85,7 +85,7 @@ import org.osgi.annotation.versioning.Pr
* Environment supports permissions.
*
* @ThreadSafe
- * @author $Id: fbf0b18296a0b85d628ee8c47d0f0f213a914e48 $
+ * @author $Id: 6c43d322b8ea2137c094ce10e1f33e9c54519dd6 $
*/
@ProviderType
public interface BundleContext extends BundleReference {
@@ -116,6 +116,7 @@ public interface BundleContext extends B
* {@code BundleContext}.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
+ @Override
Bundle getBundle();
/**
@@ -404,7 +405,7 @@ public interface BundleContext extends B
* <li>A property named {@link Constants#SERVICE_SCOPE} identifying the
* scope of the service.</li>
* <li>A property named {@link Constants#SERVICE_BUNDLEID} identifying the
- * the context bundle.</li>
+ * context bundle.</li>
* </ul>
* Properties with these names in the specified {@code Dictionary} will be
* ignored.</li>
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleListener.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleListener.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundleListener.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2015). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,9 +35,10 @@ import org.osgi.annotation.versioning.Co
*
* @see BundleEvent
* @NotThreadSafe
- * @author $Id: 2c27d37a3a77e1c80f9b022f8dc2f614dff5f5ef $
+ * @author $Id: 50c74faa9062af826e76064737568302e6993366 $
*/
@ConsumerType
+@FunctionalInterface
public interface BundleListener extends EventListener {
/**
* Receives notification that a bundle has had a lifecycle change.
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundlePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundlePermission.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundlePermission.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/BundlePermission.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2016). 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.
@@ -58,7 +58,7 @@ import java.util.Map;
*
* @since 1.3
* @ThreadSafe
- * @author $Id: 5d3a115a2622919f564e2a2f46d70090ad9859cb $
+ * @author $Id: 7b0816059dc9b3e37f0375039bebbe5f0b18d998 $
*/
public final class BundlePermission extends BasicPermission {
@@ -314,7 +314,7 @@ public final class BundlePermission exte
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
if ((action_mask & ACTION_PROVIDE) == ACTION_PROVIDE) {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/CapabilityPermission.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/CapabilityPermission.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/CapabilityPermission.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). 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.
@@ -47,7 +47,7 @@ import java.util.Set;
* </ul>
*
* @ThreadSafe
- * @author $Id: 1d8e892cf46d7410cd3fdff1f5ca2fb010a33ae6 $
+ * @author $Id: 8a38df04e56e9dcab7ea413ba69d4c4f05487c25 $
* @since 1.6
*/
@@ -320,9 +320,7 @@ public final class CapabilityPermission
try {
return FrameworkUtil.createFilter(filterString);
} catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException("invalid filter", e);
}
}
@@ -387,7 +385,7 @@ public final class CapabilityPermission
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
int mask = action_mask;
@@ -507,8 +505,9 @@ public final class CapabilityPermission
return properties = props;
}
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
- props.put("id", new Long(bundle.getBundleId()));
+ props.put("id", Long.valueOf(bundle.getBundleId()));
props.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
if (name != null) {
@@ -551,6 +550,7 @@ public final class CapabilityPermission
return attributes.get(key);
}
+ @Override
public Set<Map.Entry<String, Object>> entrySet() {
if (entries != null) {
return entries;
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Constants.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Constants.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Constants.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Constants.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2018). 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.
@@ -29,7 +29,7 @@ import org.osgi.framework.launch.Framewo
* otherwise indicated.
*
* @since 1.1
- * @author $Id: 6873c6f7d537ddbe39a6a2eba107ca3c2de49ce5 $
+ * @author $Id: 41e648afb56767a610f279a9c7effef47dfcbf2e $
*/
@ProviderType
public interface Constants {
@@ -783,9 +783,8 @@ public interface Constants {
* Manifest header directive value identifying a reexport visibility type. A
* reexport visibility type indicates any packages that are exported by the
* required bundle are re-exported by the requiring bundle. Any arbitrary
- * arbitrary matching attributes with which they were exported by the
- * required bundle are deleted.
- *
+ * matching attributes with which they were exported by the required bundle
+ * are deleted.
* <p>
* The directive value is encoded in the Require-Bundle manifest header
* like:
@@ -814,7 +813,6 @@ public interface Constants {
*
* @see #FRAGMENT_HOST
* @see #EXTENSION_FRAMEWORK
- * @see #EXTENSION_BOOTCLASSPATH
* @since 1.3
*/
String EXTENSION_DIRECTIVE = "extension";
@@ -840,7 +838,6 @@ public interface Constants {
* Manifest header directive value identifying the type of extension
* fragment. An extension fragment type of bootclasspath indicates that the
* extension fragment is to be loaded by the boot class loader.
- *
* <p>
* The directive value is encoded in the Fragment-Host manifest header like:
*
@@ -850,6 +847,7 @@ public interface Constants {
*
* @see #EXTENSION_DIRECTIVE
* @since 1.3
+ * @deprecated As of 1.9.
*/
String EXTENSION_BOOTCLASSPATH = "bootclasspath";
@@ -1809,4 +1807,76 @@ public interface Constants {
* @since 1.8
*/
String BUNDLE_LICENSE = "Bundle-License";
+
+ /**
+ * Manifest header identifying the bundle's developers.
+ * <p>
+ * The header value may be retrieved from the {@code Dictionary} object
+ * returned by the {@code Bundle.getHeaders} method.
+ *
+ * @since 1.9
+ */
+ String BUNDLE_DEVELOPERS = "Bundle-Developers";
+
+ /**
+ * Manifest header identifying the bundle's software configuration
+ * management system.
+ * <p>
+ * The header value may be retrieved from the {@code Dictionary} object
+ * returned by the {@code Bundle.getHeaders} method.
+ *
+ * @since 1.9
+ */
+ String BUNDLE_SCM = "Bundle-SCM";
+
+ /**
+ * Service property identifying the monotonically increasing change count of
+ * a service.
+ * <p>
+ * A service may optional provide this property to indicate there has been a
+ * change in some data provided by the service. The change count must be
+ * incremented with a positive value every time the data provided by the
+ * service is changed. The service announces the modified change count by
+ * updating its service properties with the new value for this service
+ * property.
+ * <p>
+ * The value of this property must be of type {@code Long}.
+ *
+ * @since 1.9
+ */
+ String SERVICE_CHANGECOUNT = "service.changecount";
+
+ /**
+ * Intent supported by Remote Services implementations that support Basic
+ * Remote Services as defined for the {@code osgi.basic} intent.
+ *
+ * @since 1.9
+ */
+ String INTENT_BASIC = "osgi.basic";
+
+ /**
+ * Intent supported by Remote Service implementations that support
+ * Asynchronous Remote Services as defined for the {@code osgi.async}
+ * intent.
+ *
+ * @since 1.9
+ */
+ String INTENT_ASYNC = "osgi.async";
+
+ /**
+ * Intent supported by Remote Service implementation that provide
+ * confidential communications as defined for the {@code osgi.confidential}
+ * intent.
+ *
+ * @since 1.9
+ */
+ String INTENT_CONFIDENTIAL = "osgi.confidential";
+
+ /**
+ * Intent supported by Remote Service implementations that provide private
+ * communications as defined for the {@code osgi.private} intent.
+ *
+ * @since 1.9
+ */
+ String INTENT_PRIVATE = "osgi.private";
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Filter.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Filter.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Filter.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Filter.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2015). 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.
@@ -42,7 +42,7 @@ import org.osgi.annotation.versioning.Pr
* @since 1.1
* @see "Core Specification, Filters, for a description of the filter string syntax."
* @ThreadSafe
- * @author $Id: 58cd4db16892b20e44be1288ccac929a5a26c53a $
+ * @author $Id: b8bf786f2bde901997f24c6f1bcff61320a533fe $
*/
@ProviderType
public interface Filter {
@@ -82,6 +82,7 @@ public interface Filter {
*
* @return This {@code Filter}'s filter string.
*/
+ @Override
String toString();
/**
@@ -96,6 +97,7 @@ public interface Filter {
* result of calling {@code this.toString().equals(obj.toString())};
* {@code false} otherwise.
*/
+ @Override
boolean equals(Object obj);
/**
@@ -107,6 +109,7 @@ public interface Filter {
*
* @return The hashCode of this {@code Filter}.
*/
+ @Override
int hashCode();
/**
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkEvent.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkEvent.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkEvent.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.osgi.framework;
import java.util.EventObject;
+
import org.osgi.framework.startlevel.FrameworkStartLevel;
import org.osgi.framework.wiring.FrameworkWiring;
@@ -33,7 +34,7 @@ import org.osgi.framework.wiring.Framewo
*
* @Immutable
* @see FrameworkListener
- * @author $Id: 7b74a68311acf2116ccf21e589ece0ce2cd383ba $
+ * @author $Id: b3072b2d058e70389a52e342ed5f8647b930b8f1 $
*/
public class FrameworkEvent extends EventObject {
@@ -169,6 +170,19 @@ public class FrameworkEvent extends Even
public final static int WAIT_TIMEDOUT = 0x00000200;
/**
+ * The Framework has stopped and the framework requires a new class loader
+ * to restart.
+ * <p>
+ * This event is fired when the Framework has been stopped because of a stop
+ * operation on the system bundle and the framework requires a new class
+ * loader to be used to restart. For example, if a framework extension
+ * bundle has been refreshed. The source of this event is the System Bundle.
+ *
+ * @since 1.9
+ */
+ public final static int STOPPED_SYSTEM_REFRESHED = 0x00000400;
+
+ /**
* Creates a Framework event.
*
* @param type The event type.
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkListener.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkListener.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkListener.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2015). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,9 +35,10 @@ import org.osgi.annotation.versioning.Co
*
* @see FrameworkEvent
* @NotThreadSafe
- * @author $Id: 97c76c64c6e6595ad445dcc2d8083d52540f73b8 $
+ * @author $Id: a8e5255b2b18c9ba60cf82d6e16a296667017399 $
*/
@ConsumerType
+@FunctionalInterface
public interface FrameworkListener extends EventListener {
/**
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkUtil.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkUtil.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/FrameworkUtil.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2016). 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.
@@ -32,6 +32,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import javax.security.auth.x500.X500Principal;
/**
@@ -43,7 +44,7 @@ import javax.security.auth.x500.X500Prin
*
* @since 1.3
* @ThreadSafe
- * @author $Id: e93d15cef98c0e7f425f3b076d317c46ebb9a52a $
+ * @author $Id: 90d50e4d3f69b659bed23beedab6e54b31b96d76 $
*/
public class FrameworkUtil {
/**
@@ -206,6 +207,7 @@ public class FrameworkUtil {
// We use doPriv since the caller may not have permission
// to call getClassLoader.
Object cl = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
return classFromBundle.getClassLoader();
}
@@ -397,6 +399,7 @@ public class FrameworkUtil {
* @return {@code true} if the service's properties match this
* {@code Filter}; {@code false} otherwise.
*/
+ @Override
public boolean match(ServiceReference<?> reference) {
return matches(new ServiceReferenceMap(reference));
}
@@ -414,6 +417,7 @@ public class FrameworkUtil {
* @throws IllegalArgumentException If {@code dictionary} contains case
* variants of the same key name.
*/
+ @Override
public boolean match(Dictionary<String, ?> dictionary) {
return matches(new CaseInsensitiveMap(dictionary));
}
@@ -429,6 +433,7 @@ public class FrameworkUtil {
* filter; {@code false} otherwise.
* @since 1.3
*/
+ @Override
public boolean matchCase(Dictionary<String, ?> dictionary) {
switch (op) {
case AND : {
@@ -486,6 +491,7 @@ public class FrameworkUtil {
* {@code false} otherwise.
* @since 1.6
*/
+ @Override
public boolean matches(Map<String, ?> map) {
switch (op) {
case AND : {
@@ -556,8 +562,8 @@ public class FrameworkUtil {
*
* @return This {@code Filter}'s filter string.
*/
- private StringBuffer normalize() {
- StringBuffer sb = new StringBuffer();
+ private StringBuilder normalize() {
+ StringBuilder sb = new StringBuilder();
sb.append('(');
switch (op) {
@@ -734,6 +740,9 @@ public class FrameworkUtil {
if (value1 instanceof String) {
return compare_String(operation, (String) value1, value2);
}
+ if (value1 instanceof Version) {
+ return compare_Version(operation, (Version) value1, value2);
+ }
Class<?> clazz = value1.getClass();
if (clazz.isArray()) {
@@ -1213,6 +1222,31 @@ public class FrameworkUtil {
return false;
}
+ private boolean compare_Version(int operation, Version value1, Object value2) {
+ if (operation == SUBSTRING) {
+ return false;
+ }
+ try {
+ Version version2 = Version.valueOf((String) value2);
+ switch (operation) {
+ case APPROX :
+ case EQUAL : {
+ return value1.compareTo(version2) == 0;
+ }
+ case GREATER : {
+ return value1.compareTo(version2) >= 0;
+ }
+ case LESS : {
+ return value1.compareTo(version2) <= 0;
+ }
+ }
+ } catch (Exception e) {
+ // if the valueOf or compareTo method throws an exception
+ return false;
+ }
+ return false;
+ }
+
private boolean compare_Unknown(int operation, Object value1, Object value2) {
if (operation == SUBSTRING) {
return false;
@@ -1356,7 +1390,8 @@ public class FrameworkUtil {
operands.add(child);
}
- return new FilterImpl(FilterImpl.AND, null, operands.toArray(new FilterImpl[operands.size()]));
+ return new FilterImpl(FilterImpl.AND, null,
+ operands.toArray(new FilterImpl[0]));
}
private FilterImpl parse_or() throws InvalidSyntaxException {
@@ -1375,7 +1410,8 @@ public class FrameworkUtil {
operands.add(child);
}
- return new FilterImpl(FilterImpl.OR, null, operands.toArray(new FilterImpl[operands.size()]));
+ return new FilterImpl(FilterImpl.OR, null,
+ operands.toArray(new FilterImpl[0]));
}
private FilterImpl parse_not() throws InvalidSyntaxException {
@@ -1471,7 +1507,7 @@ public class FrameworkUtil {
}
private String parse_value() throws InvalidSyntaxException {
- StringBuffer sb = new StringBuffer(filterChars.length - pos);
+ StringBuilder sb = new StringBuilder(filterChars.length - pos);
parseloop: while (true) {
char c = filterChars[pos];
@@ -1507,7 +1543,7 @@ public class FrameworkUtil {
}
private Object parse_substring() throws InvalidSyntaxException {
- StringBuffer sb = new StringBuffer(filterChars.length - pos);
+ StringBuilder sb = new StringBuilder(filterChars.length - pos);
List<String> operands = new ArrayList<String>(10);
@@ -1568,7 +1604,7 @@ public class FrameworkUtil {
}
}
- return operands.toArray(new String[size]);
+ return operands.toArray(new String[0]);
}
private void skipWhiteSpace() {
@@ -1616,7 +1652,7 @@ public class FrameworkUtil {
keyList.add(key);
}
}
- this.keys = keyList.toArray(new String[keyList.size()]);
+ this.keys = keyList.toArray(new String[0]);
}
@Override
@@ -1630,6 +1666,7 @@ public class FrameworkUtil {
return null;
}
+ @Override
public Set<java.util.Map.Entry<String, Object>> entrySet() {
throw new UnsupportedOperationException();
}
@@ -1656,6 +1693,7 @@ public class FrameworkUtil {
return reference.getProperty((String) key);
}
+ @Override
public Set<java.util.Map.Entry<String, Object>> entrySet() {
throw new UnsupportedOperationException();
}
@@ -1668,6 +1706,7 @@ public class FrameworkUtil {
this.accessible = accessible;
}
+ @Override
public Void run() {
accessible.setAccessible(true);
return null;
@@ -2090,16 +2129,14 @@ public class FrameworkUtil {
try {
parsedDNChain = parseDNchain(dnChain);
} catch (RuntimeException e) {
- IllegalArgumentException iae = new IllegalArgumentException("Invalid DN chain: " + toString(dnChain));
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException(
+ "Invalid DN chain: " + toString(dnChain), e);
}
try {
parsedDNPattern = parseDNchainPattern(pattern);
} catch (RuntimeException e) {
- IllegalArgumentException iae = new IllegalArgumentException("Invalid match pattern: " + pattern);
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException(
+ "Invalid match pattern: " + pattern, e);
}
return dnChainMatch(parsedDNChain, 0, parsedDNPattern, 0);
}
@@ -2108,7 +2145,7 @@ public class FrameworkUtil {
if (dnChain == null) {
return null;
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (Iterator<?> iChain = dnChain.iterator(); iChain.hasNext();) {
sb.append(iChain.next());
if (iChain.hasNext()) {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PackagePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PackagePermission.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PackagePermission.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PackagePermission.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). 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.
@@ -54,7 +54,7 @@ import java.util.Map;
* deprecated, implies the {@code import} action.
*
* @ThreadSafe
- * @author $Id: c2d45ff158a6a19ff7bc155af3ac9941cb6a89d6 $
+ * @author $Id: 264ccd683465cbe22d571b0cb7d0b19352d582f7 $
*/
public final class PackagePermission extends BasicPermission {
@@ -64,7 +64,7 @@ public final class PackagePermission ext
* The action string {@code export}. The {@code export} action implies the
* {@code import} action.
*
- * @deprecated Since 1.5. Use {@code exportonly} instead.
+ * @deprecated As of 1.5. Use {@code exportonly} instead.
*/
public final static String EXPORT = "export";
@@ -343,9 +343,7 @@ public final class PackagePermission ext
try {
return FrameworkUtil.createFilter(filterString);
} catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException("invalid filter", e);
}
}
@@ -429,7 +427,7 @@ public final class PackagePermission ext
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
int mask = action_mask;
@@ -544,8 +542,9 @@ public final class PackagePermission ext
map.put("package.name", getName());
if (bundle != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
- map.put("id", new Long(bundle.getBundleId()));
+ map.put("id", Long.valueOf(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
if (name != null) {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/PrototypeServiceFactory.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.
@@ -96,6 +96,7 @@ public interface PrototypeServiceFactory
* the classes named when the service was registered.
* @see ServiceObjects#getService()
*/
+ @Override
public S getService(Bundle bundle, ServiceRegistration<S> registration);
/**
@@ -120,5 +121,6 @@ public interface PrototypeServiceFactory
* method.
* @see ServiceObjects#ungetService(Object)
*/
+ @Override
public void ungetService(Bundle bundle, ServiceRegistration<S> registration, S service);
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceListener.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceListener.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceListener.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2015). 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.
@@ -50,9 +50,10 @@ import org.osgi.annotation.versioning.Co
* @see ServiceEvent
* @see ServicePermission
* @ThreadSafe
- * @author $Id: 8468dbc769382269184c932d41e084cb2fa58eb9 $
+ * @author $Id: e061a4c69c017c04dafe285926424bd1a2132b51 $
*/
@ConsumerType
+@FunctionalInterface
public interface ServiceListener extends EventListener {
/**
* Receives notification that a service has had a lifecycle change.
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceObjects.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceObjects.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceObjects.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceObjects.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2016). 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.
@@ -20,14 +20,16 @@ import org.osgi.annotation.versioning.Pr
/**
* Allows multiple service objects for a service to be obtained.
- *
* <p>
* For services with {@link Constants#SCOPE_PROTOTYPE prototype} scope, multiple
- * service objects for the service can be obtained. For services with
- * {@link Constants#SCOPE_SINGLETON singleton} or {@link Constants#SCOPE_BUNDLE
- * bundle} scope, only one, use-counted service object is available to a
- * requesting bundle.
- *
+ * service objects for the service can be obtained. Since implementations of
+ * {@link PrototypeServiceFactory} can return the same service object
+ * repeatedly, the framework must use count the returned service objects to
+ * release the service object only when its use count returns to zero.
+ * <p>
+ * For services with {@link Constants#SCOPE_SINGLETON singleton} or
+ * {@link Constants#SCOPE_BUNDLE bundle} scope, only one, use-counted service
+ * object is available to a requesting bundle.
* <p>
* Any unreleased service objects obtained from this {@code ServiceObjects}
* object are automatically released by the framework when the bundle associated
@@ -46,23 +48,19 @@ public interface ServiceObjects<S> {
/**
* Returns a service object for the {@link #getServiceReference()
* associated} service.
- *
* <p>
* This {@code ServiceObjects} object can be used to obtain multiple service
* objects for the associated service if the service has
* {@link Constants#SCOPE_PROTOTYPE prototype} scope.
- *
* <p>
* If the associated service has {@link Constants#SCOPE_SINGLETON singleton}
* or {@link Constants#SCOPE_BUNDLE bundle} scope, this method behaves the
* same as calling the {@link BundleContext#getService(ServiceReference)}
* method for the associated service. That is, only one, use-counted service
* object is available from this {@link ServiceObjects} object.
- *
* <p>
* This method will always return {@code null} when the associated service
* has been unregistered.
- *
* <p>
* For a prototype scope service, the following steps are required to obtain
* a service object:
@@ -71,13 +69,16 @@ public interface ServiceObjects<S> {
* returned.</li>
* <li>The
* {@link PrototypeServiceFactory#getService(Bundle, ServiceRegistration)}
- * method is called to supply a customized service object for the caller.</li>
+ * method is called to supply a customized service object for the caller.
+ * </li>
* <li>If the service object returned by the {@code PrototypeServiceFactory}
* object is {@code null}, not an {@code instanceof} all the classes named
* when the service was registered or the {@code PrototypeServiceFactory}
* object throws an exception, {@code null} is returned and a Framework
* event of type {@link FrameworkEvent#ERROR} containing a
* {@link ServiceException} describing the error is fired.</li>
+ * <li>The use count for the customized service object is incremented by
+ * one.</li>
* <li>The customized service object is returned.</li>
* </ol>
*
@@ -87,7 +88,7 @@ public interface ServiceObjects<S> {
* classes under which it was registered or the
* {@code ServiceFactory} threw an exception.
* @throws IllegalStateException If the BundleContext used to create this
- * {@code ServiceObjects} object is no longer valid.
+ * {@code ServiceObjects} object is no longer valid.
* @see #ungetService(Object)
*/
public S getService();
@@ -95,7 +96,6 @@ public interface ServiceObjects<S> {
/**
* Releases a service object for the {@link #getServiceReference()
* associated} service.
- *
* <p>
* This {@code ServiceObjects} object can be used to obtain multiple service
* objects for the associated service if the service has
@@ -105,28 +105,30 @@ public interface ServiceObjects<S> {
* as calling the {@link BundleContext#ungetService(ServiceReference)}
* method for the associated service. That is, only one, use-counted service
* object is available from this {@link ServiceObjects} object.
- *
* <p>
* For a prototype scope service, the following steps are required to
* release a service object:
* <ol>
* <li>If the associated service has been unregistered, this method returns
* without doing anything.</li>
- * <li>The
+ * <li>The use count for the specified service object is decremented by one.
+ * </li>
+ * <li>If the use count for the specified service object is now zero, the
* {@link PrototypeServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
* method is called to release the specified service object.</li>
* </ol>
- *
* <p>
* The specified service object must no longer be used and all references to
- * it should be destroyed after calling this method.
+ * it should be destroyed after calling this method when the use count has
+ * returned to zero.
*
* @param service A service object previously provided by this
- * {@code ServiceObjects} object.
+ * {@code ServiceObjects} object.
* @throws IllegalStateException If the BundleContext used to create this
- * {@code ServiceObjects} object is no longer valid.
- * @throws IllegalArgumentException If the specified service object was not
- * provided by this {@code ServiceObjects} object.
+ * {@code ServiceObjects} object is no longer valid.
+ * @throws IllegalArgumentException If the specified service object is
+ * {@code null} or was not provided by a {@code ServiceObjects}
+ * object for the associated service.
* @see #getService()
*/
public void ungetService(S service);
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServicePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServicePermission.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServicePermission.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServicePermission.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). 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.
@@ -51,7 +51,7 @@ import java.util.Set;
* to get the specific service.
*
* @ThreadSafe
- * @author $Id: ff7fc46dd623c0a09b49965048dd6faa2b111b39 $
+ * @author $Id: 8db61d0b1cadd57ab173cba677b6bfb353680800 $
*/
public final class ServicePermission extends BasicPermission {
@@ -207,7 +207,7 @@ public final class ServicePermission ext
if (reference == null) {
throw new IllegalArgumentException("reference must not be null");
}
- StringBuffer sb = new StringBuffer("(" + Constants.SERVICE_ID + "=");
+ StringBuilder sb = new StringBuilder("(" + Constants.SERVICE_ID + "=");
sb.append(reference.getProperty(Constants.SERVICE_ID));
sb.append(")");
return sb.toString();
@@ -350,9 +350,7 @@ public final class ServicePermission ext
try {
return FrameworkUtil.createFilter(filterString);
} catch (InvalidSyntaxException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException("invalid filter", e);
}
}
@@ -443,7 +441,7 @@ public final class ServicePermission ext
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
int mask = action_mask;
@@ -562,8 +560,9 @@ public final class ServicePermission ext
final Bundle bundle = service.getBundle();
if (bundle != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
- props.put("id", new Long(bundle.getBundleId()));
+ props.put("id", Long.valueOf(bundle.getBundleId()));
props.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
if (name != null) {
@@ -607,6 +606,7 @@ public final class ServicePermission ext
return service.getProperty(key);
}
+ @Override
public Set<Map.Entry<String, Object>> entrySet() {
if (entries != null) {
return entries;
@@ -632,14 +632,17 @@ public final class ServicePermission ext
this.v = value;
}
+ @Override
public String getKey() {
return k;
}
+ @Override
public Object getValue() {
return v;
}
+ @Override
public Object setValue(Object value) {
throw new UnsupportedOperationException();
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceReference.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceReference.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceReference.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/ServiceReference.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.osgi.framework;
import java.util.Dictionary;
+
import org.osgi.annotation.versioning.ProviderType;
/**
@@ -49,7 +50,7 @@ import org.osgi.annotation.versioning.Pr
* @see BundleContext#getService(ServiceReference)
* @see BundleContext#getServiceObjects(ServiceReference)
* @ThreadSafe
- * @author $Id: a56f8df70e8c74a76a1ef02b714b4612bc064ecc $
+ * @author $Id: 1454244c30992b7a52ac3838b03bc584c3495816 $
*/
@ProviderType
public interface ServiceReference<S> extends Comparable<Object> {
@@ -179,5 +180,36 @@ public interface ServiceReference<S> ext
* instance as this {@code ServiceReference}.
* @since 1.4
*/
+ @Override
public int compareTo(Object reference);
+
+ /**
+ * Returns a copy of the properties of the service referenced by this
+ * {@code ServiceReference} object.
+ * <p>
+ * This method will continue to return the properties after the service has
+ * been unregistered. This is so references to unregistered services (for
+ * example, {@code ServiceReference} objects stored in the log) can still be
+ * interrogated.
+ * <p>
+ * The returned {@code Dictionary} object:
+ * <ul>
+ * <li>Must map property values by using property keys in a
+ * <i>case-insensitive manner</i>.</li>
+ * <li>Must return property keys is a <i>case-preserving</i> manner. This
+ * means that the keys must have the same case as the corresponding key in
+ * the properties {@code Dictionary} that was passed to the
+ * {@link BundleContext#registerService(String[],Object,Dictionary)} or
+ * {@link ServiceRegistration#setProperties(Dictionary)} methods.</li>
+ * <li>Is the property of the caller and can be modified by the caller but
+ * any changes are not reflected in the properties of the service.
+ * {@link ServiceRegistration#setProperties(Dictionary)} must be called to
+ * modify the properties of the service.</li>
+ * </ul>
+ *
+ * @return A copy of the properties of the service referenced by this
+ * {@code ServiceReference} object
+ * @since 1.9
+ */
+ public Dictionary<String,Object> getProperties();
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2015). 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.
@@ -59,9 +59,10 @@ import org.osgi.annotation.versioning.Co
* @since 1.1
* @see BundleEvent
* @ThreadSafe
- * @author $Id: 6b50c6c9d8b8b091928495eb036552773284b13a $
+ * @author $Id: e1555f69b0cba5d9d8b6ad51add3d9e02827ef66 $
*/
@ConsumerType
+@FunctionalInterface
public interface SynchronousBundleListener extends BundleListener {
// This is a marker interface
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2015). 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.
@@ -66,9 +66,10 @@ import org.osgi.framework.hooks.service.
* @see ServicePermission
* @ThreadSafe
* @since 1.7
- * @author $Id: c68fe7ab0c3461256613d22dd666f17f87597dfe $
+ * @author $Id: ed5080773ff2a67f5f2ebf98628b7f14be115f73 $
*/
@ConsumerType
+@FunctionalInterface
public interface UnfilteredServiceListener extends ServiceListener {
// This is a marker interface
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Version.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Version.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/Version.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2016). 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.
@@ -37,7 +37,7 @@ import java.util.StringTokenizer;
*
* @since 1.3
* @Immutable
- * @author $Id: c24d4d37a0657ac69de29085d2d290cbb0031c4a $
+ * @author $Id: 2a5e4b8c63928ffda304dfe523fc06df49c68eae $
*/
public class Version implements Comparable<Version> {
@@ -144,9 +144,8 @@ public class Version implements Comparab
}
}
} catch (NoSuchElementException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": invalid format");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException(
+ "invalid version \"" + version + "\": invalid format", e);
}
major = maj;
@@ -167,9 +166,8 @@ public class Version implements Comparab
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": non-numeric \"" + value + "\"");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException("invalid version \"" + version
+ + "\": non-numeric \"" + value + "\"", e);
}
}
@@ -319,7 +317,7 @@ public class Version implements Comparab
return s;
}
int q = qualifier.length();
- StringBuffer result = new StringBuffer(20 + q);
+ StringBuilder result = new StringBuilder(20 + q);
result.append(major);
result.append(SEPARATOR);
result.append(minor);
@@ -402,6 +400,7 @@ public class Version implements Comparab
* @throws ClassCastException If the specified object is not a
* {@code Version} object.
*/
+ @Override
public int compareTo(Version other) {
if (other == this) { // quicktest
return 0;
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/VersionRange.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/VersionRange.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/VersionRange.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/VersionRange.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2016). 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.
@@ -32,7 +32,7 @@ import java.util.StringTokenizer;
*
* @since 1.7
* @Immutable
- * @author $Id: 1f5fa660a1a42e83371fe0d2c61ae79ce1cb1710 $
+ * @author $Id: cc407ff6fb1d5252b61a033924e63b751880f580 $
*/
public class VersionRange {
@@ -170,9 +170,8 @@ public class VersionRange {
}
}
} catch (NoSuchElementException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException(
+ "invalid range \"" + range + "\": invalid format", e);
}
leftClosed = closedLeft;
@@ -193,9 +192,8 @@ public class VersionRange {
try {
return Version.valueOf(version);
} catch (IllegalArgumentException e) {
- IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage());
- iae.initCause(e);
- throw iae;
+ throw new IllegalArgumentException(
+ "invalid range \"" + range + "\": " + e.getMessage(), e);
}
}
@@ -385,12 +383,13 @@ public class VersionRange {
}
String leftVersion = left.toString();
if (right == null) {
- StringBuffer result = new StringBuffer(leftVersion.length() + 1);
+ StringBuilder result = new StringBuilder(leftVersion.length() + 1);
result.append(left.toString0());
return versionRangeString = result.toString();
}
String rightVerion = right.toString();
- StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5);
+ StringBuilder result = new StringBuilder(
+ leftVersion.length() + rightVerion.length() + 5);
result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN);
result.append(left.toString0());
result.append(ENDPOINT_DELIMITER);
@@ -475,7 +474,7 @@ public class VersionRange {
}
}
- StringBuffer result = new StringBuffer(128);
+ StringBuilder result = new StringBuilder(128);
final boolean needPresence = !leftClosed && ((right == null) || !rightClosed);
final boolean multipleTerms = needPresence || (right != null);
if (multipleTerms) {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java Fri Feb 23 15:11:00 2018
@@ -26,7 +26,7 @@ import org.osgi.framework.ServiceReferen
*
* <p>
* {@code ServiceReferenceDTO}s for all registered services can be obtained from
- * a {@link FrameworkDTO}. An installed Bundle can be adapted to provide a
+ * a {@link FrameworkDTO}. A started Bundle can be adapted to provide a
* {@code ServiceReferenceDTO[]} of the services registered by the Bundle. A
* {@code ServiceReferenceDTO} obtained from a framework must convert service
* property values which are not valid value types for DTOs to type
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2018). 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.
@@ -51,9 +51,8 @@ import org.osgi.framework.wiring.Framewo
* stop calling the resolver hook instance provided by the unregistered hook
* factory and the current resolve process must fail. If possible, an exception
* must be thrown to the caller of the API which triggered the resolve process.
- * In cases where the the caller is not available a framework event of type
- * error should be fired.</li>
- *
+ * In cases where the caller is not available a framework event of type error
+ * should be fired.</li>
* <li>For each registered hook factory call the
* {@link ResolverHookFactory#begin(Collection)} method to inform the hooks
* about a resolve process beginning and to obtain a Resolver Hook instance that
@@ -131,7 +130,7 @@ import org.osgi.framework.wiring.Framewo
*
* @see ResolverHookFactory
* @NotThreadSafe
- * @author $Id: 7b2a0a5dbec7b0e999112ae324d050fcf190fa5d $
+ * @author $Id: 6c1f3732d22b088e9f8a80c17e70e61862abf1c4 $
*/
@ConsumerType
public interface ResolverHook {
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2018). 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.
@@ -29,7 +29,7 @@ import org.osgi.framework.BundleContext;
* addition and removal.
*
* @ThreadSafe
- * @author $Id: 34bd086f723505e6ec22dadd9f0e47e92f80352b $
+ * @author $Id: b17e35a5cab84256d78ed9b749f9829d690a752d $
*/
@ConsumerType
public interface ListenerHook {
@@ -102,7 +102,7 @@ public interface ListenerHook {
* service listener. This method can be used to detect this rare
* occurrence.
*
- * @return {@code false} if the listener has not been been removed,
+ * @return {@code false} if the listener has not been removed,
* {@code true} otherwise.
*/
boolean isRemoved();
@@ -119,6 +119,7 @@ public interface ListenerHook {
* object and both objects refer to the same listener for a
* given addition and removal life cycle.
*/
+ @Override
boolean equals(Object obj);
/**
@@ -126,6 +127,7 @@ public interface ListenerHook {
*
* @return The hash code of this {@code ListenerInfo}.
*/
+ @Override
int hashCode();
}
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/launch/Framework.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/launch/Framework.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/launch/Framework.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/launch/Framework.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2018). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import org.osgi.framework.FrameworkListe
* instance.
*
* @ThreadSafe
- * @author $Id: 25b603f31ba381c47a8db8a9f2e006e13588877a $
+ * @author $Id: 7fa67978e59a43dfedd6e755ddfa5b1aa6ea9141 $
*/
@ProviderType
public interface Framework extends Bundle {
@@ -85,8 +85,8 @@ public interface Framework extends Bundl
* {@link #STARTING}, {@link #ACTIVE} or {@link #STOPPING} states.
*
* <p>
- * All framework events fired by this method method are also delivered to
- * the specified FrameworkListeners in the order they are specified before
+ * All framework events fired by this method are also delivered to the
+ * specified FrameworkListeners in the order they are specified before
* returning from this method. After returning from this method the
* specified listeners are no longer notified of framework events.
*
@@ -182,6 +182,7 @@ public interface Framework extends Bundl
* Environment supports permissions.
* @see "Start Level Specification"
*/
+ @Override
void start() throws BundleException;
/**
@@ -198,6 +199,7 @@ public interface Framework extends Bundl
* Environment supports permissions.
* @see #start()
*/
+ @Override
void start(int options) throws BundleException;
/**
@@ -233,6 +235,7 @@ public interface Framework extends Bundl
* Environment supports permissions.
* @see "Start Level Specification"
*/
+ @Override
void stop() throws BundleException;
/**
@@ -250,6 +253,7 @@ public interface Framework extends Bundl
* Environment supports permissions.
* @see #stop()
*/
+ @Override
void stop(int options) throws BundleException;
/**
@@ -263,6 +267,7 @@ public interface Framework extends Bundl
* {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
* Environment supports permissions.
*/
+ @Override
void uninstall() throws BundleException;
/**
@@ -284,6 +289,7 @@ public interface Framework extends Bundl
* {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
* Environment supports permissions.
*/
+ @Override
void update() throws BundleException;
/**
@@ -301,6 +307,7 @@ public interface Framework extends Bundl
* {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
* Environment supports permissions.
*/
+ @Override
void update(InputStream in) throws BundleException;
/**
@@ -310,6 +317,7 @@ public interface Framework extends Bundl
* @return 0.
* @see Bundle#getBundleId()
*/
+ @Override
long getBundleId();
/**
@@ -324,6 +332,7 @@ public interface Framework extends Bundl
* @see Bundle#getLocation()
* @see Constants#SYSTEM_BUNDLE_LOCATION
*/
+ @Override
String getLocation();
/**
@@ -337,6 +346,7 @@ public interface Framework extends Bundl
* @see Bundle#getSymbolicName()
* @see Constants#SYSTEM_BUNDLE_SYMBOLICNAME
*/
+ @Override
String getSymbolicName();
/**
@@ -347,6 +357,7 @@ public interface Framework extends Bundl
* @return {@code null} as a framework implementation does not have a proper
* bundle from which to return entry paths.
*/
+ @Override
Enumeration<String> getEntryPaths(String path);
/**
@@ -357,6 +368,7 @@ public interface Framework extends Bundl
* @return {@code null} as a framework implementation does not have a proper
* bundle from which to return an entry.
*/
+ @Override
URL getEntry(String path);
/**
@@ -371,6 +383,7 @@ public interface Framework extends Bundl
* @return The time when the set of bundles in this framework was last
* modified.
*/
+ @Override
long getLastModified();
/**
@@ -383,6 +396,7 @@ public interface Framework extends Bundl
* @return {@code null} as a framework implementation does not have a proper
* bundle from which to return entries.
*/
+ @Override
Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
/**
@@ -402,5 +416,6 @@ public interface Framework extends Bundl
* @return The object, of the specified type, to which this Framework has
* been adapted or {@code null} if this Framework cannot be adapted
*/
+ @Override
<A> A adapt(Class<A> type);
}
Modified: felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java?rev=1825132&r1=1825072&r2=1825132&view=diff
==============================================================================
--- felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java (original)
+++ felix/trunk/osgi-r7/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java Fri Feb 23 15:11:00 2018
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
@@ -66,7 +66,7 @@ import org.osgi.resource.Namespace;
* capability.
*
* @Immutable
- * @author $Id: a7cbf04c393bfaaa7515804a8ab6b9ebfd72fbe5 $
+ * @author $Id: 9f789ca25dafcf9d5e9a4f45d377f943d62b134a $
*/
public final class HostNamespace extends AbstractWiringNamespace {