org.mmbase.module.core
Class MMObjectBuilder

java.lang.Object
  extended byorg.mmbase.util.functions.FunctionProvider
      extended byorg.mmbase.module.core.MMTable
          extended byorg.mmbase.module.core.MMObjectBuilder
All Implemented Interfaces:
EventListener, NodeEventListener, RelationEventListener
Direct Known Subclasses:
AbstractServletBuilder, Contexts, CronJobs, DayMarkers, Dummy, EmailBuilder, ExampleBuilder, Groups, ImageAliases, InsRel, Jumpers, MediaFragments, MediaProviders, MediaSources, MMEvents, MMServers, OAlias, Properties, Ranks, RelDef, TypeDef, TypeRel, Urls, UserBuilder, Users, Versions, VirtualBuilder

public class MMObjectBuilder
extends MMTable
implements NodeEventListener, RelationEventListener

This class is the base class for all builders. It offers a list of routines which are useful in maintaining the nodes in the MMBase object cloud.
Builders are the core of the MMBase system. They create, delete and search the MMObjectNodes. Most manipulations concern nodes of that builders type. However, a number of retrieval routines extend beyond a builders scope and work on the cloud in general, allowing some ease in retrieval of nodes. The basic routines in this class can be extended to handle more specific demands for nodes. Most of these 'extended builders' will be stored in mmbase.org.builders or mmbase.org.corebuilders. Examples include relation builders or builders for handling binary data such as images. The various builders are registered by the 'TypeDef' builder class (one of the core builders, itself an extension of this class).

Version:
$Id: MMObjectBuilder.java,v 1.386 2006/07/10 17:17:23 michiel Exp $
Author:
Daniel Ockeloen, Rob Vermeulen, Pierre van Rooden, Eduard Witteveen, Johannes Verelst, Rob van Maris, Michiel Meeuwissen, Ernst Bunders

Field Summary
static Parameter[] AGE_PARAMETERS
          Parameters for the age function
protected  boolean broadCastChanges
          Determines whether changes to this builder need be broadcasted to other known mmbase servers.
static String DEFAULT_ALINEA
          Default replacements for method getHTML()
static String DEFAULT_EOL
           
 String description
          Description of the builder in the currently selected language Not that the first time the builder is created, this value is what is stored in the TypeDef table.
 Hashtable descriptions
          Descriptions of the builder per language Can be set with the <descriptions> tag in the xml builder file.
static int EVENT_TYPE_LOCAL
           
static int EVENT_TYPE_REMOTE
           
static String FIELD_NUMBER
          Name of the field containing the object number, which uniquely identifies the node.
static String FIELD_OBJECT_TYPE
          Name of the field containing the object type number.
static String FIELD_OWNER
          Name of the field containing the owner.
protected  Map fields
           
protected static BlobCache genericBlobCache
          The cache for all blobs.
protected  Function getFunctions
          Every Function Provider provides least the 'getFunctions' function, which returns a Set of all functions which it provides.
static Parameter[] GUI_PARAMETERS
          Parameters for the GUI function
protected  Function guiFunction
          The famous GUI function as a function object.
protected  Function infoFunction
          The info-function is a node-function and a builder-function.
protected  long internalVersion
          Internal (instance) version number of this builder.
protected static NodeCache nodeCache
          The cache that contains the X last requested nodes
protected  int oType
          The current builder's object type Retrieved from the TypeDef builder.
 String searchAge
          The default search age for this builder.
static String SYSTEM_OWNER
          Default (system) owner name for the owner field.
static int TEMPNODE_DEFAULT_SIZE
          Default size of the temporary node cache
static Map temporaryNodes
          Collection for temporary nodes, Used by the Temporarynodemanager when working with transactions The default size is 1024.
static String TMP_FIELD_NUMBER
           
protected  boolean virtual
          Determines whether a builder is virtual (data is not stored in the storage layer).
protected static Parameter[] WRAP_PARAMETERS
          Parameters constants for the NodeFunction wrapFunction.
protected  Function wrapFunction
          This function wraps the text of a node's field and returns the result as a String.
 
Fields inherited from class org.mmbase.module.core.MMTable
maxNodesFromQuery, mmb, storageConnector, tableName
 
Fields inherited from class org.mmbase.util.functions.FunctionProvider
functions
 
Constructor Summary
MMObjectBuilder()
          Constructor.
 
Method Summary
 void addEventListener(EventListener listener)
          simple way to register a NodeEvent listener and a RelationEventListener at the same time.
 void addField(CoreField def)
          Add a field to this builder.
 boolean addLocalObserver(MMBaseObserver obs)
          Deprecated. use the new event system as well. check out addEventListener(Object listener) or MMBase.addEventListener(EventListener listener)
 boolean addRemoteObserver(MMBaseObserver obs)
          Deprecated. use the new event system as well. check out addEventListener(Object listener) or MMBase.addEventListener(EventListener listener)
 boolean broadcastChanges()
          Determines whether changes to this builder need be broadcasted to other known mmbase servers.
 boolean checkAddTmpField(String field)
          Defines a virtual field to use for temporary nodes.
 int clearBlobCache(int nodeNumber)
           
 boolean commit(MMObjectNode node)
          Commit changes to this node to the storage layer.
 boolean create()
          Creates a new builder table in the storage layer.
 boolean createAlias(int number, String alias)
          Creates an alias for a node, provided the OAlias builder is loaded.
 boolean createAlias(int number, String alias, String owner)
          Creates an alias for a node, provided the OAlias builder is loaded.
 void delete()
          Removes the builder from the storage.
 boolean equals(MMObjectNode o1, MMObjectNode o2)
          Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)
 boolean equals(Object o)
          Equals must be implemented because of the list of MMObjectBuilder which is used for ancestors Declared the method final, because the instanceof operator is used.
protected  Object executeFunction(MMObjectNode node, String function, List arguments)
          Executes a function on the field of a node, and returns the result.
protected  Object executeFunction(MMObjectNode node, String function, String field)
          Deprecated. use getFunction(MMObjectNode, String)
 boolean fieldLocalChanged(String number, String builder, String field, String value)
          Called when a local field is changed.
 List getAncestors()
          Gives the list of parent-builders.
