Interface ComponentPool

All Known Implementing Classes:
SimpleComponentPool

public interface ComponentPool
A ComponentPool provides access to the Components created by parsing an ArooaConfiguration.
Author:
rob
  • Method Details

    • configure

      void configure(Object component) throws ArooaConfigurationException
      Configure the component. The is a shortcut method equivalent to contextFor(component).getRuntime().configure().
      Parameters:
      component - The component or it's proxy.
      Throws:
      ArooaConfigurationException
    • save

      void save(Object either) throws ComponentPersistException
      Possibly save the component to a persistent store, if everything is in place for this to happen.

      If a ComponentPersister is in operation and the component was registered with an id then the ComponentPersister is invoked with the component.

      Parameters:
      either - A component or it's proxy.
      Throws:
      ComponentPersistException
    • remove

      boolean remove(Object either) throws ComponentPersistException
      Remove a component.
      Parameters:
      either - A component or it's proxy.
      Returns:
      true if the component was removed.
      Throws:
      ComponentPersistException
    • contextFor

      ArooaContext contextFor(Object either)
      Get the components ArooaContext.
      Parameters:
      either - The component or the proxy.
      Returns:
      The context or null if the component/proxy is not in this pool.
    • trinityForContext

      ComponentTrinity trinityForContext(ArooaContext context)
      Get the ComponentTrinity for the given ArooaContext.

      This is required for ContextHierarchyServiceFinder.

      Parameters:
      context - A context;
      Returns:
      The trinity or null.
      Since:
      1.3
    • trinityFor

      ComponentTrinity trinityFor(Object either)
      Get the ComponentTrinity for either the component or proxy.

      Parameters:
      either - Either the component or the proxy.
      Returns:
      The component trinity or null if it can't be found.
      Since:
      1.3
    • registerComponent

      String registerComponent(ComponentTrinity trinity, String id)
      Register a ComponentTrinity.
      Parameters:
      trinity - The trinity.
      id - The id. May be null.
      Returns:
      The new id if one was assigned.
    • getIdFor

      String getIdFor(Object either)
      Provide the Id for either a component or it's proxy.
      Parameters:
      either - Either a component or it's proxy.
      Returns:
      The id, or null if the component wasn't registered with an id, or the component doesn't exist in pool.
    • trinityForId

      ComponentTrinity trinityForId(String id)
      Provide the ComponentTrinity for a given id, if possible.
      Parameters:
      id - The id.
      Returns:
      The trinity, or null if none exists for the given id.
    • allTrinities

      Iterable<ComponentTrinity> allTrinities()
      Provide a way of iterating over all trinities.
      Returns:
      An Iterable of trinities. Will never be null.