com.ibm.websphere.collective.repository

Interface RepositoryPathUtilityMBean



  • public interface RepositoryPathUtilityMBean
    The RepositoryPathUtilityMBean provides utility methods to construct repository node paths and server tuples.

    The ObjectName for this MBean is "WebSphere:feature=collectiveController,type=RepositoryPathUtility,name=RepositoryPathUtility".

    A server tuple is defined as (hostName,wlpUserDir,serverName). The host name is always in lower case. The wlpUserDir is not encoded. The elements of the tuple can always be safely parsed as follows:

    String hostName = tuple.substring(0, tuple.indexOf(,));
    String wlpUserDir = tuple.substring(tuple.indexOf(,) + 1, tuple.lastIndexOf(,));
    String serverName = tuple.substring(tuple.lastIndexOf(,) + 1);

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String OBJECT_NAME
      A String representing the ObjectName that this MBean maps to.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String buildHostRepositoryPath(java.lang.String hostName)
      Builds the host's path in the repository.
      java.lang.String buildServerRepositoryPath(java.lang.String serverTuple)
      Builds the server's path in the repository from a server tuple.
      java.lang.String buildServerRepositoryPath(java.lang.String hostName, java.lang.String urlEncodedUserDir, java.lang.String serverName)
      Builds the server's path in the repository.
      java.lang.String buildServerTuple(java.lang.String hostName, java.lang.String wlpUserDir, java.lang.String serverName)
      Builds the server tuple from the given host name, wlp user directory and server name.
      java.lang.String getServerTuple(java.lang.String path)
      Extracts the server tuple from the given path.
      java.lang.String getURLEncodedPath(java.lang.String path)
      Encodes an OS file system path with a UTF-8 URL encoding.
      java.lang.String normalizePath(java.lang.String path)
      Normalizes a file system path to be consistent when used within the collective.
      java.lang.String[] splitServerTuple(java.lang.String tuple)
      Safely splits the tuple into its component parts.
    • Field Detail

      • OBJECT_NAME

        static final java.lang.String OBJECT_NAME
        A String representing the ObjectName that this MBean maps to.
        See Also:
        Constant Field Values
    • Method Detail

      • normalizePath

        java.lang.String normalizePath(java.lang.String path)
        Normalizes a file system path to be consistent when used within the collective. Normalization consists of converting all \ to /, and collapsing relative paths, as well as removing duplicate slashes.

        Windows drive-letters are always converted to their upper-case form to ensure consistency.

        e.g. RepositoryPathUtility.getURLEncodedPath("c:\\wlp\\usr\\") will result in: C%3A%2Fwlp%2Fusr

        Note that URL-style prefixing, such as file:// is stripped.

        e.g. RepositoryPathUtility.getURLEncodedPath("file:/c:/wlp/usr") will result in: C%3A%2Fwlp%2Fusr

        Parameters:
        path - The file system path to be normalized. May be null.
        Returns:
        The normalized path
      • getURLEncodedPath

        java.lang.String getURLEncodedPath(java.lang.String path)
        Encodes an OS file system path with a UTF-8 URL encoding.

        The encoded form can be used in the repository as a path element. See normalizePath(String) for details on the resulting path.

        Parameters:
        path - The OS filesystem path to encode. Must not be null.
        Returns:
        The URL encoded path, without a trailing slash
      • buildHostRepositoryPath

        java.lang.String buildHostRepositoryPath(java.lang.String hostName)
        Builds the host's path in the repository.

        The host name will automatically converted to lower-case.

        Parameters:
        hostName - The host name. Must not be null or empty.
        Returns:
        The path to the host in the repository, with the trailing slash.
      • buildServerRepositoryPath

        java.lang.String buildServerRepositoryPath(java.lang.String hostName,
                                                 java.lang.String urlEncodedUserDir,
                                                 java.lang.String serverName)
        Builds the server's path in the repository.

        A server is uniquely identified by its host name, its user dir, and its server name.

        The host name will automatically converted to lower-case.

        Parameters:
        hostName - The host name for the server. Must not be null or empty.
        urlEncodedUserDir - The URL encoded canonical path for the user directory of server. Must not be null or empty.
        serverName - The name of the server. Must not be null or empty.
        Returns:
        The path to the server in the repository, with the trailing slash.
        See Also:
        getURLEncodedPath(String)
      • buildServerRepositoryPath

        java.lang.String buildServerRepositoryPath(java.lang.String serverTuple)
        Builds the server's path in the repository from a server tuple.

        The host name will automatically be converted to lower-case.

        Parameters:
        server - tuple
        Returns:
        The path to the server in the repository, with the trailing slash.
        See Also:
        getServerTuple(String)
      • getServerTuple

        java.lang.String getServerTuple(java.lang.String path)
                                        throws java.lang.IllegalArgumentException
        Extracts the server tuple from the given path. If the path is not a server repository path, an IllegalArgumentException will be thrown.
        Parameters:
        path - A server repository path. Must not be null or empty.
        Returns:
        A server tuple, or null if the path is not a server repository path
        Throws:
        java.lang.IllegalArgumentException - If the path is not a server repository path
      • buildServerTuple

        java.lang.String buildServerTuple(java.lang.String hostName,
                                        java.lang.String wlpUserDir,
                                        java.lang.String serverName)
        Builds the server tuple from the given host name, wlp user directory and server name.
        Parameters:
        hostName - The host name for the server. Must not be null or empty.
        wlpUserDir - The canonical path for the user directory of server. Must not be null or empty.
        serverName - The name of the server. Must not be null or empty.
        Returns:
        The server tuple
        See Also:
        getURLEncodedPath(String)
      • splitServerTuple

        java.lang.String[] splitServerTuple(java.lang.String tuple)
        Safely splits the tuple into its component parts. If the input is not a tuple, then null is returned. Otherwise the return is an array with 3 indices: split[0] - the host name split[1] - the user dir (encoded if the input was encoded) split[2] - the server name
        Parameters:
        tuple - The server tuple to split (in host,userdir,server format)
        Returns:
        The server tuple split into its component parts, an array of 3 elements: host|userdir|name or null if the input was not a tuple