org.cougaar.core.blackboard
Interface Claimable

All Known Implementing Classes:
ClaimableImpl, DirectiveImpl, RelayDirective, RelayDirective.Add, RelayDirective.Change, RelayDirective.Remove, RelayDirective.Response

public interface Claimable

An object "claimed" by a single actor, typically a plugin instance.

For example, a Claimable object would likely be "claimed" by a plugin when that plugin creates the object or the object is added into the blackboard.

Claiming of objects is done by the infrastruture *only* - plugins should *never* call claim().


Method Summary
 java.lang.Object getClaim()
           
 boolean isClaimed()
           
 void resetClaim(java.lang.Object oldClaimHolder)
          Release a Claim on the object.
 void setClaim(java.lang.Object putativeClaimHolder)
          Stake a Claim on the object.
 boolean tryClaim(java.lang.Object putativeClaimHolder)
          Try to stake a Claim on the object.
 

Method Detail

isClaimed

boolean isClaimed()
Returns:
true IFF this object been claimed.

getClaim

java.lang.Object getClaim()
Returns:
the current claim holder, or null if there is none.

setClaim

void setClaim(java.lang.Object putativeClaimHolder)
Stake a Claim on the object.

Throws:
java.lang.IllegalArgumentException - If there is already a Claim on the object which is not == the putativeClaimHolder.

tryClaim

boolean tryClaim(java.lang.Object putativeClaimHolder)
Try to stake a Claim on the object.

Returns:
true IFF success.

resetClaim

void resetClaim(java.lang.Object oldClaimHolder)
Release a Claim on the object.

Throws:
IllegalArgumentExcpeiton - If the object is not currently claimed, or is claimed by someone else.