protected  BlobCache getBlobCache(String fieldName)
          Returns
 String getClassName()
          Deprecated. don't use
 File getConfigFile()
          Deprecated. Need something as getConfigResource in stead.
 String getConfigResource()
           
 DataTypeCollector getDataTypeCollector()
          Returns the datatype collector belonging to this buidler.
 int getDBKey()
          Deprecated. use MMBase.getStorageManager().createKey()
 int getDBState(String fieldName)
          Return a field's storage state.
 int getDBType(String fieldName)
          Return a field's storage type.
 MMObjectNode getDefaultTeaser(MMObjectNode node, MMObjectNode tnode)
          Deprecated. Will be removed?
 String getDefaultUrl(int src)
          Return the default url of this object.
 List getDescendants()
          Creates list of descendant-builders.
 String getDescription()
          Get description of the builder
 String getDescription(String lang)
          Gets description of the builder, using the specified language.
 Hashtable getDescriptions()
          Get descriptions of the builder
 Vector getEditFields()
          Deprecated. use getFields() with sortorder ORDER_SEARCH
 MMObjectNode getEmptyNode(String owner)
          Returns a new empty node object.
 FieldDefs getField(String fieldName)
          Return a field's definition
 Set getFieldNames()
          Return a list of field names of this table.
 Collection getFields()
          Return a copy of the list of field definitions of this table.
 List getFields(int sortOrder)
          Gets the field definitions for the editor, sorted according to the specified order, and excluding the fields that have not been assigned a valid position (valid is >= 0).
protected  Function getFunction(MMObjectNode node, String functionName)
          Instantiates a Function object for a certain function on a certain node of this type.
protected  Vector getFunctionParameters(String fields)
          Deprecated. use executeFunction(node, function, list)
protected  Collection getFunctions(MMObjectNode node)
          Returns all Functions which are available (or at least known to be available) on a Node.
 String getGUIIndicator(MMObjectNode node)
          What should a GUI display for this node.
protected  String getGUIIndicator(MMObjectNode node, Parameters pars)
          A complicated default implementation for GUI.
 String getGUIIndicator(String fieldName, MMObjectNode node)
          What should a GUI display for this node/field combo.
 MMObjectNode getHardNode(int number)
          Retrieves a node based on it's number (a unique key), directly from the storage, not using the node cache.
 MMObjectNode getHardNode(String key)
          Retrieves a node based on a unique key.
protected  String getHTML(String body)
          Deprecated.  
 String getInitParameter(String name)
          Retrieve a specific property.
 Hashtable getInitParameters()
          Get all builder properties
 long getInternalVersion()
          Returns the builder's internal version number.
 Vector getList(PageInfo sp, StringTagger tagger, StringTokenizer tok)
          Obtains a list of string values by performing the provided command and parameters.
protected  String getLocaleGUIIndicator(Locale locale, MMObjectNode node)
          The GUIIndicator can depend on the locale.
protected  String getLocaleGUIIndicator(Locale locale, String field, MMObjectNode node)
          The GUIIndicator can depend on the locale.
 String getMachineName()
          Get the name of this mmserver from the MMBase Root
 String getMaintainer()
          Retrieves the maintainer of this builder
 MMObjectNode getNewNode(String owner)
          Get a new node, using this builder as its parent.
 MMObjectNode getNewTmpNode(String owner, String key)
          Create a new temporary node and put it in the temporary _exist node space
 FieldDefs getNextField(String currentfield)
          Deprecated. use getNextField() with sortorder ORDER_EDIT
 FieldDefs getNextField(String currentfield, int sortorder)
          Returns the next field as defined by its sortorder, according to the specified order.
 MMObjectNode getNode(int number)
          Retrieves a node based on it's number (a unique key), retrieving the node from the node cache if possible.
 MMObjectNode getNode(String key)
          Retrieves a node based on a unique key.
 MMObjectNode getNode(String key, boolean useCache)
          Retrieves a node based on a unique key.
 MMObjectNode getNodeFromCache(Integer number)
          Retrieves a node from the cache, or null if it doesn't exist.
protected  String getNodeGUIIndicator(MMObjectNode node, Parameters params)
          Returns a GUI-indicator for the node itself.
 int getNumber()
          Returns the builder object number, which also functions as the objecttype.
 int getObjectType()
          Returns the objecttype (otype).
protected  Object getObjectValue(MMObjectNode node, String field)
          Like getValue, but without the 'old' code (short_ html_ etc).
 MMObjectBuilder getParentBuilder()
          Returns the builder that this builder extends.
 String getPluralName()
          Gets long name of the builder in the current default language.
 String getPluralName(String lang)
          Gets long name of the builder, using the specified language.
 Hashtable getPluralNames()
          Gets a list of plural names (language - value pairs)
 Vector getRelations_main(int src)
          Returns all relations of a node.
 String getSearchAge()
          Gets search Age
 String getShort(String str, int len)
          Support routine to return shorter strings.
protected  byte[] getShortedByte(String fieldName, MMObjectNode node)
          Get binary data of a blob field.
protected  String getShortedText(String fieldName, MMObjectNode node)
          Get text from a blob field.
 String getSingularName()
          Gets short name of the builder in the current default language.
 String getSingularName(String lang)
          Gets short name of the builder, using the specified language.
 Hashtable getSingularNames()
          Gets a list of singular names (language - value pairs)
 String getSmartPath(String documentRoot, String path, String nodeNumber, String version)
          Returns the path to use for TREEPART, TREEFILE, LEAFPART and LEAFFILE.
 Vector getSortedFields()
          Deprecated. use getFields() with sortorder ORDER_EDIT
 Vector getSortedListFields()
          Deprecated. use getFields() with sortorder ORDER_LIST
 MMObjectNode getTmpNode(String key)
          Get nodes from the temporary node space
protected  String getURLEncode(String body)
          Returns a URLEncoded-version (MIME x-www-form-urlencoded) of a string.
 Object getValue(MMObjectNode node, String field)
          Provides additional functionality when obtaining field values.
 int getVersion()
          Retrieves the version of this builder
protected  String getWAP(String body)
          Returns a WAP-version of a string.
 String getXMLPath()
          Retrieves the subpath of the builder's xml configuration file.
 boolean hasField(String fieldName)
           
 int hashCode()
           
 int hashCode(MMObjectNode o)
          Implements for MMObjectNode
 String hostname_function(String url)
          Deprecated. Has nothing to do with mmbase nodes. Should be in org.mmbase.util
 boolean init()
          Initializes this builder The property 'mmb' needs to be set for the builder before this method can be called.
 int insert(int oType, String owner)
          Insert a new, empty, object of a certain type.
 int insert(String owner, MMObjectNode node)
          Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided).
 boolean isExtensionOf(MMObjectBuilder o)
          Checks wether this builder is an extension of the argument builder
 boolean isNodeCached(Integer number)
          Is this node cached at this moment?
 boolean isVirtual()
          Determine whether this builder is virtual.
