org.mmbase.util.jumpers
Class JumperStrategy

java.lang.Object
  extended by org.mmbase.util.jumpers.JumperStrategy
Direct Known Subclasses:
ChainedJumperStrategy, DefaultUrlStrategy, UrlStrategy

public abstract class JumperStrategy
extends Object

This is the baseclass for strategies. A strategy has to extend this class and provide its own methods for: - contains(MMObjectNode) - calculate(MMObjectNode) The contains(node) checks whether the strategy can/will handle this node. For example, it can check whether the node has a certain type of relation, is of a special type or is just of a type this strategy can handle. The calculate(node) will then try to calculate an url. An implementation for a JumperStrategy must be stateless because it is instantiated only once, and may be accessed by more than one thread. So you may not use result of the calculation of contains(org.mmbase.module.core.MMObjectNode) in calculate(org.mmbase.module.core.MMObjectNode). For calculating actual jumper only calculate(org.mmbase.module.core.MMObjectNode) is called, which can rapidly return null if it cannot calculate for the given Node.

Version:
$Id: JumperStrategy.java 35335 2009-05-21 08:14:41Z michiel $
Author:
Marcel Maatkamp, VPRO Digitaal
See Also:
contains(MMObjectNode), calculate(MMObjectNode)

Constructor Summary
JumperStrategy()
           
 
Method Summary
abstract  String calculate(MMObjectNode node)
          calculates an url for this node.
 boolean contains(MMObjectNode node)
          signals whether this strategy can calculate an url for this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JumperStrategy

public JumperStrategy()
Method Detail

contains

public boolean contains(MMObjectNode node)
signals whether this strategy can calculate an url for this node.

Parameters:
node - node for which an url has to be calculated for
Returns:
url for this node

calculate

public abstract String calculate(MMObjectNode node)
calculates an url for this node. call this method only when the contains(node) returns true.

Parameters:
node - node for which an url has to be calculated for
Returns:
the url for this node
See Also:
contains(MMObjectNode)


MMBase 2.0-SNAPSHOT - null