org.ow2.weblab.services.iterator
Class InterfacesMappingSingleton

java.lang.Object
  extended by org.ow2.weblab.services.iterator.InterfacesMappingSingleton

public class InterfacesMappingSingleton
extends java.lang.Object

This class is a singleton in charge of the mapping between the two interfaces of the service (Configurable and QueueManager).

Author:
ymombrun
Date:
2011-08-17

Method Summary
 java.util.Iterator<?> addToMap(java.lang.String usageContext, java.util.Iterator<?> fileIterator)
          Add to the configuration map this mapping between usageContext and fileIterator.
 void clearMap()
          Removes every mapping from the configuration map.
static InterfacesMappingSingleton getInstance()
          Get the existing instance of MappingSingleton or initialise it.
 java.util.Iterator<?> getIterator(java.lang.String usageContext)
          Get the iterator associated to this usageContext or null if not configured.
 boolean isConfigured(java.lang.String usageContext)
          Check if the usageContext in parameter has been configured.
 void removeConfiguration(java.lang.String usageContext)
          Removes usageContext from the configuration map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static InterfacesMappingSingleton getInstance()
Get the existing instance of MappingSingleton or initialise it.

Returns:
The singleton

addToMap

public java.util.Iterator<?> addToMap(java.lang.String usageContext,
                                      java.util.Iterator<?> fileIterator)
Add to the configuration map this mapping between usageContext and fileIterator.

Parameters:
usageContext - A non-null UsageContext used for the configuration.
fileIterator - The file iterator generated by commons-io, to be associated with usageContext.
Returns:
The previous value associated with usageContext, or null if there was no mapping for usageContext.

clearMap

public void clearMap()
Removes every mapping from the configuration map. Bug before, for every mapping, it consumes their iterator till their end to eases their collection by the garbage collector.


getIterator

public java.util.Iterator<?> getIterator(java.lang.String usageContext)
Get the iterator associated to this usageContext or null if not configured.

Parameters:
usageContext - A non-null UsageContext previously configured.
Returns:
The iterator configured with the usageContext or null if not configured.

isConfigured

public boolean isConfigured(java.lang.String usageContext)
Check if the usageContext in parameter has been configured.

Parameters:
usageContext - The String to test existence in the configuration map.
Returns:
Whether usageContext is in the map.

removeConfiguration

public void removeConfiguration(java.lang.String usageContext)
Removes usageContext from the configuration map. If a mapping was defined, it consumes the iterator till it's end to eases its collection by the garbage collector.

Parameters:
usageContext - A non-null UsageContext to remove the configuration.


Copyright © 2004-2011. All Rights Reserved.