protected  Function newFunctionInstance(String name, Parameter[] parameters, ReturnType returnType)
           
 boolean nodeLocalChanged(String machine, String number, String builder, String ctype)
          Deprecated. use notify(NodeEvent) in stead
 boolean nodeRemoteChanged(String machine, String number, String builder, String ctype)
          Deprecated. use notify(NodeEvent) in stead
 void notify(NodeEvent event)
           
 void notify(RelationEvent event)
           
 MMObjectNode preCommit(MMObjectNode node)
          This method is called before an actual write to the storage layer is performed.
 boolean process(PageInfo sp, StringTokenizer command, Hashtable cmds, Hashtable vars)
          The hook that passes all form related pages to the correct handler.
 void putTmpNode(String key, MMObjectNode node)
          Put a Node in the temporary node list
 void removeEventListener(EventListener listener)
           
 void removeField(String fieldName)
          Remove a field from this builder.
 boolean removeLocalObserver(MMBaseObserver obs)
           
 void removeNode(MMObjectNode node)
          Remove a node from the cloud.
 void removeRelations(MMObjectNode node)
          Remove the relations of a node.
 boolean removeRemoteObserver(MMBaseObserver obs)
           
protected  void removeSyncNodes(MMObjectNode node)
          Removes the syncnodes to this node.
 void removeTmpNode(String key)
          Remove a node from the temporary node space
 String replace(PageInfo sp, StringTokenizer tok)
          Obtains a string value by performing the provided command.
 MMObjectNode safeCache(Integer n, MMObjectNode node)
          Stores a node in the cache provided the cache is not write locked.
 boolean sendFieldChangeSignal(MMObjectNode node, String fieldName)
          Send a signal to other servers that a field was changed.
 void setDefaults(MMObjectNode node)
          Sets defaults for a node.
 void setDescription(String e)
          Set description of the builder
 void setDescriptions(Hashtable e)
          Set descriptions of the builder
 void setFields(List f)
          Stores fields information of this table.
 void setInitParameter(String name, String value)
          Set a single builder property The propertie will not be saved.
 void setMaintainer(String m)
          Sets the maintainer of this builder
 void setParentBuilder(MMObjectBuilder parent)
          Sets the builder that this builder extends, and registers it in the storage layer.
 void setPluralNames(Hashtable names)
          Sets a list of plural names (language - value pairs)
 void setSearchAge(String age)
          Sets search Age.
 void setSingularNames(Hashtable names)
          Sets a list of singular names (language - value pairs)
protected  int setUniqueValue(MMObjectNode node, String field, int offset)
          In setDefault you could want to generate unique values for fields (if the field is 'unique').
protected  String setUniqueValue(MMObjectNode node, String field, String baseValue)
          In setDefault you could want to generate unique values for fields (if the field is 'unique').
 boolean setValue(MMObjectNode node, String fieldName)
          Provides additional functionality when setting field values.
 boolean setValue(MMObjectNode node, String fieldName, Object originalValue)
          Sets a key/value pair in the main values of this node.
 void setVersion(int i)
          Sets the version of this builder
 void setXMLPath(String m)
          Sets the subpath of the builder's xml configuration file.
 void testValidData(MMObjectNode node)
          Tests whether the data in a node is valid (throws an exception if this is not the case).
 String toString()
          Implmenting a sensible toString is usefull for debugging.
 String toString(MMObjectNode n)
          Implements for MMObjectNode
protected  void update()
          Updates the internal version number of this buidler;
protected  void updateFields()
          Clears all field list caches, and recalculates the field list.
 String wrap(String text, int width)
          Wraps a string.
 
Methods inherited from class org.mmbase.module.core.MMTable
count, count, created, getFullTableName, getMMBase, getNode, getNodes, getNodes, getNodes, getNodeType, getStorageConnector, getTableName, search, searchVector, setMMBase, setTableName, size
 
Methods inherited from class org.mmbase.util.functions.FunctionProvider
addFunction, createParameters, getFunction, getFunctions, getFunctionValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_NUMBER

public static final String FIELD_NUMBER
Name of the field containing the object number, which uniquely identifies the node.

Since:
MMBase-1.8
See Also:
Constant Field Values

FIELD_OWNER

public static final String FIELD_OWNER
Name of the field containing the owner. The owner field is used for security implementations.

Since:
MMBase-1.8
See Also:
Constant Field Values

FIELD_OBJECT_TYPE

public static final String FIELD_OBJECT_TYPE
Name of the field containing the object type number. This refers to an entry in the 'typedef' builder table.

Since:
MMBase-1.8
See Also:
Constant Field Values

TMP_FIELD_NUMBER

public static final String TMP_FIELD_NUMBER
Since:
MMBase-1.8
See Also:
Constant Field Values

SYSTEM_OWNER

public static final String SYSTEM_OWNER
Default (system) owner name for the owner field.

Since:
MMBase-1.8
See Also:
Constant Field Values

TEMPNODE_DEFAULT_SIZE

public static final int TEMPNODE_DEFAULT_SIZE
Default size of the temporary node cache

See Also:
Constant Field Values

DEFAULT_ALINEA

public static final String DEFAULT_ALINEA
Default replacements for method getHTML()

See Also:
Constant Field Values

DEFAULT_EOL

public static final String DEFAULT_EOL
See Also:
Constant Field Values

EVENT_TYPE_LOCAL

public static final int EVENT_TYPE_LOCAL
See Also:
Constant Field Values

EVENT_TYPE_REMOTE

public static final int EVENT_TYPE_REMOTE
See Also:
Constant Field Values

AGE_PARAMETERS

public static final Parameter[] AGE_PARAMETERS
Parameters for the age function

Since:
MMBase-1.7

temporaryNodes

public static Map temporaryNodes
Collection for temporary nodes, Used by the Temporarynodemanager when working with transactions The default size is 1024.

Warning: Scope will be changed to:
protected
Warning: Contains Duplicate Code (present in other classes)
use Cache object instead

genericBlobCache

protected static BlobCache genericBlobCache
The cache for all blobs.

Since:
1.8.0

nodeCache

protected static NodeCache nodeCache
The cache that contains the X last requested nodes


description

public String description
Description of the builder in the currently selected language Not that the first time the builder is created, this value is what is stored in the TypeDef table.

Warning: Scope will be changed to:
protected

descriptions

public Hashtable descriptions
Descriptions of the builder per language Can be set with the <descriptions> tag in the xml builder file.

Warning: Scope will be changed to:
protected

searchAge

public String searchAge
The default search age for this builder. Used for intializing editor search forms (see HtmlBase) Default value is 31. Can be changed with the <searchage> tag in the xml builder file.

Warning: Scope will be changed to:
protected

broadCastChanges

protected boolean broadCastChanges
Determines whether changes to this builder need be broadcasted to other known mmbase servers.


internalVersion

protected long internalVersion
Internal (instance) version number of this builder.


oType

protected int oType
The current builder's object type Retrieved from the TypeDef builder.


GUI_PARAMETERS

