info.aduna.gee.publication.session
Class Session

java.lang.Object
  extended by info.aduna.gee.publication.session.Session
All Implemented Interfaces:
EntryConstants, FileNames
Direct Known Subclasses:
Subscription

public class Session
extends Object
implements EntryConstants, FileNames

Content extractor: Section and Privacy based access to the content database.


Field Summary
protected  OutputHandler _outputHandler
          The object that does the PL4 password checking
protected  int _privacyLevel
          The current privacy level
 String cdrName
          The name of the CLabel Definition Redirection (if applicable).
 Hashtable customImgExists
          Whether or not .../images/subscribed.gif and shop.gif exists.
 Hashtable customImgOverExists
          Whether or not .../images/subscribedOver.gif and shopOver exists.
 InputHandler inputHandler
          The object that does the input
 String name
          The name.
 long zpadDatTime
          Remember when (in combination with what zpad.dat) you have calculated customImgExists and customImgOverExists.
 
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
 
Fields inherited from interface info.aduna.gee.publication.net.FileNames
ASA_FILE_NAME, BAK_FILE_NAME, CAT_FILE_NAME, CFG_FILE_NAME, CHS_FILE_NAME, DAT_FILE_NAME, HLP_FILE_NAME, LOCAL_FILE_PREFIX, SBS_FILE_NAME, SSS_FILE_NAME, WIF_FILE_NAME
 
Constructor Summary
  Session(InputHandler input, OutputHandler output)
          Sets up a new session.
protected Session(String name)
           
 
Method Summary
protected  boolean _checkPrivacyLevel(int level)
          Check a request for a PL for *this* ZPad.
protected  boolean _emptyAtThisPL(ZContainer container)
          Check whether a Container contains entries that can be seen at this privacy level.
protected  ZContainer _getContainer(Object name)
           
protected  ZContainer _getEntries(Object sectionID, Navigator navigator, Vector avoidSections)
           
protected  void _lazyLoadExtra()
          Load the clabel information of this stream.
