*** This class provides Binary Compatibility only, not Source Compatibility ***
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe default delimiter (#) used for separating nested objects contained within an extended path.static final intstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionConstruct 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 TypeMethodDescriptionObjectclone()Create a copy of this object.static StringdecodeString(String origString) static StringencodeString(String origString) booleanequals(Object obj) StringGet the absolute path to the object This basically just leaves off the SBIP and repository/server.StringGet a user-friendly display string.StringStringGet the type with any extension it may have.StringgetName()Get the name of the object.StringgetPath()Get the path for this object.StringGet the name of the object in the main path.StringGet the string with the repository definition name.StringGet the name of the root Tree for this item.StringGet the string with the server definition name.StringgetType()Get the type of the object.static booleanisAbsolutePath(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.booleanReturn the flag indicating if this instance is write-protected.static PathUrlnewPathUrlFromAbsolutePath(ServerInterface server, String absolutePath) Create a new PathUrl from an existing absolute path and a ServerInterface to use as context.static PathUrlnewPathUrlFromExistingUrl(ServerInterface server, PathUrl oldPath) Create a new PathUrl from an existing PathUrl.voidsetExtendedPath(String extension) voidsetName(String name) Set the name of the object.voidsetPath(String path) Set the path from the root folder to the object.voidsetRepository(String repository) Set the name of the repository definition for this object.voidsetRootTree(String tree) Set the root tree for this item.voidsetType(String type) Set the type for the object.voidMake this instance write-protected.StringtoString()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_DELIMITERThe default delimiter (#) used for separating nested objects contained within an extended path.- See Also:
-
PATHURL_DONT_USE_NAME
public static final String PATHURL_DONT_USE_NAME- See Also:
-
PARSE_FLAG_NO_TYPE
public static final int PARSE_FLAG_NO_TYPE- See Also:
-
-
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
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:
clonein classObject- 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:
toStringin classObject
-
equals
public boolean equals(Object obj) - Overrides:
equalsin classObject
-