public static final Parameter[] GUI_PARAMETERS
Parameters for the GUI function

Since:
MMBase-1.7

guiFunction

protected Function guiFunction
The famous GUI function as a function object.

Since:
MMBase-1.8

WRAP_PARAMETERS

protected static final Parameter[] WRAP_PARAMETERS
Parameters constants for the NodeFunction wrapFunction.

Since:
MMBase-1.8

wrapFunction

protected Function wrapFunction
This function wraps the text of a node's field and returns the result as a String. It takes as parameters a fieldname, the line length to wrap, and the Node containing the data. This function can be called through the function framework.

Since:
MMBase-1.8

getFunctions

protected Function getFunctions
Every Function Provider provides least the 'getFunctions' function, which returns a Set of all functions which it provides. This is overridden from FunctionProvider, because this one needs to be (also) a NodeFunction

Since:
MMBase-1.8

infoFunction

protected Function infoFunction
The info-function is a node-function and a builder-function. Therefore it is defined as a node-function, but also overidesd getFunctionValue(Parameters).

Since:
MMBase-1.8

fields

protected final Map fields

virtual

protected boolean virtual
Determines whether a builder is virtual (data is not stored in the storage layer).

Constructor Detail

MMObjectBuilder

public MMObjectBuilder()
Constructor.

Method Detail

init

public boolean init()
Initializes this builder The property 'mmb' needs to be set for the builder before this method can be called. The method retrieves data from the TypeDef builder, or adds data to that builder if the current builder is not yet registered.

Returns:
true if init was completed, false if uncompleted.
See Also:
create()

getNumber

public int getNumber()
Returns the builder object number, which also functions as the objecttype. This is the same value as the value of the 'otype' field of objects created by this builder (rather than created by its descendants).

Returns:
the builder number
Since:
MMBase-1.8

getObjectType

public int getObjectType()
Returns the objecttype (otype). By preference, use getNumber() for future compatibility with the bridge NodeManager methods.

Returns:
the objecttype

update

protected void update()
Updates the internal version number of this buidler;


getInternalVersion

public long getInternalVersion()
Returns the builder's internal version number. This number can be used to sync wrapper classes. I.e. to make sure that a nodemanager's fieldlist is the same as that of the wrapped builder.


create

public boolean create()
Creates a new builder table in the storage layer.


delete

public void delete()
Removes the builder from the storage.

Since:
MMBase-1.7

testValidData

public void testValidData(MMObjectNode node)
                   throws InvalidDataException
Tests whether the data in a node is valid (throws an exception if this is not the case).

Parameters:
node - The node whose data to check
Throws:
InvalidDataException - If the data was unrecoverably invalid (the references did not point to existing objects)

insert

public int insert(int oType,
                  String owner)
Insert a new, empty, object of a certain type.

Parameters:
oType - The type of object to create
owner - The administrator creating the node
Returns:
An int value which is the new object's unique number, -1 if the insert failed. The basic routine does not create any nodes this way and always fails.

insert

public int insert(String owner,
                  MMObjectNode node)
Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided). This method indirectly calls preCommit(org.mmbase.module.core.MMObjectNode).

Parameters:
owner - The administrator creating the node
node - The object to insert. The object need be of the same type as the current builder.
Returns:
An int value which is the new object's unique number, -1 if the insert failed.

preCommit

public MMObjectNode preCommit(MMObjectNode node)
This method is called before an actual write to the storage layer is performed.

Parameters:
node - The node to be committed.
Returns:
the node to be committed (possibly after changes have been made).

commit

public boolean commit(MMObjectNode node)
Commit changes to this node to the storage layer. This method indirectly calls preCommit(org.mmbase.module.core.MMObjectNode). Use only to commit changes - for adding node, use insert(int, java.lang.String).

Parameters:
node - The node to be committed
Returns:
true if commit successful

broadcastChanges

public boolean broadcastChanges()
Determines whether changes to this builder need be broadcasted to other known mmbase servers. This setting also governs whether the cache for relation builders is emptied when a relation changes. Actual broadcasting (and cache emptying) is initiated in the storage layer, when changes are commited. By default, all builders broadcast their changes, with the exception of the TypeDef builder. MM: Can somebody please explain _why_ typedef node changes, like e.g. creating a new node type are _not_ broadcasted.

Since:
MMBase-1.8

createAlias

public boolean createAlias(int number,
                           String alias,
                           String owner)
Creates an alias for a node, provided the OAlias builder is loaded.

Parameters:
number - the to-be-aliased node's unique number
alias - the aliasname to associate with the object
owner - the owner of the alias
Returns:
if the alias could be created
Since:
MMBase-1.8

createAlias

public boolean createAlias(int number,
                           String alias)
Creates an alias for a node, provided the OAlias builder is loaded.

Parameters:
number - the to-be-aliased node's unique number
alias - the aliasname to associate with the object
Returns:
if the alias could be created

getParentBuilder

public MMObjectBuilder getParentBuilder()
Returns the builder that this builder extends.

Returns:
the extended (parent) builder, or null if not available
Since:
MMBase-1.6

getAncestors

public List getAncestors()
Gives the list of parent-builders.

Since:
MMBase-1.6.2

getDescendants

public List getDescendants()
Creates list of descendant-builders.

Since:
MMBase-1.6.2

setParentBuilder

public void setParentBuilder(MMObjectBuilder parent)
Sets the builder that this builder extends, and registers it in the storage layer.

Parameters:
parent - the extended (parent) builder, or null if not available
Since:
MMBase-1.6

getDataTypeCollector

public DataTypeCollector getDataTypeCollector()
Returns the datatype collector belonging to this buidler. A datatype collector contains the datatypes that are local to this builder.

Since:
MMBase-1.8

isExtensionOf

public boolean isExtensionOf(MMObjectBuilder o)
Checks wether this builder is an extension of the argument builder

Since:
MMBase-1.6.2

getNewNode

public MMObjectNode getNewNode(String owner)
Get a new node, using this builder as its parent. The new node is not a part of the cloud yet, and thus has the value -1 as a number. (Call insert(int, java.lang.String) to add the node to the cloud).

Parameters:
owner - The administrator creating the new node.
Returns:
A newly initialized MMObjectNode.

getEmptyNode

public MMObjectNode getEmptyNode(String owner)
Returns a new empty node object. This is used by Storage to create a non-new node object (isNew is false), which is then be filled with actual values from storage.

Since:
MMBase-1.8.

setDefaults

public void setDefaults(MMObjectNode node)
Sets defaults for a node. Fields "number", "owner" and "otype" are not set by this method.

Parameters:
node - The node to set the defaults of.

setUniqueValue

protected String setUniqueValue(MMObjectNode node,
                                String field,
                                String baseValue)
In setDefault you could want to generate unique values for fields (if the field is 'unique').

