webfunds.ricardian
Interface ContractStore

All Known Implementing Classes:
DirContractStore

public interface ContractStore


Method Summary
 void addContract(Contract contract)
          Add a contract to the store.
 Contract[] getAllContracts()
          Return all contracts in the store.
 ItemId[] getAllIds()
          One to one with getAllContracts().
 java.lang.String[] getAllNames()
          There are many names for each contract, this list will be larger than the number of contracts.
 Contract getContract(ItemId hash)
          Return a contract named by hash.
 Contract[] getContractsByName(java.lang.String name)
          Return a list of contracts answering to the given name.
 ItemId[] getIdsByName(java.lang.String name)
           
 Contract getUniqueContract(java.lang.String name)
          If sure of the unique name, this returns one contract.
 void removeContract(Contract remcontract)
          Remove this contract from the store.
 

Method Detail

addContract

public void addContract(Contract contract)
                 throws ContractException
Add a contract to the store.

removeContract

public void removeContract(Contract remcontract)
Remove this contract from the store.

getContract

public Contract getContract(ItemId hash)
Return a contract named by hash. Hash is unique.
Returns:
a unique Contract which has message digest of hash

getContractsByName

public Contract[] getContractsByName(java.lang.String name)
Return a list of contracts answering to the given name. As a contract can answer to any name, and as the software can assign new names, name clashes can and do occur. It is up to the caller to decide what to do about it.
Returns:
array of unique Contract where each answers to name

getIdsByName

public ItemId[] getIdsByName(java.lang.String name)

getUniqueContract

public Contract getUniqueContract(java.lang.String name)
                           throws ContractException
If sure of the unique name, this returns one contract.

getAllContracts

public Contract[] getAllContracts()
Return all contracts in the store. One to one with getAllIds().
Returns:
a list of contracts

getAllIds

public ItemId[] getAllIds()
One to one with getAllContracts().
Returns:
a list of ItemIds for all contracts in the store.

getAllNames

public java.lang.String[] getAllNames()
There are many names for each contract, this list will be larger than the number of contracts.
Returns:
a list of all Names in the store.