org.mmbase.module.builders
Class Jumpers

java.lang.Object
  extended byorg.mmbase.util.functions.FunctionProvider
      extended byorg.mmbase.module.core.MMTable
          extended byorg.mmbase.module.core.MMObjectBuilder
              extended byorg.mmbase.module.builders.Jumpers
All Implemented Interfaces:
EventListener, NodeEventListener, RelationEventListener

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 JumpersFilter.
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.36 2006/07/05 15:15:07 pierre Exp $
Author:
Daniel Ockeloen, Pierre van Rooden (javadocs)
Class for Application :
Tools, Jumpers

Field Summary
protected  org.mmbase.module.builders.JumpersCache jumpCache
          Cache for URL jumpers.
protected static String jumperNotFoundURL
          Default redirect if no jumper can be found.
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadCastChanges, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, EVENT_TYPE_LOCAL, EVENT_TYPE_REMOTE, FIELD_NUMBER, FIELD_OBJECT_TYPE, FIELD_OWNER, fields, genericBlobCache, getFunctions, GUI_PARAMETERS, guiFunction, infoFunction, internalVersion, nodeCache, oType, searchAge, SYSTEM_OWNER, TEMPNODE_DEFAULT_SIZE, temporaryNodes, TMP_FIELD_NUMBER, virtual, WRAP_PARAMETERS, wrapFunction
 
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
Jumpers()
           
 
Method Summary
 void delJumpCache(String key)
          Removes a specified key from the cache.
protected  Object executeFunction(MMObjectNode node, String function, List arguments)
          Executes a function on the field of a node, and returns the result.
protected  String getGUIIndicator(MMObjectNode node, Parameters args)
          A complicated default implementation for GUI.
 String getJump(String key)
          Retrieves a jumper for a specified key.
 String getJump(StringTokenizer tok)
          Retrieves a jumper for a specified key.
 boolean init()
          Initializes the builder.
 void notify(NodeEvent event)
           
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addEventListener, addField, addLocalObserver, addRemoteObserver, broadcastChanges, checkAddTmpField, clearBlobCache, commit, create, createAlias, createAlias, delete, equals, equals, executeFunction, fieldLocalChanged, getAncestors, getBlobCache, getClassName, getConfigFile, getConfigResource, getDataTypeCollector, getDBKey, getDBState, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getEmptyNode, getField, getFieldNames, getFields, getFields, getFunction, getFunctionParameters, getFunctions, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getInternalVersion, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNodeFromCache, getNodeGUIIndicator, getNumber, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hasField, hashCode, hashCode, hostname_function, insert, insert, isExtensionOf, isNodeCached, isVirtual, newFunctionInstance, nodeLocalChanged, nodeRemoteChanged, notify, preCommit, process, putTmpNode, removeEventListener, removeField, removeLocalObserver, removeNode, removeRelations, removeRemoteObserver, removeSyncNodes, removeTmpNode, replace, safeCache, sendFieldChangeSignal, setDefaults, setDescription, setDescriptions, setFields, setInitParameter, setMaintainer, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setUniqueValue, setUniqueValue, setValue, setValue, setVersion, setXMLPath, testValidData, toString, toString, update, updateFields, wrap
 
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

jumpCache

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


jumperNotFoundURL

protected static 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 String getGUIIndicator(MMObjectNode node,
                                 Parameters args)
Description copied from class: MMObjectBuilder
A complicated default implementation for GUI.

Overrides:
getGUIIndicator in class MMObjectBuilder
Since:
MMBase-1.7.1

getJump

public String getJump(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(String key)
Removes a specified key from the cache.

Parameters:
key - the key to remove

getJump

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

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

notify

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

executeFunction

protected Object executeFunction(MMObjectNode node,
                                 String function,
                                 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.8.1.20060716