Class BasicElementConfig<S>

  • Direct Known Subclasses:
    BasicDeviceConfig, BasicHostConfig, BasicRegionConfig

    public abstract class BasicElementConfig<S>
    extends AllowedEntityConfig<S>
    Basic configuration for network elements, e.g. devices, hosts. Such elements can have a friendly name, geo-coordinates (or grid-coordinates), logical rack coordinates and an owner entity.
    • Constructor Detail

      • BasicElementConfig

        public BasicElementConfig()
    • Method Detail

      • name

        public String name()
        Returns friendly label for the element. If not set, returns the element identifier.
        Returns:
        friendly label or element identifier itself if not set
      • name

        public BasicElementConfig name​(String name)
        Sets friendly label for the element.
        Parameters:
        name - new friendly label; null to clear
        Returns:
        self
      • uiType

        public String uiType()
        Returns the UI type (glyph image to be used) for the element in the Topology View. If not set, null is returned.
        Returns:
        the UI type
      • uiType

        public BasicElementConfig uiType​(String uiType)
        Sets the UI type (glyph image to be used) for the element in the Topology View. Setting this to null will indicate that the default glyph image should be used for the element type.
        Parameters:
        uiType - the UI type; null for default
        Returns:
        self
      • locType

        public String locType()
        Returns the location type (geo or grid) for the element in the Topology View. If not set, the type will be determined implicitly by latitude being set ("geo") or gridX being set ("grid"); otherwise returns the default of "none".
        Returns:
        location type (string)
      • locType

        public BasicElementConfig locType​(String locType)
        Sets the location type (geo or grid) for the element in the Topology View. If null is passed, it will default to "geo".
        Parameters:
        locType - the UI type; null for default
        Returns:
        self
      • geoCoordsSet

        public boolean geoCoordsSet()
        Returns true if the geographical coordinates (latitude and longitude) are set on this element; false otherwise.
        Returns:
        true if geo-coordinates are set; false otherwise
      • latitude

        public double latitude()
        Returns element latitude.
        Returns:
        element latitude; 0.0 if (possibly) not set
        See Also:
        geoCoordsSet()
      • latitude

        public BasicElementConfig latitude​(Double latitude)
        Sets the element latitude.
        Parameters:
        latitude - new latitude; null to clear
        Returns:
        self
      • longitude

        public double longitude()
        Returns element longitude.
        Returns:
        element longitude; 0 if (possibly) not set
        See Also:
        geoCoordsSet()
      • longitude

        public BasicElementConfig longitude​(Double longitude)
        Sets the element longitude.
        Parameters:
        longitude - new longitude; null to clear
        Returns:
        self
      • gridCoordsSet

        public boolean gridCoordsSet()
        Returns true if the grid coordinates (gridY and gridX) are set on this element, i.e. if locType is set to 'grid'; false otherwise.
        Returns:
        true if grid coordinates are set; false otherwise.
      • gridY

        public double gridY()
        Returns element grid y-coordinate.
        Returns:
        element y-coordinate
      • gridY

        public BasicElementConfig gridY​(Double y)
        Sets the element grid y-coordinate.
        Parameters:
        y - new y-coordinate; null to clear
        Returns:
        self
      • gridX

        public double gridX()
        Returns element grid x-coordinate.
        Returns:
        element x-coordinate
      • gridX

        public BasicElementConfig gridX​(Double x)
        Sets the element grid x-coordinate.
        Parameters:
        x - new x-coordinate; null to clear
        Returns:
        self
      • rackAddress

        public String rackAddress()
        Returns the element rack address.
        Returns:
        rack address; null if not set
      • rackAddress

        public BasicElementConfig rackAddress​(String address)
        Sets element rack address.
        Parameters:
        address - new rack address; null to clear
        Returns:
        self
      • owner

        public String owner()
        Returns owner of the element.
        Returns:
        owner or null if not set
      • owner

        public BasicElementConfig owner​(String owner)
        Sets the owner of the element.
        Parameters:
        owner - new owner; null to clear
        Returns:
        self
      • roles

        public Set<String> roles()
        Returns set of roles assigned to the element.
        Returns:
        set of roles
      • roles

        public BasicElementConfig roles​(Set<String> roles)
        Sets the roles of the element.
        Parameters:
        roles - new roles; null to clear
        Returns:
        self
      • isValid

        public boolean isValid()
        Description copied from class: Config
        Indicates whether or not the backing JSON node contains valid data.

        Default implementation returns true. Subclasses are expected to override this with their own validation. Implementations are free to throw a RuntimeException if data is invalid.

        Overrides:
        isValid in class Config<S>
        Returns:
        true if the data is valid; false otherwise