org.eclipse.net4j.util.container

## Class ManagedContainer

- java.lang.Object
- - org.eclipse.net4j.util.event.Notifier
  - - org.eclipse.net4j.util.lifecycle.Lifecycle
    - - org.eclipse.net4j.util.container.ManagedContainer

- All Implemented Interfaces:
    IContainer<java.lang.Object>, IManagedContainer, INotifier, IDeactivateable, ILifecycle, ILifecycle.DeferrableActivation

      public class ManagedContainer
      extends Lifecycle
      implements IManagedContainer

  A default implementation of a `managed container`.
  Author:
    Eike Stepper

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IManagedContainer

      `IManagedContainer.ContainerAware`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer

      `IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `ILifecycle.DeferrableActivation`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `USE_LABEL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ManagedContainer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `activateElement(java.lang.Object element)`
    `void` | `addPostProcessor(IElementProcessor postProcessor)`
    `void` | `addPostProcessor(IElementProcessor postProcessor, boolean processExistingElements)`
    `void` | `clearElements()`
    `protected java.lang.Object` | `createElement(java.lang.String productGroup, java.lang.String factoryType, java.lang.String description)`
    `protected IRegistry<IFactoryKey,IFactory>` | `createFactoryRegistry()`
    `protected java.util.List<IElementProcessor>` | `createPostProcessors()`
    `protected void` | `doActivate()`
    `protected void` | `doDeactivate()`
    `void` | `fireEvent(IEvent event)`
    `java.lang.Object` | `getElement(java.lang.String productGroup, java.lang.String factoryType, java.lang.String description)`
    `java.lang.Object` | `getElement(java.lang.String productGroup, java.lang.String factoryType, java.lang.String description, boolean activate)`
    `java.lang.String[]` | `getElementKey(java.lang.Object element)`
    `protected java.util.Map.Entry<org.eclipse.net4j.util.container.ManagedContainer.ElementKey,java.lang.Object>[]` | `getElementRegistryEntries()`
    `protected org.eclipse.net4j.util.container.ManagedContainer.ElementKey[]` | `getElementRegistryKeys()`
    `protected java.lang.Object[]` | `getElementRegistryValues()`
    `java.lang.Object[]` | `getElements()`
    `java.lang.Object[]` | `getElements(java.lang.String productGroup)`
    `java.lang.Object[]` | `getElements(java.lang.String productGroup, java.lang.String factoryType)`
    `IFactory` | `getFactory(java.lang.String productGroup, java.lang.String factoryType)`
    `IRegistry<IFactoryKey,IFactory>` | `getFactoryRegistry()`
    `java.util.Set<java.lang.String>` | `getFactoryTypes(java.lang.String productGroup)`
    `java.lang.String` | `getName()` Returns the name of this container, or `null` if no name has been set.
    `java.util.List<IElementProcessor>` | `getPostProcessors()`
    `java.util.Set<java.lang.String>` | `getProductGroups()`
    `protected java.lang.String` | `getTypeName()`
    `boolean` | `isEmpty()`
    `void` | `loadElements(java.io.InputStream stream)`
    `protected java.lang.Object` | `postProcessElement(java.lang.String productGroup, java.lang.String factoryType, java.lang.String description, java.lang.Object element)`
    `protected java.lang.Object` | `putElement(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key, java.lang.Object element)`
    `java.lang.Object` | `putElement(java.lang.String productGroup, java.lang.String factoryType, java.lang.String description, java.lang.Object element)`
    `ManagedContainer` | `registerFactory(IFactory factory)`
    `protected java.lang.Object` | `removeElement(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key)`
    `java.lang.Object` | `removeElement(java.lang.String productGroup, java.lang.String factoryType, java.lang.String description)`
    `void` | `removePostProcessor(IElementProcessor postProcessor)`
    `void` | `saveElements(java.io.OutputStream stream)`
    `void` | `setName(java.lang.String name)` Sets the name of this container before it is activated.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation`

    - ### Methods inherited from class org.eclipse.net4j.util.event.Notifier

      `addListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `activate, deactivate, getLifecycleState, isActive`

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

