org.eclipse.webdav.internal.kernel
Class Condition

java.lang.Object
  extended by org.eclipse.webdav.internal.kernel.Condition

public class Condition
extends Object

A Condition represents some state configuration of a particular resource that must be satisfied in order for the associated request to be valid. At least one of the ConditionTerms in a Condition must match with states of the resource, i.e., they are OR'd together. Conditions are contained in a Precondition which is used in a WebDAV If header.


Constructor Summary
Condition()
          Construct a Condition on the default resource.
Condition(String uri)
          Construct a Condition with the given URI.
 
Method Summary
 void addConditionTerm(ConditionTerm term)
          Add a ConditionTerm to a Condition.
 boolean contains(ConditionTerm term)
          Does this Condition contain the given ConditionTerm?
static Condition create(StreamTokenizer tokenizer)
          Create a Condition by parsing the given If header as defined by section 9.4 in the WebDAV spec.
static Condition create(String ifHeader)
          Create a Condition by parsing the given If header as defined by section 9.4 in the WebDAV spec.
 Enumeration getConditionTerms()
          Get all the ConditionTerms for this Condition.
 String getResourceURI()
          Get the URI of the associated Resource.
 boolean matches(Condition condition)
          See if this Condition matches the given Condition.
 void setResourceURI(String value)
          Set the URI of the associated Resource.
 String toString()
          Return a String representation of this Condition as defined by section 9.4 of the WebDAV Spec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Condition

public Condition()
Construct a Condition on the default resource.


Condition

public Condition(String uri)
Construct a Condition with the given URI.

Parameters:
uri - the URI of the resource associated with this condition
Method Detail

addConditionTerm

public void addConditionTerm(ConditionTerm term)
                      throws WebDAVException
Add a ConditionTerm to a Condition.

Parameters:
term - the term to add
Throws:
WebDAVException

contains

public boolean contains(ConditionTerm term)
Does this Condition contain the given ConditionTerm?

Parameters:
term - the term to check for
Returns:
true if the condition contains the given term, false otherwise

create

public static Condition create(StreamTokenizer tokenizer)
                        throws WebDAVException
Create a Condition by parsing the given If header as defined by section 9.4 in the WebDAV spec.

Parameters:
tokenizer - a StreamTokenizer on the contents of a WebDAV If header
Returns:
the parsed condition
Throws:
WebDAVException

create

public static Condition create(String ifHeader)
                        throws WebDAVException
Create a Condition by parsing the given If header as defined by section 9.4 in the WebDAV spec.

Parameters:
ifHeader - the contents of a WebDAV If header
Returns:
the parsed condition
Throws:
WebDAVException - thrown if there is a syntax error in the header

getConditionTerms

public Enumeration getConditionTerms()
Get all the ConditionTerms for this Condition. At least one of the ConditionTerms in a Condition must match with states of the resource, i.e., they are OR'd together. Conditions are contained in a Precondition which is used in a WebDAV If header.


getResourceURI

public String getResourceURI()
Get the URI of the associated Resource. The condition must match on this resource. This is useful for Preconditions that span multiple resources.

Returns:
the resource URI whose state is described by this Condition, may be null indicating the condition applies to the resource receiving the request

matches

public boolean matches(Condition condition)
See if this Condition matches the given Condition. This is an OR operation.

Parameters:
condition - the condition to match against
Returns:
true if the conditions match, false otherwise.

setResourceURI

public void setResourceURI(String value)
Set the URI of the associated Resource. The condition must match on this resource. This is useful for Preconditions that span multiple resources.

Parameters:
value - the resource URI whose state is described by this Condition. value can be null if the condition applies to the resource executing the method.

toString

public String toString()
Return a String representation of this Condition as defined by section 9.4 of the WebDAV Spec.

Overrides:
toString in class Object
Returns:
a String representation of this condition


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.