org.mmbase.bridge.util
Class AbstractCloudContext

java.lang.Object
  extended by org.mmbase.bridge.util.AbstractCloudContext
All Implemented Interfaces:
CloudContext
Direct Known Subclasses:
MockCloudContext

public abstract class AbstractCloudContext
extends Object
implements CloudContext

Abstract implementation of CloudContext which implements a number of methods with reasonable defaults, or based on other methods.

Since:
MMBase-1.9.2
Version:
$Id: AbstractCloudContext.java 41991 2010-04-20 16:48:55Z michiel $
Author:
Michiel Meeuwissen

Field Summary
protected  BasicStringList clouds
           
 
Constructor Summary
AbstractCloudContext()
           
 
Method Summary
 CloudContext assertUp()
          Assert whether MMbase is up and running.
 FieldList createFieldList()
          Returns a new, empty field list
 ModuleList createModuleList()
          Returns a new, empty module list
 NodeList createNodeList()
          Returns a new, empty node list.
 NodeManagerList createNodeManagerList()
          Returns a new, empty node manager list Note that it is generally better to use Cloud.createNodeManagerList().
 RelationList createRelationList()
          Returns a new, empty relation list Note that it is generally better to use Cloud.createRelationList() or NodeManager.createRelationList().
 RelationManagerList createRelationManagerList()
          Returns a new, empty relation manager list Note that it is generally better to use Cloud.createRelationManagerList().
 StringList createStringList()
          Returns a new, empty string list
 ActionRepository getActionRepository()
          Returns the Repository with actions
 AuthenticationData getAuthentication()
          Acquires information about the currently configuration Authentication implementation.
 Cloud getCloud(String name)
          Returns the cloud with the specified name.
 Cloud getCloud(String name, String authenticationType, Map<String,?> loginInfo)
          Returns the cloud with the specified name, with authentication
 StringList getCloudNames()
          Returns the names of all the clouds known to the system.
 String getDefaultCharacterEncoding()
          Returns the default character encoding, which can be used as a default.
protected  String getDefaultCloudName()
           
 Locale getDefaultLocale()
          Returns the default locale setting.
 TimeZone getDefaultTimeZone()
          Returns the default time zone.
 Module getModule(String name)
          Returns the module with the specified name.
 ModuleList getModules()
          Returns all modules available in this context.
 boolean hasModule(String name)
          Returns whether the module with the specified name is available.
 boolean isUp()
          Returns whether MMbase is up and running
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.CloudContext
getCloud, getSearchQueryHandler, getUri
 

Field Detail

clouds

protected final BasicStringList clouds
Constructor Detail

AbstractCloudContext

public AbstractCloudContext()
Method Detail

getModules

public ModuleList getModules()
Description copied from interface: CloudContext
Returns all modules available in this context.

Specified by:
getModules in interface CloudContext
Returns:
all available modules

getModule

public Module getModule(String name)
                 throws NotFoundException
Description copied from interface: CloudContext
Returns the module with the specified name.

Specified by:
getModule in interface CloudContext
Parameters:
name - the name of the module to be returned
Returns:
the requested module
Throws:
NotFoundException - if the specified module could not be found

hasModule

public boolean hasModule(String name)
Description copied from interface: CloudContext
Returns whether the module with the specified name is available.

Specified by:
hasModule in interface CloudContext
Parameters:
name - the name of the module
Returns:
true if the module is available

getCloudNames

public StringList getCloudNames()
Description copied from interface: CloudContext
Returns the names of all the clouds known to the system. Most bridge implementations return a list with one entry 'mmbase'.

Specified by:
getCloudNames in interface CloudContext
Returns:
A StringList of all clouds names known to our Context

getDefaultCharacterEncoding

public String getDefaultCharacterEncoding()
Description copied from interface: CloudContext
Returns the default character encoding, which can be used as a default. E.g. 'UTF-8'. This is a setting in MMBase which you may want to access. It is nowadays of little importance, and you can ignore it and simply always use UTF-8 or so.

Specified by:
getDefaultCharacterEncoding in interface CloudContext
Returns:
A string with the character encoding

getDefaultLocale

public Locale getDefaultLocale()
Description copied from interface: CloudContext
Returns the default locale setting. This may correspond to the JVM default, but it also may not. The point is that the JVM may be shared by other applications. It corresponds to a property of the mmbase module (in 'mmbaseroot.xml').

