### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.information.metadata

# Class PathUrl

java.lang.Object
com.sas.services.information.metadata.PathUrl

All Implemented Interfaces:
  `Serializable`, `Cloneable`

@SASScope("ALL") @BinaryCompatibilityOnly public class PathUrl extends Object implements Serializable, Cloneable
This class encapsulates the SBIP formatted URL. IT has a protocol of SBIP, and has a repository name, a root tree name, the path, the entity name, and the type. Instances can be set as write-protected, so the URL can't be changed out from under an object that may be using it to represent a specific entity in the repository. The clone method can be used to create a copy of an instance that can be modified.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final char`
  `EXTENDED_PATH_DELIMITER`
  The default delimiter (#) used for separating nested objects contained within an extended path.
  `static final int`
  `PARSE_FLAG_NO_TYPE`
  `static final String`
  `PATHURL_DONT_USE_NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PathUrl(PathUrl context, String url)`
  Construct a PathUrl from a known context, plus a partial path.
  `PathUrl(String url)`
  Construct a new PathUrl from a URL string.
  `PathUrl(String url, int flags)`
  `PathUrl(String repository, String rootTree, String path, String name, String type)`
  Construct a new PathUrl from the URL components.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  Create a copy of this object.
  `static String`
  `decodeString(String origString)`
  `static String`
  `encodeString(String origString)`
  `boolean`
  `equals(Object obj)`
  `String`
  `getAbsolutePath()`
  Get the absolute path to the object This basically just leaves off the SBIP and repository/server.
  `String`
  `getDisplayPath()`
  Get a user-friendly display string.
  `String`
  `getExtendedPath()`
  `String`
  `getFullTypeString()`
  Get the type with any extension it may have.
  `String`
  `getName()`
  Get the name of the object.
  `String`
  `getPath()`
  Get the path for this object.
  `String`
  `getPrimaryName()`
  Get the name of the object in the main path.
  `String`
  `getRepository()`
  Get the string with the repository definition name.
  `String`
  `getRootTree()`
  Get the name of the root Tree for this item.
  `String`
  `getServer()`
  Get the string with the server definition name.
  `String`
  `getType()`
  Get the type of the object.
  `static boolean`
  `isAbsolutePath(String pathString)`
  This is a method requested by another group to take a string and determine if it's a full SBIP URL, or just an absolute path.
  `boolean`
  `isWritable()`
  Return the flag indicating if this instance is write-protected.
  `static PathUrl`
  `newPathUrlFromAbsolutePath(ServerInterface server, String absolutePath)`
  Create a new PathUrl from an existing absolute path and a ServerInterface to use as context.
  `static PathUrl`
  `newPathUrlFromExistingUrl(ServerInterface server, PathUrl oldPath)`
  Create a new PathUrl from an existing PathUrl.
  `void`
  `setExtendedPath(String extension)`
  `void`
  `setName(String name)`
  Set the name of the object.
  `void`
  `setPath(String path)`
  Set the path from the root folder to the object.
  `void`
  `setRepository(String repository)`
  Set the name of the repository definition for this object.
  `void`
  `setRootTree(String tree)`
  Set the root tree for this item.
  `void`
  `setType(String type)`
  Set the type for the object.
  `void`
  `setUnwritable()`
  Make this instance write-protected.
  `String`
  `toString()`
  Return the string representation of this URL.

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### EXTENDED_PATH_DELIMITER

    public static final char EXTENDED_PATH_DELIMITER
    The default delimiter (#) used for separating nested objects contained within an extended path.
    See Also:
      - Constant Field Values

  - ### PATHURL_DONT_USE_NAME

    public static final String PATHURL_DONT_USE_NAME
    See Also:
      - Constant Field Values

  - ### PARSE_FLAG_NO_TYPE

    public static final int PARSE_FLAG_NO_TYPE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### PathUrl

    public PathUrl(String url)
    Construct a new PathUrl from a URL string. A valid string must start with "SBIP://", have a repository definition name, a root tree name, and an entity name. It may also have a path, and a type.

    Parameters:
      `url` - A string of the form SBIP://repositorydef/root[/path]/name[(type)]

  - ### PathUrl

    public PathUrl(String url, int flags)

  - ### PathUrl

    public PathUrl(PathUrl context, String url)
    Construct a PathUrl from a known context, plus a partial path.
    Parameters:
      `context` - The context of the url which should yield an absolute address.
      `url` - The path of the object relative to the context.

  - ### PathUrl

    public PathUrl(String repository, String rootTree, String path, String name, String type)
    Construct a new PathUrl from the URL components.

    Parameters:
      `repository` - The name of the repository definition the entity resides in.
      `rootTree` - The name of the tree where the entity resides.
      `path` - The path to the object.
      `name` - The name of the object.
      `type` - The type string for the object.

- ## Method Details

  - ### isAbsolutePath

    public static boolean isAbsolutePath(String pathString)
    This is a method requested by another group to take a string and determine if it's a full SBIP URL, or just an absolute path. I do not do any validation of the string. If it starts with SBIP, it's not an absolute path. Otherwise, it is.
    Parameters:
      `pathString` - The String to check for absolute path or not.
    Returns:
      True if the string does not start with SBIP, false otherwise.

  - ### newPathUrlFromAbsolutePath

    public static PathUrl newPathUrlFromAbsolutePath(ServerInterface server, String absolutePath) throws ServiceException, RemoteException
    Create a new PathUrl from an existing absolute path and a ServerInterface to use as context.
    Parameters:
      `server` - The server where the path exists.
      `absolutePath` - The path to the desired object.
    Returns:
      A new PathUrl with the context of the server, and the absolutePath.
    Throws:
      `ServiceException` - If the path cannot be resolved.
      `RemoteException` - In the event of remote object failure.

  - ### newPathUrlFromExistingUrl

    public static PathUrl newPathUrlFromExistingUrl(ServerInterface server, PathUrl oldPath) throws ServiceException, RemoteException
    Create a new PathUrl from an existing PathUrl. Here are the possible scenarios: 1) This is a valid, current PathUrl and I don't need to do anything to it. 2) This is a valid, new style PathUrl but the server name changed. Just fix the server name. 3) This is an old-style PathUrl in the Foundation repository. Just replace the repository name with the server name. 4) This is an old-style PathUrl in a custom repository and I need to figure out what repository and its root folder and rebuild the PathUrl accordingly. In order to be able to reliably resolve the names, the repository name in an old-style PathUrl has to either be the metadata server repository name, or a repository definition name in the current Information service configuration.
    Parameters:
      `server` - The server where the path actually exists.
      `oldPath` - The old SBIP URL with the correct absolute path. This can actually also be a new style SBIP URL, in which case it will simply be returned.
    Returns:
      A new PathUrl with the context of server, and absolute path of oldPath.
    Throws:
      `ServiceException` - If the path cannot be resolved.
      `RemoteException` - In the event of remote object failure.

  - ### encodeString

    public static String encodeString(String origString)

  - ### decodeString

    public static String decodeString(String origString)

  - ### clone

    public Object clone()
    Create a copy of this object. The new object will be writable.

    Overrides:
      `clone` in class `Object`
    Returns:
      a copy of this PathUrl instance.

  - ### isWritable

    public boolean isWritable()
    Return the flag indicating if this instance is write-protected.

    Returns:
      True if the instance is writable, false otherwise.

  - ### setUnwritable

    public void setUnwritable()
    Make this instance write-protected. No updates will be allowed to this instance. This can't be undone. Once this flag is set, it's set for the life of the object. If you need to update it, create a copy using the clone() method and update that instance.

  - ### getRepository

    public String getRepository()
    Get the string with the repository definition name.

    Returns:
      The name of the repository where this object resides.

  - ### getServer

    public String getServer()
    Get the string with the server definition name.
    Returns:
      The name of the server where this object resides.

  - ### setRepository

    public void setRepository(String repository)
    Set the name of the repository definition for this object.

    Parameters:
      `repository` - The name of the repository this object resides in.
    Throws:
      `IllegalStateException` - If the instance is write-protected.

  - ### getRootTree

    public String getRootTree()
    Get the name of the root Tree for this item.

    Returns:
      The name of the root Tree for this entity.

  - ### setRootTree

    public void setRootTree(String tree)
    Set the root tree for this item.

    Parameters:
      `tree` - The root tree name under which this item resides.
    Throws:
      `IllegalStateException` - if the instance is write-protected.

  - ### getPath

    public String getPath()
    Get the path for this object. This may be null if the object is in a root folder.

    Returns:
      The path from the root folder to the object.

  - ### getAbsolutePath

    public String getAbsolutePath()
    Get the absolute path to the object This basically just leaves off the SBIP and repository/server.
    Returns:
      The absolute path of the object.

  - ### getDisplayPath

    public String getDisplayPath()
    Get a user-friendly display string. This is basically the absolute path without the type at the end. This string should not be used to fetch the object since removing the type can make the URL ambiguous.
    Returns:
      The path string without a type.

  - ### setPath

    public void setPath(String path)
    Set the path from the root folder to the object. It is valid for this to be null if the object is in the root folder.
    Parameters:
      `path` - The path of the object.
    Throws:
      `IllegalStateException` - If the instance is write-protected.

  - ### getPrimaryName

    public String getPrimaryName()
    Get the name of the object in the main path. This will only return a different value than getName() if an extended path is present. For instance, if the PathUrl represents a Channel, getPrimaryName and getName will return the same thing. If it represents a channel archive, getPrimaryName will return the name of the channel and getName will return the name of the package.

    Returns:
      The string representing the name of the object in main SAS Folders path.

  - ### getName

    public String getName()
    Get the name of the object.

    Returns:
      The string representing the name of the object in the repository.

  - ### setName

    public void setName(String name)
    Set the name of the object.

    Parameters:
      `name` - The repository name of the object
    Throws:
      `IllegalStateException` - If the instance is write-protected.

  - ### getType

    public String getType()
    Get the type of the object. This should be a "smart object" type if one exists for the object.

    Returns:
      The type of the object.

  - ### setType

    public void setType(String type)
    Set the type for the object.

    Parameters:
      `type` - The type for the object.
    Throws:
      `IllegalStateException` - If the instance is write-protected.

  - ### getFullTypeString

    public String getFullTypeString()
    Get the type with any extension it may have. For instance, getType may return only "InformationMap", but getExtendedType may return "InformationMap.Relational".
    Returns:
      The fully qualified type name.

  - ### getExtendedPath

    public String getExtendedPath()

  - ### setExtendedPath

    public void setExtendedPath(String extension)

  - ### toString

    public String toString()
    Return the string representation of this URL.
    Overrides:
      `toString` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`