eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'PersistentFileHistory':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: PersistentFileHistory


Inheritance:

   Object
   |
   +--PersistentFileHistory

Package:
stx:libbasic2
Category:
Interface-Framework
Version:
rev: 1.11 date: 2022/10/19 14:50:48
user: cg
file: PersistentFileHistory.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


Support code to provide a common access layer for persistent storage for applications.
For example, a persistent history of previously opened files.
On Windows systems, this is stored in the registry.
On Unix systems, it is stored in the user's home folder under '.smalltalk/registry/...'.
Both registry and directory use the same hierarchical structure.
The name and parent folder can be configured.

PersistentFileHistory new
    applicationKey:'GDBApplication';
    fileHistory
    

copyright

COPYRIGHT (c) 2019 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  new
return an initialized instance

o  newForApplicationKey: applicationKey
return an initialized instance

o  newForClass: anApplicationClass
return an initialized instance


Instance protocol:

accessing - configuration
o  applicationKey: aStringOrNil
this is used as the key under which the application's values are stored.
In the registry, this is the last key above the history entry);
if files are used, this is the folder name above which history, and other files are stored.
By default, the name of the application without prefix is used.
If nil, the data is stored right under the topDirectory/topRegistryKey

o  fileHistorySize
returns the max. number of remembered files in the history

o  fileHistorySizeLimit: anInteger
set the max. number of entries stored in the history.
Defaults to 25 if never explicitly changed

o  topDirectoryName: topKeyName
the directory under the home directory, where the history is made persistent.
Defaults to '.smalltalk',
but can be changed to eg. '.expecco'.

o  topRegistryKeyName: topKeyName
the key in the Windows Registry, where the history is made persistent.
Defaults to 'SmalltalkX',
but can be changed to eg. 'Expecco'.

accessing - file history
o  addToFileHistory: aFilename
remember a filename in the file history

o  do: aBlock
enumerate files in the file history;
Save to add or remove items while enumerating

o  fileHistory
return the file history

o  fileHistoryFilteredForStillExistingFilesDo: aBlock removeNonExisting: aBoolean
remove all non-existing history entries

o  first

o  remove: aFilename
remove a filename from the file history

o  removeAll
remove a filename from the file history

initialization
o  initialize
topDirectoryName can be set to eg '.expecco';
topRegistryKeyName to eg. Éxpecco'
see comments there.

private
o  directoryForFileHistory
the filename where the history is made persistent.
This depends on the owningApplication which should not be nil.

Usage example(s):

     self new directoryForFileHistory => UnixFilename('/Users/exept/.smalltalk')

Usage example(s):

     (self new topDirectoryName:'.expecco')
        directoryForFileHistory         => UnixFilename('/Users/exept/.expecco')

Usage example(s):

     ((self new topDirectoryName:'.expecco') applicationKey:'Foo')
        directoryForFileHistory         => UnixFilename('/Users/exept/.expecco/Foo')

o  fetchFileHistoryFromPersistentStore

o  initializeFileHistory

o  makeFileHistoryPersistent
private:
should be called in a synchronized region to protect fileHistory
from changes while being written

o  registryKeyForApplication
HKEY_CURRENT_USER\Software\Exept\SmalltalkX\<appname>

Usage example(s):

     self registryKeyForApplication 

o  registryKeyForFileHistory
HKEY_CURRENT_USER\Software\Exept\SmalltalkX\<appName>\History

Usage example(s):

     self registryKeyForFileHistory

o  topDirectory
the filename where persistent files are stored.

Usage example(s):

     self new topDirectory

queries
o  isEmpty
true if there is no history (yet)

o  isEmptyOrNil
true if there is no history (yet)

o  notEmpty
true if there is some history

o  notEmptyOrNil
true if there is some history

o  size
return the number of entries in the history



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 15:47:18 GMT