Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java5
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceFactoryUse.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java9
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java5
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java20
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java17
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java7
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java19
8 files changed, 84 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java
index b8bb40dab..1a6638366 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/FilteredServiceListener.java
@@ -76,6 +76,7 @@ class FilteredServiceListener implements ServiceListener, ListenerHook.ListenerI
*
* @param event The <code>ServiceEvent</code> object.
*/
+ @Override
public void serviceChanged(ServiceEvent event) {
ServiceReferenceImpl<?> reference = (ServiceReferenceImpl<?>) event.getServiceReference();
@@ -145,6 +146,7 @@ class FilteredServiceListener implements ServiceListener, ListenerHook.ListenerI
*
* @return The string representation of this listener.
*/
+ @Override
public String toString() {
String filterString = getFilter();
if (filterString == null) {
@@ -158,6 +160,7 @@ class FilteredServiceListener implements ServiceListener, ListenerHook.ListenerI
* @return The context of the bundle which added the service listener.
* @see org.osgi.framework.hooks.service.ListenerHook.ListenerInfo#getBundleContext()
*/
+ @Override
public BundleContext getBundleContext() {
return context;
}
@@ -168,6 +171,7 @@ class FilteredServiceListener implements ServiceListener, ListenerHook.ListenerI
* be <code>null</code> if the listener was added without a filter.
* @see org.osgi.framework.hooks.service.ListenerHook.ListenerInfo#getFilter()
*/
+ @Override
public String getFilter() {
if (filter != null) {
return filter.toString();
@@ -185,6 +189,7 @@ class FilteredServiceListener implements ServiceListener, ListenerHook.ListenerI
* @return <code>false</code> if the listener has not been been removed,
* <code>true</code> otherwise.
*/
+ @Override
public boolean isRemoved() {
return removed;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceFactoryUse.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceFactoryUse.java
index 4865b3cd3..cd55b5b54 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceFactoryUse.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceFactoryUse.java
@@ -211,6 +211,7 @@ public class ServiceFactoryUse<S> extends ServiceUse<S> {
final S service;
try {
service = AccessController.doPrivileged(new PrivilegedAction<S>() {
+ @Override
public S run() {
return factory.getService(context.getBundleImpl(), registration);
}
@@ -259,6 +260,7 @@ public class ServiceFactoryUse<S> extends ServiceUse<S> {
void factoryUngetService(final S service) {
try {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
factory.ungetService(context.getBundleImpl(), registration, service);
return null;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java
index 82d6ab97c..a1887a767 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceReferenceImpl.java
@@ -80,6 +80,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
* @return The property value to which the key is mapped; <code>null</code>
* if there is no property named after the key.
*/
+ @Override
public Object getProperty(String key) {
return registration.getProperty(key);
}
@@ -104,6 +105,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
*
* @return An array of property keys.
*/
+ @Override
public String[] getPropertyKeys() {
return registration.getPropertyKeys();
}
@@ -122,6 +124,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
* that service has already been unregistered.
* @see BundleContext#registerService(String[],Object,java.util.Dictionary)
*/
+ @Override
public Bundle getBundle() {
return registration.getBundle();
}
@@ -138,6 +141,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
*
* @since 1.1
*/
+ @Override
public Bundle[] getUsingBundles() {
return registration.getUsingBundles();
}
@@ -169,6 +173,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
*
* @since 1.3
*/
+ @Override
public boolean isAssignableTo(Bundle bundle, String className) {
return registration.isAssignableTo(bundle, className);
}
@@ -198,6 +203,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
* greater than the specified <code>ServiceReference</code>.
* @since 1.4
*/
+ @Override
public int compareTo(Object object) {
ServiceRegistrationImpl<?> other = ((ServiceReferenceImpl<?>) object).registration;
@@ -225,6 +231,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
*
* @return a hash code value for this object.
*/
+ @Override
public int hashCode() {
return registration.hashCode();
}
@@ -236,6 +243,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
* @return <code>true</code> if this object is the same as the obj
* argument; <code>false</code> otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -255,6 +263,7 @@ public class ServiceReferenceImpl<S> implements ServiceReference<S> {
*
* @return String
*/
+ @Override
public String toString() {
return registration.toString();
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
index 49b7f7dba..9c9f09bd0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
@@ -152,6 +152,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
* @exception IllegalArgumentException If the <tt>properties</tt>
* parameter contains case variants of the same key name.
*/
+ @Override
public void setProperties(Dictionary<String, ?> props) {
final ServiceReferenceImpl<S> ref;
final Map<String, Object> previousProperties;
@@ -201,6 +202,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
* this ServiceRegistration has already been unregistered.
* @see BundleContextImpl#ungetService
*/
+ @Override
public void unregister() {
final ServiceReferenceImpl<S> ref;
synchronized (registry) {
@@ -273,6 +275,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
* this ServiceRegistration has already been unregistered.
* @return A {@link ServiceReferenceImpl} object.
*/
+ @Override
public ServiceReference<S> getReference() {
return getReferenceImpl();
}
@@ -691,6 +694,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
*
* @return String representation of this object.
*/
+ @Override
public String toString() {
int size = clazzes.length;
StringBuilder sb = new StringBuilder(50 * size);
@@ -724,6 +728,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
* <code>ServiceRegistrationImpl</code> is greater than, equal to, or
* less than the specified <code>ServiceRegistrationImpl</code>.
*/
+ @Override
public int compareTo(ServiceRegistrationImpl<?> other) {
final int thisRanking = this.getRanking();
final int otherRanking = other.getRanking();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
index 63d22c60e..5d4da714c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
@@ -804,6 +804,7 @@ public class ServiceRegistry {
publishServiceEventPrivileged(event);
} else {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
publishServiceEventPrivileged(event);
return null;
@@ -1107,6 +1108,7 @@ public class ServiceRegistry {
*/
static String checkServiceClass(final String[] clazzes, final Object serviceObject) {
ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ @Override
public ClassLoader run() {
return serviceObject.getClass().getClassLoader();
}
@@ -1164,6 +1166,7 @@ public class ServiceRegistry {
notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result);
} else {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result);
return null;
@@ -1177,16 +1180,19 @@ public class ServiceRegistry {
Debug.println("notifyServiceFindHooks(" + context.getBundleImpl() + "," + clazz + "," + filterstring + "," + allservices + "," + result + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}
notifyHooksPrivileged(new HookContext() {
+ @Override
public void call(Object hook, ServiceRegistration<?> hookRegistration) throws Exception {
if (hook instanceof FindHook) {
((FindHook) hook).find(context, clazz, filterstring, allservices, result);
}
}
+ @Override
public String getHookClassName() {
return findHookName;
}
+ @Override
public String getHookMethodName() {
return "find"; //$NON-NLS-1$
}
@@ -1212,16 +1218,19 @@ public class ServiceRegistry {
}
notifyHooksPrivileged(new HookContext() {
@SuppressWarnings("deprecation")
+ @Override
public void call(Object hook, ServiceRegistration<?> hookRegistration) throws Exception {
if (hook instanceof EventHook) {
((EventHook) hook).event(event, result);
}
}
+ @Override
public String getHookClassName() {
return eventHookName;
}
+ @Override
public String getHookMethodName() {
return "event"; //$NON-NLS-1$
}
@@ -1246,16 +1255,19 @@ public class ServiceRegistry {
Debug.println("notifyServiceEventListenerHooks(" + event.getType() + ":" + event.getServiceReference() + "," + result + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
notifyHooksPrivileged(new HookContext() {
+ @Override
public void call(Object hook, ServiceRegistration<?> hookRegistration) throws Exception {
if (hook instanceof EventListenerHook) {
((EventListenerHook) hook).event(event, result);
}
}
+ @Override
public String getHookClassName() {
return eventListenerHookName;
}
+ @Override
public String getHookMethodName() {
return "event"; //$NON-NLS-1$
}
@@ -1324,6 +1336,7 @@ public class ServiceRegistry {
notifyNewListenerHookPrivileged(registration);
} else {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
notifyNewListenerHookPrivileged(registration);
return null;
@@ -1350,16 +1363,19 @@ public class ServiceRegistry {
final Collection<ListenerInfo> listeners = Collections.unmodifiableCollection(addedListeners);
notifyHookPrivileged(systemBundleContext, registration, new HookContext() {
+ @Override
public void call(Object hook, ServiceRegistration<?> hookRegistration) throws Exception {
if (hook instanceof ListenerHook) {
((ListenerHook) hook).added(listeners);
}
}
+ @Override
public String getHookClassName() {
return listenerHookName;
}
+ @Override
public String getHookMethodName() {
return "added"; //$NON-NLS-1$
}
@@ -1386,6 +1402,7 @@ public class ServiceRegistry {
notifyListenerHooksPrivileged(listeners, added);
} else {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
notifyListenerHooksPrivileged(listeners, added);
return null;
@@ -1402,6 +1419,7 @@ public class ServiceRegistry {
}
notifyHooksPrivileged(new HookContext() {
+ @Override
public void call(Object hook, ServiceRegistration<?> hookRegistration) throws Exception {
if (hook instanceof ListenerHook) {
if (added) {
@@ -1412,10 +1430,12 @@ public class ServiceRegistry {
}
}
+ @Override
public String getHookClassName() {
return listenerHookName;
}
+ @Override
public String getHookMethodName() {
return added ? "added" : "removed"; //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
index 59fbb049a..43e41bd11 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
@@ -95,14 +95,17 @@ public class ShrinkableCollection<E> implements Collection<E> {
return true;
}
+ @Override
public boolean add(E e) {
throw new UnsupportedOperationException();
}
+ @Override
public boolean addAll(Collection<? extends E> c) {
throw new UnsupportedOperationException();
}
+ @Override
public void clear() {
collection.clear();
for (Collection<? extends E> c : list) {
@@ -110,18 +113,22 @@ public class ShrinkableCollection<E> implements Collection<E> {
}
}
+ @Override
public boolean contains(Object o) {
return collection.contains(o);
}
+ @Override
public boolean containsAll(Collection<?> c) {
return collection.containsAll(c);
}
+ @Override
public boolean isEmpty() {
return collection.isEmpty();
}
+ @Override
public Iterator<E> iterator() {
@SuppressWarnings("unchecked")
final Iterator<E> iter = (Iterator<E>) collection.iterator();
@@ -132,15 +139,18 @@ public class ShrinkableCollection<E> implements Collection<E> {
return new Iterator<E>() {
private E last;
+ @Override
public boolean hasNext() {
return iter.hasNext();
}
+ @Override
public E next() {
last = iter.next();
return last;
}
+ @Override
public void remove() {
iter.remove();
for (Collection<? extends E> c : collections) {
@@ -150,6 +160,7 @@ public class ShrinkableCollection<E> implements Collection<E> {
};
}
+ @Override
public boolean remove(Object o) {
final boolean result = collection.remove(o);
if (result) {
@@ -160,6 +171,7 @@ public class ShrinkableCollection<E> implements Collection<E> {
return result;
}
+ @Override
public boolean removeAll(Collection<?> c) {
final boolean result = collection.removeAll(c);
if (result) {
@@ -170,6 +182,7 @@ public class ShrinkableCollection<E> implements Collection<E> {
return result;
}
+ @Override
public boolean retainAll(Collection<?> c) {
final boolean result = collection.retainAll(c);
if (result) {
@@ -180,18 +193,22 @@ public class ShrinkableCollection<E> implements Collection<E> {
return result;
}
+ @Override
public int size() {
return collection.size();
}
+ @Override
public Object[] toArray() {
return collection.toArray();
}
+ @Override
public <T> T[] toArray(T[] var0) {
return collection.toArray(var0);
}
+ @Override
public String toString() {
return collection.toString();
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java
index ed177886b..9df2bb5df 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java
@@ -26,18 +26,22 @@ public class ShrinkableEntrySetValueCollection<E> extends AbstractCollection<E>
entrySet = e;
}
+ @Override
public void clear() {
entrySet.clear();
}
+ @Override
public boolean isEmpty() {
return entrySet.isEmpty();
}
+ @Override
public Iterator<E> iterator() {
return new ValueIterator<>(entrySet.iterator());
}
+ @Override
public int size() {
return entrySet.size();
}
@@ -52,15 +56,18 @@ public class ShrinkableEntrySetValueCollection<E> extends AbstractCollection<E>
iter = i;
}
+ @Override
public boolean hasNext() {
return iter.hasNext();
}
+ @Override
public E next() {
final Map.Entry<?, ? extends E> entry = iter.next();
return entry.getValue();
}
+ @Override
public void remove() {
iter.remove();
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java
index d4033f7fd..b3190bad0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java
@@ -28,6 +28,7 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
values = null;
}
+ @Override
public void clear() {
map.clear();
if (values != null) {
@@ -35,10 +36,12 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
}
}
+ @Override
public boolean containsKey(Object key) {
return map.containsKey(key);
}
+ @Override
public boolean containsValue(Object value) {
/* Since values are collections and the collection has identity equality,
* there is no way any value could be contained in this map unless that
@@ -50,10 +53,12 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
return values.containsValue(value);
}
+ @Override
public Set<Map.Entry<K, Collection<V>>> entrySet() {
return new EntrySet();
}
+ @Override
public Collection<V> get(Object key) {
Collection<V> value = null;
if (values != null) {
@@ -73,10 +78,12 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
return value;
}
+ @Override
public boolean isEmpty() {
return map.isEmpty();
}
+ @Override
public Collection<V> remove(Object key) {
Set<? extends Map.Entry<?, ? extends V>> entrySet = map.remove(key);
Collection<V> value = null;
@@ -89,6 +96,7 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
return value;
}
+ @Override
public int size() {
return map.size();
}
@@ -101,10 +109,12 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
super();
}
+ @Override
public Iterator<Map.Entry<K, Collection<V>>> iterator() {
return new EntryIterator();
}
+ @Override
public int size() {
return ShrinkableValueCollectionMap.this.size();
}
@@ -121,15 +131,18 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
iter = map.keySet().iterator();
}
+ @Override
public boolean hasNext() {
return iter.hasNext();
}
+ @Override
public Map.Entry<K, Collection<V>> next() {
last = iter.next();
return new Entry(last);
}
+ @Override
public void remove() {
iter.remove();
if (values != null) {
@@ -149,10 +162,12 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
key = k;
}
+ @Override
public K getKey() {
return key;
}
+ @Override
public Collection<V> getValue() {
if (value == null) {
value = ShrinkableValueCollectionMap.this.get(key);
@@ -160,18 +175,22 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
return value;
}
+ @Override
public Collection<V> setValue(Collection<V> value) {
throw new UnsupportedOperationException(); // entries cannot be modified.
}
+ @Override
public String toString() {
return getKey() + "=" + getValue(); //$NON-NLS-1$
}
+ @Override
public int hashCode() {
return hash(getKey()) ^ hash(getValue());
}
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;

Back to the top