public abstract class PubSubPort extends TypedIOPort implements HierarchyListener, Initializable
Red (eal) |
Yellow (eal) |
TypedIOPort.RunTimeTypeCheckException
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
_channel
Cached channel name, for publish and subscribe.
|
protected boolean |
_global
Cached variable indicating whether publishing or subscribing is global.
|
StringParameter |
channel
If set, then this port is used to communicate over a named
publish and subscribe channel, rather than over manually
established connections.
|
Parameter |
global
Specification of whether the published data is global.
|
Parameter |
initialTokens
The values that will be made available in the initialize method.
|
_resolvedType, TYPE
_constantLimit, _constantToken, _constantTokensSent, _hasPortEventListeners, _portEventListeners, CONFIGURATION, defaultValue, RECEIVERS, REMOTERECEIVERS
_insideLinks, _relationsList
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
PubSubPort(ComponentEntity container,
java.lang.String name)
Construct a subscriber port with a containing actor and a name.
|
Modifier and Type | Method and Description |
---|---|
void |
addInitializable(Initializable initializable)
Throw an exception.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
hierarchyChanged()
Notify this object that the containment hierarchy above it has
changed.
|
void |
hierarchyWillChange()
Notify this object that the containment hierarchy above it will be
changed, which results in this port being removed from the set
of initializables of the container.
|
void |
initialize()
Do nothing.
|
void |
preinitialize()
Do nothing.
|
void |
removeInitializable(Initializable initializable)
Do nothing.
|
void |
setContainer(Entity container)
Override the base class to register as an
Initializable
so that preinitialize() is invoked, and as a
HierarchyListener , so that we are notified of
changes in the hierarchy above. |
void |
wrapup()
Do nothing.
|
_checkContainer, _checkLiberalLink, _checkLink, _checkType, _checkTypedIOPortContainer, _description, addTypeListener, attributeChanged, broadcast, broadcast, convert, getAutomaticTypeConversion, getType, getTypeTerm, isTypeAcceptable, removeTypeListener, send, send, sendInside, setAutomaticTypeConversion, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, typeConstraintList, typeConstraints
_checkLiberalLink, _exportMoMLContents, _getInsideWidth, _getOutsideWidth, _getReceiversLinkedToGroup, _newInsideReceiver, _newInsideReceiver, _newReceiver, _newReceiver, _notifyPortEventListeners, _removeReceivers, _setConstant, _wrapReceiver, addIOPortEventListener, broadcastClear, checkWidthConstraints, createReceivers, deepConnectedInPortList, deepConnectedInPorts, deepConnectedOutPortList, deepConnectedOutPorts, deepGetReceivers, get, get, getChannelForReceiver, getCommunicationAspects, getCurrentTime, getDefaultWidth, getInside, getInsideReceivers, getModelTime, getReceivers, getReceivers, getReceivers, getRelationIndex, getRemoteReceivers, getRemoteReceivers, getWidth, getWidthFromConstraints, getWidthInside, hasNewToken, hasNewTokenInside, hasRoom, hasRoomInside, hasToken, hasToken, hasTokenInside, hasWidthConstraints, insertLink, insideSinkPortList, insideSourcePortList, invalidateCommunicationAspects, isInput, isInsideConnected, isKnown, isKnown, isKnownInside, isMultiport, isOutput, isOutsideConnected, liberalLink, link, numberOfSinks, numberOfSources, removeIOPortEventListener, reset, sendClear, sendClearInside, setDefaultWidth, setInput, setMultiport, setOutput, setWidthEquals, setWidthEquals, sinkPortList, sourcePortList, transferInputs, transferOutputs, unlink, unlink, unlinkAll, unlinkAllInside, unlinkInside, unlinkInside
_deepConnectedPortList, _deepConnectedPorts, _deepInsidePortList, _deepInsidePorts, _isInsideLinkable, deepConnectedPortList, deepConnectedPorts, deepInsidePortList, deepInsidePorts, insertInsideLink, insidePortList, insidePorts, insideRelationList, insideRelations, isDeeplyConnected, isInsideGroupLinked, isInsideLinked, isOpaque, numInsideLinks
_getContainedObject, _propagateExistence, connectedPortList, connectedPorts, getContainer, isGroupLinked, isLinked, linkedRelationList, linkedRelations, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, numLinks, setName
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public StringParameter channel
public Parameter global
channel
is empty.
If this is set to true, then a subscriber anywhere in the model that
references the same channel by name will see values published by
this port. If this is set to false (the default), then only
those subscribers that are controlled by the same director will see
values published on this channel.public Parameter initialTokens
protected java.lang.String _channel
protected boolean _global
public PubSubPort(ComponentEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container actor.name
- The name of the port.IllegalActionException
- If the port is not of an acceptable
class for the container, or if the container does not implement the
Actor interface.NameDuplicationException
- If the name coincides with
a port already in the container.public void addInitializable(Initializable initializable)
addInitializable
in interface Initializable
initializable
- The object whose methods should be invoked.Initializable.removeInitializable(Initializable)
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedIOPort
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void hierarchyChanged() throws IllegalActionException
preinitialize()
to handle re-establishing the connections.hierarchyChanged
in interface HierarchyListener
IllegalActionException
- If the change is not
acceptable.public void hierarchyWillChange() throws IllegalActionException
hierarchyWillChange
in interface HierarchyListener
IllegalActionException
- If unlinking to a published port fails.public void initialize() throws IllegalActionException
initialize
in interface Initializable
IllegalActionException
- If execution is not permitted.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
IllegalActionException
- If initializing is not permitted.public void removeInitializable(Initializable initializable)
removeInitializable
in interface Initializable
initializable
- The object whose methods should no longer be invoked.Initializable.addInitializable(Initializable)
public void setContainer(Entity container) throws IllegalActionException, NameDuplicationException
Initializable
so that preinitialize() is invoked, and as a
HierarchyListener
, so that we are notified of
changes in the hierarchy above.setContainer
in class IOPort
container
- The proposed container.IllegalActionException
- If the action would result in a
recursive containment structure, or if
this entity and container are not in the same workspace.NameDuplicationException
- If the container already has
an entity with the name of this entity.Port.getContainer()
,
Port._checkContainer(Entity)
public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
IllegalActionException
- If wrapup is not permitted.