Package 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<Object>
,IManagedContainer
,INotifier
,INotifier.INotifier2
,IDeactivateable
,ILifecycle
,ILifecycle.DeferrableActivation
A default implementation of a
managed container
.- Author:
- Eike Stepper
-
Nested Class Summary
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
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IManagedContainer
IManagedContainer.ContainerAware
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
INotifier.INotifier2
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
activateElement
(Object element) void
addPostProcessor
(IElementProcessor postProcessor) void
addPostProcessor
(IElementProcessor postProcessor, boolean processExistingElements) void
int
countElements
(String productGroup) int
countElements
(String productGroup, String factoryType) <T> T
createElement
(String productGroup, String factoryType, String description) <T> T
createElement
(String productGroup, String factoryType, Tree config) protected IRegistry<IFactoryKey,
IFactory> protected List<IElementProcessor>
protected void
protected void
void
<T> void
forEachElement
(String productGroup, Class<T> productType, String description, Consumer<T> consumer) <T> void
forEachElement
(String productGroup, Class<T> productType, Consumer<T> consumer) <T> void
forEachElement
(String productGroup, Class<T> productType, Function<String, String> descriptionProvider, Consumer<T> consumer) getElement
(String productGroup, String factoryType, String description) getElement
(String productGroup, String factoryType, String description, boolean activate) String[]
getElementKey
(Object element) <T> T
getElementOrNull
(String productGroup, String factoryType) <T> T
getElementOrNull
(String productGroup, String factoryType, String description) <T> T
getElementOrNull
(String productGroup, String factoryType, Tree config) protected org.eclipse.net4j.util.container.ManagedContainer.ElementKey[]
protected Object[]
Object[]
Object[]
getElements
(String productGroup) Object[]
getElements
(String productGroup, String factoryType) getFactory
(String productGroup, String factoryType) getFactoryTypes
(String productGroup) getName()
Returns the name of this container, ornull
if no name has been set.protected String
boolean
isEmpty()
void
loadElements
(InputStream stream) protected Object
postProcessElement
(String productGroup, String factoryType, String description, Object element) putElement
(String productGroup, String factoryType, String description, Object element) protected Object
putElement
(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key, Object element) registerFactory
(IFactory factory) removeElement
(String productGroup, String factoryType, String description) protected Object
removeElement
(org.eclipse.net4j.util.container.ManagedContainer.ElementKey key) void
removePostProcessor
(IElementProcessor postProcessor) void
saveElements
(OutputStream stream) void
Sets the name of this container before it is activated.toString()
unregisterFactory
(IFactory factory) 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, addUniqueListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, 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 Details
-
ManagedContainer
public ManagedContainer()
-
-
Method Details
-
getName
Description copied from interface:IManagedContainer
Returns the name of this container, ornull
if no name has been set.- Specified by:
getName
in interfaceIManagedContainer
- Since:
- 3.8
-
setName
Description copied from interface:IManagedContainer
Sets the name of this container before it is activated.- Specified by:
setName
in interfaceIManagedContainer
- Since:
- 3.8
-
getFactoryRegistry
- Specified by:
getFactoryRegistry
in interfaceIManagedContainer
-
registerFactory
- Specified by:
registerFactory
in interfaceIManagedContainer
-
unregisterFactory
- Specified by:
unregisterFactory
in interfaceIManagedContainer
-
getPostProcessors
- Specified by:
getPostProcessors
in interfaceIManagedContainer
-
addPostProcessor
- Specified by:
addPostProcessor
in interfaceIManagedContainer
-
addPostProcessor
- Specified by:
addPostProcessor
in interfaceIManagedContainer
-
removePostProcessor
- Specified by:
removePostProcessor
in interfaceIManagedContainer
-
getProductGroups
- Specified by:
getProductGroups
in interfaceIManagedContainer
-
getFactoryTypes
- Specified by:
getFactoryTypes
in interfaceIManagedContainer
-
getFactory
- Specified by:
getFactory
in interfaceIManagedContainer
- Throws:
FactoryNotFoundException
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIContainer<Object>
-
getElementKey
- Specified by:
getElementKey
in interfaceIManagedContainer
-
getElements
- Specified by:
getElements
in interfaceIContainer<Object>
-
getElements
- Specified by:
getElements
in interfaceIManagedContainer
-
getElements
- Specified by:
getElements
in interfaceIManagedContainer
-
getElement
public Object getElement(String productGroup, String factoryType, String description) throws FactoryNotFoundException, ProductCreationException - Specified by:
getElement
in interfaceIManagedContainer
- Throws:
FactoryNotFoundException
ProductCreationException
-
getElement
public Object getElement(String productGroup, String factoryType, String description, boolean activate) throws FactoryNotFoundException, ProductCreationException - Specified by:
getElement
in interfaceIManagedContainer
- Throws:
FactoryNotFoundException
ProductCreationException
- Since:
- 2.0
-
getElementOrNull
public <T> T getElementOrNull(String productGroup, String factoryType) throws ProductCreationException - Specified by:
getElementOrNull
in interfaceIManagedContainer
- Throws:
ProductCreationException
-
getElementOrNull
public <T> T getElementOrNull(String productGroup, String factoryType, String description) throws ProductCreationException - Specified by:
getElementOrNull
in interfaceIManagedContainer
- Throws:
ProductCreationException
-
getElementOrNull
public <T> T getElementOrNull(String productGroup, String factoryType, Tree config) throws ProductCreationException - Specified by:
getElementOrNull
in interfaceIManagedContainer
- Throws:
ProductCreationException
- Since:
- 3.23
-
createElement
public <T> T createElement(String productGroup, String factoryType, String description) throws FactoryNotFoundException, ProductCreationException - Specified by:
createElement
in interfaceIManagedContainer
- Throws:
FactoryNotFoundException
ProductCreationException
- Since:
- 3.23
-
createElement
public <T> T createElement(String productGroup, String factoryType, Tree config) throws FactoryNotFoundException, ProductCreationException - Specified by:
createElement
in interfaceIManagedContainer
- Throws:
FactoryNotFoundException
ProductCreationException
- Since:
- 3.23
-
countElements
- Specified by:
countElements
in interfaceIManagedContainer
-
countElements
- Specified by:
countElements
in interfaceIManagedContainer
-
activateElement
- Since:
- 3.2
-
putElement
public Object putElement(String productGroup, String factoryType, String description, Object element) - Specified by:
putElement
in interfaceIManagedContainer
-
putElement
-
removeElement
- Specified by:
removeElement
in interfaceIManagedContainer
-
removeElement
-
forEachElement
public <T> void forEachElement(String productGroup, Class<T> productType, Function<String, String> descriptionProvider, Consumer<T> consumer) - Specified by:
forEachElement
in interfaceIManagedContainer
-
forEachElement
public <T> void forEachElement(String productGroup, Class<T> productType, String description, Consumer<T> consumer) - Specified by:
forEachElement
in interfaceIManagedContainer
-
forEachElement
- Specified by:
forEachElement
in interfaceIManagedContainer
-
clearElements
public void clearElements()- Specified by:
clearElements
in interfaceIManagedContainer
-
loadElements
public void loadElements(InputStream stream) throws IOException, FactoryNotFoundException, ProductCreationException - Specified by:
loadElements
in interfaceIManagedContainer
- Throws:
IOException
FactoryNotFoundException
ProductCreationException
-
saveElements
- Specified by:
saveElements
in interfaceIManagedContainer
- Throws:
IOException
-
fireEvent
-
toString
-
getTypeName
- Since:
- 3.8
-
createFactoryRegistry
-
createPostProcessors
-
getElementRegistryKeys
protected org.eclipse.net4j.util.container.ManagedContainer.ElementKey[] getElementRegistryKeys()- Since:
- 2.0
-
getElementRegistryValues
- Since:
- 2.0
-
getElementRegistryEntries
protected Map.Entry<org.eclipse.net4j.util.container.ManagedContainer.ElementKey,Object>[] getElementRegistryEntries()- Since:
- 2.0
-
postProcessElement
-
doActivate
- Overrides:
doActivate
in classLifecycle
- Throws:
Exception
-
doDeactivate
- Overrides:
doDeactivate
in classLifecycle
- Throws:
Exception
-