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

com.sas.services.util
Class Names

com.sas.services.util.Names

public class Names

Utility classes needed to support consistent naming behavior.

Since:
1.1.3

Field Summary
static int MAX_VARIABLE_NAME_LENGTH
          The maximum length of a SAS Variable name.
static int UNIX
          UNIX operating system.
static int UNKNOWN
          Unknown operating system.
static int WEBDAV
          WebDAV
static int WINDOWS
          Windows operating system.
static int ZOS_HFS
          z/OS HFS operating system.
static int ZOS_PDS
          z/OS PDS operating system.
 
Method Summary
static java.lang.String generateName(int numOfChars)
          Attempt to generate a unique name.
static java.lang.String getObjectName(java.lang.String name, RemoteServiceInterface remoteService)
          Create the String representation of the MBean object name.
static java.lang.String mapNameToFilesystem(java.lang.String name, int hostOS, java.lang.String prefix, java.lang.String suffix)
          Map the object name to a file system path.
static java.lang.String mapNameToOMRObjectName(java.lang.String name)
          Map the parameter name to a valid OMR object name.
static java.lang.String mapNameToSASVariableName(java.lang.String name, java.util.Collection existingNames)
          Map the parameter name to a valid SAS variable name.
static java.lang.String mapUrlToFilesystem(java.lang.String url, int hostOS, java.lang.String prefix, java.lang.String suffix)
          Map the object SBIP URLto a file system path.
static java.lang.String trimName(java.lang.String name)
          Trim leading and trailing space and control characters.
static boolean validateOMRObjectName(java.lang.String name, boolean throwException)
          Test for a valid Metadata Repository object name.
static boolean validateParameterName(java.lang.String name, boolean throwException)
          Test for valid parameter name or parameter group name.
static boolean validateSASFilerefName(java.lang.String name, boolean throwException)
          Test for valid SAS fileref name.
static boolean validateSASLibrefName(java.lang.String name, boolean throwException)
          Test for valid SAS libref name.
static boolean validateSASVariableName(java.lang.String name, boolean throwException)
          Test for valid SAS variable name.
 

Field Detail

MAX_VARIABLE_NAME_LENGTH

public static final int MAX_VARIABLE_NAME_LENGTH
The maximum length of a SAS Variable name.

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
Unknown operating system.

See Also:
Constant Field Values

WINDOWS

public static final int WINDOWS
Windows operating system.

See Also:
Constant Field Values

UNIX

public static final int UNIX
UNIX operating system.

See Also:
Constant Field Values

ZOS_HFS

public static final int ZOS_HFS
z/OS HFS operating system.

See Also:
Constant Field Values

ZOS_PDS

public static final int ZOS_PDS
z/OS PDS operating system.

See Also:
Constant Field Values

WEBDAV

public static final int WEBDAV
WebDAV

See Also:
Constant Field Values
Method Detail

mapNameToFilesystem

public static java.lang.String mapNameToFilesystem(java.lang.String name,
                                                   int hostOS,
                                                   java.lang.String prefix,
                                                   java.lang.String suffix)
                                            throws java.lang.IllegalArgumentException
Map the object name to a file system path.

Parameters:
name - The name to map to a file system path.
hostOS - The host operating system. Valid values include UNKNOWN,WINDOWS,UNIX, ZOS_HFS,ZOS_PDSand WEBDAV.
prefix - The prefix to use when creating the file system path.
suffix - The suffix to use when creating the file system path.
Returns:
String The file system path.
Throws:
java.lang.IllegalArgumentException - If a null name is specified or if an invalid host operating system value is specified.

mapUrlToFilesystem

public static java.lang.String mapUrlToFilesystem(java.lang.String url,
                                                  int hostOS,
                                                  java.lang.String prefix,
                                                  java.lang.String suffix)
                                           throws java.lang.IllegalArgumentException
Map the object SBIP URLto a file system path.

Parameters:
url - The url to map to a file system path.
hostOS - The host operating system. Valid values include UNKNOWN,WINDOWS,UNIX, ZOS_HFS,ZOS_PDSand WEBDAV.
prefix - The prefix to use when creating the file system path.
suffix - The suffix to use when creating the file system path.
Returns:
String The file system path.
Throws:
java.lang.IllegalArgumentException - If an invalid SBIP URL is specified.

mapNameToSASVariableName

public static java.lang.String mapNameToSASVariableName(java.lang.String name,
                                                        java.util.Collection existingNames)
                                                 throws java.lang.IllegalArgumentException
Map the parameter name to a valid SAS variable name. The rules for conversion are as follows:

Parameters:
name - The name to map to a SAS variable name.
existingNames - Is an optional collection containingg all pre-existing parameters so that the method can avoid name collisions. A value of null for this Collection would disable any name collision checking.
Returns:
String the SAS variable name.
Throws:
java.lang.IllegalArgumentException - If a null name is specified.

mapNameToOMRObjectName

public static java.lang.String mapNameToOMRObjectName(java.lang.String name)
Map the parameter name to a valid OMR object name. The rules for conversion are as follows:

Parameters:
name - the name to map to a valid OMR object name
Returns:
String the OMR object name.
Throws:
java.lang.IllegalArgumentException - If a null name is specified.

validateOMRObjectName

public static boolean validateOMRObjectName(java.lang.String name,
                                            boolean throwException)
                                     throws java.lang.IllegalArgumentException
Test for a valid Metadata Repository object name. The rules for validating are as follows. The object name is invalid if any of the following are true:

Parameters:
name - The name to validate
throwException - indicates whether to throw an exception if the value is not valid.
Returns:
boolean is true if this is a valid name; is false if the name contains an illegal character or is too long.
Throws:
java.lang.IllegalArgumentException - If the throwException parameter is true and the name is invalid.

validateParameterName

public static boolean validateParameterName(java.lang.String name,
                                            boolean throwException)
                                     throws java.lang.IllegalArgumentException
Test for valid parameter name or parameter group name. The rules for validating are as follows. The parameter name is invalid if any of the following are true:

Parameters:
name - The name to validate.
throwException - indicates whether to throw an exception if the value is not valid.
Returns:
boolean is true if this is a valid name; is false if the name contains an illegal character or is too long.
Throws:
java.lang.IllegalArgumentException - If the throwException parameter is true and the name is invalid.

validateSASVariableName

public static boolean validateSASVariableName(java.lang.String name,
                                              boolean throwException)
                                       throws java.lang.IllegalArgumentException
Test for valid SAS variable name. The rules for validating are as follows. The variable name is invalid if any of the following are true:

Parameters:
name - The SAS variable name to validate.
throwException - indicates whether to throw an exception if the value is not valid.
Returns:
boolean is true if this is a valid name; is false if the name contains an illegal character or is too long.
Throws:
java.lang.IllegalArgumentException - If the throwException parameter is code>true and the name is invalid.

validateSASLibrefName

public static boolean validateSASLibrefName(java.lang.String name,
                                            boolean throwException)
                                     throws java.lang.IllegalArgumentException
Test for valid SAS libref name. The rules for validating are as follows. The libref name is invalid if any of the following are true:

Parameters:
name - The SAS libref name to validate.
throwException - indicates whether to throw an exception if the value is not valid.
Returns:
boolean is true if this is a valid name; is false if the name contains an illegal character or is too long.
Throws:
java.lang.IllegalArgumentException - If the throwException parameter is code>true and the name is invalid.

validateSASFilerefName

public static boolean validateSASFilerefName(java.lang.String name,
                                             boolean throwException)
                                      throws java.lang.IllegalArgumentException
Test for valid SAS fileref name. The SAS fileref name is invalid if any of the following are true:

Parameters:
name - The SAS fileref name to validate.
throwException - indicates whether to throw an exception if the value is not valid.
Returns:
boolean is true if this is a valid name; is false if the name contains an illegal character or is too long.
Throws:
java.lang.IllegalArgumentException - If the throwException parameter is code>true and the name is invalid.

trimName

public static java.lang.String trimName(java.lang.String name)
                                 throws java.lang.IllegalArgumentException
Trim leading and trailing space and control characters. Whitespace identified by the Character.isSpaceChar method will be trimmed. Control characters identified by the Character.isISOControl method will be trimmed.

Parameters:
name - The name to trim.
Returns:
String The trimmed name.
Throws:
java.lang.IllegalArgumentException - If a null name is specified.

generateName

public static java.lang.String generateName(int numOfChars)
Attempt to generate a unique name. This generates the name based on the CRC32 checksum of a VMID.

The unique name generation is not guaranteed to be 100% unique so calling applications should handle duplicates accordingly.

Parameters:
numOfChars - the number of characters in the generated name. Specify zero to get the default name/length.
Returns:
the unique name

getObjectName

public static java.lang.String getObjectName(java.lang.String name,
                                             RemoteServiceInterface remoteService)
Create the String representation of the MBean object name.

Parameters:
name - The name of the Service.
remoteService - the remote service
Returns:
the String representation of the MBean object name

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




Copyright © 2009 SAS Institute Inc. All Rights Reserved.