protected  ZContainer _loadInternalImport(Entry entry, Object sectionID, Navigator navigator, Vector avoidSections)
          Handle an Import entry, which import handler is the Zpad itself.
 boolean activeAtThisLevel()
          Should the generator do anything at all at the current privacy level? If true, it will operate (and respect all PL's at a more detailed level).
 void addExtraInfo(Object sectionID, Entry entry)
          This function changes the Entry.
 Object findContent(Object sectionID, Vector sectionIDs, boolean searchFuture, Navigator navigator)
          Search for a non-empty date section before/after a given sectionID.
 Vector getChildren(PathString sectionName, boolean createThem)
           
 CLabelDefinitions getCLabelDefinitions()
          Get the effective CLabel definitions for this Session.
 ZContainer getEntries(Object sectionID, Navigator navigator)
          Get the entries from a section.
 int getNumberOfEntries(Object sectionID)
          Get the number of Entries (but in the sense of e.g.
 int getPrivacyLevel(boolean current)
          Return the privacy level.
 int getSeparatorType(Object sectionID)
           
 Object getStartSection()
           
 ZContainer getSummarizedEntries(Object overviewSection, Object contentSection, Object placeHolder, int max)
          ...
 int getTemplatePreferenceIndex(String coverName, Object sectionID)
           
 boolean login(String name, String password)
          Login a new name/password combination.
 void refresh()
           
 boolean setPrivacyLevel(int level)
          Set the privacy level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public String name
The name.


cdrName

public String cdrName
The name of the CLabel Definition Redirection (if applicable).


customImgExists

public Hashtable customImgExists
Whether or not .../images/subscribed.gif and shop.gif exists. For each clabel N, key is "N". For the overall, key = ""


customImgOverExists

public Hashtable customImgOverExists
Whether or not .../images/subscribedOver.gif and shopOver exists. For each clabel N, key is "N". For the overall, key = ""


zpadDatTime

public long zpadDatTime
Remember when (in combination with what zpad.dat) you have calculated customImgExists and customImgOverExists. Recalculate its contents in case zpad.dat has changed.


_privacyLevel

protected int _privacyLevel
The current privacy level


inputHandler

public InputHandler inputHandler
The object that does the input


_outputHandler

protected OutputHandler _outputHandler
The object that does the PL4 password checking

Constructor Detail

Session

public Session(InputHandler input,
               OutputHandler output)
        throws IOException
Sets up a new session.

Parameters:
input - the inputHandler that knows how to retrieve the database and the configuration.
output - the outputHandler that knows how to check name/password combinations An "empty" Session is used to speed-up startup. In that case input and output are null, so check it everywhere!
Throws:
IOException - When an io error occures while loading the database, or configuration

Session

protected Session(String name)
Method Detail

setPrivacyLevel

public boolean setPrivacyLevel(int level)
Set the privacy level.

Parameters:
level - the requested privacy level.
Returns:
true if the change was accepted, false otherwise.

_checkPrivacyLevel

protected boolean _checkPrivacyLevel(int level)
Check a request for a PL for *this* ZPad.

Parameters:
level - the requested privacy level.
Returns:
true if acceptable, false otherwise.

login

public boolean login(String name,
                     String password)
Login a new name/password combination. Someone has got to do this, I've choosen for Session to contain this knowledge. There is no InputHandler, nor OutputHandler yet, nor are they useful apart from name/password checking. This is a very expensive operation!


getPrivacyLevel

public int getPrivacyLevel(boolean current)
Return the privacy level.

Parameters:
current - obsoleted.
Returns:
the requested privacy level.

getEntries

public ZContainer getEntries(Object sectionID,
                             Navigator navigator)
Get the entries from a section. All entries that are available for the current privacy level are returned.

Parameters:
sectionID - The name of the requested setion.
Returns:
All valid content entries in the section or null

_getEntries

protected ZContainer _getEntries(Object sectionID,
                                 Navigator navigator,
                                 Vector avoidSections)
Returns:
the requested entries or null.

findContent

public Object findContent(Object sectionID,
                          Vector sectionIDs,
                          boolean searchFuture,
                          Navigator navigator)
Search for a non-empty date section before/after a given sectionID. The privacy level is taken into account. A sectionID is either a WDate or a String. It is allowed (but not efficient) to suggest a ZContainer that *is* empty. It is NOT allowed not to suggest a ZContainer empty that *is* non-empty.

Parameters:
sectionID - the sectionID to start the search from.
sectionIDs - the sectionID's of all named sections.
searchFuture - if true search after the sectionID, else before
Returns:
the resulting sectionID or null

_emptyAtThisPL

protected boolean _emptyAtThisPL(ZContainer container)
Check whether a Container contains entries that can be seen at this privacy level. Note: we don't use the full "getEntries()" because of the costs of execution. This one is a simpler implementation and it is 99.9% correct. It is allowed (but not efficient) to mark a ZContainer non-empty that *is* empty. It is NOT allowed to mark a ZContainer empty that *is* non-empty. Note that _emptyAtThisPL is only used suggesting the next non-empty ZContainer by findContent. The result is always double-checked at an higher level. Errors of this function are caught by "Generator.isEmpty".

Parameters:
container - the container to test
Returns:
true if empty at this PrivacyLevel, false otherwise

getCLabelDefinitions

public CLabelDefinitions getCLabelDefinitions()
Get the effective CLabel definitions for this Session. NOTE: this function does follow a clabel definition redirection (once!).


activeAtThisLevel

public boolean activeAtThisLevel()
Should the generator do anything at all at the current privacy level? If true, it will operate (and respect all PL's at a more detailed level). If false, it will show nothing at all (nor the own database nor the subscriptions). At the moment we do not support the option to set the Config's PL and the Database's PL separately. But the code is there to do so (but the right GUI is the problem).


_lazyLoadExtra

protected void _lazyLoadExtra()
Load the clabel information of this stream.


addExtraInfo

public void addExtraInfo(Object sectionID,
                         Entry entry)
This function changes the Entry. It adds the custom image indications. For "own" entries these should be cloned before you apply this operation!


_loadInternalImport

protected ZContainer _loadInternalImport(Entry entry,
                                         Object sectionID,
                                         Navigator navigator,
                                         Vector avoidSections)
Handle an Import entry, which import handler is the Zpad itself. Note: the Zpad Import entries will be handled at the Session Layer (basic Database operations) Subscription Layer (clabel related filtering) Generator Layer (integration)

Parameters:
entry - the import entry
sectionID - the section containing entry
navigator - the Navigator
avoidSections - the sections already handled or null
Returns:
the requested entries or null

refresh

public void refresh()

getChildren

public Vector getChildren(PathString sectionName,
                          boolean createThem)
Returns:
the vector children (never null)

_getContainer

protected ZContainer _getContainer(Object name)
Returns:
the requested container or null

getTemplatePreferenceIndex

public int getTemplatePreferenceIndex(String coverName,
                                      Object sectionID)

getStartSection

public Object getStartSection()
Returns:
a specified start section or null

getNumberOfEntries

public int getNumberOfEntries(Object sectionID)
Get the number of Entries (but in the sense of e.g. expanded summary entries!).

Returns:
-1 if unknown so calculate in upper layer, the number otherwise.

getSummarizedEntries

public ZContainer getSummarizedEntries(Object overviewSection,
                                       Object contentSection,
                                       Object placeHolder,
                                       int max)
...


getSeparatorType

public int getSeparatorType(Object sectionID)


Copyright © 1997-2008 Aduna. All Rights Reserved.