org.mmbase.module.corebuilders
Class ObjectTypes

java.lang.Object
  |
  +--org.mmbase.module.core.MMTable
        |
        +--org.mmbase.module.core.MMObjectBuilder
              |
              +--org.mmbase.module.corebuilders.TypeDef
                    |
                    +--org.mmbase.module.corebuilders.ObjectTypes

public class ObjectTypes
extends TypeDef

This builder is the same as TypeDef, only it has an adittion field, which is the config field. This field contains the xml-Document of the builder wich is represented by a Node inside this Builder. The filename which shall be used depends on the fields 'name' of the Node. Also, a new node, means a new builder removal of node is removal of builder (also of the xml). Changes to the config will also be active on commit of the node. TODO: update/merging code, and futher testing..

Version:
$Id: ObjectTypes.java,v 1.23.2.2 2003/04/03 16:03:26 michiel Exp $
Author:
Eduard Witteveen

Fields inherited from class org.mmbase.module.core.MMObjectBuilder
broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, nodeCache, obj2type, OBJ2TYPE_MAX_SIZE, oType, REPLACE_CACHE, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual
 
Fields inherited from class org.mmbase.module.core.MMTable
mmb, tableName
 
Constructor Summary
ObjectTypes()
           
 
Method Summary
 boolean commit(MMObjectNode node)
          Commit changes to this node to the database.
protected  boolean deleteBuilderFile(MMObjectNode node)
           
protected  boolean deleteBuilderTable(MMObjectBuilder builder)
           
protected  java.lang.String getBuilderFilePath(MMObjectNode node)
          Returns the path, where the builderfile can be found, for not exising builders, a path will be generated.
protected  java.lang.String getBuilderPath(MMObjectNode node)
          Returns the path, where the builderfile can be found, for not exising builders, a path will be generated.
 java.lang.String getGUIIndicator(MMObjectNode node)
          What should a GUI display for this node.
 java.lang.Object getValue(MMObjectNode node, java.lang.String field)
          Provides additional functionality when obtaining field values.
 boolean init()
          Sets the default deploy directory for the builders.
 int insert(java.lang.String owner, MMObjectNode node)
          Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided).
protected  MMObjectBuilder loadBuilder(MMObjectNode node)
           
 void removeNode(MMObjectNode node)
          Remove a node from the cloud, when the represented builder was active it will also be unloaded
 boolean setValue(MMObjectNode node, java.lang.String fieldname, java.lang.Object originalValue)
          Sets a key/value pair in the main values of this node.
protected  java.io.File storeBuilderFile(MMObjectNode node)
           
protected  MMObjectBuilder unloadBuilder(MMObjectNode node)
           
 
Methods inherited from class org.mmbase.module.corebuilders.TypeDef
executeFunction, fieldLocalChanged, getBuilder, getGUIIndicator, getIntValue, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getNameToNumberCache, getNumberToNameCache, getSingularName, getValue, getValue, isRelationTable, loadTypeDef, reloadBuilder, unloadTypeDef
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, convertMMNode2SQL, count, create, createAlias, created, deleteNodeCache, drop, equals, equals, executeFunction, getAge, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFullTableName, getFunctionParameters, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTableName, getTmpNode, getURLEncode, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, putTmpNode, readSearchResults, removeField, removeRelations, removeTmpNode, replace, safeCache, safeCommit, safeInsert, search, search, search, searchIn, searchIn, searchIn, searchList, searchList, searchNumbers, searchVector, searchVector, searchVector, searchVector, searchVectorIn, searchVectorIn, searchVectorIn, searchVectorIn, searchWithWhere, sendFieldChangeSignal, setDBLayout_xml, setDefaults, setDescription, setDescriptions, setInitParameter, setMaintainer, setMMBase, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setTableName, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectTypes

public ObjectTypes()
Method Detail

init

public boolean init()
Sets the default deploy directory for the builders.
Overrides:
init in class MMObjectBuilder
Returns:
true if init was completed, false if uncompleted.

getValue

public java.lang.Object getValue(MMObjectNode node,
                                 java.lang.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 TypeDef.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, override TypeDef.executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List) instead.
Overrides:
getValue in class TypeDef
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.

insert

public int insert(java.lang.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 MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode).
Overrides:
insert in class TypeDef
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.

commit

public boolean commit(MMObjectNode node)
Commit changes to this node to the database. This method indirectly calls MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode). Use only to commit changes - for adding node, use insert(java.lang.String, org.mmbase.module.core.MMObjectNode).
Overrides:
commit in class TypeDef
Parameters:
node - The node to be committed
Returns:
true if commit successful

removeNode

public void removeNode(MMObjectNode node)
Remove a node from the cloud, when the represented builder was active it will also be unloaded
Overrides:
removeNode in class TypeDef
Parameters:
node - The node to remove.

setValue

public boolean setValue(MMObjectNode node,
                        java.lang.String fieldname,
                        java.lang.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.
Overrides:
setValue in class MMObjectBuilder
Parameters:
fieldname - the name of the field to change
fieldValue - the value to assign
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.

getBuilderFilePath

protected java.lang.String getBuilderFilePath(MMObjectNode node)
Returns the path, where the builderfile can be found, for not exising builders, a path will be generated.
Parameters:
node - The node, from which we want to know it;s MMObjectBuilder
Returns:
The path where the builder should live or null in case of strange failures When the builder was not loaded.

getBuilderPath

protected java.lang.String getBuilderPath(MMObjectNode node)
Returns the path, where the builderfile can be found, for not exising builders, a path will be generated.
Parameters:
node - The node, from which we want to know it;s MMObjectBuilder
Returns:
The path where the builder should live or null in case of strange failures When the builder was not loaded.

loadBuilder

protected MMObjectBuilder loadBuilder(MMObjectNode node)

storeBuilderFile

protected java.io.File storeBuilderFile(MMObjectNode node)

unloadBuilder

protected MMObjectBuilder unloadBuilder(MMObjectNode node)

deleteBuilderTable

protected boolean deleteBuilderTable(MMObjectBuilder builder)

deleteBuilderFile

protected boolean deleteBuilderFile(MMObjectNode node)

getGUIIndicator

public java.lang.String getGUIIndicator(MMObjectNode node)
What should a GUI display for this node. This method returns the gui name (singular name) of the builder that goes with this node.
Overrides:
getGUIIndicator in class TypeDef
Parameters:
node - The node to display
Returns:
the display of the node as a String


MMBase build 1.6.5.20030923