Since:
MMBase-1.7

setUniqueValue

protected int setUniqueValue(MMObjectNode node,
                             String field,
                             int offset)
In setDefault you could want to generate unique values for fields (if the field is 'unique').

Since:
MMBase-1.7

removeNode

public void removeNode(MMObjectNode node)
Remove a node from the cloud.

Parameters:
node - The node to remove.

removeSyncNodes

protected void removeSyncNodes(MMObjectNode node)
Removes the syncnodes to this node. This is logical, but also needed to maintain storage integrety.

Since:
MMBase-1.7

removeRelations

public void removeRelations(MMObjectNode node)
Remove the relations of a node.

Parameters:
node - The node whose relations to remove.

isNodeCached

public boolean isNodeCached(Integer number)
Is this node cached at this moment?

Parameters:
number - The number of the node to check.
Returns:
true if the node is in the cache, false otherwise

getNodeFromCache

public MMObjectNode getNodeFromCache(Integer number)
Retrieves a node from the cache, or null if it doesn't exist.

Parameters:
number - The number of the node to retrieve.
Returns:
an MMObjectNode or null if the node is not in the cache
Since:
MMBase-1.8
To Do:
This is a simple wrapper around node cache, why not expose node cache in stead?

safeCache

public MMObjectNode safeCache(Integer n,
                              MMObjectNode node)
Stores a node in the cache provided the cache is not write locked.

Returns:
a valid node. If the node already was in the cache, the cached node is returned. In that case the node given as parameter should become invalid

isVirtual

public boolean isVirtual()
Determine whether this builder is virtual. A virtual builder represents nodes that are not stored or retrieved directly from storage, but are created as needed.

Returns:
true if the builder is virtual.

getNode

public MMObjectNode getNode(String key,
                            boolean useCache)
Retrieves a node based on a unique key. The key is either an entry from the OAlias table or the string-form of an integer value (the number field of an object node). Note that the OAlias builder needs to be active for the alias to be used (otherwise using an alias is concidered invalid).

Parameters:
key - The value to search for
useCache - If true, the node is retrieved from the node cache if possible.
Returns:
null if the node does not exist or the key is invalid, or a MMObjectNode containing the contents of the requested node.

getNode

public MMObjectNode getNode(String key)
Retrieves a node based on a unique key. The key is either an entry from the OAlias table or the string-form of an integer value (the number field of an object node). Retrieves a node from the node cache if possible.

Parameters:
key - The value to search for
Returns:
null if the node does not exist or the key is invalid, or a MMObjectNode containing the contents of the requested node.

getHardNode

public MMObjectNode getHardNode(String key)
Retrieves a node based on a unique key. The key is either an entry from the OAlias table or the string-form of an integer value (the number field of an object node). Retrieves the node from directly the storage, not using the node cache.

Parameters:
key - The value to search for
Returns:
null if the node does not exist or the key is invalid, or a MMObjectNode containing the contents of the requested node.

getNode

public MMObjectNode getNode(int number)
Retrieves a node based on it's number (a unique key), retrieving the node from the node cache if possible.

Parameters:
number - The number of the node to search for
Returns:
null if the node does not exist or the key is invalid, or a MMObjectNode containign the contents of the requested node.

getHardNode

public MMObjectNode getHardNode(int number)
Retrieves a node based on it's number (a unique key), directly from the storage, not using the node cache.

Parameters:
number - The number of the node to search for
Returns:
null if the node does not exist or the key is invalid, or a MMObjectNode containign the contents of the requested node.

getNewTmpNode

public MMObjectNode getNewTmpNode(String owner,
                                  String key)
Create a new temporary node and put it in the temporary _exist node space


putTmpNode

public void putTmpNode(String key,
                       MMObjectNode node)
Put a Node in the temporary node list

Parameters:
key - The (temporary) key under which to store the node
node - The node to store

checkAddTmpField

public boolean checkAddTmpField(String field)
Defines a virtual field to use for temporary nodes. If the given field-name does not start with underscore ('_'), wich it usually does, then the field does also get a 'dbpos' (1000) as if it was actually present in the builder's XML as a virtual field (this is accompanied with a log message). Normally this is used to add 'tmp' fields like _number, _exists and _snumber which are system fields which are normally invisible.

Parameters:
field - the name of the temporary field
Returns:
true if the field was added, false if it already existed.

getTmpNode

public MMObjectNode getTmpNode(String key)
Get nodes from the temporary node space

Parameters:
key - The (temporary) key to use under which the node is stored

removeTmpNode

public void removeTmpNode(String key)
Remove a node from the temporary node space

Parameters:
key - The (temporary) key under which the node is stored

getFields

public Collection getFields()
Return a copy of the list of field definitions of this table.

Returns:
An unmodifiable Collection with the tables fields

getFieldNames

public Set getFieldNames()
Return a list of field names of this table.

Returns:
a unmodifiable Set with the tables field names
To Do:
return an unmodifiable Set.

getField

public FieldDefs getField(String fieldName)
Return a field's definition

Parameters:
fieldName - the requested field's name
Returns:
a FieldDefs belonging with the indicated field
To Do:
Should return CoreField

hasField

public boolean hasField(String fieldName)
Since:
MMBase-1.8

updateFields

protected void updateFields()
Clears all field list caches, and recalculates the field list.


addField

public void addField(CoreField def)
Add a field to this builder. This does not affect the builder config file, nor the table used.

Parameters:
def - the field definiton to add

removeField

public void removeField(String fieldName)
Remove a field from this builder. This does not affect the builder config file, nor the table used.

Parameters:
fieldName - the name of the field to remove

getDBType

public int getDBType(String fieldName)
Return a field's storage type. The returned value is one of the following values declared in Field: TYPE_STRING, TYPE_INTEGER, TYPE_BINARY, TYPE_FLOAT, TYPE_DOUBLE, TYPE_LONG, TYPE_NODE, TYPE_UNKNOWN

Parameters:
fieldName - the requested field's name
Returns:
the field's type.

getDBState

public int getDBState(String fieldName)
Return a field's storage state. The returned value is one of the following values declared in Field: STATE_VIRTUAL, STATE_PERSISTENT, STATE_SYSTEM, STATE_UNKNOWN

Parameters:
fieldName - the requested field's name
Returns:
the field's state.

getGUIIndicator

protected String getGUIIndicator(MMObjectNode node,
                                 Parameters pars)
A complicated default implementation for GUI.

Since:
MMBase-1.8

getNodeGUIIndicator

protected String getNodeGUIIndicator(MMObjectNode node,
                                     Parameters params)
Returns a GUI-indicator for the node itself.

Since:
MMBase-1.8.1

getGUIIndicator

