java.lang.Object
org.praxislive.base.AbstractComponent
- All Implemented Interfaces:
Component
- Direct Known Subclasses:
AbstractContainer
Abstract base implementation of
Component supporting Control
and Port management. A ComponentProtocol.INFO control is
added automatically, returning the information provided by the abstract
Component.getInfo() method.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected ComponentAddressfindService(Class<? extends Service> service) protected ComponentAddressgetControl(String id) Get a Control that can handle a Call to the given ID, or null if it does not exist.protected LookupReturn the Container that is the immediate parent of this Component, or null if this Component is not currently contained within a Component hierarchy.Get the Port with the given ID, or null if it does not exist.voidNotify the component that a change has happened in its component hierarchy.voidparentNotify(Container parent) Notify the Component that it has been added to the supplied Container, or removed from its parent if the supplied argument is null.protected final voidregisterControl(String id, Control control) protected final voidregisterPort(String id, Port port) protected final voidprotected final voidunregisterPort(String id) voidwrite(TreeWriter writer) If supported, write the state of this component to the providedTreeWriter.protected final voidwriteMeta(TreeWriter writer) protected final voidwriteTypeAndInfo(TreeWriter writer)
-
Constructor Details
-
AbstractComponent
protected AbstractComponent()
-
-
Method Details
-
getParent
Description copied from interface:ComponentReturn the Container that is the immediate parent of this Component, or null if this Component is not currently contained within a Component hierarchy. -
parentNotify
Description copied from interface:ComponentNotify the Component that it has been added to the supplied Container, or removed from its parent if the supplied argument is null. The Component may throw a VetoException if it should not be added to the Container provided. It should also throw this exception if a parent is already set.- Specified by:
parentNotifyin interfaceComponent- Parameters:
parent-- Throws:
VetoException
-
hierarchyChanged
public void hierarchyChanged()Description copied from interface:ComponentNotify the component that a change has happened in its component hierarchy. For example its direct parent or an ancestor has changed. This method will be called after parentNotify() if the result of an immediate parent change.- Specified by:
hierarchyChangedin interfaceComponent
-
getControl
Description copied from interface:ComponentGet a Control that can handle a Call to the given ID, or null if it does not exist. Component implementations are free to return a different Control for each ID, a single control to handle any message, or somewhere in between. A null return from this method shall be handled by the Root component by responding with an error message to the sender where required.- Specified by:
getControlin interfaceComponent- Parameters:
id-- Returns:
- Control or null
-
getPort
Description copied from interface:ComponentGet the Port with the given ID, or null if it does not exist. -
write
Description copied from interface:ComponentIf supported, write the state of this component to the providedTreeWriter. This should allow for the component to be recreated in as close to its current state as possible.To fully support this method, the Component should write its type, component info, and property values, in that order. It may also add custom annotations.
The component should delegate to
Container.getType(org.praxislive.core.Component)to find its type rather than relying directly onComponentInfo.KEY_COMPONENT_TYPE.The default implementation of this method does nothing.
-
writeTypeAndInfo
-
writeMeta
-
getAddress
-
getLookup
-
findService
protected ComponentAddress findService(Class<? extends Service> service) throws ServiceUnavailableException - Throws:
ServiceUnavailableException
-
disconnectAll
protected void disconnectAll() -
registerControl
-
unregisterControl
-
registerPort
-
unregisterPort
-