com.cafesoft.cams.access
Interface ResourcePattern

All Superinterfaces:
Comparable
All Known Implementing Classes:
AbstractResourcePattern

public interface ResourcePattern
extends Comparable

The ResourcePattern interface represents a set of Resources using a pattern that matches Resource identifiers.


Method Summary
 FieldInfo[] getFieldInfo()
          Get information about ResourcePattern fields.
 FieldInfo getFieldInfo(String fieldName)
          Get information about a specific ResourcePattern field.
 Object getFieldValue(String fieldName)
          Get the value associated with a ResourcePattern field.
 String getPattern()
          Get the general Resource Identifier pattern.
 boolean match(ResourceRequest resourceReq)
          Determine if a ResourceRequest matches this ResourcePattern.
 BigDecimal score()
          Get the specificality score.
 void setFieldValue(String fieldName, Object fieldValue)
          Set the value associated with a ResourcePattern field.
 void setPattern(String pattern)
          Set the Resource Identifier pattern.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getPattern

public String getPattern()
Get the general Resource Identifier pattern.

Returns:
A string that represents a pattern of Resource identifiers.

setPattern

public void setPattern(String pattern)
                throws ResourcePatternException
Set the Resource Identifier pattern.

Parameters:
pattern - a string that represents a pattern of Resource identifiers.
Throws:
ResourcePatternException - if the overall resource identifier pattern is invalid.

getFieldInfo

public FieldInfo[] getFieldInfo()
Get information about ResourcePattern fields.

Returns:
an array of FieldInfo objects: one for each ResourcePattern field.

getFieldInfo

public FieldInfo getFieldInfo(String fieldName)
Get information about a specific ResourcePattern field.

Parameters:
fieldName - the name of the Field.
Returns:
the corresponding FieldInfo containing metadata about the ResourcePattern Field or null if no Field by that name.

getFieldValue

public Object getFieldValue(String fieldName)
Get the value associated with a ResourcePattern field.

Parameters:
fieldName - the name of the Field.
Returns:
the value associated with the Field.

setFieldValue

public void setFieldValue(String fieldName,
                          Object fieldValue)
                   throws ResourcePatternException
Set the value associated with a ResourcePattern field.

Parameters:
fieldName - the name of the Field.
fieldValue - the value to be be assigned to the Field.
Throws:
ResourcePatternException - if the specified field is unknown or the field value is invalid.

match

public boolean match(ResourceRequest resourceReq)
Determine if a ResourceRequest matches this ResourcePattern.

Parameters:
resourceReq - the ResourceRequest to be checked against this ResourcePattern.
Returns:
true if ResourceRequest matches, else return false.

score

public BigDecimal score()
Get the specificality score.

This method calculates how specific a ResourcePattern is. Because, the ResourcePattern is aware of the various FieldValuePatterns that compose itself it can determine how specific a pattern is. The score is calculated using an algorithm that is implementation specific.

Returns:
a BigDecimal object containing the speificality score.


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.