| java.lang.Object org.mmbase.storage.StorageManagerFactory
StorageManagerFactory | abstract public class StorageManagerFactory (Code) | | This class contains functionality for retrieving StorageManager instances, which give access to the storage device.
It also provides functionality for setting and retrieving configuration data.
This is an abstract class. You cannot instantiate it. Use the static
StorageManagerFactory.newInstance() or
StorageManagerFactory.newInstance(MMBase) methods to obtain a factory class.
author: Pierre van Rooden since: MMBase-1.7 version: $Id: StorageManagerFactory.java,v 1.33 2008/02/22 12:28:19 michiel Exp $ |
Method Summary | |
public Object | getAttribute(String key) Obtain an attribute from this factory. | public Map | getAttributes() Retrieve a map of attributes for this factory. | public String | getCatalog() Returns the name of the catalog used by this storage (null if no catalog is used). | public ChangeManager | getChangeManager() Returns the ChangeManager utility instance, used to register and broadcast changes to nodes
in the storage layer. | protected String | getDataDir() | public Map<String, String> | getDisallowedFields() Returns a map of disallowed field names and their possible alternate values. | public StorageReader<SM> | getDocumentReader() Locates and opens the storage configuration document, if available. | public CharTransformer | getGetSurrogator() Returns a filter which can be used to filter strings taken from storage or null if none defined. | public MMBase | getMMBase() | public Scheme | getScheme(String key) Obtain a scheme from this factory. | public Scheme | getScheme(String key, String defaultPattern) Obtain a scheme from this factory. | public SearchQueryHandler | getSearchQueryHandler() Obtains a SearchQueryHandler from the factory. | public CharTransformer | getSetSurrogator() Returns a filter which can be used to filter strings which are to be set into storage or null if none defined. | public Object | getStorageIdentifier() Obtains the identifier for the basic storage element. | public Object | getStorageIdentifier(Object mmobject) Obtains a identifier for an MMBase object. | public SM | getStorageManager() Obtains a StorageManager from the factory. | public List<String> | getStoreBinaryAsFileObjects() Returns a list of objects of which binary data should be stored in a file. | public int | getTimeZoneOffset(long time) Returns the offset which must be used in the database. | public List<TypeMapping> | getTypeMappings() Returns a sorted list of type mappings for this storage. | abstract public double | getVersion() Returns the version of this factory implementation. | public boolean | hasOption(String key) Check whether an option was set. | final protected void | init(MMBase mmbase) Initialize the StorageManagerFactory. | abstract protected Object | instantiateBasicHandler(Class handlerClass) Instantiate a basic handler object using the specified class. | abstract protected Object | instantiateChainedHandler(Class handlerClass, Object previousHandler) Instantiate a chained handler object using the specified class.
A chained handler can be any type of class and is dependent on the
factory implementation.
For instance, the database factory expects an
org.mmbase.storage.search.implentation.database.ChainedSQLHandler class.
Parameters: handlerClass - the class to instantuate teh object with Parameters: previousHandler - a handler thatw a sinstantiated previously.this handler should be passed to the new handler class during orafter constrcution, so the ne whandler can 'chain' any events it cannothandle to this class. | abstract protected SearchQueryHandler | instantiateQueryHandler(Object data) Instantiate a SearchQueryHandler object using the specified object. | protected void | load() Opens and reads the storage configuration document. | public static StorageManagerFactory | newInstance(MMBase mmbase) Obtain the StorageManagerFactory belonging to the indicated MMBase module. | public static StorageManagerFactory | newInstance() Obtain the storage manager factory belonging to the default MMBase module. | public void | setAttribute(String key, Object value) Set an attribute of this factory. | public void | setAttributes(Map<String, Object> attributes) Add a map of attributes for this factory. | protected void | setDisallowedFields(Map disallowedFields) Sets the map of disallowed Fields. | public void | setOption(String key, boolean value) Set an option to true or false. | public void | setScheme(String key, String pattern) Set a scheme of this factory, using a string pattern to base the Scheme on. | abstract public boolean | supportsTransactions() Returns whether transactions, and specifically rollback, is supported in the storage layer. |
changeManager | protected ChangeManager changeManager(Code) | | The ChangeManager object, used to register/broadcast changes to a node or set of nodes.
|
disallowedFields | final protected SortedMap<String, String> disallowedFields(Code) | | The map with disallowed fieldnames and (if given) alternates
|
mmbase | protected MMBase mmbase(Code) | | A reference to the MMBase module
|
queryHandler | protected SearchQueryHandler queryHandler(Code) | | The query handler to use with this factory.
Note: the current handler makes use of the JDBC2NodeInterface and is not optimized for storage: using it means
you call getNodeManager() TWICE.
Have to look into how this should work together.
|
queryHandlerClasses | protected List<Class<?>> queryHandlerClasses(Code) | | The query handler classes.
Assign a value to this class if you want to set a default query handler.
|
storageManagerClass | protected Class<SM> storageManagerClass(Code) | | The class used to instantiate storage managers.
The classname is retrieved from the storage configuration file
|
storeBinaryAsFileObjects | protected List<String> storeBinaryAsFileObjects(Code) | | The list with objects of which binary data should not be stored in database
|
getAttribute | public Object getAttribute(String key)(Code) | | Obtain an attribute from this factory.
Attributes are the configuration parameters for the storagefactory.
Parameters: key - the key of the attribute the attribute value, or null if it is unknown |
getAttributes | public Map getAttributes()(Code) | | Retrieve a map of attributes for this factory.
The attributes are the configuration parameters for the factory.
You cannot change this map, though you can change the attributes themselves.
an unmodifiable Map |
getCatalog | public String getCatalog()(Code) | | Returns the name of the catalog used by this storage (null if no catalog is used).
|
getChangeManager | public ChangeManager getChangeManager()(Code) | | Returns the ChangeManager utility instance, used to register and broadcast changes to nodes
in the storage layer.
This method is for use by the StorageManager
|
getDisallowedFields | public Map<String, String> getDisallowedFields()(Code) | | Returns a map of disallowed field names and their possible alternate values.
A Map of disallowed field names |
getDocumentReader | public StorageReader<SM> getDocumentReader() throws StorageException(Code) | | Locates and opens the storage configuration document, if available.
The configuration document to open can be set in mmbasereoot (using the storage property).
The property should point to a resource which is to be present in the MMBase classpath.
Overriding factories may provide ways to auto-detect the location of a configuration file.
throws: StorageException - if something went wrong while obtaining the document reader a StorageReader instance, or null if no reader has been configured |
getGetSurrogator | public CharTransformer getGetSurrogator()(Code) | | Returns a filter which can be used to filter strings taken from storage or null if none defined.
since: MMBase-1.7.4 |
getMMBase | public MMBase getMMBase()(Code) | | Return the MMBase module for which the factory was instantiated
the MMBase instance |
getScheme | public Scheme getScheme(String key)(Code) | | Obtain a scheme from this factory.
Schemes are special attributes, consisting of patterned strings that can be
expanded with arguments.
Parameters: key - the key of the attribute the scheme value, or null if it is unknown |
getScheme | public Scheme getScheme(String key, String defaultPattern)(Code) | | Obtain a scheme from this factory.
Schemes are special attributes, consisting of patterned strings that can be
expanded with arguments.
If no scheme is present, the default pattern is used to create a scheme and add it to the factory.
Parameters: key - the key of the attribute Parameters: defaultPattern - the pattern to use for the default scheme, null if there is no default the scheme value, null if there is no scheme |
getSearchQueryHandler | public SearchQueryHandler getSearchQueryHandler() throws StorageException(Code) | | Obtains a SearchQueryHandler from the factory.
This provides ways to query for data using the SearchQuery interface.
Note that cannot run the querys on a transaction (since SearchQuery does not support them).
a SearchQueryHandler instance throws: StorageException - when the handler cannot be created |
getSetSurrogator | public CharTransformer getSetSurrogator()(Code) | | Returns a filter which can be used to filter strings which are to be set into storage or null if none defined.
since: MMBase-1.7.4 |
getStorageIdentifier | public Object getStorageIdentifier() throws StorageException(Code) | | Obtains the identifier for the basic storage element.
the storage-specific identifier throws: StorageException - if the object cannot be given a valid identifier |
getStorageIdentifier | public Object getStorageIdentifier(Object mmobject) throws StorageException(Code) | | Obtains a identifier for an MMBase object.
The default implementation returns the following type of identifiers:
- For StorageManager: the basename
- For MMBase: the String '[basename]_object
- For MMObjectBuilder: the String '[basename]_[builder name]'
- For Indices: the String '[basename]_[builder name]_[index name]_idx'
- For MMObjectNode: the object number as a Integer
- For CoreField or String: the field name, or the replacement fieldfname (from the disallowedfields map)
Note that 'basename' is a property from the mmbase module, set in mmbaseroot.xml.
You can override this method if you intend to use different ids.
See Also: Storable Parameters: mmobject - the MMBase objecty the storage-specific identifier throws: StorageException - if the object cannot be given a valid identifier |
getStorageManager | public SM getStorageManager() throws StorageException(Code) | | Obtains a StorageManager from the factory.
The instance represents a temporary connection to the datasource -
do not store the result of this call as a static or long-term member of a class.
a StorageManager instance throws: StorageException - when the storagemanager cannot be created |
getStoreBinaryAsFileObjects | public List<String> getStoreBinaryAsFileObjects()(Code) | | Returns a list of objects of which binary data should be stored in a file.
the list of objects of which BLOB fields should not be stored in database. since: MMBase-1.8.5 |
getTimeZoneOffset | public int getTimeZoneOffset(long time)(Code) | | Returns the offset which must be used in the database. Currently this is based on the system's
default time zone. It is imaginable that can have configuration or database specific details later.
Parameters: time - The time at which it is evaluated (summer time issues) since: MMBase-1.8 |
getTypeMappings | public List<TypeMapping> getTypeMappings()(Code) | | Returns a sorted list of type mappings for this storage.
the list of TypeMapping objects |
getVersion | abstract public double getVersion()(Code) | | Returns the version of this factory implementation.
The factory uses this number to verify whether it can handle storage configuration files
that list version requirements.
the version as an integer |
hasOption | public boolean hasOption(String key)(Code) | | Check whether an option was set.
Options are attributes that return a boolean value.
Parameters: key - the key of the option true if the option was set |
instantiateBasicHandler | abstract protected Object instantiateBasicHandler(Class handlerClass)(Code) | | Instantiate a basic handler object using the specified class.
A basic handler can be any type of class and is dependent on the
factory implementation.
For instance, the database factory expects an
org.mmbase.storage.search.implentation.database.SQLHandler class.
Parameters: handlerClass - the class to instantuate teh object with the new handler class |
instantiateChainedHandler | abstract protected Object instantiateChainedHandler(Class handlerClass, Object previousHandler)(Code) | | Instantiate a chained handler object using the specified class.
A chained handler can be any type of class and is dependent on the
factory implementation.
For instance, the database factory expects an
org.mmbase.storage.search.implentation.database.ChainedSQLHandler class.
Parameters: handlerClass - the class to instantuate teh object with Parameters: previousHandler - a handler thatw a sinstantiated previously.this handler should be passed to the new handler class during orafter constrcution, so the ne whandler can 'chain' any events it cannothandle to this class. the new handler class |
instantiateQueryHandler | abstract protected SearchQueryHandler instantiateQueryHandler(Object data)(Code) | | Instantiate a SearchQueryHandler object using the specified object.
The specified parameter may be an actual SearchQueryHandler object, or it may be a utility class.
For instance, the database factory expects an org.mmbase.storage.search.implentation.database.SQLHandler object,
which is used as a parameter in the construction of the actual SearchQueryHandler class.
Parameters: data - the object to instantuate a SearchQueryHandler object with |
load | protected void load() throws StorageException(Code) | | Opens and reads the storage configuration document.
Override this method to add additional configuration code before or after the configuration document is read.
throws: StorageException - if the storage could not be accessed or necessary configuration data is missing or invalid |
newInstance | public static StorageManagerFactory newInstance(MMBase mmbase) throws StorageException(Code) | | Obtain the StorageManagerFactory belonging to the indicated MMBase module.
Parameters: mmbase - The MMBase module for which to retrieve the storagefactory The StorageManagerFactory throws: StorageException - if the StorageManagerFactory class cannot be located, accessed, or instantiated,or when something went wrong during configuration of the factory |
newInstance | public static StorageManagerFactory newInstance() throws StorageException(Code) | | Obtain the storage manager factory belonging to the default MMBase module.
The StoragemanagerFactory throws: StorageException - if the StorageManagerFactory class cannot be located, accessed, or instantiated,or when something went wrong during configuration of the factory |
setAttribute | public void setAttribute(String key, Object value)(Code) | | Set an attribute of this factory.
Attributes are the configuration parameters for the factory.
The actual content the factory expects is dependent on the implementation.
To invalidate an attribute, you can pass the null value.
Parameters: key - the key of the attribute Parameters: value - the value of the attribute |
setAttributes | public void setAttributes(Map<String, Object> attributes)(Code) | | Add a map of attributes for this factory.
The attributes are the configuration parameters for the factory.
The actual content the factory expects is dependent on the implementation.
The attributes are added to any attributes already knwon to the factory.
Parameters: attributes - the map of attributes to add |
setDisallowedFields | protected void setDisallowedFields(Map disallowedFields)(Code) | | Sets the map of disallowed Fields.
Unlike setAttributes(), this actually replaces the existing disallowed fields map.
|
setOption | public void setOption(String key, boolean value)(Code) | | Set an option to true or false.
Parameters: key - the key of the option Parameters: value - the value of the option (true or false) |
setScheme | public void setScheme(String key, String pattern)(Code) | | Set a scheme of this factory, using a string pattern to base the Scheme on.
Schemes are special attributes, consisting of patterned strings that can be
expanded with arguments.
Parameters: key - the key of the scheme Parameters: pattern - the pattern to use for the scheme |
supportsTransactions | abstract public boolean supportsTransactions()(Code) | | Returns whether transactions, and specifically rollback, is supported in the storage layer.
true if trasnactions are supported |
|
|