Specified by:
getDefaultLocale in interface CloudContext
Returns:
A Locale object

getDefaultTimeZone

public TimeZone getDefaultTimeZone()
Description copied from interface: CloudContext
Returns the default time zone. This may or may not correspond to the JVM default. It corresponds to a property of the mmbase module (in 'mmbaseroot.xml').

Specified by:
getDefaultTimeZone in interface CloudContext
Returns:
the default time zone

createFieldList

public FieldList createFieldList()
Description copied from interface: CloudContext
Returns a new, empty field list

Specified by:
createFieldList in interface CloudContext
Returns:
The empty list

getDefaultCloudName

protected String getDefaultCloudName()

getCloud

public Cloud getCloud(String name)
Description copied from interface: CloudContext
Returns the cloud with the specified name. The available cloud names are returned by CloudContext.getCloudNames().

Specified by:
getCloud in interface CloudContext
Parameters:
name - The name of the cloud to be returned, this is very often "mmbase".
Returns:
The requested cloud

getCloud

public Cloud getCloud(String name,
                      String authenticationType,
                      Map<String,?> loginInfo)
               throws NotFoundException
Description copied from interface: CloudContext
Returns the cloud with the specified name, with authentication

Specified by:
getCloud in interface CloudContext
Parameters:
name - The name of the cloud to be returned. See CloudContext.getCloudNames()
authenticationType - The type of authentication, which should be used by the authentication implementation.. This is one of the strings returned by CloudContext.getAuthentication().AuthenticationData.getTypes(). Typically, 'anonymous', 'class' and 'name/password' are supported.
loginInfo - The required user information and credentials. What exactly is required, depends on the Authentication implementation, and the value of the authenticationType parameter. If no credentials are needed null can be specified (This for example is the case with authenticationType 'class'). It is possible to create this Map using #getAuthentcation.AuthenticationData.createParameters(String).Parameters.toMap(java.util.Map). That e.g. makes it possible to know beforehand what keys can be used in the loginInfo Map, given a certain authenticationType.
Returns:
the requested cloud
Throws:
NotFoundException - if the specified cloud could not be found

createNodeList

public NodeList createNodeList()
Description copied from interface: CloudContext
Returns a new, empty node list. Note that it is generally better to use Cloud.createNodeList() or NodeManager.createNodeList(), because then the object can be properly associated with a Cloud.

Specified by:
createNodeList in interface CloudContext
Returns:
The empty list

createRelationList

public RelationList createRelationList()
Description copied from interface: CloudContext
Returns a new, empty relation list Note that it is generally better to use Cloud.createRelationList() or NodeManager.createRelationList().

Specified by:
createRelationList in interface CloudContext
Returns:
The empty list

createNodeManagerList

public NodeManagerList createNodeManagerList()
Description copied from interface: CloudContext
Returns a new, empty node manager list Note that it is generally better to use Cloud.createNodeManagerList().

Specified by:
createNodeManagerList in interface CloudContext
Returns:
The empty list

createRelationManagerList

public RelationManagerList createRelationManagerList()
Description copied from interface: CloudContext
Returns a new, empty relation manager list Note that it is generally better to use Cloud.createRelationManagerList().

Specified by:
createRelationManagerList in interface CloudContext
Returns:
The empty list

createModuleList

public ModuleList createModuleList()
Description copied from interface: CloudContext
Returns a new, empty module list

Specified by:
createModuleList in interface CloudContext
Returns:
The empty list

createStringList

public StringList createStringList()
Description copied from interface: CloudContext
Returns a new, empty string list

Specified by:
createStringList in interface CloudContext
Returns:
The empty list

getAuthentication

public AuthenticationData getAuthentication()
Description copied from interface: CloudContext
Acquires information about the currently configuration Authentication implementation.

Specified by:
getAuthentication in interface CloudContext
Returns:
current Authentication information

getActionRepository

public ActionRepository getActionRepository()
Description copied from interface: CloudContext
Returns the Repository with actions

Specified by:
getActionRepository in interface CloudContext
Returns:
Repository with actions

isUp

public boolean isUp()
Description copied from interface: CloudContext
Returns whether MMbase is up and running

Specified by:
isUp in interface CloudContext
Returns:
true when mmbase is running

assertUp

public CloudContext assertUp()
Description copied from interface: CloudContext
Assert whether MMbase is up and running. This will wait until it is.

Specified by:
assertUp in interface CloudContext


MMBase 2.0-SNAPSHOT - null