org.apache.felix.ipojo.handlers.dependency
Class ServiceCollection

java.lang.Object
  extended by org.apache.felix.ipojo.handlers.dependency.ServiceCollection
All Implemented Interfaces:
Collection, List, Set

public class ServiceCollection
extends Object
implements Collection, List, Set

Maintains a service object collection. This collection wrap the temporal dependency to be accessible from a Collection, that can be passed to helper objects (Collaborators). The Collection.iterator() method returns an Iterator iterating on a cached copy of available service objects. In the case that there are no available services, the policies act as follows:

Author:
Felix Project Team

Constructor Summary
ServiceCollection(Dependency dep)
          Creates a Service Collection.
 
Method Summary
 void add(int index, Object obj)
          Unsupported method.
 boolean add(Object o)
          Unsupported method.
 boolean addAll(Collection c)
          Unsupported method.
 boolean addAll(int index, Collection c)
          Unsupported method.
 void clear()
          Unsupported method.
 boolean contains(Object o)
          Checks if the wrapped dependency has always access to the given service object.The method allows knowing if the provider returning the service object has left.
 boolean containsAll(Collection c)
          Checks if the wrapped dependencies has always access to the given service objects.The method allows knowing if providers returning the service objects have left.
 Object get(int index)
          Gets the object stored at the given index.
 int indexOf(Object o)
          Gets the index of the given object in the current collection.
 boolean isEmpty()
          Checks if at least one provider matching with the dependency is available.
 Iterator iterator()
          Gets an iterator on the current list of available service objects.
 int lastIndexOf(Object o)
          Gets the last index of the given object in the current collection.
 ListIterator listIterator()
          Gets a list iterator on the current list of available service objects.
 ListIterator listIterator(int index)
          Unsupported Method.
 Object remove(int index)
          Unsupported method.
 boolean remove(Object o)
          Unsupported method.
 boolean removeAll(Collection c)
          Unsupported method.
 boolean retainAll(Collection c)
          Unsupported method.
 Object set(int arg0, Object arg1)
          Unsupported Method.
 int size()
          Gets the number of available providers.
 List subList(int fromIndex, int toIndex)
          Returns a sublist from the current list.
 Object[] toArray()
          Returns an array containing available service objects.
 Object[] toArray(Object[] a)
          Returns an array containing available service objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

ServiceCollection

public ServiceCollection(Dependency dep)
Creates a Service Collection.

Parameters:
dep - the wrapped dependency
Method Detail

add

public boolean add(Object o)
Unsupported method.

Specified by:
add in interface Collection
Specified by:
add in interface List
Specified by:
add in interface Set
Parameters:
o - an object
Returns:
N/A
See Also:
Collection.add(java.lang.Object)

addAll

public boolean addAll(Collection c)
Unsupported method.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Specified by:
addAll in interface Set
Parameters:
c - an object
Returns:
N/A
See Also:
Collection.addAll(java.util.Collection)

add

public void add(int index,
                Object obj)
Unsupported method.

Specified by:
add in interface List
Parameters:
index - an index
obj - an object
See Also:
List.add(int, java.lang.Object)

addAll

public boolean addAll(int index,
                      Collection c)
Unsupported method.

Specified by:
addAll in interface List
Parameters:
index - an index
c - an object
Returns:
N/A
See Also:
List.addAll(int, java.util.Collection)

clear

public void clear()
Unsupported method.

Specified by:
clear in interface Collection
Specified by:
clear in interface List
Specified by:
clear in interface Set
See Also:
Collection.clear()

contains

public boolean contains(Object o)
Checks if the wrapped dependency has always access to the given service object.The method allows knowing if the provider returning the service object has left.

Specified by:
contains in interface Collection
Specified by:
contains in interface List
Specified by:
contains in interface Set
Parameters:
o - the service object
Returns:
true if the object is still available, false otherwise.
See Also:
Collection.contains(java.lang.Object)

containsAll

