org.mmbase.module.builders
Class Jumpers

java.lang.Object
  extended byorg.mmbase.module.core.MMTable
      extended byorg.mmbase.module.core.MMObjectBuilder
          extended byorg.mmbase.module.builders.Jumpers

public class Jumpers
extends MMObjectBuilder

Maintains jumpers for redirecting urls. The data stored in this builder is used to redirect urls based ons a specific key. The jumpers builder is called from the servjumpers servlet.
The jumpers builder can be configured using two properties:


XXX:Note that this builder is called directly from a servlet, and may therefor be bound to the cloud context rather than a cloud. This would mean that in a multi-cloud environment, this builder will be shared.

Version:
$Id: Jumpers.java,v 1.24.2.1 2004/06/02 17:12:59 michiel Exp $
Author:
Daniel Ockeloen, Pierre van Rooden (javadocs)

Field Summary
protected  org.mmbase.module.builders.JumpersCache jumpCache
          Cache for URL jumpers.
protected static java.lang.String jumperNotFoundURL
          Default redirect if no jumper can be found.
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, GUI_PARAMETERS, listCache, nodeCache, 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
Jumpers()
           
 
Method Summary
 void delJumpCache(java.lang.String key)
          Removes a specified key from the cache.
protected  java.lang.Object executeFunction(MMObjectNode node, java.lang.String function, java.util.List arguments)
          Executes a function on the field of a node, and returns the result.
protected  java.lang.String getGUIIndicator(MMObjectNode node, Parameters args)
           
 java.lang.String getJump(java.lang.String key)
          Retrieves a jumper for a specified key.
 java.lang.String getJump(java.util.StringTokenizer tok)
          Retrieves a jumper for a specified key.
protected  java.lang.String getJumpByField(java.lang.String fieldName, java.lang.String key)
           
 boolean init()
          Initializes the builder.
 boolean nodeChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Clears the jump cache if a jumper was added, removed, or changed.
 boolean nodeLocalChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Handles changes made to a node by this server.
 boolean nodeRemoteChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Handles changes made to a node by a remote server.
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, count, create, createAlias, delete, deleteNodeCache, drop, equals, equals, executeFunction, fieldLocalChanged, getAge, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getMMBase, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParameterDefinition, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRawNodes, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, preCommit, preEdit, process, processSearchResults, putTmpNode, readSearchResults, removeField, removeNode, removeRelations, removeSyncNodes, 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, setUniqueValue, setUniqueValue, setValue, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
created, getFullTableName, getTableName, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jumpCache

protected org.mmbase.module.builders.JumpersCache jumpCache
Cache for URL jumpers.


jumperNotFoundURL

protected static java.lang.String jumperNotFoundURL
Default redirect if no jumper can be found. If this field is null, a url will not be 'redirected' if the search for a jumper failed. This may cause a 404 error on your server if the path specified is unavailable. However, you may need it if other servlets rely on specific paths that would otherwise be caught by the jumper servlet. The value fo this field is set using the JumperNotFoundURL property in the builder configuration file.

Constructor Detail

Jumpers

public Jumpers()
Method Detail

init

public boolean init()
Initializes the builder. Determines the jumper cache size, and initializes it. Also determines the default jumper url.

Overrides:
init in class MMObjectBuilder
Returns:
always true
See Also:
MMObjectBuilder.create()

getGUIIndicator

protected java.lang.String getGUIIndicator(MMObjectNode node,
                                           Parameters args)
Since:
MMBase-1.7.1

getJump

public java.lang.String getJump(java.util.StringTokenizer tok)
Retrieves a jumper for a specified key.

Parameters:
tok - teh tokenizer, in which the first token is the key to search for.
Returns:
the found alternate url.

delJumpCache

public void delJumpCache(java.lang.String key)
Removes a specified key from the cache.

Parameters:
key - the key to remove

getJumpByField

protected java.lang.String getJumpByField(java.lang.String fieldName,
                                          java.lang.String key)

getJump

public java.lang.String getJump(java.lang.String key)
Retrieves a jumper for a specified key.

Parameters:
key - the key to search for.
Returns:
the found alternate url.

nodeRemoteChanged

public boolean nodeRemoteChanged(java.lang.String machine,
                                 java.lang.String number,
                                 java.lang.String builder,
                                 java.lang.String ctype)
Handles changes made to a node by a remote server.

Overrides:
nodeRemoteChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - the number of the node that was added, removed, or changed.
builder - the name of the builder of the changed node (should be 'jumpers')
ctype - the type of change
Returns:
always true

nodeLocalChanged

public boolean nodeLocalChanged(java.lang.String machine,
                                java.lang.String number,
                                java.lang.String builder,
                                java.lang.String ctype)
Handles changes made to a node by this server.

Overrides:
nodeLocalChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - the number of the node that was added, removed, or changed.
builder - the name of the builder of the changed node (should be 'jumpers')
ctype - the type of change
Returns:
always true

nodeChanged

public boolean nodeChanged(java.lang.String machine,
                           java.lang.String number,
                           java.lang.String builder,
                           java.lang.String ctype)
Clears the jump cache if a jumper was added, removed, or changed.

Parameters:
machine - Name of the machine that changed the node.
number - the number of the node that was added, removed, or changed.
builder - the name of the builder of the changed node (should be 'jumpers')
ctype - the type of change

executeFunction

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

Overrides:
executeFunction in class MMObjectBuilder
See Also:
MMObjectBuilder.executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List)


MMBase build 1.7.1.20041002