Reading properties
To
read properties from a resource, the client must create a PropertyRequest
that identifies the properties to be read and pass the request as
an argument to the Resource proxy's doReadProperties() method.
You can also use other do methods so properties can be retrieved
in the same server interaction that also performs an operation on
the resource. The do methods pass the resource location specified
by the proxy and the list of desired properties to the repository.
For example:
// create a PropertyRequest requesting the specified
// property names
PropertyRequest wantedProps = new PropertyRequest(Resource.DISPLAY_NAME, Resource.COMMENT);
// you must call doReadProperties to retrieve the properties
// through the proxy
my_resource = my_resource.doReadProperties(wantedProps);
// work with the properties
// for example, get and set values for these properties
// ...
The response from the server is returned through the API back to the client application as a new proxy that contains the requested properties. The property values obtained by the doReadProperties method are stored in the proxy it returns.
After a proxy is populated with properties, the value of these
properties can be extracted from the proxy by using either a PropertyName
object or the access method defined by the proxy class for the property.
The API provides getPropertyName
methods
for each statically-defined property, to get its value from a proxy.
See Naming convention for get and set property value methods for more information.