public boolean containsAll(Collection c)
Checks if the wrapped dependencies has always access to the given service objects.The method allows knowing if providers returning the service objects have left.

Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List
Specified by:
containsAll in interface Set
Parameters:
c - the set of service object
Returns:
true if the objects are still available, false otherwise.
See Also:
Collection.contains(java.lang.Object)

isEmpty

public boolean isEmpty()
Checks if at least one provider matching with the dependency is available.

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List
Specified by:
isEmpty in interface Set
Returns:
true if one provider or more satisfying the dependency are available. Otherwise, returns false
See Also:
Collection.isEmpty()

iterator

public Iterator iterator()
Gets an iterator on the current list of available service objects. The returned iterator iterates on a cached copy of the service objects.

Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Specified by:
iterator in interface Set
Returns:
a iterator giving access to service objects.
See Also:
Collection.iterator()

remove

public boolean remove(Object o)
Unsupported method.

Specified by:
remove in interface Collection
Specified by:
remove in interface List
Specified by:
remove in interface Set
Parameters:
o - a object
Returns:
N/A
See Also:
Collection.remove(java.lang.Object)

remove

public Object remove(int index)
Unsupported method.

Specified by:
remove in interface List
Parameters:
index - the index
Returns:
N/A
See Also:
Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(Collection c)
Unsupported method.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Specified by:
removeAll in interface Set
Parameters:
c - a set of objects
Returns:
N/A
See Also:
Collection.removeAll(java.util.Collection)

retainAll

public boolean retainAll(Collection c)
Unsupported method.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Specified by:
retainAll in interface Set
Parameters:
c - a set of objects
Returns:
N/A
See Also:
Collection.retainAll(java.util.Collection)

size

public int size()
Gets the number of available providers.

Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in interface Set
Returns:
the number of matching service providers.
See Also:
Collection.size()

toArray

public Object[] toArray()
Returns an array containing available service objects. This method executed on timeout policies if no matching providers when the timeout is reached.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Specified by:
toArray in interface Set
Returns:
a array containing available service objects.
See Also:
Collection.toArray()

toArray

public Object[] toArray(Object[] a)
Returns an array containing available service objects. This method executed on timeout policies if no matching providers when the timeout is reached.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Specified by:
toArray in interface Set
Parameters:
a - the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
a array containing available service objects.
See Also:
Collection.toArray(java.lang.Object[])

get

public Object get(int index)
Gets the object stored at the given index.

Specified by:
get in interface List
Parameters:
index - the index
Returns:
the service object
See Also:
List.get(int)

indexOf

public int indexOf(Object o)
Gets the index of the given object in the current collection.

Specified by:
indexOf in interface List
Parameters:
o - the object
Returns:
the index of the object of -1 if not found.
See Also:
List.indexOf(java.lang.Object)

lastIndexOf

public int lastIndexOf(Object o)
Gets the last index of the given object in the current collection.

Specified by:
lastIndexOf in interface List
Parameters:
o - the object
Returns:
the index of the object of -1 if not found.
See Also:
List.lastIndexOf(java.lang.Object)

listIterator

public ListIterator listIterator()
Gets a list iterator on the current list of available service objects. The returned iterator iterates on a cached copy of the service objects.

Specified by:
listIterator in interface List
Returns:
a iterator giving access to service objects.
See Also:
List.listIterator()

listIterator

public ListIterator listIterator(int index)
Unsupported Method.

Specified by:
listIterator in interface List
Parameters:
index - an index
Returns:
N/A
See Also:
List.listIterator(int)

set

public Object set(int arg0,
                  Object arg1)
Unsupported Method.

Specified by:
set in interface List
Parameters:
arg0 - an index
arg1 - an object
Returns:
N/A
See Also:
java.util.List#set(int, E)

subList

public List subList(int fromIndex,
                    int toIndex)
Returns a sublist from the current list.

Specified by:
subList in interface List
Parameters:
fromIndex - the index of the list beginning
toIndex - the index of the list end
Returns:
the sub-list
See Also:
List.subList(int, int)


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.