cz.cuni.versatile.api
Interface PropertyRegistry

All Known Subinterfaces:
DeliveryContext, ResourceProvider

public interface PropertyRegistry

A common super-type for all interfaces which need to keep track of properties and their dependencies via property mappings.

Author:
Jaroslav Gergic

Method Summary
 java.util.Set getProperties()
          Returns a read-only view of the currently registered properties.
 Property getProperty(java.lang.String uniqueName)
          Returns a Property corresponding to the given uniqueName
 PropertyMapping getPropertyMapping(Property prop)
          Returns the PropertyMapping for the given Property.
 boolean hasProperty(Property prop)
          Check whether the given Property is already registered to this registry.
 boolean hasProperty(java.lang.String uniqueName)
          Check whether a property with the given uniqueName is already registered to this registry.
 boolean isMappedProperty(Property prop)
          Checks, whether the given Property is a leaf or a property derived using a PropertyMapping.
 void registerProperty(Property prop, PropertyMapping pm)
          Registers a derived property and its value-providing PropertyMapping.
 void unregisterProperty(Property prop)
          Unregisters the given Property from the registry.
 

Method Detail

hasProperty

public boolean hasProperty(Property prop)
Check whether the given Property is already registered to this registry.

Parameters:
prop - a property instance
Returns:
true if the property is already registered, false otherwise

hasProperty

public boolean hasProperty(java.lang.String uniqueName)
Check whether a property with the given uniqueName is already registered to this registry.

Parameters:
uniqueName - a unique identifier of the property
Returns:
true if the property is already registered, false otherwise
See Also:
Property.getUniqueName()

getProperty

public Property getProperty(java.lang.String uniqueName)
                     throws UnregisteredPropertyException
Returns a Property corresponding to the given uniqueName

Parameters:
uniqueName - a unique identifier of the property
Returns:
a Property corresponding to the given uniqueName
Throws:
UnregisteredPropertyException - in case a property the given uniqueName is not registered

isMappedProperty

public boolean isMappedProperty(Property prop)
                         throws UnregisteredPropertyException
Checks, whether the given Property is a leaf or a property derived using a PropertyMapping.

Parameters:
prop - a property instance
Returns:
true if the given property is a derived property, false otherwise
Throws:
UnregisteredPropertyException - in case the property is not registered

getPropertyMapping

public PropertyMapping getPropertyMapping(Property prop)
                                   throws UnregisteredPropertyException,
                                          PropertyKindException
Returns the PropertyMapping for the given Property.

Parameters:
prop - a Property instance
Returns:
PropertyMapping registered for the given Property.
Throws:
UnregisteredPropertyException - in case the property is not registered
PropertyKindException - in case there is no PropertyMapping registered for the given Property

registerProperty

public void registerProperty(Property prop,
                             PropertyMapping pm)
                      throws PropertyMappingException
Registers a derived property and its value-providing PropertyMapping. If the Property has already been registered, it redefines the Property

Parameters:
prop - a Property to register
pm - a PropertyMapping for the given Property
Throws:
PropertyMappingException - in case the domain and/or range of the mapping is incorrect with the respect to the semantics of the underlying PropertyRegistry implementation.

unregisterProperty

public void unregisterProperty(Property prop)
                        throws UnregisteredPropertyException
Unregisters the given Property from the registry.

Parameters:
prop - a Property to unregister
Throws:
UnregisteredPropertyException - in case the property is not registered

getProperties

public java.util.Set getProperties()
Returns a read-only view of the currently registered properties.

Returns:
a read-only view of the currently registered properties.