Contained WithinFind More DocumentationFeatured Support Resources | PDF로 이 문서 다운로드 (1531 KB)
Chapter 7 Property Data Types and FunctionsSun OpenSSO Enterprise contains public data types and functions you can use to associate properties between an external application and OpenSSO Enterprise itself. Reference summaries include a short description, syntax, parameters and returns. Prototypes for the types and functions are contained in the <am_properties.h> header file. This chapter contains the following sections: The Property API for CThe property API for C are used to manipulate configuration data read from a standard JavaTM properties file. A properties file is a text file that contains a list of key/value pairs. More information on properties files can be found at http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream). Property Data TypesThe property data types defined in <am_properties.h> are: am_properties_tPointer to a properties object. Detailsam_properties_t provides a key to single value mapping. It provides the additional functionality of loading a configuration file and getting values of specific data types. Syntax#include "am_properties.h" typedef struct am_properties *am_properties_t; Membersam_properties is an opaque structure with no accessible members. am_properties_iter_tPointer to the iterator for a properties object. Syntax#include "am_properties.h" typedef struct am_properties_iter *am_properties_iter_t; Membersam_properties_iter is an opaque structure with no accessible members. Property FunctionsThe property functions defined in <am_properties.h> are: am_properties_copy()Duplicates a specified properties object. Detailsam_properties_copy() copies all the elements in the specified properties object, creates a duplicate instance, and assigns a pointer to it. The original object is not affected during the operation. The removal of any item in either structures does not affect the other. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_copy(am_properties_t source_properties,
am_properties_t *properties_ptr);
ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):
Memory ConcernsAfter using the properties_ptr, call am_properties_destroy() to clean up the allocated memory. am_properties_create()Creates an empty properties object. Syntax#include "am_properties.h" AM_EXPORT am_status_t am_properties_create(am_properties_t *properties_ptr); ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):
Memory ConcernsAfter using the properties_ptr, call am_properties_destroy() to clean up the allocated memory. am_properties_destroy()Destroys the specified properties object. DetailsBe sure not to pass the same instance of am_properties_t to am_properties_destroy() more than once. After calling this function, it is advised to initialize properties to NULL. Syntax#include "am_properties.h" AM_EXPORT void am_properties_destroy(am_properties_t properties); ParametersThis function takes the following parameter:
ReturnsThis function returns no values. am_properties_get()Retrieves the value associated with the specified key from the specified properties object. Detailsam_properties_get() checks for the presence of the specified key and returns its value, if present. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_get(am_properties_t properties,
const char *key,
const char **value_ptr);
ParametersThis function takes the following parameters:
ReturnsOne of the following values as well as value_ptr containing an unparsed string with the address of the location of the value.
Memory ConcernsDo not modify value_ptr or free the memory. am_properties_get_boolean()Retrieves boolean type values associated with the specified key from the specified properties object. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_get_boolean(am_properties_t properties,
const char *key,
int *value_ptr);
ParametersThis function takes the following parameters:
ReturnsOne of the following values stored in value_ptr:
If the associated value does not match any of these recognized boolean values, AM_INVALID_VALUE will be returned. am_properties_get_boolean_with_default()Retrieves boolean type values from the specified properties object. Detailsam_properties_get_boolean_with_default() will return a defined default value if no other value is present, contrary to the behavior of am_properties_get_boolean(). Syntax#include "am_properties.h"
am_properties_get_boolean_with_default(am_properties_t properties,
const char *key,
int default_value,
int *value_ptr);
ParametersThis function takes the following parameters:
ReturnsOne of the following values stored in value_ptr:
If the associated value does not match any of the recognized boolean values, AM_INVALID_VALUE will be returned. am_properties_get_entries()Returns an iterator object that can be used to sequence through the entries in the specified properties object. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_get_entries(am_properties_t properties,
am_properties_iter_t *properties_iter_ptr);
ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):
am_properties_get_positive_number()Retrieves a positive integer value associated with a specified key from the specified properties object. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_get_unsigned(am_properties_t properties,
const char *key,
unsigned long default_value
unsigned long *value_ptr);
ParametersThis function takes the following parameters:
ReturnsThis function returns the unsigned integer value associated with the specified key. am_properties_get_signed()Retrieves a signed integer value associated with the specified key from the specified properties object. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_get_signed(am_properties_t properties,
const char *key,
long *value_ptr);
ParametersThis function takes the following parameters:
ReturnsThis function returns a 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, AM_INVALID_VALUE will be returned. am_properties_get_signed_with_default()Retrieves a signed integer value associated with a specified key from the specified properties object. Detailsam_properties_get_signed_with_default() will return a defined default value if no other value is present, contrary to the behavior of am_properties_get_signed(). Syntax#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);
ParametersThis function takes the following parameters:
ReturnsThis function returns a 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, AM_INVALID_VALUE will be returned. am_properties_get_unsigned()Retrieves an unsigned integer value associated with a specified key from the specified properties object. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_get_unsigned(am_properties_t properties,
const char *key,
unsigned long *value_ptr);
ParametersThis function takes the following parameters:
ReturnsThis function returns the unsigned integer value associated with the specified key. am_properties_get_unsigned_with_default()Retrieves an unsigned integer value associated with a specified key from the specified properties object. Detailsam_properties_get_unsigned_with_default() will return a defined default value if no other value is present, contrary to the behavior of am_properties_get_unsigned(). Syntax#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);
ParametersThis function takes the following parameters:
ReturnsThis function returns the unsigned integer value associated with the specified key. am_properties_get_with_default()Retrieves the value (or the specified default) associated with the specified key from the specified properties object. Detailsam_properties_get_with_default() checks for the presence of the specified key and returns its value, if present. Contrary to am_properties_get(), if no value is present, it returns the specified default value. Syntax#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);
ParametersThis function takes the following parameters:
ReturnsOne of the following values as well as value_ptr containing an unparsed string with the address of the location of the value.
Memory ConcernsDo not modify value_ptr or free the memory. am_properties_is_set()Determines whether the specified key of the specified properties object contains a value. Detailsam_properties_is_set() does not return the value. Syntax#include "am_properties.h"
AM_EXPORT boolean_t
am_properties_is_set(am_properties_t properties,
const char *key);
ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the boolean_t enumeration (defined in the standard <types.h> header file):
am_properties_iter_destroy()Destroys the specified iterator object. Syntax#include "am_properties.h" AM_EXPORT void am_properties_iter_destroy(am_properties_iter_t properties_iter); ParametersThis function takes the following parameter:
ReturnsThis function returns no value. am_properties_iter_get_key()Returns the key of the entry currently referenced by the specified iterator object. Syntax#include "am_properties.h" AM_EXPORT const char * am_properties_iter_get_key (am_properties_iter_t properties_iter); ParametersThis function takes the following parameter:
ReturnsThis function returns one of the following values:
am_properties_iter_get_value()Returns the value of the key currently referenced by the specified iterator object. Syntax#include "am_properties.h" AM_EXPORT const char * am_properties_iter_get_value (am_properties_iter_t properties_iter); ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values:
am_properties_load()Loads information from the specified properties file into the specified properties object. DetailsThe file is assumed to follow the syntax of a standard Java properties file. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_load(am_properties_t properties,
const char *file_name);
ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):
am_properties_set()Sets a value for the specified key in the specified properties object. DetailsThe specified value will replace any existing value. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_set(am_properties_t properties,
const char *key,
const char *value);
ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):
am_properties_store()Retrieves key/value information from the specified properties object and stores it in the specified file. Syntax#include "am_properties.h"
AM_EXPORT am_status_t
am_properties_store(am_properties_t properties,
const char *file_name);
ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values of the am_status_t enumeration (defined in the <am_types.h> header file):
|