ComponentDefinition¶
-
public abstract class
ComponentDefinition
¶ The
ComponentDefinition
class.Author: Cosmin Arad <cosmin@sics.se>, Jim Dowling <jdowling@sics.se>, Lars Kroll <lkroll@kth.se>
Fields¶
MDC_KEY_CID¶
-
public static final String
MDC_KEY_CID
¶ Pre-configured MDC key for the unique component id.
See the logback manuel for how to use this with logback.
MDC_KEY_CSTATE¶
-
public static final String
MDC_KEY_CSTATE
¶ Pre-configured MDC key for the current component lifecycle state.
See the logback manuel for how to use this with logback.
control¶
-
protected Negative<ControlPort>
control
¶
logger¶
-
protected final Logger
logger
¶ Kompics provided slf4j logger with managed diagnostic context.
See the logback manuel for how to use this with logback.
loopback¶
-
protected Negative<LoopbackPort>
loopback
¶
onSelf¶
-
protected Positive<LoopbackPort>
onSelf
¶
proxy¶
-
public final ComponentProxy
proxy
¶
Constructors¶
ComponentDefinition¶
-
protected
ComponentDefinition
(Class<? extends ComponentCore> coreClass)¶
Methods¶
answer¶
connect¶
connect¶
connect¶
-
protected <P extends PortType> Channel<P>
connect
(Positive<P> positive, Negative<P> negative, ChannelSelector<?, ?> selector)¶ Parameters: - <P> –
- negative –
- positive –
connect¶
-
protected <P extends PortType> Channel<P>
connect
(Negative<P> negative, Positive<P> positive, ChannelSelector<?, ?> selector)¶ Parameters: - <P> –
- negative –
- positive –
connect¶
-
protected <P extends PortType> Channel<P>
connect
(Negative<P> negative, Positive<P> positive, ChannelSelector<?, ?> selector, ChannelFactory factory)¶
connect¶
-
protected <P extends PortType> Channel<P>
connect
(Positive<P> positive, Negative<P> negative, ChannelSelector<?, ?> selector, ChannelFactory factory)¶
connect¶
-
protected <P extends PortType> Channel<P>
connect
(Negative<P> negative, Positive<P> positive, ChannelFactory factory)¶
connect¶
-
protected <P extends PortType> Channel<P>
connect
(Positive<P> positive, Negative<P> negative, ChannelFactory factory)¶
create¶
create¶
create¶
-
protected final <T extends ComponentDefinition> Component
create
(Class<T> definition, Init<T> initEvent, ConfigUpdate update)¶ Creates the.
Parameters: - definition – the definition
- initEvent – init event to be passed to constructor
Returns: the component
create¶
disconnect¶
disconnect¶
getComponentCore¶
-
public final ComponentCore
getComponentCore
()¶
getControlPort¶
-
public final Negative<ControlPort>
getControlPort
()¶
handleFault¶
-
public ResolveAction
handleFault
(Fault fault)¶ Override for custom error handling.
Default action is ESCALATE.
ESCALATE -> Forward fault to parent. IGNORE -> Drop fault. Resume component as if nothing happened. RESOLVED -> Fault has been handled by user. Don’t do anything else.
Parameters: - fault –
handleUpdate¶
-
public UpdateAction
handleUpdate
(ConfigUpdate update)¶ Override for custom update handling.
Default action is to propagate the original everywhere and apply to self.
Parameters: - update –
loggingCtxGet¶
loggingCtxPut¶
-
protected void
loggingCtxPut
(String key, String value)¶ Associate key with value in the logging diagnostic context.
See the logback manuel for how to use this with logback.
Parameters: - key –
- value –
loggingCtxPutAlways¶
-
protected void
loggingCtxPutAlways
(String key, String value)¶ Associate key permanently with value in the logging diagnostic context.
Keys set in this way are not removed by
loggingCtxReset()
orloggingCtxRemove()
.See the logback manuel for how to use this with logback.
Parameters: - key –
- value –
loggingCtxRemove¶
loggingCtxReset¶
-
protected void
loggingCtxReset
()¶ Reset the current logging diagnostic context.
Removes all items added to context by the user that weren’t set with
loggingCtxPutAlways(String,String)
negative¶
positive¶
postUpdate¶
-
public void
postUpdate
()¶ Override to perform actions after a ConfigUpdate was applied and forwarded.
requires¶
separateConfigId¶
-
public boolean
separateConfigId
()¶ Override to allow components of this type to start their own independent
se.sics.kompics.config.Config
id lines.This is helpful in simulation, when simulating multiple independent nodes. Make sure that no
ConfigUpdate
s are passed to siblings or parents of such nodes! (OverridehandleUpdate(se.sics.kompics.config.ConfigUpdate)
)Returns: Whether to create a new config id line for this component (default: true
)
setMDC¶
-
protected void
setMDC
()¶ Should not be necessary to call usually, as ComponentCore will do it.
Protected mainly for use by Kompics Scala.
Can also be used to set component MDC when executing related off-kompics work (check for concurrency issues, though!).
subscribe¶
subscribe¶
-
protected final void
subscribe
(MatchedHandler<?, ?, ?> handler, Port<?> port)¶
tearDown¶
-
public void
tearDown
()¶ Use for custom cleanup. Will be called after all child components have stopped, but before sending a Stopped message to the parent.
trigger¶
-
protected final <P extends PortType> void
trigger
(KompicsEvent event, Port<P> port)¶ Trigger.
Parameters: - event – the event
- port – the port
unsubscribe¶
-
protected final void
unsubscribe
(MatchedHandler<?, ?, ?> handler, Port<?> port)¶
unsubscribe¶
updateConfig¶
-
public final void
updateConfig
(ConfigUpdate update)¶