Package Functions

alma.acs.container.ComponentMap Class Reference

List of all members.

Package Functions

 ComponentMap (Logger logger)
synchronized boolean reserveComponent (int compHandle)
synchronized ComponentAdapter put (int compHandle, ComponentAdapter compAdapter)
synchronized void sort (int[] sortedHandles)
synchronized ComponentAdapter remove (int compHandle)
synchronized ComponentAdapter get (int compHandle)
synchronized ComponentAdapter[] getComponentAdapters (int[] compHandles)
ComponentAdapter getComponentByNameAndType (String name, String type)
synchronized ComponentAdapter[] getAllComponentAdapters ()
synchronized int[] getAllHandles ()

Detailed Description

Synchronized type-safe map for loaded components. Keys are component handles, values are ComponentAdapters. The map entries are sorted by insertion order, or by the handle sequence given to sort(int[]).

Note that it is not sufficient to use something like Collections.synchronizedMap(new HashMap()), since reading out the keys or values of such a map with an iterator is still backed by the original instance and therefore not thread-safe. See Collections#synchronizedMap(java.util.Map).

Author:
hsommer created Oct 30, 2003 10:04:28 AM

Constructor & Destructor Documentation

alma.acs.container.ComponentMap.ComponentMap ( Logger  logger  )  [package]

Member Function Documentation

synchronized ComponentAdapter alma.acs.container.ComponentMap.get ( int  compHandle  )  [package]

Returns the component adapter for a given component handle, or null if either the component handle is unknown, or if the corresponding component is still under construction (which means that the handle is just for a 'reservation'.

Parameters:
compHandle 
Returns:
component adapter, or null
See also:
Map.get(java.lang.Object)

Referenced by alma.acs.container.AcsContainer.restart_component().

synchronized ComponentAdapter [] alma.acs.container.ComponentMap.getAllComponentAdapters (  )  [package]

Gets all component adapters stored in the map. Unlike Map#values(), the returned array contains a snapshot of the map contents, rather than a live view backed by the map.

Notice that null adapters for reserved components are not included in the returned array of adapters.

Returns:
adapters for all components in the map
See also:
Map.values()

Referenced by alma.acs.container.AcsContainer.components_available(), alma.acs.container.AcsContainer.components_unavailable(), alma.acs.container.AcsContainer.get_component_info(), and alma.acs.container.ComponentMap.getComponentByNameAndType().

synchronized int [] alma.acs.container.ComponentMap.getAllHandles (  )  [package]

Gets all component handles, which are the keys of the map. Unlike Map#keySet(), the returned array contains a snapshot of the map contents, rather than a view backed by the map.

TODO: check if it's ok to include handles for reserved component adapters (value still null)

Returns:
keys for all component (adapters) in the map
See also:
Map.keySet()
synchronized ComponentAdapter [] alma.acs.container.ComponentMap.getComponentAdapters ( int[]  compHandles  )  [package]

Gets component adapters with the specified handles out of the map. Ignores handles for which no components are stored. The order of the returned component adapters matches the order of the handles.

Unlike Map#values(), the returned array contains a snapshot of the map contents, rather than a view backed by the map.

Parameters:
compHandles handles of those components whose adapters should be returned.
Returns:
adapters for all components in the map whose handles match compHandles. Possibly an empty array (if compHandles is null or empty or contains wrong handles), but never null.
See also:
Map.values()

Referenced by alma.acs.container.AcsContainer.deactivate_component(), and alma.acs.container.AcsContainer.get_component_info().

ComponentAdapter alma.acs.container.ComponentMap.getComponentByNameAndType ( String  name,
String  type 
) [package]

Tries to find a component with the given name and type, regardless of the handle which is the "primary key".

Parameters:
name component instance name (curl)
type IDL type name
Returns:
the component adapter that matches name and type, or null if none is found.

References alma.acs.container.ComponentMap.getAllComponentAdapters(), alma.acs.container.ComponentAdapter.getName(), and alma.acs.container.ComponentAdapter.getType().

synchronized ComponentAdapter alma.acs.container.ComponentMap.put ( int  compHandle,
ComponentAdapter  compAdapter 
) [package]
Parameters:
compHandle 
compAdapter 
Returns:
previously stored adapter, possibly null
See also:
Map.put(java.lang.Object, java.lang.Object)

Referenced by alma.acs.container.AcsContainer.activate_component().

synchronized ComponentAdapter alma.acs.container.ComponentMap.remove ( int  compHandle  )  [package]

Removes a component adapter from the map.

Parameters:
compHandle handle of component (adapter) to be removed
Returns:
old ComponentAdapter with that handle, or null
See also:
Map.remove(java.lang.Object)

Referenced by alma.acs.container.AcsContainer.activate_component().

synchronized boolean alma.acs.container.ComponentMap.reserveComponent ( int  compHandle  )  [package]

Makes a reservation for a ComponentAdapter based on the component handle. Can be used to avoid concurrent multiple activation of the same component (which also manager should prevent).

Parameters:
compHandle 
Returns:
true if this handle could be reserved

Referenced by alma.acs.container.AcsContainer.activate_component().

synchronized void alma.acs.container.ComponentMap.sort ( int[]  sortedHandles  )  [package]

Sorts the entries in the order given by sortedHandles. The sorted component handles will be received from the manager. Before this method is called, the iteration order is that of insertion order.

Parameters:
sortedHandles 

Referenced by alma.acs.container.AcsContainer.set_component_shutdown_order().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties