*** This class provides Binary Compatibility only, not Source Compatibility ***
Package com.sas.services.util
Class AttributeMap
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.sas.services.util.AttributeMap
- All Implemented Interfaces:
AttributeMapInterface,Serializable,Remote
@SASScope("ALL")
@BinaryCompatibilityOnly
public class AttributeMap
extends UnicastRemoteObject
implements AttributeMapInterface
Represents the name/value pairs. A name/value can be specified as a name, a
name and a value, or a name and multiple values.
Name/value pairs are used by the Publish services to provide user or application control information describing the result package or entry. Name/values can be associated with a result package, or with individual entries within the result package.
- Since:
- 1.0
- See Also:
-
Field Summary
Fields inherited from class java.rmi.server.RemoteObject
ref -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, String value) Add a value to existing name/value pair.static booleanapplyFilter(String filter, AttributeMapInterface attr) Apply a filter string to the specified name/value pairs to determine if there is a match.static StringbuildValue(String[] values) Takes the values of a name/value pair, and builds the appropriate value String.StringgetAttribute(String name) Get the value for the specified name.String[]getAttributes(String name) Get all the values for the specified name.String[]Returns an array of all the names.static AttributeMapInterfaceparseNameValuePairs(AttributeMapInterface attrMap, String nameValuePairs) Parses a name/value pairs string.static AttributeMapInterfaceparseValues(AttributeMapInterface attrMap, String name, String values) Parses a name/value pairs string.voidsetAttribute(String name, String value) Set the name/value pair.Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLogMethods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStubMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
AttributeMap
public AttributeMap() throws RemoteExceptionConstructor.- Throws:
RemoteException- if unable to export a remote object to the RMI system.
-
-
Method Details
-
getAttribute
public String getAttribute(String name) throws RemoteException Get the value for the specified name. If there are multiple values for this name, it returns the first name that was added.- Specified by:
getAttributein interfaceAttributeMapInterface- Parameters:
name- The name portion of the name/value pair.- Returns:
StringThe value.- Throws:
RemoteException- If a network anomaly is encountered.
-
getAttributes
public String[] getAttributes(String name) throws RemoteException Get all the values for the specified name. If no values exist for this name, an empty array is returned.- Specified by:
getAttributesin interfaceAttributeMapInterface- Parameters:
name- The name portion of the name/value pair.- Returns:
String[]An array of all values for the specified name.- Throws:
RemoteException- If a network anomaly is encountered.
-
setAttribute
public void setAttribute(String name, String value) throws RemoteException, IllegalArgumentException Set the name/value pair. Any existing value(s) will be cleared in favor of the new value.- Specified by:
setAttributein interfaceAttributeMapInterface- Parameters:
name- The name portion of the name/value pair.value- The value portion of the name/value pair. If this value is null, any existing value(s) are removed for the name/value pair.- Throws:
IllegalArgumentException- If anullor blank name is specified.RemoteException- If a network anomaly is encountered.
-
addAttribute
public void addAttribute(String name, String value) throws RemoteException, IllegalArgumentException Add a value to existing name/value pair. This value is appended to the set of any existing values for the specified name. If this name does not already exist, the behavior is the same assetAttribute(String, String). The order is preserved betweenaddAttributeandgetAttributes(String).- Specified by:
addAttributein interfaceAttributeMapInterface- Parameters:
name- The name portion of the name/value pair.value- The value portion of the name/value pair.- Throws:
IllegalArgumentException- If anullor blank name is specified.RemoteException- If a network anomaly is encountered.
-
listAttributeNames
public String[] listAttributeNames() throws RemoteExceptionReturns an array of all the names.- Specified by:
listAttributeNamesin interfaceAttributeMapInterface- Returns:
SetAn array of all the names.- Throws:
RemoteException- If a network anomaly is encountered.
-
parseNameValuePairs
public static AttributeMapInterface parseNameValuePairs(AttributeMapInterface attrMap, String nameValuePairs) throws ParseException Parses a name/value pairs string. The parsed name/values are returned in a AttributeMapInterface object.- Parameters:
attrMap- The AttributeMapInterface to continue to build with the parsed name/value pairs. This may benull. Ifnull, a new attribute map will be created and returned. If notnull, the existing map will be updated and returned.nameValuePairs- The name/value string to parse.- Returns:
- AttributeMapInterface The name/value pairs attribute map.
- Throws:
ParseException- If an error occurs during parsing.
-
parseValues
public static AttributeMapInterface parseValues(AttributeMapInterface attrMap, String name, String values) throws ParseException Parses a name/value pairs string. The parsed name/values are returned in a AttributeMapInterface object.- Parameters:
attrMap- The AttributeMapInterface to continue to build with the parsed name/value pairs. This may benull. Ifnull, a new attribute map will be created and returned. If notnull, the existing map will be updated and returned.name- The name to parse.values- Values to be parsed.- Returns:
- Map of attributes.
- Throws:
ParseException- If an error occurs during parsing.
-
buildValue
Takes the values of a name/value pair, and builds the appropriate value String. Single values that contain spaces will quoted. For example, "single value with spaces". The constructed String will contain the quotes. Multi-valued name/value specifications will be surrounded in parenthesis, and values will be comma-separated. For example, (value1, "value 2", value3, ...valueN).- Parameters:
values- The array of values for this name/value specification- Returns:
StringThe constructed values string. This may benull.- Throws:
ParseException- If an error is encountered building the value string.
-
applyFilter
Apply a filter string to the specified name/value pairs to determine if there is a match.- Parameters:
filter- Filter to be applied.attr- Map of attributes.- Returns:
booleanReturnstrueif the name/value filter matches the name/value pair specification; otherwise if there is not match,falseis returned.- Throws:
ParseException- If an error occurs parsing the name/value filter.
-