Class DayMarkers

  extended by org.mmbase.util.functions.FunctionProvider
      extended by org.mmbase.module.core.MMTable
          extended by org.mmbase.module.core.MMObjectBuilder
              extended by
All Implemented Interfaces:
EventListener, NodeEventListener, RelationEventListener

public class DayMarkers
extends MMObjectBuilder

Daymarkers are used to calculate the age of MMBase objects. Every day a daymarker is added to the daymarks table. Such an entry consists of a daycount (number of days from 1970), and a count (current object number of that day).

$Id: 41843 2010-04-12 15:04:13Z michiel $
Daniel Ockeloen,Rico Jansen, Michiel Meeuwissen

Field Summary
static String FIELD_DAYCOUNT
static String FIELD_MARK
static long SECONDS_IN_A_DAY
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_INDICATOR, GUI_PARAMETERS, guiFunction, infoFunction, internalVersion, nodeCache, oType, pluralNames, searchAge, singularNames, SYSTEM_OWNER, TEMPNODE_DEFAULT_SIZE, TMP_FIELD_EXISTS, 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
Constructor Summary
Method Summary
 int getAge(int nodeNumber)
          Returns the age, in days, of a node.
 Date getDate(MMObjectNode node)
          Returns the date of a daymarker
 int getDayCount()
          The current day count.
 int getDayCountAge(int daysold)
          Given an age, this function returns a mark, _not a day count_, and also _not an age_!
 int getDayCountByObject(int number)
 String getLocaleGUIIndicator(Locale locale, MMObjectNode node)
          Returns gui information for a specific node.
 int getMonthsByDayCount(int daycount)
 boolean init()
          Calculate smallestMark, and smallestDay.
 String replace(PageInfo sp, StringTokenizer command)
 void shutdown()
          clean all acquired resources, because system is shutting down
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addEventListener, addField, addLocalObserver, addRemoteObserver, broadcastChanges, checkAddTmpField, clearBlobCache, commit, create, createAlias, createAlias, delete, equals, equals, executeFunction, executeFunction, fieldLocalChanged, getAncestors, getBlobCache, getClassName, getConfigFile, getConfigResource, getDataTypeCollector, getDBState, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEmptyNode, getField, getFieldNames, getFields, getFields, getFunction, getFunctionParameters, getFunctions, getGUIIndicator, getGUIIndicator, getGUIIndicator, getHTML, getInitParameter, getInitParameters, getInitParameters, getInternalVersion, getList, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNodeFromCache, getNodeGUIIndicator, getNumber, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedInputStream, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hasField, hashCode, hashCode, hostname_function, insert, insert, isExtensionOf, isNodeCached, isNull, isVirtual, loadInitParameters, newFunctionInstance, nodeLocalChanged, nodeRemoteChanged, notify, notify, preCommit, process, removeEventListener, removeField, removeLocalObserver, removeNode, removeRelations, removeRemoteObserver, removeSyncNodes, safeCache, sendFieldChangeSignal, setDefaults, setDescription, setDescriptions, setFields, setInitParameter, setMaintainer, 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


public static final String FIELD_DAYCOUNT
See Also:
Constant Field Values


public static final String FIELD_MARK
See Also:
Constant Field Values


public static final long SECONDS_IN_A_DAY
See Also:
Constant Field Values


public static final long MILLISECONDS_IN_A_DAY
See Also:
Constant Field Values
Constructor Detail


public DayMarkers()
Method Detail


public boolean init()
Calculate smallestMark, and smallestDay. smallestMark is the smallest object number for which a daymark exists. smallestDay is the first daymarker that was set.

init in class MMObjectBuilder
true if init was completed, false if uncompleted.
See Also:


public void shutdown()
Description copied from class: MMObjectBuilder
clean all acquired resources, because system is shutting down

shutdown in class MMObjectBuilder


public int getAge(int nodeNumber)
Returns the age, in days, of a node. So, this does the inverse of most methods in this class. It converts a node number (which is like a mark) to a day.


public int getDayCount()
The current day count.

the number of days from 1970 of today.


public int getDayCountAge(int daysold)
Given an age, this function returns a mark, _not a day count_, and also _not an age_!

daysold - a time in days ago.
the smallest object number of all objects that are younger than given parameter daysold.


public String replace(PageInfo sp,
                      StringTokenizer command)
Scan. Known tokens are: COUNT-X gets an object number of X days after 1970 COUNTAGE-X gets an object number of X days old COUNTMONTH-X gets an object number of X months after 1970 COUNTNEXTMONTH-X gets an object number of X+1 months after 1970 COUNTPREVMONTH-X gets an object number of X-1 months after 1970 COUNTPREVDELTAMONTH-X-Y gets an object number of X-Y months after 1970 COUNTNEXTDELTAMONTH-X-Y gets an object number of X+Y months after 1970 TIMETOOBJECTNUMBER gets an object number of X seconds after 1970

replace in class MMObjectBuilder
sp - The PageInfo (containing http and user info) that calls the function
command - a list of strings that describe the (sub)command to execute
the result value as a String


public int getDayCountByObject(int number)


public int getMonthsByDayCount(int daycount)


public Date getDate(MMObjectNode node)
Returns the date of a daymarker

node - The node of which the date is wanted
a Date which is the date


public String getLocaleGUIIndicator(Locale locale,
                                    MMObjectNode node)
Returns gui information for a specific node. This value is retrieved by retrieving the field 'gui()' of the node (node.getStringValue("gui()") )

getLocaleGUIIndicator in class MMObjectBuilder
node - The node of which the gui information is wanted
a String in which the current date is shown

MMBase 2.0-SNAPSHOT - null