org.eclipse.net4j.util.container
Class ManagedContainer

java.lang.Object
  extended by org.eclipse.net4j.util.event.Notifier
      extended by org.eclipse.net4j.util.lifecycle.Lifecycle
          extended by org.eclipse.net4j.util.container.ManagedContainer
All Implemented Interfaces:
IContainer<Object>, IManagedContainer, INotifier, ILifecycle, ILifecycle.DeferrableActivation

public class ManagedContainer
extends Lifecycle
implements IManagedContainer

A default implementation of a managed container.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer
IContainer.Modifiable<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
ManagedContainer()
           
 
Method Summary
protected  void activateElement(Object element)
           
 void addPostProcessor(IElementProcessor postProcessor)
           
 void addPostProcessor(IElementProcessor postProcessor, boolean processExistingElements)
           
 void clearElements()
           
protected  Object createElement(String productGroup, String factoryType, String description)
           
protected  IRegistry<IFactoryKey,IFactory> createFactoryRegistry()
           
protected  List<IElementProcessor> createPostProcessors()
           
protected  void doActivate()
           
protected  void doDeactivate()
           
 void fireEvent(IEvent event)
           
 Object getElement(String productGroup, String factoryType, String description)
           
 Object getElement(String productGroup, String factoryType, String description, boolean activate)
           
 String[] getElementKey(Object element)
           
protected  Map.Entry<org.eclipse.net4j.util.container.ManagedContainer.ElementKey,Object>[] getElementRegistryEntries()
           
protected  org.eclipse.net4j.util.container.ManagedContainer.ElementKey[] getElementRegistryKeys()
           
protected  Object[] getElementRegistryValues()
           
 Object[] getElements()
           
 Object[] getElements(String productGroup)
           
 Object[] getElements(String productGroup, String factoryType)
           
 IFactory getFactory(String productGroup, String factoryType)
           
 IRegistry<IFactoryKey,IFactory> getFactoryRegistry()
           
 Set<String> getFactoryTypes(String productGroup)
           
 List<IElementProcessor> getPostProcessors()
           
 Set<String> getProductGroups()
           
 boolean isEmpty()
           
 void loadElements(InputStream stream)
           
protected  Object postProcessElement(String productGroup, String factoryType, String description, Object element)
           
protected  Object putElement(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key, Object element)
           
 Object putElement(String productGroup, String factoryType, String description, Object element)
           
 ManagedContainer registerFactory(IFactory factory)
           
protected  Object removeElement(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key)
           
 Object removeElement(String productGroup, String factoryType, String description)
           
 void removePostProcessor(IElementProcessor postProcessor)
           
 void saveElements(OutputStream stream)
           
 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

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 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 Set<String> getProductGroups()
Specified by:
getProductGroups in interface IManagedContainer

getFactoryTypes

public Set<String> getFactoryTypes(String productGroup)
Specified by:
getFactoryTypes in interface IManagedContainer

getFactory

public IFactory getFactory(String productGroup,
                           String factoryType)
                    throws FactoryNotFoundException
Specified by:
getFactory in interface IManagedContainer
Throws:
FactoryNotFoundException

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IContainer<Object>

getElementKey

public String[] getElementKey(Object element)
Specified by:
getElementKey in interface IManagedContainer

getElements

public Object[] getElements()
Specified by:
getElements in interface IContainer<Object>

getElements

public Object[] getElements(String productGroup)
Specified by:
getElements in interface IManagedContainer

getElements

public Object[] getElements(String productGroup,
                            String factoryType)
Specified by:
getElements in interface IManagedContainer

getElement

public Object getElement(String productGroup,
                         String factoryType,
                         String description)
                  throws FactoryNotFoundException,
                         ProductCreationException
Specified by:
getElement in interface IManagedContainer
Throws:
FactoryNotFoundException
ProductCreationException

getElement

public Object getElement(String productGroup,
                         String factoryType,
                         String description,
                         boolean activate)
                  throws FactoryNotFoundException,
                         ProductCreationException
Specified by:
getElement in interface IManagedContainer
Throws:
FactoryNotFoundException
ProductCreationException
Since:
2.0

activateElement

protected void activateElement(Object element)
Since:
3.2

putElement

public Object putElement(String productGroup,
                         String factoryType,
                         String description,
                         Object element)
Specified by:
putElement in interface IManagedContainer

putElement

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

removeElement

public Object removeElement(String productGroup,
                            String factoryType,
                            String description)
Specified by:
removeElement in interface IManagedContainer

removeElement

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

clearElements

public void clearElements()
Specified by:
clearElements in interface IManagedContainer

loadElements

public void loadElements(InputStream stream)
                  throws IOException,
                         FactoryNotFoundException,
                         ProductCreationException
Specified by:
loadElements in interface IManagedContainer
Throws:
IOException
FactoryNotFoundException
ProductCreationException

saveElements

public void saveElements(OutputStream stream)
                  throws IOException
Specified by:
saveElements in interface IManagedContainer
Throws:
IOException

fireEvent

public void fireEvent(IEvent event)
Overrides:
fireEvent in class Notifier

toString

public String toString()
Overrides:
toString in class Lifecycle

createFactoryRegistry

protected IRegistry<IFactoryKey,IFactory> createFactoryRegistry()

createPostProcessors

protected List<IElementProcessor> createPostProcessors()

getElementRegistryKeys

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

getElementRegistryValues

protected Object[] getElementRegistryValues()
Since:
2.0

getElementRegistryEntries

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

createElement

protected Object createElement(String productGroup,
                               String factoryType,
                               String description)
                        throws FactoryNotFoundException,
                               ProductCreationException
Throws:
FactoryNotFoundException
ProductCreationException

postProcessElement

protected Object postProcessElement(String productGroup,
                                    String factoryType,
                                    String description,
                                    Object element)

doActivate

protected void doActivate()
                   throws Exception
Overrides:
doActivate in class Lifecycle
Throws:
Exception

doDeactivate

protected void doDeactivate()
                     throws Exception
Overrides:
doDeactivate in class Lifecycle
Throws:
Exception


Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.