org.mmbase.module.builders
Class ImageCaches

java.lang.Object
  extended byorg.mmbase.module.core.MMTable
      extended byorg.mmbase.module.core.MMObjectBuilder
          extended byorg.mmbase.module.builders.AbstractServletBuilder
              extended byorg.mmbase.module.builders.AbstractImages
                  extended byorg.mmbase.module.builders.ImageCaches

public class ImageCaches
extends AbstractImages

ImageCaches (aka as 'icaches') is a system-like builder used by builders with the 'Images' class. It contains the converted images.

Version:
$Id: ImageCaches.java,v 1.37.2.2 2004/08/26 12:18:26 michiel Exp $
Author:
Daniel Ockeloen, Michiel Meeuwissen

Nested Class Summary
 
Nested classes inherited from class org.mmbase.module.builders.AbstractImages
AbstractImages.CKeyCache
 
Field Summary
 
Fields inherited from class org.mmbase.module.builders.AbstractServletBuilder
FORMAT_PARAMETERS, GUI_PARAMETERS, MIMETYPE_PARAMETERS, SERVLETPATH_PARAMETERS, usesBridgeServlet
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, 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
ImageCaches()
           
 
Method Summary
protected  MMObjectNode getCachedNode(java.lang.String ckey)
          Given a certain ckey, return the cached image node number, if there is one, otherwise return -1.
 ByteFieldContainer getCkeyNode(java.lang.String ckey)
          Return a @link{ ByteFieldContainer} containing the bytes and object number for the cached image with a certain ckey, or null, if not cached.
protected  java.lang.String getGUIIndicatorWithAlt(MMObjectNode node, java.lang.String title, Parameters a)
          The GUI indicator of an image can have an alt-text.
 byte[] getImageBytes(java.util.List params)
          Returns the bytes of a cached image.
protected  java.lang.String getImageFormat(MMObjectNode node)
          Returns the image format.
 java.lang.String getImageMimeType(java.util.List params)
           
protected  java.lang.String getSGUIIndicatorForNode(MMObjectNode node, Parameters a)
          Returns GUI Indicator for node
 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).
protected  void invalidate(MMObjectNode imageNode)
          Invalidate the Image Cache for a specific Node method only accessable on package level, since only Images should call it..
 boolean nodeLocalChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Called when a local node is changed.
 void removeNode(MMObjectNode node)
          Override the MMObjectBuilder removeNode, to invalidate the LRU ImageCache, when a node gets deleted.
 
Methods inherited from class org.mmbase.module.builders.AbstractImages
executeFunction, getAssociation, getDefaultPath, getImageMimeType, getSGUIIndicator
 
Methods inherited from class org.mmbase.module.builders.AbstractServletBuilder
getGUIIndicator, getGUIIndicator, getParameterDefinition, getServletPath, getServletPath, getSuperGUIIndicator
 
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, 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, 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, init, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeRemoteChanged, preCommit, preEdit, process, processSearchResults, putTmpNode, readSearchResults, removeField, 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
 

Constructor Detail

ImageCaches

public ImageCaches()
Method Detail

getGUIIndicatorWithAlt

protected java.lang.String getGUIIndicatorWithAlt(MMObjectNode node,
                                                  java.lang.String title,
                                                  Parameters a)
The GUI indicator of an image can have an alt-text.

Specified by:
getGUIIndicatorWithAlt in class AbstractImages
Since:
MMBase-1.6

getSGUIIndicatorForNode

protected java.lang.String getSGUIIndicatorForNode(MMObjectNode node,
                                                   Parameters a)
Description copied from class: AbstractImages
Returns GUI Indicator for node

Overrides:
getSGUIIndicatorForNode in class AbstractImages

getCachedNode

protected MMObjectNode getCachedNode(java.lang.String ckey)
Given a certain ckey, return the cached image node number, if there is one, otherwise return -1. This functions always does a query. The caching must be done somewhere else. This is done because caching on ckey is not necesarry when caching templates.

Since:
MMBase-1.6

getImageBytes

public byte[] getImageBytes(java.util.List params)
Returns the bytes of a cached image. It accepts a list, just because it is also like this in Images.java. But of course a cached image only uses the first element (number of the node). It also works if the the node is a real image in stead of a cached image, in which case simple the unconverted image is returned. If the node does not exists, it returns empty byte array

Specified by:
getImageBytes in class AbstractImages
Parameters:
params - A list of parameters, containign at least the id of the image, possibly followed by operations
Returns:
the image as a byte[], or null if something went wrong

getCkeyNode

public ByteFieldContainer getCkeyNode(java.lang.String ckey)
Return a @link{ ByteFieldContainer} containing the bytes and object number for the cached image with a certain ckey, or null, if not cached.

Parameters:
ckey - teh ckey to search for
Returns:
null, or a @link{ ByteFieldContainer} object

invalidate

protected void invalidate(MMObjectNode imageNode)
Invalidate the Image Cache for a specific Node method only accessable on package level, since only Images should call it..


removeNode

public void removeNode(MMObjectNode node)
Override the MMObjectBuilder removeNode, to invalidate the LRU ImageCache, when a node gets deleted. Remove a node from the cloud.

Overrides:
removeNode in class MMObjectBuilder
Parameters:
node - The node to remove.

nodeLocalChanged

public boolean nodeLocalChanged(java.lang.String machine,
                                java.lang.String number,
                                java.lang.String builder,
                                java.lang.String ctype)
Description copied from class: MMObjectBuilder
Called when a local node is changed. Should be called by subclasses if they override it.

Overrides:
nodeLocalChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - Number of the changed node as a String
builder - type of the changed node
ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
Returns:
always true

getImageFormat

protected java.lang.String getImageFormat(MMObjectNode node)
Returns the image format.

Specified by:
getImageFormat in class AbstractImages
Since:
MMBase-1.6

getImageMimeType

public java.lang.String getImageMimeType(java.util.List params)

insert

public int insert(java.lang.String owner,
                  MMObjectNode node)
Description copied from class: MMObjectBuilder
Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided). This method indirectly calls MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode).

Overrides:
insert in class MMObjectBuilder
Parameters:
owner - The administrator creating the node
node - The object to insert. The object need be of the same type as the current builder.
Returns:
An int value which is the new object's unique number, -1 if the insert failed.


MMBase build 1.7.1.20041002