Additional information about properties

Although some properties are specific to a resource, many properties are common to all resources. From any resource, a client can obtain the following information:
  • A location of the resource.
  • A string that represents the unique and persistent location of the resource.
  • A string that contains a name for the resource that can be used when it is displayed to the user.
  • A string that contains a description of the creator of the resource.
  • The time and date the resource was created and last modified.
  • A string that contains a comment about the resource.
  • If the resource has content (in addition to properties), pertinent information about the size and form of that content.
  • The resources that directly or indirectly contain the resource.
  • A list of the resources that the resource contains.

Although these properties are defined for all resources, some resources may return null or empty values for them or provide a PROPERTY_NOT_SUPPORTED_BY_SERVER exception for them.

All properties (except the location) must be explicitly requested from the server before they are available from a proxy.

The Resource class provides generic methods for accessing the property values defined by a proxy by using the PropertyName object for each property. WVCM defines the methods Resource.getProperty(PropertyNameList.PropertyName) and Resource.setProperty(PropertyNameList.PropertyName, Object). The getProperty method throws the exception PropertyException if the proxy does not contain a valid value for the property identified by the PropertyName object.

There is also the Resource.lookupProperty() method for retrieving a property value. If the property value is defined, lookupProperty() returns the same object as getProperty. If the property value is undefined, lookupProperty() returns the exception that is thrown by the getProperty method.

The setProperty, getProperty, and lookupProperty methods do not verify that the PropertyName is defined by the proxy class. Any proxy can be used to interact with any type of resource. Such interactions fail only when they attempt to write or retrieve values for properties that are not defined for the resource addressed by the proxy; the failures occur only when the API Provider attempts to transfer such property values to or from the resource. Note, however, that when constructing a proxy for a given location, the domain of the location must match the domain of the provider from which the proxy is being requested.