public String getGUIIndicator(MMObjectNode node)
What should a GUI display for this node. Default is the first non system field (first field after owner). Override this to display your own choice (see Images.java). You may want to override getNodeGUIIndicator(org.mmbase.module.core.MMObjectNode, org.mmbase.util.functions.Parameters) for more flexibility.

Parameters:
node - The node to display
Returns:
the display of the node as a String

getGUIIndicator

public String getGUIIndicator(String fieldName,
                              MMObjectNode node)
What should a GUI display for this node/field combo. Default is null (indicating to display the field as is) Override this to display your own choice.

Parameters:
node - The node to display
fieldName - the name field of the field to display
Returns:
the display of the node's field as a String, null if not specified

getLocaleGUIIndicator

protected String getLocaleGUIIndicator(Locale locale,
                                       String field,
                                       MMObjectNode node)
The GUIIndicator can depend on the locale. Override this function

Since:
MMBase-1.6

getLocaleGUIIndicator

protected String getLocaleGUIIndicator(Locale locale,
                                       MMObjectNode node)
The GUIIndicator can depend on the locale. Override this function You may want to override getNodeGUIIndicator(org.mmbase.module.core.MMObjectNode, org.mmbase.util.functions.Parameters) for more flexibility.

Since:
MMBase-1.6

getFields

public List getFields(int sortOrder)
Gets the field definitions for the editor, sorted according to the specified order, and excluding the fields that have not been assigned a valid position (valid is >= 0). This method makes an explicit sort (it does not use a cached list).

Parameters:
sortOrder - One of the sortorders defined in CoreField
Returns:
The ordered list of field definitions.

getEditFields

public Vector getEditFields()
Deprecated. use getFields() with sortorder ORDER_SEARCH

Get the field definitions for the editor, sorted according to it's GUISearch property (as set in the builder xml file). Used for creating search-forms.

Returns:
a vector with CoreField objects

getSortedListFields

public Vector getSortedListFields()
Deprecated. use getFields() with sortorder ORDER_LIST

Get the field definitions for the editor, sorted accoring to it's GUIList property (as set in the builder xml file). Used for creating list-forms (tables).

Returns:
a vector with CoreField objects

getSortedFields

public Vector getSortedFields()
Deprecated. use getFields() with sortorder ORDER_EDIT

Get the field definitions for the editor, sorted according to it's GUIPos property (as set in the builder xml file). Used for creating edit-forms.

Returns:
a vector with CoreField objects

getNextField

public FieldDefs getNextField(String currentfield,
                              int sortorder)
Returns the next field as defined by its sortorder, according to the specified order.


getNextField

public FieldDefs getNextField(String currentfield)
Deprecated. use getNextField() with sortorder ORDER_EDIT

Returns the next field as defined by its sortorder, according to it's GUIPos property (as set in the builder xml file). Used for moving between fields in an edit-form.


getBlobCache

protected BlobCache getBlobCache(String fieldName)
Returns

Since:
MMBase-1.7.4

clearBlobCache

public int clearBlobCache(int nodeNumber)
Since:
MMBase-1.8

getValue

public Object getValue(MMObjectNode node,
                       String field)
Provides additional functionality when obtaining field values. This method is called whenever a Node of the builder's type fails at evaluating a getValue() request (generally when a fieldname is supplied that doesn't exist). It allows the system to add 'functions' to be included with a field name, such as 'html(body)' or 'time(lastmodified)'. This method will parse the fieldname, determining functions and calling the executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List) method to handle it. Functions in fieldnames can be given in the format 'functionname(fieldname)'. An old format allows 'functionname_fieldname' instead, though this only applies to the text functions 'short', 'html', and 'wap'. Functions can be nested, i.e. 'html(shorted(body))'. Derived builders should override this method only if they want to provide virtual fieldnames. To provide addiitonal functions, call FunctionProvider.addFunction(org.mmbase.util.functions.Function) instead. See also the source code for ExampleBuilder.

Parameters:
node - the node whos efields are queries
field - the fieldname that is requested
Returns:
the result of the 'function', or null if no valid functions could be determined.

getObjectValue

protected Object getObjectValue(MMObjectNode node,
                                String field)
Like getValue, but without the 'old' code (short_ html_ etc). This is for protected use, when you are sure this is not used, and you can avoid the overhead.

Since:
MMBase-1.6
See Also:
getValue(org.mmbase.module.core.MMObjectNode, java.lang.String)

getFunctionParameters

protected Vector getFunctionParameters(String fields)
Deprecated. use executeFunction(node, function, list)

Parses string containing function parameters. The parameters must be separated by ',' or ';' and may be functions themselves (i.e. a functionname, followed by a parameter list between parenthesis).

Parameters:
fields - The string, containing function parameters.
Returns:
List of function parameters (may be functions themselves).

getFunction

protected Function getFunction(MMObjectNode node,
                               String functionName)
Instantiates a Function object for a certain function on a certain node of this type.

Parameters:
node - The Node for on which the function must work
functionName - Name of the request function.
Returns:
a Function object or null if no such function.
Since:
MMBase-1.8

getFunctions

protected Collection getFunctions(MMObjectNode node)
Returns all Functions which are available (or at least known to be available) on a Node.

Since:
MMBase-1.8

newFunctionInstance

protected Function newFunctionInstance(String name,
                                       Parameter[] parameters,
                                       ReturnType returnType)
Overrides:
newFunctionInstance in class FunctionProvider
Since:
MMBase-1.8

executeFunction

protected Object executeFunction(MMObjectNode node,
                                 String function,
                                 List arguments)
Executes a function on the field of a node, and returns the result. This method is called by the builder's getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method. Derived builders should override this method to provide additional functions.

Throws:
IllegalArgumentException - if the argument List does not fit the function
Since:
MMBase-1.6
See Also:
executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List)

executeFunction

protected Object executeFunction(MMObjectNode node,
                                 String function,
                                 String field)
Deprecated. use getFunction(MMObjectNode, String)

Executes a function on the field of a node, and returns the result. This method is called by the builder's getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method. current functions are:
on dates: date, time, timesec, longmonth, month, monthnumber, weekday, shortday, day, yearhort year
on text: wap, html, shorted, uppercase, lowercase
on node: age()
on numbers: wrap_<int>, currency_euro

Parameters:
node - the node whose fields are queries
field - the fieldname that is requested
Returns:
the result of the 'function', or null if no valid functions could be determined.

getRelations_main

public Vector getRelations_main(int src)
Returns all relations of a node. This returns the relation objects, not the objects related to. Note that the relations returned are always of builder type 'InsRel', even if they are really from a derived builser such as AuthRel.

Parameters:
src - the number of the node to obtain the relations from
Returns:
a Vector with InsRel nodes
To Do:
Return-type and name of this function are not sound.

