org.objectweb.cjdbc.controller.cache.metadata
Class MetadataCache

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.cache.metadata.MetadataCache

public class MetadataCache
extends java.lang.Object

This class implements a ResultSet metadata cache.

ResultSet Fields are kept here to prevent recomputing them and allocating them each time a query is executed.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
private  java.util.Hashtable fieldCache
           
private static Trace logger
           
private  int maxNbOfField
           
private  int maxNbOfMetadata
           
private  java.util.Hashtable metadataCache
           
 
Constructor Summary
MetadataCache(int maxNbOfMetadata, int maxNbOfField)
          Constructor for MetadataCache.
 
Method Summary
 void addField(java.lang.String fullyQualifiedFieldName, Field field)
          Add a Field entry to the cache and associate it to the given name.
 void addMetadata(AbstractRequest request, Field[] metadata)
          Add a metadata entry to the cache and associate it to the given request.
 void flushCache()
          Flush the cache
 Field getField(java.lang.String fullyQualifiedFieldName)
          Get the field corresponding to a column name.
 Field[] getMetadata(AbstractRequest request)
          Get metadata associated to a request.
 java.lang.String getXml()
          Get xml information about this ParsingCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static Trace logger

metadataCache

private java.util.Hashtable metadataCache

fieldCache

private java.util.Hashtable fieldCache

maxNbOfMetadata

private int maxNbOfMetadata

maxNbOfField

private int maxNbOfField
Constructor Detail

MetadataCache

public MetadataCache(int maxNbOfMetadata,
                     int maxNbOfField)
Constructor for MetadataCache.

Parameters:
maxNbOfMetadata - maximum nb of entries in metadata cache
maxNbOfField - maximum nb of entries in field cache
Method Detail

flushCache

public void flushCache()
Flush the cache


getMetadata

public Field[] getMetadata(AbstractRequest request)
Get metadata associated to a request.

Returns null if the cache contains no metadata for the given request.

Parameters:
request - the request we look for
Returns:
the metadata or null if not in cache

addMetadata

public void addMetadata(AbstractRequest request,
                        Field[] metadata)
Add a metadata entry to the cache and associate it to the given request.

Parameters:
request - request to which the metadata belong
metadata - metadata to cache

getField

public Field getField(java.lang.String fullyQualifiedFieldName)
Get the field corresponding to a column name.

Returns null if the cache contains no field for the given name.

Parameters:
fullyQualifiedFieldName - the field name (table.column) to look for
Returns:
the corresponding Field or null if not in cache

addField

public void addField(java.lang.String fullyQualifiedFieldName,
                     Field field)
Add a Field entry to the cache and associate it to the given name.

Parameters:
fullyQualifiedFieldName - table.column name that uniquely identifies the field
field - field to cache

getXml

public java.lang.String getXml()
Get xml information about this ParsingCache

Returns:
String in xml formatted text


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.