org.mmbase.module.core
Class VirtualBuilder

java.lang.Object
  |
  +--org.mmbase.module.core.MMTable
        |
        +--org.mmbase.module.core.MMObjectBuilder
              |
              +--org.mmbase.module.core.VirtualBuilder
Direct Known Subclasses:
ClusterBuilder, VirtualRefererBuilder

public class VirtualBuilder
extends MMObjectBuilder

VirtualBuilder is a builder which creates 'virtual' nodes. This class is intended to facilitate practical creation of virtual builders by capturing events that migth otherwise lead to unexpected or faulty behavior.

Version:
11 May 2001
Author:
Pierre van Rooden

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
  VirtualBuilder(MMBase m)
          Creates an instance of a Virtual builder.
protected VirtualBuilder(MMBase m, java.lang.String tableName)
          Creates an instance of a Virtual builder and registers it in MMBase.
 
Method Summary
 boolean create()
          Creates a new builder table in the current database.
 int getDBState(java.lang.String fieldName)
          Return a field's database state.
 java.lang.String getGUIInicator(MMObjectNode node)
          What should a GUI display for this node.
 MMObjectNode getNewNode(java.lang.String owner)
          Get a new node, using this builder as its parent.
 byte[] getShortedByte(java.lang.String fieldname, int number)
          Get binary data of a blob field from a database.
 java.lang.String getShortedText(java.lang.String fieldname, int number)
          Get text from a blob field from a database.
 boolean init()
          Initializes this builder.
 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).
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, createAlias, created, deleteNodeCache, drop, equals, equals, executeFunction, executeFunction, fieldLocalChanged, getAge, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFullTableName, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRelations_main, getSearchAge, getShort, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTableName, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, putTmpNode, readSearchResults, removeField, removeNode, 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, 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

VirtualBuilder

public VirtualBuilder(MMBase m)
Creates an instance of a Virtual builder. A builder instantiated with this constrcutor is not registered in MMBase and should only be used as a temporary parent for virtual nodes which do not have a long life span.
Parameters:
m - the MMbase cloud creating the node

VirtualBuilder

protected VirtualBuilder(MMBase m,
                         java.lang.String tableName)
Creates an instance of a Virtual builder and registers it in MMBase.
Parameters:
m - the MMbase cloud creating the node
tableName - the name of the builder as known in the MMbase system
Method Detail

init

public boolean init()
Initializes this builder. No specifici cation is performed. This method overrides the default emthod in MMObhjectBuilder, which would otherwise attempt to access the database.
Overrides:
init in class MMObjectBuilder
Returns:
Always true.
See Also:
create()

create

public boolean create()
Creates a new builder table in the current database. This method does not perform any action in a virtual builder, as there is no actual table associated with it.
Overrides:
create in class MMObjectBuilder

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 does not perform any action in a virtual builder.
Overrides:
insert in class MMObjectBuilder
Parameters:
owner - The administrator creating the node
node - The object to insert
Returns:
-1 (the insert failed)

getNewNode

public MMObjectNode getNewNode(java.lang.String owner)
Get a new node, using this builder as its parent. The new node is a virtual node.
Overrides:
getNewNode in class MMObjectBuilder
Parameters:
owner - The administrator creating the new node.
Returns:
A newly initialized VirtualNode.

getGUIInicator

public java.lang.String getGUIInicator(MMObjectNode node)
What should a GUI display for this node. The default behavior of a virtual node is to display the content of the 'name' field (if present). XXX: should be changed to something better
Parameters:
node - The node to display
Returns:
either the name field of the node or "no info"

getDBState

public int getDBState(java.lang.String fieldName)
Return a field's database state. The default behavior for a virtual node is to return DBSTATE_VIRTUAL.
Overrides:
getDBState in class MMObjectBuilder
Parameters:
the - requested field's name
Returns:
DBSTATE_VIRTUAL

getShortedText

public java.lang.String getShortedText(java.lang.String fieldname,
                                       int number)
Get text from a blob field from a database. Since virtual builders are generally not associated with a database, this method returns null.
Overrides:
getShortedText in class MMObjectBuilder
Parameters:
fieldname - name of the field
number - number of the object in the table
Returns:
null

getShortedByte

public byte[] getShortedByte(java.lang.String fieldname,
                             int number)
Get binary data of a blob field from a database. Since virtual builders are generally not associated with a database, this method returns null.
Overrides:
getShortedByte in class MMObjectBuilder
Parameters:
fieldname - name of the field
number - number of the object in the table
Returns:
null


MMBase build 1.6.5.20030923