Class NodeEntryImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      NodeEntryImpl()
      Base constructor
      NodeEntryImpl​(java.lang.String nodename)
      Create an instance with a nodename value
      NodeEntryImpl​(java.lang.String hostname, java.lang.String nodename)
      Create a NodeEntryImpl with hostname and nodename
    • Constructor Detail

      • NodeEntryImpl

        public NodeEntryImpl()
        Base constructor
      • NodeEntryImpl

        public NodeEntryImpl​(java.lang.String nodename)
        Create an instance with a nodename value
        Parameters:
        nodename - the node name
      • NodeEntryImpl

        public NodeEntryImpl​(java.lang.String hostname,
                             java.lang.String nodename)
        Create a NodeEntryImpl with hostname and nodename
        Parameters:
        hostname - hostname
        nodename - node name
    • Method Detail

      • create

        public static INodeEntry create​(java.lang.String hostname,
                                        java.lang.String nodename)
        Factory method
        Parameters:
        hostname - hostname value
        nodename - node name
        Returns:
        create an instance with a hostname and node name.
      • setNodename

        public void setNodename​(java.lang.String nodename)
        Description copied from class: NodeBaseImpl
        Set the node name
        Overrides:
        setNodename in class NodeBaseImpl
        Parameters:
        nodename - name of the node
      • getTags

        public java.util.Set getTags()
        Specified by:
        getTags in interface INodeEntry
        Returns:
        the set of tag strings
      • setTags

        public void setTags​(java.util.Set tags)
      • getOsName

        public java.lang.String getOsName()
        Specified by:
        getOsName in interface INodeEntry
        Returns:
        the OS name
      • setOsName

        public void setOsName​(java.lang.String osName)
      • getOsFamily

        public java.lang.String getOsFamily()
        Specified by:
        getOsFamily in interface INodeEntry
        Returns:
        the OS family
      • setOsFamily

        public void setOsFamily​(java.lang.String osFamily)
      • getOsVersion

        public java.lang.String getOsVersion()
        Specified by:
        getOsVersion in interface INodeEntry
        Returns:
        the OS version
      • setOsVersion

        public void setOsVersion​(java.lang.String osVersion)
      • getHostname

        public java.lang.String getHostname()
        Description copied from interface: INodeDesc
        Returns hostname
        Specified by:
        getHostname in interface INodeDesc
        Returns:
        Name of node
      • setHostname

        public void setHostname​(java.lang.String hostname)
      • getOsArch

        public java.lang.String getOsArch()
        Specified by:
        getOsArch in interface INodeEntry
        Returns:
        the OS architecture
      • setOsArch

        public void setOsArch​(java.lang.String osArch)
      • getUsername

        public java.lang.String getUsername()
        Specified by:
        getUsername in interface INodeEntry
        Returns:
        the username
      • setUsername

        public void setUsername​(java.lang.String username)
      • equals

        public boolean equals​(INodeDesc node)
        Description copied from interface: INodeDesc
        Checks equality with another node description
        Specified by:
        equals in interface INodeDesc
        Parameters:
        node - descriptor
        Returns:
        true if equal
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • containsUserName

        public static boolean containsUserName​(java.lang.String host)
        Checks if nodename contains a user name
        Parameters:
        host - hostname value
        Returns:
        true if matches a "user@host" pattern
      • containsUserName

        public boolean containsUserName()
        Specified by:
        containsUserName in interface INodeEntry
        Returns:
        true if the hostname string includes embedded username in the "username@hostname" pattern
      • extractUserName

        public static java.lang.String extractUserName​(java.lang.String hostname)
        Extract a username from a "username@hostname" pattern.
        Parameters:
        hostname - value
        Returns:
        username extracted, or null
      • extractUserName

        public java.lang.String extractUserName()
        Gets the username for remote connections. The following logic is used: If the username property is set then the username value is returned. If the username is not set and the hostname contains a "user@" prefix then the "user" substring is returned If the hostname contains a substring that looks like a port (eg, :22) the port is stripped off
        Specified by:
        extractUserName in interface INodeEntry
        Returns:
        Gets the username for remote connections
      • extractHostname

        public static java.lang.String extractHostname​(java.lang.String host)
        Extract hostname from a string of the pattern "username@hostname:port"
        Parameters:
        host - the hostname
        Returns:
        the extracted hostname, or the original string if the pattern is not matched
      • extractHostname

        public java.lang.String extractHostname()
        Specified by:
        extractHostname in interface INodeEntry
        Returns:
        the standalone hostname value extracted from the hostname string
      • extractPort

        public java.lang.String extractPort()
        Specified by:
        extractPort in interface INodeEntry
        Returns:
        the port string extracted from the hostname
      • extractPort

        public static java.lang.String extractPort​(java.lang.String host)
        Extract the port string from a string in the pattern "hostname:port"
        Parameters:
        host - the hostname
        Returns:
        the extracted port string, or null if the pattern is not matched.
      • containsPort

        public boolean containsPort()
        Specified by:
        containsPort in interface INodeEntry
        Returns:
        true if the hostname string includes embedded port in the "hostname:port" pattern
      • containsPort

        public static boolean containsPort​(java.lang.String host)
        Return true if the hostname contains a port value in the form "hostname:port".
        Parameters:
        host - hostname
        Returns:
        true if it matches the "host:port" pattern
      • setFrameworkProject

        public void setFrameworkProject​(java.lang.String project)
      • getFrameworkProject

        public java.lang.String getFrameworkProject()
        Specified by:
        getFrameworkProject in interface INodeEntry
        Returns:
        the project name if it is set
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()
        Get the map of attributes for the node, including all predefined attribtes available via acessors.
        Specified by:
        getAttributes in interface INodeEntry
        Returns:
        attributes
      • setAttributes

        public void setAttributes​(java.util.Map<java.lang.String,​java.lang.String> attributes)
      • setDescription

        public void setDescription​(java.lang.String description)
      • getDescription

        public java.lang.String getDescription()
        Specified by:
        getDescription in interface INodeEntry
        Returns:
        the description
      • getExtendedAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getExtendedAttributes()
        Returns:
        the attributes for the node without any of the predefined attributes.
      • nodeExtendedAttributes

        public static java.util.Map<java.lang.String,​java.lang.String> nodeExtendedAttributes​(INodeEntry node)
        Parameters:
        node - node
        Returns:
        the attributes for the node without any of the predefined attributes.
      • nodeNamespacedAttributes

        public static java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.util.List<java.lang.String>>> nodeNamespacedAttributes​(INodeEntry node)
        Parameters:
        node - node
        Returns:
        the node attributes broken into namespaces, the result map will be contructed as: "namespace" : { "key": ["attr","value"] } where "attr" is the source full attribute name
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String name)
        Get the value for a specific attribute
        Parameters:
        name - attribute name
        Returns:
        attribute value, or null if it is not set
      • setAttribute

        public java.lang.String setAttribute​(java.lang.String name,
                                             java.lang.String value)
        Set the value for a specific attribute
        Parameters:
        name - attribute name
        value - attribute value
        Returns:
        value
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class NodeBaseImpl