org.apache.felix.ipojo.handler.temporal
Class ServiceCollection

java.lang.Object
  extended by org.apache.felix.ipojo.handler.temporal.ServiceCollection
All Implemented Interfaces:
Collection

public class ServiceCollection
extends Object
implements Collection

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 onTimeout policies are executed when the Collection.iterator(), Collection.toArray(Object[]) and Collection.toArray() methods are called. 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 when the timeout is reached, the policies act as follows:

Author:
Felix Project Team

Constructor Summary
ServiceCollection(TemporalDependency dep)
          Creates a Service Collection.
 
Method Summary
 boolean add(Object o)
          Unsupported method.
 boolean addAll(Collection c)
          Unsupported method.
 void clear()
          Unsupported method.
 boolean contains(Object o)
          Checks if the wrapped temporal dependencies has always access to the given service object.The method allows knowing if the provider returning the service object has leaved.
 boolean containsAll(Collection c)
          Checks if the wrapped temporal dependencies has always access to the given service objects.The method allows knowing if providers returning the service objects have leaved.
 boolean isEmpty()
          Checks if at least one provider matching with the dependency is available.
 Iterator iterator()
          Gets an iterator on the actual list of available service objects.
 boolean remove(Object o)
          Unsupported method.
 boolean removeAll(Collection c)
          Unsupported method.
 boolean retainAll(Collection c)
          Unsupported method.
 int size()
          Gets the number of available providers.
 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.Collection
equals, hashCode
 

Constructor Detail

ServiceCollection

public ServiceCollection(TemporalDependency dep)
Creates a Service Collection.

Parameters:
dep - the wrapped temporal dependencies
Method Detail

add

public boolean add(Object o)
Unsupported method.

Specified by:
add in interface Collection
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
Parameters:
c - an object
Returns:
N/A
See Also:
Collection.addAll(java.util.Collection)

clear

public void clear()
Unsupported method.

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

contains

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

Specified by:
contains in interface Collection
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 temporal dependencies has always access to the given service objects.The method allows knowing if providers returning the service objects have leaved.

Specified by:
containsAll in interface Collection
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
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 actual list of available service objects. This method applies on timeout policies is no services are available after the timeout. The returned iterator iterates on a cached copy of the service objects.

Specified by:
iterator in interface Collection
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
Parameters:
o - a object
Returns:
N/A
See Also:
Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(Collection c)
Unsupported method.

Specified by:
removeAll in interface Collection
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
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
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
Returns:
a array containing available service objects. depending on the timeout policy, this array can also be null, be empty, or can contain only one element (a default-implementation object, or a nullable object).
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
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. depending on the timeout policy, this array can also be null, be empty, or can contain only one element (a default-implementation object, or a nullable object).
See Also:
Collection.toArray(java.lang.Object[])


Copyright © 2011 Apache Software Foundation. All Rights Reserved.