public interface Cloud
Nodes (and Relations that are also nodes), and
is also associated with a certain authentication UserContext.
A Cloud can be obtained using a CloudContext (which itself can be obtained from ContextProvider).
The Cloud also contains the information about what types of nodes getNodeManagers() and
what type of relations between nodes getRelationManagers() can be made.
Cloud also can support Transactions, which are a kind of temporary 'sub' clouds.| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_IGNOREVALIDATION
If you set this property on the cloud to true, validation errors will not be fatal, and nodes
can be saved anyways.
|
static String |
PROP_REQUEST
With the Cloud a ServletRequest can be associated and stored in a property with this name
|
static String |
PROP_RESPONSE
With the Cloud a ServletResponse can be associated and stored in a property with this name.
|
static String |
PROP_SESSIONNAME
The cloud itself may have been stored in a user's 'session', using this the key stored in
this property.
|
static String |
PROP_XMLMODE
This property can contain hints on how to deal with XML fields.
|
| Modifier and Type | Method and Description |
|---|---|
Query |
createAggregatedQuery() |
NodeList |
createNodeList()
Returns a new, empty node list for this cloud
|
NodeManagerList |
createNodeManagerList()
Returns a new, empty node manager list for this cloud
|
NodeQuery |
createNodeQuery()
Create an empty NodeQuery, which can be filled, and used in
NodeManager.getList(NodeQuery) or
getList(Query) (but then no 'real' node are returned). |
Query |
createQuery()
Create an empty Query, which can be filled, and used in
getList(Query). |
RelationList |
createRelationList()
Returns a new, empty relation list for this cloud
|
RelationManagerList |
createRelationManagerList()
Returns a new, empty relation manager list for this cloud
|
Transaction |
createTransaction()
Creates a transaction on this cloud.
|
Transaction |
createTransaction(String name)
Creates a transaction on this cloud with a specified name.
|
Transaction |
createTransaction(String name,
boolean overwrite)
Creates a transaction on this cloud with a specified name.
|
CloudContext |
getCloudContext()
Returns the context to which this cloud belongs.
|
String |
getDescription()
This may return
getName(), but in principable it could have been localized using the
value also returned by getLocale(). |
Function<?> |
getFunction(String setName,
String functionName)
Returns a Function object from a function set.
|
Collection<Function<?>> |
getFunctions(String setName)
Returns all Function objects from a function set.
|
NodeList |
getList(Query query)
Executes a query and returns the result as a Cluster Node List (also if the query is a
NodeQuery). |
NodeList |
getList(String startNodes,
String nodePath,
String fields,
String constraints,
String orderby,
String directions,
String searchDir,
boolean distinct)
Returns a list of virtual nodes that are composed by fields of other
nodes.
|
Locale |
getLocale()
Gets the locale assocatied with this
Cloud instance. |
String |
getName()
Returns the name of this cloud.
|
Node |
getNode(int number)
Returns the node with the specified number from this cloud.
|
Node |
getNode(String number)
Returns the node with the specified number from this cloud.
|
Node |
getNodeByAlias(String alias)
Returns the node with the specified alias from this cloud.
|
NodeManager |
getNodeManager(int nodeManagerId)
Returns the specified node manager.
|
NodeManager |
getNodeManager(String name)
Returns the specified node manager.
|
NodeManagerList |
getNodeManagers()
Returns all node managers available in this cloud.
|
Cloud |
getNonTransactionalCloud()
Returns a cloud which is not a Transaction.
|
StringList |
getPossibleContexts()
Contacts the security implementation to find out to which possible contexts are
available to the current user.
|
Map<Object,Object> |
getProperties()
Retrieves all properties previously set for this cloud.
|
Object |
getProperty(Object key)
Retrieves a property previously set for this cloud.
|
Relation |
getRelation(int number)
Returns the relation with the specified number from this cloud.
|
Relation |
getRelation(String number)
Returns the relation with the specified number from this cloud.
|
RelationManager |
getRelationManager(int relationManagerId)
Returns the specified relation manager.
|
RelationManager |
getRelationManager(NodeManager sourceManager,
NodeManager destinationManager,
String roleName)
Returns the specified relation manager.
|
RelationManager |
getRelationManager(String roleName)
Returns the specified relation manager.
|
RelationManager |
getRelationManager(String sourceManagerName,
String destinationManagerName,
String roleName)
Returns the specified relation manager.
|
RelationManagerList |
getRelationManagers()
Returns all relation managers available in this cloud.
|
RelationManagerList |
getRelationManagers(NodeManager sourceManager,
NodeManager destinationManager,
String roleName)
Returns all relation managers available in this cloud that follow the specified filter.
|
RelationManagerList |
getRelationManagers(String sourceManagerName,
String destinationManagerName,
String roleName)
Returns all relation managers available in this cloud that follow the specified filter.
|
Transaction |
getTransaction(String name)
Returnes the transaction with the specified name.
|
UserContext |
getUser()
Who is using this cloud.
|
boolean |
hasNode(int number)
Determines whether a node with the specified number exists in this cloud.
|
boolean |
hasNode(String number)
Determines whether a node with the specified number is available from this cloud.
|
boolean |
hasNodeManager(String name)
Returns whether the specified node manager exists.
|
boolean |
hasRelation(int number)
Determines whether a relation with the specified number exists in this cloud.
|
boolean |
hasRelation(String number)
Determines whether a relation with the specified number is available from this cloud.
|
boolean |
hasRelationManager(NodeManager sourceManager,
NodeManager destinationManager,
String roleName)
Returns whether the specified relation manager exists.
|
boolean |
hasRelationManager(String roleName)
Returns whether the specified relation manager exists.
|
boolean |
hasRelationManager(String sourceManagerName,
String destinationManagerName,
String roleName)
Returns whether the specified relation manager exists.
|
boolean |
hasRole(String roleName)
Returns whether the specified role exists.
|
boolean |
may(Action action,
Parameters parameters)
Check whether an action is allowed
|
boolean |
mayRead(int number)
Determines whether a node with the specified number is accessible for the user - that is,
the user has sufficient rights to read the node.
|
boolean |
mayRead(String number)
Determines whether a node with the specified number is accessible for the user - that is,
the user has sufficient rights to read the node.
|
void |
setLocale(Locale locale)
Sets a locale for this
Cloud instance. |
void |
setProperty(Object key,
Object value)
Sets a property for this cloud object.
|
void |
shutdown()
Shutdown MMBase, if you are allowed to do so.
|
static final String PROP_XMLMODE
static final String PROP_SESSIONNAME
static final String PROP_REQUEST
static final String PROP_RESPONSE
static final String PROP_IGNOREVALIDATION
Node getNode(int number) throws NotFoundException
Node with a reference to this
instance of Cloud.number - the number of the requested nodeNotFoundException - if the specified node could not be foundNode getNode(String number) throws NotFoundException
Node with a reference to this
instance of Cloud.number - a string containing the number or alias of the requested nodeNotFoundException - if the specified node could not be foundNode getNodeByAlias(String alias) throws NotFoundException
Node with a reference to this
instance of Cloud.alias - the alias of the requested nodeNotFoundException - if the specified node could not be foundRelation getRelation(int number) throws NotFoundException
Relation with a reference to this
instance of Cloud.number - the number of the requested nodeNotFoundException - if the specified node could not be foundClassCastException - if the specified node is not a relationRelation getRelation(String number) throws NotFoundException
Relation with a reference to this
instance of Cloud.number - a string containing the number or alias of the requested nodeNotFoundException - if the specified node could not be foundClassCastException - if the specified node is not a relationboolean hasNode(int number)
mayRead(int) to determine this.number - the number of the nodeboolean hasNode(String number)
mayRead(int) to determine this.number - a string containing the number or alias of the requested nodeboolean hasRelation(int number)
mayRead(int) to determine this.number - the number of the nodeboolean hasRelation(String number)
mayRead(int) to determine this.number - a string containing the number or alias of the requested nodeboolean mayRead(int number)
number - the number of the requested nodeNotFoundException - if the specified node could not be foundboolean may(Action action, Parameters parameters)
action - Action to performparameters - parameters passed into this actiontrue when allowedboolean mayRead(String number)
number - a string containing the number or alias of the requested nodeNotFoundException - if the specified node could not be foundNodeManagerList getNodeManagers()
NodeManagerList containing all node managers
available in this cloud.NodeManager getNodeManager(String name) throws NotFoundException
name - the name of the requested node managerNotFoundException - if the specified node manager could not be foundboolean hasNodeManager(String name)
name - the name of the requested node managertrue if the specified node manager existsNodeManager getNodeManager(int nodeManagerId) throws NotFoundException
nodeManagerId - Unique ID of the NodeManager to retrieveNotFoundException - if the specified node manager could not be foundRelationManager getRelationManager(int relationManagerId) throws NotFoundException
relationManagerId - Unique ID of the RelationManager to retrieveNotFoundException - if the specified relation manager could not be foundRelationManager getRelationManager(String sourceManagerName, String destinationManagerName, String roleName) throws NotFoundException
sourceManagerName - name of the node manager of the source nodedestinationManagerName - name of the node manager of the destination noderoleName - name of the roleNotFoundException - if the specified relation manager could not be foundRelationManager getRelationManager(NodeManager sourceManager, NodeManager destinationManager, String roleName) throws NotFoundException
sourceManager - the node manager of the source nodedestinationManager - the node manager of the destination noderoleName - name of the roleNotFoundException - if the specified relation manager could not be foundboolean hasRelationManager(String sourceManagerName, String destinationManagerName, String roleName)
sourceManagerName - name of the node manager of the source nodedestinationManagerName - name of the node manager of the destination noderoleName - name of the roletrue if the specified relation manager could be foundboolean hasRelationManager(NodeManager sourceManager, NodeManager destinationManager, String roleName)
sourceManager - name of the node manager of the source nodedestinationManager - name of the node manager of the destination noderoleName - name of the roletrue if the specified relation manager could be foundboolean hasRole(String roleName)
roleName - name of the roletrue if the specified role could be foundRelationManager getRelationManager(String roleName) throws NotFoundException
roleName - name of the roleNotFoundException - if the specified relation manager could not be foundboolean hasRelationManager(String roleName)
roleName - name of the roletrue if the specified relation manager existsRelationManagerList getRelationManagers()
RelationManagerList containing all relation
managers available in this cloudRelationManagerList getRelationManagers(String sourceManagerName, String destinationManagerName, String roleName) throws NotFoundException
sourceManagerName - the name of the manager for the source of the relationdestinationManagerName - the name of the manager for the destination of the relationroleName - the rolenameRelationManagerList containing all relation
managers that follow this filterNotFoundException - if one of the specified relation managers or the rolename could not be foundRelationManagerList getRelationManagers(NodeManager sourceManager, NodeManager destinationManager, String roleName) throws NotFoundException
sourceManager - the manager for the source of the relationdestinationManager - the manager for the destination of the relationroleName - the rolenameRelationManagerList containing all relation
managers that follwo thsi filterNotFoundException - if one of the specified relation managers or the rolename could not be foundCloudContext getCloudContext()
CloudContext to which this cloud belongsTransaction createTransaction()
Transaction will have a generic ID.Transaction on this cloudTransaction createTransaction(String name) throws AlreadyExistsException
name - an unique name to use for the transactionTransaction on this cloudAlreadyExistsException - if a transaction with the specified name allready existsTransaction createTransaction(String name, boolean overwrite) throws AlreadyExistsException
name - an unique name to use for the transactionoverwrite - if true, cancels and replaces
any existing transaction of this name for the current userTransaction on this cloudAlreadyExistsException - if a transaction with the specified name allready
exists and overwrite is falseTransaction getTransaction(String name)
name - the name of the requested transactionString getName()
Transaction.String getDescription()
getName(), but in principable it could have been localized using the
value also returned by getLocale().UserContext getUser()
NodeList getList(String startNodes, String nodePath, String fields, String constraints, String orderby, String directions, String searchDir, boolean distinct)
- A node manager recordcompany containing a field name. - A node manager artist containing a field name. - A node manager url containing a field description and url. - A relation type related between recordcompany and artist. - A relation type related between artist and url. - A relation type homepagerel between artist and url.If node 100 has a node manager called recordcompany we can do the following to get a list of the record company's artists and all urls belonging to these artist (including nodes found through the related relation and the homepagerel relation):
getList("100", "recordcompany,artist,url",
"artist.name,description,url", null, null, null, null, true);
This call returns a list of virtual nodes with the fields artist.name,
description and url for every valid traversal.
If we only want to list homepage urls of the artists we do:
getList("100", "recordcompany,artist,url",
"artist.name,description,homepagerel,url", null, null, null,
null, true);
If we want to list all url's except the the homepage urls we do:
getList("100", "recordcompany,artist,url",
"artist.name,description,related,url", null, null, null, null, true);
If node 200 also has a node manager with name recordcompany we can get the info from their artist together with the info of the artist from the first company by also putting number 200 in the first parameter:
getList("100,200", "recordcompany,artist,url",
"artist.name,description,related,url", null, null, null, null, true);
For more information about the constraints parameter consult
NodeManager.getList(String constraints, String orderby, String
directions).startNodes - A comma separated list of node numbers that should
be used as a starting point for all traversals
or null if all nodes of the first node
manager in nodePath should be used.nodePath - A comma separated list of node manager names
which specifies the path that should be followed.
It is possible to explicitly specify a relation
manager that should be used to go from one node to
an other. If no relation manager is specified
between two nodes, all possible relation managers
that can be used to go to the next specified node in
the path are followed.fields - A comma separated list of field names that will make
up the returned virtual
nodes. A fieldname can be prefixed with the
original node manager name of the field and a dot
in cases where more than one node manager in the
path has a field with the same name.constraints - Constraints to prevent nodes from being
included in the resulting list which would normally
by included or null if no constraints
should be applied.orderby - A comma separated list of field names on which the
returned list should be sorted or null
if the order of the returned virtual nodes doesn't
matter.directions - A comma separated list of values indicating wether
to sort up (ascending) or down (descending) on the
corresponding field in the orderby
parameter or null if sorting on all
fields should be up.
The value DOWN (case insensitive) indicates
that sorting on the corresponding field should be
down, all other values (including the
empty value) indicate that sorting on the
corresponding field should be up.
If the number of values found in this parameter are
less than the number of fields in the
orderby parameter, all fields that
don't have a corresponding direction value are
sorted according to the last specified direction
value.searchDir - Determines how directionality affects the search.
This is a string with the following possible values:"both", which is the default, searches for all
valid relations through a path, checking full directionality
of relations where appropriate.
"destination" searches for only those relations
in a path where valid relations exist from source to destination,
in the order of the nodemanagers given in the nodePath.
"source" searches for only those relations
in a path where valid relations exist from destination to source,
in the order of the nodemanagers given in the nodePath.
"all" searches all existing relations, and does
not check on directionality.
A value of null or any other values than those
listed above are ignored. In that case, search is
treated as if the default ("both") was specified.distinct - true if nodes who allready exist in
the list should not be added to the list.
false if all nodes should be added to
the list even if a node with exactly the same field
values is allready present.NodeList getList(Query query)
NodeQuery).query - Query to executeSearchQueryQuery createQuery()
getList(Query).Query createAggregatedQuery()
NodeQuery createNodeQuery()
NodeManager.getList(NodeQuery) or
getList(Query) (but then no 'real' node are returned). The query can be used on NodeManager only when at
least one step is added, and NodeQuery.setNodeStep(org.mmbase.storage.search.Step) is called.void setLocale(Locale locale)
Cloud instance.locale - To which locale it must be set. It can be null, in which case it will be reset to a default.Locale getLocale()
Cloud instance.Object getProperty(Object key)
Transaction), then this will also mirror properties in this
parent cloud.key - the key of the propertysetProperty(Object, Object)void setProperty(Object key, Object value)
key - the key of the propertyvalue - the property valueMap<Object,Object> getProperties()
Collection<Function<?>> getFunctions(String setName)
Function object.setName - name of the function setFunction objects.NotFoundException - if the function set does not existFunction<?> getFunction(String setName, String functionName)
Function object.setName - name of the function setfunctionName - name of the functionFunction object.NotFoundException - if the function set or the function do not existNodeList createNodeList()
RelationList createRelationList()
NodeManagerList createNodeManagerList()
RelationManagerList createRelationManagerList()
StringList getPossibleContexts()
SecurityException - When appropriate rights to perform this are lacking (read rights)Cloud getNonTransactionalCloud()
Transactionvoid shutdown()
SecurityException - If you are not allowed.MMBase 1.9-SNAPSHOT - ${javadoctimestamp}