info.aduna.gee.publication.content
Class Database

java.lang.Object
  extended by info.aduna.gee.publication.net.WStorable
      extended by info.aduna.gee.publication.content.Database
All Implemented Interfaces:
EntryConstants
Direct Known Subclasses:
JitContentDatabase, JitNavigationDatabase

public class Database
extends WStorable
implements EntryConstants

ZPad Database.


Field Summary
protected  Vector _containerNames
           
protected static ZContainer _dummyContainer
           
protected  Vector _sortedDates
           
protected  char _storeVersion
          No need to know.
 Hashtable[] containers
          The hashtables with named and dated containers *
static int DATED
           
static int NAMED
           
 String navigation
           
 int privacyLevel
           
static int SEPARATOR_TYPE_CONTINUATION
           
static int SEPARATOR_TYPE_DEFAULT
           
static int SEPARATOR_TYPE_IGNORE
           
static int SEPARATOR_TYPE_META
           
 String startSection
           
static char STORE_DEFAULT_VERSION
           
static char STORE_JAZZZ_VERSION
           
static char STORE_TOSTRING_VERSION
           
static Integer TEMPLATE_CACHE
           
 WProperties tmplPreferences
           
static Integer TODAY_WILD_CARD
           
static int WILDC
           
 
Fields inherited from class info.aduna.gee.publication.net.WStorable
_isStorable, _lastModified, BASE64ENCODING, GZIPCOMPRESSION, NONE, WLZ77COMPRESSION
 
Fields inherited from interface info.aduna.gee.publication.content.EntryConstants
ACLS_PREFIX, AFTER_TRANSFER, APPLET_TYPE_VALUE, ASSOCIATES_EDIT_LEVEL, BEFORE_STORAGE, BEFORE_TRANSFER, CODE_KEY, CODEBASE_KEY, CONSTRUCTION_KEY, CONTAINER_TTL_KEY, CONTAINERID_KEY, CONTAINERPROPS_KEY, DBPRIVACY_LEVEL_KEY, DESCRIPTION_KEY, EMBED_TYPE_VALUE, END_TIME_KEY, ENTRY_ID_KEY, ENTRYATTRIBS_KEY, ENTRYPARAMS_KEY, ENTRYPROPS_KEY, EXPIRES_KEY, EXTERNAL_ENTRY_KEY, HEIGHT_KEY, HTML_KEY, HTML_TYPE_VALUE, ID2IDID_KEY, IMAGE_TYPE_VALUE, IMPORT_CLASSNAME, IMPORT_DONT_FORWARD, IMPORT_IMPORTED, IMPORT_LANGUAGE, IMPORT_SERVER_NAME, IMPORT_TYPE_VALUE, INFO_EXTENSION, INHERIT_CONFIGURATION, INLINE_DESCRIPTION_IS_HTML_KEY, INLINE_DESCRIPTION_KEY, INSPIRES_KEY, JIT_DESTINATION, JIT_DESTINATION_INDEX, LINK_IN_FRAME_KEY, LINK_KEY, MANUAL_KEY, MINIMALHEIGHT_KEY, MINIMALWIDTH_KEY, NAVIGATION_KEY, OBJECT_TYPE_VALUE, OCCURRING_CLABELS_KEY, OVERRIDE_SUGGESTION_KEY, PRIVACY_LEVEL_KEY, PROVIDE_KEY, PROVIDE_PL_KEY, QUALIFIED_BASE_KEY, RE_EXPORT_KEY, RE_MANUAL_KEY, REPEAT_ID_KEY, REPEAT_TODAY_KEY, REQUIRES_NEW_PAGE, ROTATABLE_KEY, SHARED_CLABELS_KEY, SHOP_GIF_KEY, SHOP_GIF_LOCATION_KEY, SHOP_ID_KEY, SHOP_ORIGIN_KEY, SHOP_OVER_GIF_KEY, SORT_CLABELS, SORT_DESCRIPTION, SOURCE_KEY, STARTSECTION_KEY, SUBSCRIBED_COLOR_KEY, SUBSCRIBED_GIF_KEY, SUBSCRIBED_GIF_LOCATION_KEY, SUBSCRIBED_OVER_GIF_KEY, SUBSCRIBED_VISIBLE_CLABELS_KEY, SUBSCRIPTION_KEY, SUBSCRIPTION_LINK_KEY, SUGGESTION_KEY, SUMMARY_IS_HTML_KEY, SUMMARY_KEY, SUMMARY_TYPE_VALUE, TEMPLATEPREFERENCES_KEY, TEXT_KEY, TEXT_TYPE_VALUE, TIME_KEY, TMPL_DESCRIPTOR_KEY, TMPL_FOREIGN_ID_KEY, TMPL_ID_KEY, TMPL_PREFERENCES_KEY, TMPL_STUB_RECOGNIZER_KEY, TMPLD_TYPE_VALUE, TYPE_KEY, WIDTH_KEY
 
