Class ContainerProtocol

  • All Implemented Interfaces:
    Protocol

    public class ContainerProtocol
    extends Object
    implements Protocol
    A container protocol that allows for calls to add / remove child components, and connect / disconnect their ports.
    • Field Detail

      • ADD_CHILD_INFO

        public static final ControlInfo ADD_CHILD_INFO
        Info for the add-child control. It is a function control that accepts two arguments, the child name and the component type. It returns no arguments. It will respond with an error if the child cannot be added.
      • REMOVE_CHILD_INFO

        public static final ControlInfo REMOVE_CHILD_INFO
        Info for the remove-child control. It is a function control that accepts one argument, the child name. It returns no arguments.
      • CHILDREN_INFO

        public static final ControlInfo CHILDREN_INFO
        Info for the children control. It is a read-only property control that returns a PArray of child names. The response is equivalent to Container.children().
      • CONNECT_INFO

        public static final ControlInfo CONNECT_INFO
        Info for the connect control. It is a function control that accepts four arguments, the first component name, the first port name, the second component name, and the second port name. It returns no arguments. It will response with an error if the connection cannot be made.
      • DISCONNECT_INFO

        public static final ControlInfo DISCONNECT_INFO
        Info for the disconnect control. It is a function control that accepts four arguments, the first component name, the first port name, the second component name, and the second port name. It returns no arguments.
      • CONNECTIONS_INFO

        public static final ControlInfo CONNECTIONS_INFO
        Info for the connections control. It is a read-only property that returns a PArray of PArray. Each internal PArray consists of four values, corresponding to the arguments passed to each call to connect.
      • SUPPORTED_TYPES_INFO

        public static final ControlInfo SUPPORTED_TYPES_INFO
        Info for the (optional) supported-types control. It is a read-only property that returns a PArray consisting of all supported ComponentType that can be passed to add-child.

        A SupportedTypes implementation may be registered in the container's Lookup to facilitate implementation of this control by child containers.

    • Constructor Detail

      • ContainerProtocol

        public ContainerProtocol()
    • Method Detail

      • controls

        public Stream<String> controls()
        Description copied from interface: Protocol
        The names of the controls that a component advertising this protocol must provide.
        Specified by:
        controls in interface Protocol
        Returns:
        stream of control names
      • optionalControls

        public Stream<String> optionalControls()
        Description copied from interface: Protocol
        The names of additional controls that a component advertising this protocol might provide. These controls are optional. Any caller should check whether the component info contains the control, or otherwise prepare for the control not to be available.

        Implementation note : the protocol implementation should support querying the control info via Protocol.getControlInfo(java.lang.String). The default implementation returns an empty stream.

        Specified by:
        optionalControls in interface Protocol
        Returns:
        stream of optional control names
      • getControlInfo

        public ControlInfo getControlInfo​(String control)
        Description copied from interface: Protocol
        Query the ControlInfo for the provided control name on this protocol. The component implementing this protocol will generally use the control info provided here inside its component info. In exceptional circumstances, the component may extend or adapt the behaviour of the control, as long as it is fully compatible with this control info and the specification.
        Specified by:
        getControlInfo in interface Protocol
        Parameters:
        control - name of control
        Returns:
        control info for named control