org.mmbase.bridge.mock
Class MockCloud

java.lang.Object
  extended by org.mmbase.bridge.util.AbstractCloud
      extended by org.mmbase.bridge.mock.MockCloud
All Implemented Interfaces:
Cloud
Direct Known Subclasses:
MockTransaction

public class MockCloud
extends AbstractCloud

Straight forward (partial) implementation of Cloud, which maintains everything in memory.

Since:
MMBase-1.9.2
Version:
$Id: MockCloud.java 41968 2010-04-20 11:23:20Z michiel $
Author:
Michiel Meeuwissen
To Do:
EXPERIMENTAL

Field Summary
(package private)  MockCloudContext cloudContext
           
 
Fields inherited from class org.mmbase.bridge.util.AbstractCloud
transactions
 
Fields inherited from interface org.mmbase.bridge.Cloud
PROP_IGNOREVALIDATION, PROP_REQUEST, PROP_RESPONSE, PROP_SESSIONNAME, PROP_XMLMODE
 
Constructor Summary
MockCloud(String n, MockCloudContext cc, UserContext uc)
           
 
Method Summary
 MockCloudContext getCloudContext()
          Returns the context to which this cloud belongs.
 NodeList getList(Query query)
          Executes a query and returns the result as a Cluster Node List (also if the query is a NodeQuery).
 Node getNode(int number)
          Returns the node with the specified number from this cloud.
(package private)  Node getNode(MockCloudContext.NodeDescription nd, boolean n)
           
 Node getNodeByAlias(String alias)
          Returns the node with the specified alias from this cloud.
 NodeManager getNodeManager(String name)
          Returns the specified node manager.
 NodeManagerList getNodeManagers()
          Returns all node managers available in this cloud.
 RelationManager getRelationManager(NodeManager sourceManager, NodeManager destinationManager, String roleName)
          Returns the specified relation manager.
 RelationManager getRelationManager(String roleName)
          Returns the specified relation manager.
 boolean hasNode(int number)
          Determines whether a node with the specified number exists in this cloud.
protected  Transaction newTransaction(String name)
           
 String toString()
           
 
Methods inherited from class org.mmbase.bridge.util.AbstractCloud
createAggregatedQuery, createNodeList, createNodeManagerList, createNodeQuery, createQuery, createRelationList, createRelationManagerList, createTransaction, createTransaction, createTransaction, getDescription, getFunction, getFunctions, getList, getLocale, getName, getNode, getNodeManager, getNonTransactionalCloud, getPossibleContexts, getProperties, getProperty, getRelation, getRelation, getRelationManager, getRelationManager, getRelationManagers, getRelationManagers, getRelationManagers, getTransaction, getUser, hasNode, hasNodeManager, hasRelation, hasRelation, hasRelationManager, hasRelationManager, hasRelationManager, hasRole, may, mayRead, mayRead, setLocale, setProperty, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cloudContext

final MockCloudContext cloudContext
Constructor Detail

MockCloud

MockCloud(String n,
          MockCloudContext cc,
          UserContext uc)
Method Detail

getNode

Node getNode(MockCloudContext.NodeDescription nd,
             boolean n)

getNode

public Node getNode(int number)
             throws NotFoundException
Description copied from interface: Cloud
Returns the node with the specified number from this cloud. The returned node is a new instance of Node with a reference to this instance of Cloud.

Specified by:
getNode in interface Cloud
Specified by:
getNode in class AbstractCloud
Parameters:
number - the number of the requested node
Returns:
the requested node
Throws:
NotFoundException - if the specified node could not be found

getNodeByAlias

public Node getNodeByAlias(String alias)
                    throws NotFoundException
Description copied from interface: Cloud
Returns the node with the specified alias from this cloud. The returned node is a new instance of Node with a reference to this instance of Cloud.

Specified by:
getNodeByAlias in interface Cloud
Overrides:
getNodeByAlias in class AbstractCloud
Parameters:
alias - the alias of the requested node
Returns:
the requested node
Throws:
NotFoundException - if the specified node could not be found

hasNode

public boolean hasNode(int number)
Description copied from interface: Cloud
Determines whether a node with the specified number exists in this cloud. Note that this method does not determine whether you may actually access (read) this node, use Cloud.mayRead(int) to determine this.

Specified by:
hasNode in interface Cloud
Overrides:
hasNode in class AbstractCloud
Parameters:
number - the number of the node
Returns:
true if the node exists

getNodeManagers

public NodeManagerList getNodeManagers()
Description copied from interface: Cloud
Returns all node managers available in this cloud.

Specified by:
getNodeManagers in interface Cloud
Specified by:
getNodeManagers in class AbstractCloud
Returns:
a NodeManagerList containing all node managers available in this cloud.

getNodeManager

public NodeManager getNodeManager(String name)
                           throws NotFoundException
Description copied from interface: Cloud
Returns the specified node manager.

Specified by:
getNodeManager in interface Cloud
Specified by:
getNodeManager in class AbstractCloud
Parameters:
name - the name of the requested node manager
Returns:
the requested node manager
Throws:
NotFoundException - if the specified node manager could not be found

getCloudContext

public MockCloudContext getCloudContext()
Description copied from interface: Cloud
Returns the context to which this cloud belongs.

Specified by:
getCloudContext in interface Cloud
Specified by:
getCloudContext in class AbstractCloud
Returns:
a CloudContext to which this cloud belongs

getList

public NodeList getList(Query query)
Description copied from interface: Cloud
Executes a query and returns the result as a Cluster Node List (also if the query is a NodeQuery).

Specified by:
getList in interface Cloud
Overrides:
getList in class AbstractCloud
Parameters:
query - Query to execute
Returns:
Cluster Node List
See Also:
SearchQuery

newTransaction

protected Transaction newTransaction(String name)
Overrides:
newTransaction in class AbstractCloud

toString

public String toString()
Overrides:
toString in class Object

getRelationManager

public RelationManager getRelationManager(NodeManager sourceManager,
                                          NodeManager destinationManager,
                                          String roleName)
                                   throws NotFoundException
Description copied from interface: Cloud
Returns the specified relation manager.

Specified by:
getRelationManager in interface Cloud
Overrides:
getRelationManager in class AbstractCloud
Parameters:
sourceManager - the node manager of the source node
destinationManager - the node manager of the destination node
roleName - name of the role
Returns:
the requested relation manager
Throws:
NotFoundException - if the specified relation manager could not be found

getRelationManager

public RelationManager getRelationManager(String roleName)
                                   throws NotFoundException
Description copied from interface: Cloud
Returns the specified relation manager.

Specified by:
getRelationManager in interface Cloud
Overrides:
getRelationManager in class AbstractCloud
Parameters:
roleName - name of the role
Returns:
the requested relation manager
Throws:
NotFoundException - if the specified relation manager could not be found


MMBase 2.0-SNAPSHOT - null