getDefaultUrl

public String getDefaultUrl(int src)
Return the default url of this object. The basic value returned is null.

Parameters:
src - the number of the node to obtain the url from
Returns:
the basic url as a String, or null if unknown.

getSmartPath

public String getSmartPath(String documentRoot,
                           String path,
                           String nodeNumber,
                           String version)
Returns the path to use for TREEPART, TREEFILE, LEAFPART and LEAFFILE. The system searches in a provided base path for a filename that matches the supplied number/alias of a node (possibly extended with a version number). See the documentation on the TREEPART SCAN command for more info.

Parameters:
documentRoot - the root of the path to search
path - the subpath of the path to search
nodeNumber - the number or alias of the node to filter on
version - the version number (or null if not applicable) to filter on
Returns:
the found path as a String, or null if not found This method should be added to the bridge so jsp can make use of it. This method can be overriden to make an even smarter search possible.
Warning: Will be moved to:
maybe to a different SmartPathFunction class?

getDBKey

public int getDBKey()
Deprecated. use MMBase.getStorageManager().createKey()

Get the next object key (unique index for an object).

Returns:
an int value that is the next available key for an object.

getMachineName

public String getMachineName()
Get the name of this mmserver from the MMBase Root

Returns:
a String which is the server's name

nodeRemoteChanged

public boolean nodeRemoteChanged(String machine,
                                 String number,
                                 String builder,
                                 String ctype)
Deprecated. use notify(NodeEvent) in stead

Called when a remote node is changed. Should be called by subclasses if they override it.

Parameters:
machine - Name of the machine that changed the node.
number - Number of the changed node as a String
builder - type of the changed node
ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
Returns:
always true

nodeLocalChanged

public boolean nodeLocalChanged(String machine,
                                String number,
                                String builder,
                                String ctype)
Deprecated. use notify(NodeEvent) in stead

Called when a local node is changed. Should be called by subclasses if they override it.

Parameters:
machine - Name of the machine that changed the node.
number - Number of the changed node as a String
builder - type of the changed node
ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
Returns:
always true

fieldLocalChanged

public boolean fieldLocalChanged(String number,
                                 String builder,
                                 String field,
                                 String value)
Called when a local field is changed.

Parameters:
number - Number of the changed node as a String
builder - type of the changed node
field - name of the changed field
value - value it changed to
Returns:
always true

addRemoteObserver

public boolean addRemoteObserver(MMBaseObserver obs)
Deprecated. use the new event system as well. check out addEventListener(Object listener) or MMBase.addEventListener(EventListener listener)

Adds a remote observer to this builder. The observer is notified whenever an object of this builder is changed, added, or removed.

Returns:
always true

addLocalObserver

public boolean addLocalObserver(MMBaseObserver obs)
Deprecated. use the new event system as well. check out addEventListener(Object listener) or MMBase.addEventListener(EventListener listener)

Adds a local observer to this builder. The observer is notified whenever an object of this builder is changed, added, or removed.

Returns:
always true

removeLocalObserver

public boolean removeLocalObserver(MMBaseObserver obs)
Since:
MMBase-1.8

removeRemoteObserver

public boolean removeRemoteObserver(MMBaseObserver obs)
Since:
MMBase-1.8

getDefaultTeaser

public MMObjectNode getDefaultTeaser(MMObjectNode node,
                                     MMObjectNode tnode)
Deprecated. Will be removed?

Used to create a default teaser by any builder


getList

public Vector getList(PageInfo sp,
                      StringTagger tagger,
                      StringTokenizer tok)
Obtains a list of string values by performing the provided command and parameters. This method is SCAN related and may fail if called outside the context of the SCAN servlet.

Parameters:
sp - The PageInfo (containing http and user info) that calls the function
tagger - a Hashtable of parameters (name-value pairs) for the command
tok - a list of strings that describe the (sub)command to execute
Returns:
a Vector containing the result values as a String

replace

public String replace(PageInfo sp,
                      StringTokenizer tok)
Obtains a string value by performing the provided command. The command can be called:

process

public boolean process(PageInfo sp,
                       StringTokenizer command,
                       Hashtable cmds,
                       Hashtable vars)
The hook that passes all form related pages to the correct handler. This method is SCAN related and may fail if called outside the context of the SCAN servlet. The methood is currentkly called by the MMEDIT module, whenever a 'PRC-CMD-BUILDER-...' command is encountered in the list of commands to be processed.

Parameters:
sp - The PageInfo (containing http and user info) that calls the function
command - a list of strings that describe the (sub)command to execute (the portion after ' PRC-CMD-BUILDER')
cmds - the commands (PRC-CMD) that are iurrently being processed, including the current command.
vars - variables (PRC-VAR) thatw ere set to be used during processing.
Returns:
the result value as a String

setDescription

public void setDescription(String e)
Set description of the builder

Parameters:
e - the description text

setDescriptions

public void setDescriptions(Hashtable e)
Set descriptions of the builder

Parameters:
e - a Hashtable containing the descriptions

getDescription

public String getDescription()
Get description of the builder

Returns:
the description text

getDescription

public String getDescription(String lang)
Gets description of the builder, using the specified language.

Parameters:
lang - The language requested
Returns:
the descriptions in that language, or null if it is not avaialble

getDescriptions

public Hashtable getDescriptions()
Get descriptions of the builder

Returns:
a Hashtable containing the descriptions

setSearchAge

public void setSearchAge(String age)
Sets search Age.

Parameters:
age - the search age as a String

getSearchAge

public String getSearchAge()
Gets search Age

Returns:
the search age as a String

getSingularName

public String getSingularName(String lang)
Gets short name of the builder, using the specified language.

Parameters:
lang - The language requested
Returns:
the short name in that language, or null if it is not available

getSingularName

public String getSingularName()
Gets short name of the builder in the current default language. If the current language is not available, the "en" version is returned instead. If that name is not available, the internal builder name (table name) is returned.

Returns:
the short name in either the default language or in "en"

getPluralName

public String getPluralName(String lang)
Gets long name of the builder, using the specified language.

Parameters:
lang - The language requested
Returns:
the long name in that language, or null if it is not available

getPluralName

public String getPluralName()
Gets long name of the builder in the current default language. If the current language is not available, the "en" version is returned instead. If that name is not available, the singular name is returned.

Returns:
the long name in either the default language or in "en"

getClassName

public String getClassName()
Deprecated. don't use

Returns the classname of this builder


sendFieldChangeSignal

public boolean sendFieldChangeSignal(MMObjectNode node,
                                     String fieldName)
Send a signal to other servers that a field was changed.

Parameters:
node - the node the field was changed in
fieldName - the name of the field that was changed
Returns:
always true

setSingularNames

