This chapter provides a reference to the properties map used by clients of the Sun JavaTM System Access Manager Client APIs. Function summaries include a short description, syntax, parameters and returns.
The following functions are contained in the header file am_properties.h :
Makes a copy of a properties object.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_copy(am_properties_t source_properties, am_properties_t *properties_ptr);
This function takes the following parameters:
The handle for the properties object to be copied.
A pointer to where to store the handle of the new created properties object.
This function returns am_status_t with one of the following values:
If a properties object was successfully copied.
If unable to allocate memory for the new properties object.
If the source_properties or properties_ptr argument is NULL.
Creates an instance of am_properties_t and assigns it to properties_ptr. The function copies all the elements in the source_ptr to properties_ptr. The source_ptr is not affected during this operation.
Memory Concerns: After the usage of the instance properties_ptr the caller must call am_properties_destroy to clean up the allocated memory. The removal of any item in either structures do not affect the other.
Creates an empty properties object.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_create(am_properties_t *properties_ptr);
This function takes the following parameters:
A pointer to where to store the handle of the new created properties object.
This function returns am_status_t with one of the following values:
If a properties object was successfully created.
If unable to allocate memory for the properties object.
If the properties_ptr argument is NULL.
Creates an instance of am_properties_t and assigns it to properties_ptr.
Memory Concerns: After the usage of the instance the caller must call am_properties_destroy to clean up the allocated memory.
Destroys the properties object referenced by the provided handle.
#include "am_properties.h" AM_EXPORT void am_properties_destroy(am_properties_t properties);
This function takes the following parameters:
The handle for the properties object to be destroyed.
This function returns one of the following values:
If the operation was successful.
If properties argument is NULL.
Destroys an instance of am_properties_t.
Memory Concerns: Caller must make sure not to pass the same instance of am_properties_t to be destroyed more than once. After calling this function it is advised that the caller initializes properties to NULL.
This function and all functions beginning with am_properties_get retrieve values from the properties map. The following parameters and exceptions are common to all functions in the am_propteries_get collection. Additional return values may be specified some functions.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get(am_properties_t properties, const char *key, const char **value_ptr);
This function takes the following parameters:
Handle to the properties object to be examined.
Name of the property to look up.
A pointer to where to store the value associated with the default value.
Default value to use if there is no value associated with the specified key.
This function returns the unparsed string form of the value associated with one of the following keys:
If no error is detected.
If the properties, key, or value_ptr argument is NULL.
If the specified key has no associated value and a default value is not provided.
If the value associated with the specified key is cannot be parsed as required by the particular accessor function.
If insufficient memory is available to look up the key.
This function checks if the key is present is the properties instance and returns its value.
Memory Concerns: Caller must not modify the value_ptr structure or free the memory.
Retrieves values from the properties map.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_boolean(am_properties_t properties, const char *key, int *value_ptr);
See am_properties_get().
The unparsed string form of the value associated with the specified key. See am_properties_get().
A value stored in value_ptr with one of the following values.
If the value associated with the specified key is one of: true, on, or yes.
If the value associated with the specified key is one of: false, off, or no.
If the associated value does not match any of the recognized boolean values, then AM_INVALID_VALUE will be returned.
See also am_properties_get().
Retrieves values from the properties map.
#include "am_properties.h" am_properties_get_boolean_with_default(am_properties_t properties, const char *key, int default_value, int *value_ptr);
See am_properties_get().
The unparsed string form of the value associated with the specified key. See am_properties_get().
A value stored in value_ptr with one of the following values.
If the value associated with the specified key is one of: true, on, or yes.
If the value associated with the specified key is one of: false, off, or no.
If the associated value does not match any of the recognized boolean values, then AM_INVALID_VALUE will be returned.
See also am_properties_get().
Returns an iterator object that can be used to enumerate all of the entries in the specified properties object. See also am_properties_get() .
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_entries(am_properties_t properties, am_properties_iter_t *properties_iter_ptr);
This function takes the following parameters:
The handle for the properties object to be examined
Pointer to where the handle for the new properties iterator object should be stored.
This function returns am_status_t with one of the following values:
If no error was detected.
If unable to allocate memory for the properties iterator object.
If the properties_iter_ptr argument is NULL.
If the specified properties object contains no entries.
If the properties_iter_ptr argument is non-NULL, then the location that it refers to will be set to NULL if an error is returned.
See also am_properties_get().
Retrieves values from the properties map.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_signed(am_properties_t properties, const char *key, long *value_ptr);
See am_properties_get().
This function returns the value stored in value_ptr which is the signed integer value associated with the specified key.
If the associated value cannot be parsed as an integer or cannot be represented in the range LONG_MIN to LONG_MAX, then AM_INVALID_VALUE will be returned.
See also am_properties_get().
Retrieve values from the properties map.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_signed_with_default(am_properties_t properties, const char *key, long default_value, long *value_ptr);
See am_properties_get().
This function returns the value stored in value_ptr which is the signed integer value associated with the specified key.
If the associated value cannot be parsed as an integer or cannot be represented in the range LONG_MIN to LONG_MAX, then AM_INVALID_VALUE will be returned.
See also am_properties_get().
See am_properties_get().
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_unsigned(am_properties_t properties, const char *key, unsigned long *value_ptr);
See am_properties_get().
This function returns the unsigned integer value associated with the specified keyDetails.
See am_properties_get().
See am_properties_get().
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_unsigned_with_default(am_properties_t properties, const char *key, unsigned long default_value, unsigned long *value_ptr);
See am_properties_get().
This function returns the unsigned integer value associated with the specified keyDetails.
See am_properties_get().
Retrieves values from the properties map.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_get_with_default(am_properties_t properties, const char *key, const char *default_value, const char **value_ptr);
This function takes the following parameters:
The am_properties_t instance from which the keys value needs to be extracted. key The key whose value will be returned.
The value to be returned in case of any error condition. value_ptr The value pointer to which the value will be assigned to. This is an output parameter. Returns Return values may be ignored.
This function checks if the key is present is the properties instance. If the key is not present, the function returns the default value passed in. Otherwise it returns the value of the key.
Memory Concerns: Caller must not modify the value_ptr structure or free the memory.
Determines whether the object contains property with the specified name.
#include "am_properties.h" AM_EXPORT boolean_t am_properties_is_set(am_properties_t properties, const char *key);
This function takes the following parameters:
Handle to the properties object to be examined.
Name of the property to look up.
This function returns boolean_t with one of the following values:
If the property has a value.
Otherwise
Destroys the properties iterator object referenced by the provided handle.
#include "am_properties.h" AM_EXPORT void am_properties_iter_destroy(am_properties_iter_t properties_iter);
This function takes the following parameters:
The handle for the key iterator object to be destroyed. The handle may be NULL.
None
Returns the key of the element currently referenced by the specified iterator.
#include "am_properties.h" AM_EXPORT const char * am_properties_iter_get_key (am_properties_iter_t properties_iter);
This function takes the following parameters:
The handle for the properties iterator object to be examined.
This function returns const char * with one of the following values:
If the specified iterator is NULL or does not reference a valid entry.
Otherwise.
Returns the value of the element currently referenced by the specified iterator.
#include "am_properties.h" AM_EXPORT const char * am_properties_iter_get_value (am_properties_iter_t properties_iter);
This function takes the following parameters:
The handle for the properties iterator object to be examined.
This function returns const char * with one of the following values:
If the specified iterator is NULL or does not reference a valid entry.
Otherwise.
Loads property information from the specified file.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_load(am_properties_t properties, const char *file_name);
This function takes the following parameters:
Handle to the properties object to be modified.
Name of the file from which to load the property information.
This function returns am_status_t with one of the following values:
If no error is detected.
If the specified file does not exist.
If there is a problem accessing the file.
If properties or file_name is NULL or file_name points to an empty string.
If unable to allocate memory to store the property information.
The file is expected to use the standard Java Properties file syntax.
Sets the value associated with the specified key.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_set(am_properties_t properties, const char *key, const char *value);
This function takes the following parameters:
Handle to the properties object to be modified.
The key to modify.
The value to associate with the specified key.
This function returns am_status_t with one of the following values:
If no error is detected.
If the properties, key, or value argument is NULL.
If unable to allocate memory to store the new key/value.
The specified value will replace any previously existing value.
Stores the property information in the specified file.
#include "am_properties.h" AM_EXPORT am_status_t am_properties_store(am_properties_t properties, const char *file_name);
This function takes the following parameters:
Handle to the properties object to be stored.
Name of the file in which to store the property information.
This function returns am_status_t with one of the following values:
If no error is detected.
If there is a problem writing the properties to the file.
If properties or file_name is NULL or file_name points to an empty string.