!--a11y-->
Implementing the Property Submanager
(IPropertyManager) 
You implement the IPropertyManager to make system metadata that describes resources available in the repository framework. The metadata is represented as properties. The properties can be system properties like content length and creation date or content properties like the mime type.
The interface offers different methods for accessing the properties of a particular IResourceHandle:
· Single property
· All properties
· A list of specified properties
The getProperty() method accesses single properties::
public IProperty getProperty(IResourceHandle handle,
IPropertyName propName)
throws ResourceException {
Get the properties from the backend system and find the property name that needs to be returned:
Node node = ((SimpleHandle) handle).getNode();
List properties = node.getProperties();
IProperty property = null;
for( int i = 0; i < properties.size(); i++ ) {
property = (IProperty) properties.get(i);
if( propName.equals(property.getPropertyName()) ) {
return property;
}
}
return null;
If the
requested property is not found in the backend system, the method must return
a null value.
The getAllProperties() method returns all available
properties for the specified IResourceHandle.
public Map getAllProperties(IResourceHandle handle)
throws ResourceException {
Node node = ((SimpleHandle) handle).getNode();
List properties = node.getProperties();
Map propertyMap = new HashMap();
IProperty prop = null;
for( int i = 0; i < properties.size(); i++ ) {
prop = (IProperty) properties.get(i);
propertyMap.put(prop.getPropertyName(), prop);
}
return propertyMap;
}
If no properties are available, the method must return an empty map. If properties are available, it returns a map with the property name as the key entry and the property as the value.
The
getListedProperties() method returns all the properties
with the names listed in the given List for the specified IResourceHandle.
public Map getListedProperties(IResourceHandle handle
List propertyNames)
throws ResourceException {
Map propertyMap = new HashMap();
if( ( propertyNames == null )
|| ( propertyNames.size() == 0 )
) {
return propertyMap;
}
Node node = ((SimpleHandle) handle).getNode();
List properties = node.getProperties();
IProperty prop = null;
for( int i = 0; i < properties.size(); i++ ) {
prop = (IProperty) properties.get(i);
if( propertyNames.contains(prop.getPropertyName()) {
propertyMap.put(prop.getPropertyName(), prop);
}
}
return propertyMap;
}
The table shows the methods you implement for the IPropertyManager:
getProperty(…) |
Returns a single IProperty object from the IResourceHandle that matches the specified IPropertyName |
getAllProperties(…) |
Returns a map containing all properties of the specified IResourceHandle |
getListedProperties(…) |
Returns a map containing all properties specified in the list for the IResourceHandle |