Package org.codice.ddf.platform.util
Class SortedServiceList<T>
java.lang.Object
org.codice.ddf.platform.util.SortedServiceList<T>
- Type Parameters:
T-
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,SequencedCollection<T>
This utility object sorts Services by their service rankings first and then breaks ties with
service ids.
It is an implementation of List but is backed by a sorted TreeMap of invalid input: '<'@link ServiceReference, T> where the ServiceReference objects are what is used to maintain the list order but the
objects passed by this List to clients are the actual service objects and not
the service references.
For instance if this was a SortedServiceListinvalid input: '<'@link AuthenticationHandler> object, then in the
internal TreeMap the ServiceReference objects would be maintained as
keys but AuthenticationHandler objects would be what is passed to clients. Therefore, a call to a
populated SortedServiceList list such as list.get(0) would return the first
AuthenticationHandler object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUnsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanUnsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanaddAll(int arg0, Collection<? extends T> arg1) Unsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanaddAll(Collection<? extends T> arg0) Unsupported operation, throws an UnsupportedOperationException since this list is read-only.voidbindPlugin(org.osgi.framework.ServiceReference ref) Adds the newly bound OSGi service and its service reference to the internally maintained and sorted serviceMap.voidclear()Unsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanbooleancontainsAll(Collection<?> arg0) get(int arg0) protected org.osgi.framework.BundleContextintbooleanisEmpty()iterator()intlastIndexOf(Object arg0) listIterator(int arg0) remove(int arg0) Unsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanUnsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanremoveAll(Collection<?> arg0) Unsupported operation, throws an UnsupportedOperationException since this list is read-only.booleanretainAll(Collection<?> arg0) Unsupported operation, throws an UnsupportedOperationException since this list is read-only.Unsupported operation, throws an UnsupportedOperationException since this list is read-only.intsize()subList(int arg0, int arg1) Object[]toArray()<T> T[]toArray(T[] arg0) voidunbindPlugin(org.osgi.framework.ServiceReference ref) Removes the newly bound OSGi service and its service reference to the internally maintained and sorted serviceMap.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Constructor Details
-
SortedServiceList
public SortedServiceList()Constructor accepting OSGi bundle context. This constructor is currently invoked by the ddf-catalog-framework bundle's blueprint and the fanout-catalogframework bundle's blueprint upon framework construction.
-
-
Method Details
-
getContext
protected org.osgi.framework.BundleContext getContext() -
bindPlugin
public void bindPlugin(org.osgi.framework.ServiceReference ref) Adds the newly bound OSGi service and its service reference to the internally maintained and sorted serviceMap. This method is invoked when a plugin is bound (created/installed). This includes preingest, postingest, prequery, postquery, preresource, postresource plugins.- Parameters:
ref- the OSGi service reference
-
unbindPlugin
public void unbindPlugin(org.osgi.framework.ServiceReference ref) Removes the newly bound OSGi service and its service reference to the internally maintained and sorted serviceMap. This method is invoked when a plugin is unbound (removed/uninstalled). This includes preingest, postingest, prequery, postquery, preresource, postresource plugins.- Parameters:
ref- the OSGi service reference
-
add
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
add
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
addAll
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
addAll
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
clear
public void clear()Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceList<T>
-
get
-
indexOf
-
isEmpty
public boolean isEmpty() -
iterator
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
remove
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
remove
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
removeAll
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
retainAll
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
set
Unsupported operation, throws an UnsupportedOperationException since this list is read-only. -
size
public int size() -
subList
-
toArray
-
toArray
public <T> T[] toArray(T[] arg0)
-