Constructor Summary
Database()
          Creates a new Database.
 
Method Summary
protected  void _clearIdle()
          Loop through all named containers and remove 'idle' ones.
protected  String _deKeyProtect(String key)
           
protected  String _keyProtect(String key)
          Internal work-around: WProperties' key should not contain '=' (nor \n or \r, but they don't occur).
protected  int _typeToIndex(Object id)
          Give the index of Containers of a particular type.
 ZContainer addContainer(Object name)
          Ensure the existence of a Container.
 void clear()
          Clear.
 Object clone()
          Clone this Database; is often used for editing.
 boolean containerNamesAreSorted()
           
 void gc()
          Garbage collect the database.
 Vector getChildren(PathString sectionName, boolean createThem)
           
 ZContainer getContainer(Object name)
          Get a ZContainer or an empty FIXED dummy one if it doesn't exist.
 ZContainer getContainer(WDate start, boolean future)
          Get a the first Date container after (before) the specified Date -- or null.
 Vector getContainerNames()
          Returns a Vector of names (PathStrings!) of all named containers.
 int getNumberOfEntries(Object path)
           
 Vector getRange(WDate start, WDate end)
          Get a range of dates that correspond to non-empty containers.
 int getSeparatorType(Object path)
           
 ZContainer getSummarizedEntries(Object overviewSection, Object contentSection, Object placeHolder, int max)
           
 char getVersion()
          Get the version number of the storable output.
 boolean hasContainer(Object name)
          Does this database contain a Container with this name?
 void load(InputStream input, int version)
          Load the Database by reading from the specified InputStream.
 void preload()
           
 void prepareAccess(Object sectionName)
          Required for jit implementations.
 void prepareChildren(Object sectionName)
          Required for jit implementations.
 void recalculateWildCards(boolean removeToday)
          Recalculate the Wildcard containers from the current visible contents.
 void removeContainer(Object name)
          Remove a Container.
 void setStoreVersion(char v)
          Set the preferred store version.
 void store(OutputStream output)
          Store the database on an outputstream
 void sweep()
          Removes all "information-less" containers.
 WProperties toProperties()
          Creates a property representation of the database.
 
Methods inherited from class info.aduna.gee.publication.net.WStorable
destroy, getCompression, getEncoding, getLastModified, isStorable, setLastModified, setStorable, toSeconds
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORE_TOSTRING_VERSION

public static final char STORE_TOSTRING_VERSION
See Also:
Constant Field Values

STORE_JAZZZ_VERSION

public static final char STORE_JAZZZ_VERSION
See Also:
Constant Field Values

STORE_DEFAULT_VERSION

public static final char STORE_DEFAULT_VERSION
See Also:
Constant Field Values

privacyLevel

public int privacyLevel

startSection

public String startSection

tmplPreferences

public WProperties tmplPreferences

navigation

public String navigation

NAMED

public static final int NAMED
See Also:
Constant Field Values

DATED

public static final int DATED
See Also:
Constant Field Values

WILDC

public static final int WILDC
See Also:
Constant Field Values

TODAY_WILD_CARD

public static Integer TODAY_WILD_CARD

TEMPLATE_CACHE

public static Integer TEMPLATE_CACHE

containers

public Hashtable[] containers
The hashtables with named and dated containers *


_storeVersion

protected char _storeVersion
No need to know.


_sortedDates

protected Vector _sortedDates

_dummyContainer

protected static ZContainer _dummyContainer

_containerNames

protected Vector _containerNames

SEPARATOR_TYPE_IGNORE

public static final int SEPARATOR_TYPE_IGNORE
See Also:
Constant Field Values

SEPARATOR_TYPE_DEFAULT

public static final int SEPARATOR_TYPE_DEFAULT
See Also:
Constant Field Values

SEPARATOR_TYPE_META