public void setSingularNames(Hashtable names)
Sets a list of singular names (language - value pairs)


getSingularNames

public Hashtable getSingularNames()
Gets a list of singular names (language - value pairs)


setPluralNames

public void setPluralNames(Hashtable names)
Sets a list of plural names (language - value pairs)


getPluralNames

public Hashtable getPluralNames()
Gets a list of plural names (language - value pairs)


getShortedText

protected String getShortedText(String fieldName,
                                MMObjectNode node)
Get text from a blob field. This function is called to 'load' a field into the node, because it was not loaded together with the node, because it is supposed to be too big.

Parameters:
fieldName - name of the field
node -
Returns:
a String containing the complate contents of a field as text.
Since:
MMBase-1.8

getShortedByte

protected byte[] getShortedByte(String fieldName,
                                MMObjectNode node)
Get binary data of a blob field. This function is called to 'load' a field into the node, because it was not loaded together with the node, because it is supposed to be too big.

Parameters:
fieldName - name of the field
node -
Returns:
an array of byte containing the complete contents of the field.
Since:
MMBase-1.8

setValue

public boolean setValue(MMObjectNode node,
                        String fieldName,
                        Object originalValue)
Sets a key/value pair in the main values of this node. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldname is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
node - The node on which to change the field (the new value is in this node)
originalValue - the value which was original in the field
Returns:
true When an update is required(when changed), false if original value was set back into the field.

setValue

public boolean setValue(MMObjectNode node,
                        String fieldName)
Provides additional functionality when setting field values. This method is called whenever a Node of the builder's type tries to change a value. It allows the system to add functionality such as checking valid data. Derived builders should override this method if they want to add functionality.

Parameters:
node - the node whose fields are changed
fieldName - the fieldname that is changed
Returns:
true if the call was handled.

getHTML

protected String getHTML(String body)
Deprecated.  

Returns a HTML-version of a string. This replaces a number of tokens with HTML sequences. The default output does not match well with the new xhtml standards (ugly html), nor does it replace all tokens. Default replacements can be overridden by setting the builder properties in your .xml: html.alinea html.endofline Example: <br /> <br /> <br />

Parameters:
body - text to convert
Returns:
the convert text

getWAP

protected String getWAP(String body)
Returns a WAP-version of a string. This replaces a number of tokens with WAP sequences.

Parameters:
body - text to convert
Returns:
the convert text

getURLEncode

protected String getURLEncode(String body)
Returns a URLEncoded-version (MIME x-www-form-urlencoded) of a string. This version uses the java.net.URLEncoder class to encode it.

Parameters:
body - text to convert
Returns:
the URLEncoded text

getShort

public String getShort(String str,
                       int len)
Support routine to return shorter strings. Cuts a string to a amximum length if it exceeds the length specified.

Parameters:
str - the string to shorten
len - the maximum length
Returns:
the (possibly shortened) string

setFields

public void setFields(List f)
Stores fields information of this table. Asside from the fields supplied by the caller, a field 'otype' is added (if missing).

Parameters:
f - A List with fields (as CoreField objects) as defined by MMBase. This may not be in sync with the actual database table, about which Storage will report then.

setXMLPath

public void setXMLPath(String m)
Sets the subpath of the builder's xml configuration file.


getXMLPath

public String getXMLPath()
Retrieves the subpath of the builder's xml configuration file. Needed for builders that reside in subdirectories in the builder configuration file directory.


getConfigResource

public String getConfigResource()
Since:
MMBase-1.8

getConfigFile

public File getConfigFile()
Deprecated. Need something as getConfigResource in stead.

Gets the file that contains the configuration of this builder

Returns:
the builders configuration File object

getInitParameters

public Hashtable getInitParameters()
Get all builder properties

Returns:
a Hashtable containing the current properties

setInitParameter

public void setInitParameter(String name,
                             String value)
Set a single builder property The propertie will not be saved.

Parameters:
name - name of the property
value - value of the property

getInitParameter

public String getInitParameter(String name)
Retrieve a specific property.

Parameters:
name - the name of the property to get
Returns:
the value of the property as a String

setVersion

public void setVersion(int i)
Sets the version of this builder

Parameters:
i - the version number

getVersion

public int getVersion()
Retrieves the version of this builder

Returns:
the version number

getMaintainer

public String getMaintainer()
Retrieves the maintainer of this builder

Returns:
the name of the maintainer

setMaintainer

public void setMaintainer(String m)
Sets the maintainer of this builder

Parameters:
m - the name of the maintainer

hostname_function

public String hostname_function(String url)
Deprecated. Has nothing to do with mmbase nodes. Should be in org.mmbase.util

hostname, parses the hostname from a url, so http://www.mmbase.org/bug becomed www.mmbase.org


wrap

public String wrap(String text,
                   int width)
Wraps a string. Inserts newlines (\n) into a string at periodic intervals, to simulate wrapping. This also removes whitespace to the start of a line.

Parameters:
text - the text to wrap
width - the maximum width to wrap at
Returns:
the wrapped tekst

toString

public String toString()
Implmenting a sensible toString is usefull for debugging.

Since:
MMBase-1.6.2

equals

public final boolean equals(Object o)
Equals must be implemented because of the list of MMObjectBuilder which is used for ancestors Declared the method final, because the instanceof operator is used. This is the only MMObjectBuilder is frequently extended and subclasses will always break the equals contract. When subclasses require to implement the equals method then we should use getClass() == o.getClass(), but this has its own issues. For more info, search for equality in Java

Since:
MMBase-1.6.2

hashCode

public int hashCode()
See Also:
Object.hashCode()

toString

public String toString(MMObjectNode n)
Implements for MMObjectNode

Since:
MMBase-1.6.2

equals

public boolean equals(MMObjectNode o1,
                      MMObjectNode o2)
Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)

Since:
MMBase-1.6.2

hashCode

public int hashCode(MMObjectNode o)
Implements for MMObjectNode

Since:
MMBase-1.6.2

addEventListener

public void addEventListener(EventListener listener)
simple way to register a NodeEvent listener and a RelationEventListener at the same time.

Parameters:
listener -
Since:
MMBase-1.8
See Also:
MMBase.addNodeRelatedEventsListener(java.lang.String, org.mmbase.core.event.EventListener)

removeEventListener

public void removeEventListener(EventListener listener)
Parameters:
listener -
Since:
MMBase-1.8

notify

public void notify(NodeEvent event)
Specified by:
notify in interface NodeEventListener
Since:
MMBase-1.8
See Also:
here we handle all the backward compatibility stuff. this method covers for both node and relation events.

notify

public void notify(RelationEvent event)
Specified by:
notify in interface RelationEventListener
Since:
MMBase-1.8


MMBase build 1.8.1.20060716