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

com.sas.services.information.metadata
Class PathUrl

com.sas.services.information.metadata.PathUrl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class PathUrl
implements java.io.Serializable, java.lang.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
static char EXTENDED_PATH_DELIMITER
          The default delimiter (#) used for separating nested objects contained within an extended path.
static int PARSE_FLAG_NO_TYPE
           
static java.lang.String PATHURL_DONT_USE_NAME
           
 
Constructor Summary
PathUrl(PathUrl context, java.lang.String url)
          Construct a PathUrl from a known context, plus a partial path.
PathUrl(java.lang.String url)
          Construct a new PathUrl from a URL string.
PathUrl(java.lang.String url, int flags)
           
PathUrl(java.lang.String repository, java.lang.String rootTree, java.lang.String path, java.lang.String name, java.lang.String type)
          Construct a new PathUrl from the URL components.
 
Method Summary
 java.lang.Object clone()
          Create a copy of this object.
static java.lang.String decodeString(java.lang.String origString)
           
static java.lang.String encodeString(java.lang.String origString)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAbsolutePath()
          Get the absolute path to the object This basically just leaves off the SBIP and repository/server.
 java.lang.String getDisplayPath()
          Get a user-friendly display string.
 java.lang.String getExtendedPath()
           
 java.lang.String getFullTypeString()
          Get the type with any extension it may have.
 java.lang.String getName()
          Get the name of the object.
 java.lang.String getPath()
          Get the path for this object.
 java.lang.String getPrimaryName()
          Get the name of the object in the main path.
 java.lang.String getRepository()
          Get the string with the repository definition name.
 java.lang.String getRootTree()
          Get the name of the root Tree for this item.
 java.lang.String getServer()
          Get the string with the server definition name.
 java.lang.String getType()
          Get the type of the object.
static boolean isAbsolutePath(java.lang.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, java.lang.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(java.lang.String extension)
           
 void setName(java.lang.String name)
          Set the name of the object.
 void setPath(java.lang.String path)
          Set the path from the root folder to the object.
 void setRepository(java.lang.String repository)
          Set the name of the repository definition for this object.
 void setRootTree(java.lang.String tree)
          Set the root tree for this item.
 void setType(java.lang.String type)
          Set the type for the object.
 void setUnwritable()
          Make this instance write-protected.
 java.lang.String toString()
          Return the string representation of this URL.
 

Field Detail

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 java.lang.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 Detail

PathUrl

public PathUrl(java.lang.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(java.lang.String url,
               int flags)

PathUrl

public PathUrl(PathUrl context,
               java.lang.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(java.lang.String repository,
               java.lang.String rootTree,
               java.lang.String path,
               java.lang.String name,
               java.lang.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 Detail

isAbsolutePath

public static boolean isAbsolutePath(java.lang.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,
                                                 java.lang.String absolutePath)
                                          throws ServiceException,
                                                 java.rmi.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.
java.rmi.RemoteException - In the event of remote object failure.

newPathUrlFromExistingUrl

public static PathUrl newPathUrlFromExistingUrl(ServerInterface server,
                                                PathUrl oldPath)
                                         throws ServiceException,
                                                java.rmi.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.
java.rmi.RemoteException - In the event of remote object failure.

encodeString

public static java.lang.String encodeString(java.lang.String origString)

decodeString

public static java.lang.String decodeString(java.lang.String origString)

clone

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

Overrides:
clone in class java.lang.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 java.lang.String getRepository()
Get the string with the repository definition name.

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

getServer

public java.lang.String getServer()
Get the string with the server definition name.

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

setRepository

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

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

getRootTree

public java.lang.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(java.lang.String tree)
Set the root tree for this item.

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

getPath

public java.lang.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 java.lang.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 java.lang.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(java.lang.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:
java.lang.IllegalStateException - If the instance is write-protected.

getPrimaryName

public java.lang.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 java.lang.String getName()
Get the name of the object.

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

setName

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

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

getType

public java.lang.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(java.lang.String type)
Set the type for the object.

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

getFullTypeString

public java.lang.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 java.lang.String getExtendedPath()

setExtendedPath

public void setExtendedPath(java.lang.String extension)

toString

public java.lang.String toString()
Return the string representation of this URL.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

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




Copyright © 2009 SAS Institute Inc. All Rights Reserved.