- - ### Constructor Detail

    - #### ManagedContainer

          public ManagedContainer()

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `IManagedContainer`
      Returns the name of this container, or `null` if no name has been set.
      Specified by:
        `getName` in interface `IManagedContainer`
      Since:
        3.8

    - #### setName

          public void setName(java.lang.String name)

      Description copied from interface: `IManagedContainer`
      Sets the name of this container before it is activated.
      Specified by:
        `setName` in interface `IManagedContainer`
      Since:
        3.8

    - #### getFactoryRegistry

          public IRegistry<IFactoryKey,IFactory> getFactoryRegistry()

      Specified by:
        `getFactoryRegistry` in interface `IManagedContainer`

    - #### registerFactory

          public ManagedContainer registerFactory(IFactory factory)

      Specified by:
        `registerFactory` in interface `IManagedContainer`

    - #### getPostProcessors

          public java.util.List<IElementProcessor> getPostProcessors()

      Specified by:
        `getPostProcessors` in interface `IManagedContainer`

    - #### addPostProcessor

          public void addPostProcessor(IElementProcessor postProcessor,
                                       boolean processExistingElements)

      Specified by:
        `addPostProcessor` in interface `IManagedContainer`

    - #### addPostProcessor

          public void addPostProcessor(IElementProcessor postProcessor)

      Specified by:
        `addPostProcessor` in interface `IManagedContainer`

    - #### removePostProcessor

          public void removePostProcessor(IElementProcessor postProcessor)

      Specified by:
        `removePostProcessor` in interface `IManagedContainer`

    - #### getProductGroups

          public java.util.Set<java.lang.String> getProductGroups()

      Specified by:
        `getProductGroups` in interface `IManagedContainer`

    - #### getFactoryTypes

          public java.util.Set<java.lang.String> getFactoryTypes(java.lang.String productGroup)

      Specified by:
        `getFactoryTypes` in interface `IManagedContainer`

    - #### getFactory

          public IFactory getFactory(java.lang.String productGroup,
                                     java.lang.String factoryType)
                              throws FactoryNotFoundException

      Specified by:
        `getFactory` in interface `IManagedContainer`
      Throws:
        `FactoryNotFoundException`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `IContainer<java.lang.Object>`

    - #### getElementKey

          public java.lang.String[] getElementKey(java.lang.Object element)

      Specified by:
        `getElementKey` in interface `IManagedContainer`

    - #### getElements

          public java.lang.Object[] getElements()

      Specified by:
        `getElements` in interface `IContainer<java.lang.Object>`

    - #### getElements

          public java.lang.Object[] getElements(java.lang.String productGroup)

      Specified by:
        `getElements` in interface `IManagedContainer`

    - #### getElements

          public java.lang.Object[] getElements(java.lang.String productGroup,
                                                java.lang.String factoryType)

      Specified by:
        `getElements` in interface `IManagedContainer`

    - #### getElement

          public java.lang.Object getElement(java.lang.String productGroup,
                                             java.lang.String factoryType,
                                             java.lang.String description)
                                      throws FactoryNotFoundException,
                                             ProductCreationException

      Specified by:
        `getElement` in interface `IManagedContainer`
      Throws:
        `FactoryNotFoundException`
        `ProductCreationException`

    - #### getElement

          public java.lang.Object getElement(java.lang.String productGroup,
                                             java.lang.String factoryType,
                                             java.lang.String description,
                                             boolean activate)
                                      throws FactoryNotFoundException,
                                             ProductCreationException

      Specified by:
        `getElement` in interface `IManagedContainer`
      Throws:
        `FactoryNotFoundException`
        `ProductCreationException`
      Since:
        2.0

    - #### activateElement

          protected void activateElement(java.lang.Object element)

      Since:
        3.2

    - #### putElement

          public java.lang.Object putElement(java.lang.String productGroup,
                                             java.lang.String factoryType,
                                             java.lang.String description,
                                             java.lang.Object element)

      Specified by:
        `putElement` in interface `IManagedContainer`

    - #### putElement

          protected java.lang.Object putElement(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key,
                                                java.lang.Object element)

    - #### removeElement

          public java.lang.Object removeElement(java.lang.String productGroup,
                                                java.lang.String factoryType,
                                                java.lang.String description)

      Specified by:
        `removeElement` in interface `IManagedContainer`

    - #### removeElement

          protected java.lang.Object removeElement(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key)

    - #### clearElements

          public void clearElements()

      Specified by:
        `clearElements` in interface `IManagedContainer`

    - #### loadElements

          public void loadElements(java.io.InputStream stream)
                            throws java.io.IOException,
                                   FactoryNotFoundException,
                                   ProductCreationException

      Specified by:
        `loadElements` in interface `IManagedContainer`
      Throws:
        `java.io.IOException`
        `FactoryNotFoundException`
        `ProductCreationException`

    - #### saveElements

          public void saveElements(java.io.OutputStream stream)
                            throws java.io.IOException

      Specified by:
        `saveElements` in interface `IManagedContainer`
      Throws:
        `java.io.IOException`

    - #### fireEvent

          public void fireEvent(IEvent event)

      Overrides:
        `fireEvent` in class `Notifier`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `Lifecycle`

    - #### getTypeName

          protected java.lang.String getTypeName()

      Since:
        3.8

    - #### createFactoryRegistry

          protected IRegistry<IFactoryKey,IFactory> createFactoryRegistry()

    - #### createPostProcessors

          protected java.util.List<IElementProcessor> createPostProcessors()

    - #### getElementRegistryKeys

          protected org.eclipse.net4j.util.container.ManagedContainer.ElementKey[] getElementRegistryKeys()

      Since:
        2.0

    - #### getElementRegistryValues

          protected java.lang.Object[] getElementRegistryValues()

      Since:
        2.0

    - #### getElementRegistryEntries

          protected java.util.Map.Entry<org.eclipse.net4j.util.container.ManagedContainer.ElementKey,java.lang.Object>[] getElementRegistryEntries()

      Since:
        2.0

    - #### createElement

          protected java.lang.Object createElement(java.lang.String productGroup,
                                                   java.lang.String factoryType,
                                                   java.lang.String description)
                                            throws FactoryNotFoundException,
                                                   ProductCreationException

      Throws:
        `FactoryNotFoundException`
        `ProductCreationException`

    - #### postProcessElement

          protected java.lang.Object postProcessElement(java.lang.String productGroup,
                                                        java.lang.String factoryType,
                                                        java.lang.String description,
                                                        java.lang.Object element)

    - #### doActivate

          protected void doActivate()
                             throws java.lang.Exception

      Overrides:
        `doActivate` in class `Lifecycle`
      Throws:
        `java.lang.Exception`

    - #### doDeactivate

          protected void doDeactivate()
                               throws java.lang.Exception

      Overrides:
        `doDeactivate` in class `Lifecycle`
      Throws:
        `java.lang.Exception`

Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html