public static final int SEPARATOR_TYPE_META
See Also:
Constant Field Values

SEPARATOR_TYPE_CONTINUATION

public static final int SEPARATOR_TYPE_CONTINUATION
See Also:
Constant Field Values
Constructor Detail

Database

public Database()
Creates a new Database.

Method Detail

load

public void load(InputStream input,
                 int version)
          throws IOException
Load the Database by reading from the specified InputStream. Note: a Datebase may be "reloaded" so be sure to remove all contents.

Specified by:
load in class WStorable
Parameters:
input - the inputstream to read from.
version - the version of the database to read.
Throws:
IOException

setStoreVersion

public void setStoreVersion(char v)
Set the preferred store version. One of STORE_TOSTRING_VERSION (default), STORE_JAZZZ_VERSION.


getVersion

public char getVersion()
Description copied from class: WStorable
Get the version number of the storable output. By default getVersion returns '1'.

Overrides:
getVersion in class WStorable
Returns:
a valid integer in the lower range.

store

public void store(OutputStream output)
           throws IOException
Store the database on an outputstream

Specified by:
store in class WStorable
Parameters:
output - the outputstream to store on.
Throws:
IOException

toProperties

public WProperties toProperties()
Creates a property representation of the database.

Returns:
an instance of WProperties that represents the database (recursively) in plain ascii properties.

getContainer

public ZContainer getContainer(WDate start,
                               boolean future)
Get a the first Date container after (before) the specified Date -- or null.


addContainer

public ZContainer addContainer(Object name)
Ensure the existence of a Container.


getContainer

public ZContainer getContainer(Object name)
Get a ZContainer or an empty FIXED dummy one if it doesn't exist.


removeContainer

public void removeContainer(Object name)
Remove a Container.


_typeToIndex

protected int _typeToIndex(Object id)
Give the index of Containers of a particular type.


hasContainer

public boolean hasContainer(Object name)
Does this database contain a Container with this name?


containerNamesAreSorted

public boolean containerNamesAreSorted()
Returns:
true if the result of getContainerNames() is sorted, false otherwise.

getContainerNames

public Vector getContainerNames()
Returns a Vector of names (PathStrings!) of all named containers.

Returns:
a Vector of the container names.

clone

public Object clone()
Clone this Database; is often used for editing.

Specified by:
clone in class WStorable
Returns:
an object of the same type that is a thread-safe clone.

getRange

public Vector getRange(WDate start,
                       WDate end)
Get a range of dates that correspond to non-empty containers.

Returns:
the dates of non-empty containers

sweep

public void sweep()
Removes all "information-less" containers.


recalculateWildCards

public void recalculateWildCards(boolean removeToday)
Recalculate the Wildcard containers from the current visible contents.


preload

public void preload()

_keyProtect

protected String _keyProtect(String key)
Internal work-around: WProperties' key should not contain '=' (nor \n or \r, but they don't occur).


_deKeyProtect

protected String _deKeyProtect(String key)

prepareAccess

public void prepareAccess(Object sectionName)
Required for jit implementations.


prepareChildren

public void prepareChildren(Object sectionName)
Required for jit implementations.


clear

public void clear()
Clear.


getNumberOfEntries

public int getNumberOfEntries(Object path)
See Also:
Session.getNumberOfEntries(java.lang.Object)

getSummarizedEntries

public ZContainer getSummarizedEntries(Object overviewSection,
                                       Object contentSection,
                                       Object placeHolder,
                                       int max)
See Also:
Session.getSummarizedEntries(java.lang.Object, java.lang.Object, java.lang.Object, int)

getSeparatorType

public int getSeparatorType(Object path)
Parameters:
one - of SEPARATOR_TYPE_IGNORE SEPARATOR_TYPE_DEFAULT SEPARATOR_TYPE_META SEPARATOR_TYPE_CONTINUATION
See Also:
Session.getSeparatorType(java.lang.Object)

getChildren

public Vector getChildren(PathString sectionName,
                          boolean createThem)
Returns:
the children of a section or null

gc

public void gc()
Garbage collect the database.


_clearIdle

protected void _clearIdle()
Loop through all named containers and remove 'idle' ones. This method is used by JitNavigationDatabase only, but it's here because of its use of intricate internals of Database. Note: must be run in a separate thread, it'll sleep most of the time.



Copyright © 1997-2008 Aduna. All Rights Reserved.