com.cafesoft.cams.access
Class AbstractResourceRequest

java.lang.Object
  |
  +--com.cafesoft.cams.access.AbstractResourceRequest
All Implemented Interfaces:
ResourceRequest
Direct Known Subclasses:
UrlResourceRequest

public abstract class AbstractResourceRequest
extends Object
implements ResourceRequest

Base class for all ResourceRequests.

This class implements the ResourceRequest interface. In fact, this class implements almost every method. A subclass of this class must only write code to parse the id and the actions. In addition, the subclass may contain additional getter/setter methods to allow for pieces of the id to be retrieved and set quickly.

Since:
8/15/03
See Also:
ResourceRequest

Field Summary
protected  String actions
          Colloquial actions of the ResourceRequest (i.e. this is the raw actions of the ResourceRequest).
protected  long actionsMask
          ActionMask of the actions being performed on the ResourceRequest.
protected  String id
          Colloquial id of the ResourceRequest (i.e. this is the raw id of the ResourceRequest).
protected  ResourceType type
          ResourceType of the ResourceRequest.
 
Constructor Summary
AbstractResourceRequest(ResourceType type, String id, String actions)
          Create a new AbstractResourceRequest object.
 
Method Summary
 String getActions()
          Get the actions being requested on the Resource
 long getActionsMask()
          Get an integer mask representing the actions being requested on the Resource.
 String getId()
          Get the Resource's Id
 ResourceType getResourceType()
          Get the ResourceType.
protected  void parseActions(String actions)
          Parse the actions.
protected  void parseId(String id)
          Parse the id.
 void setActions(String actions)
          Set the actions being performed on the Resource
 void setId(String id)
          Set the Resource's Id
 String toString()
          Get a String representation of the ResourceRequest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected ResourceType type
ResourceType of the ResourceRequest.


id

protected String id
Colloquial id of the ResourceRequest (i.e. this is the raw id of the ResourceRequest).


actions

protected String actions
Colloquial actions of the ResourceRequest (i.e. this is the raw actions of the ResourceRequest).


actionsMask

protected long actionsMask
ActionMask of the actions being performed on the ResourceRequest.

Constructor Detail

AbstractResourceRequest

public AbstractResourceRequest(ResourceType type,
                               String id,
                               String actions)
                        throws InvalidResourceException
Create a new AbstractResourceRequest object.

Parameters:
type - the ResourceType of the ResourceRequest.
id - the colloquial id of the ResourceRequest.
actions - the colloquial actions of the ResourceRequest.
Throws:
InvalidResourceException - if any errors occur while creating the AbstractResourceRequest.
Method Detail

getResourceType

public final ResourceType getResourceType()
Get the ResourceType.

Specified by:
getResourceType in interface ResourceRequest
Returns:
the ResourceType of the Resource.

getActionsMask

public final long getActionsMask()
Get an integer mask representing the actions being requested on the Resource. (Use of this value rather than the String actions can significantly improve performance).

Specified by:
getActionsMask in interface ResourceRequest
Returns:
an integer representing the actions being requested on the Resource.

getId

public final String getId()
Get the Resource's Id

Specified by:
getId in interface ResourceRequest
Returns:
a String representing the Resource's fully-qualified identifier.

setId

public final void setId(String id)
                 throws InvalidResourceException
Set the Resource's Id

Specified by:
setId in interface ResourceRequest
Parameters:
id - a String indicating the Resource's Id
Throws:
InvalidResourceException - if the Resource's identifier is valid. This may occur if the identifier must follow a specific pattern, or it must be non-null or non-empty.

getActions

public final String getActions()
Get the actions being requested on the Resource

Specified by:
getActions in interface ResourceRequest
Returns:
a String indicating the actions being requested

setActions

public final void setActions(String actions)
                      throws InvalidResourceException
Set the actions being performed on the Resource

Specified by:
setActions in interface ResourceRequest
Parameters:
actions - a String indicating the action(s) being requested.
Throws:
InvalidResourceException - if one or more actions is invalid for the resource associated with this request.

toString

public String toString()
Get a String representation of the ResourceRequest.

Overrides:
toString in class Object
Returns:
a String representation of the ResourceRequest.

parseId

protected void parseId(String id)
                throws InvalidResourceException
Parse the id.

This method should be overridden by subclasses.

Parameters:
id - the id to parse.
Throws:
InvalidResourceException - if the id is invalid.

parseActions

protected void parseActions(String actions)
                     throws InvalidResourceException
Parse the actions.

This method should be overridden by subclasses.

Parameters:
actions - the actions to parse.
Throws:
InvalidResourceException - if the actions is invalid.


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.