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.
 boolean getIgnoreCase()
          Get the flag indicating whether pattern matching is performed in a case sensitive or a case-insensitive way.
 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 setIgnoreCase(boolean ignoreCase)
          Set the flag that enables/disables ignoring the case of the pattern.
 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.

setIgnoreCase

public void setIgnoreCase(boolean ignoreCase)
Set the flag that enables/disables ignoring the case of the pattern.

Parameters:
ignoreCase - if true, ignore the case of the pattern. If false, then matches the pattern case-sensitively.

getIgnoreCase

public boolean getIgnoreCase()
Get the flag indicating whether pattern matching is performed in a case sensitive or a case-insensitive way.

Returns:
true if pattern matching is performed case-insentively, false if pattern matchin is performed case-sensitively.

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 5:16:42 PM May 12, 2008, © 1996-2005 Cafésoft LLC. All rights reserved.