|
Qizx fe-4.4p2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LibraryManager
Manages a group of XML Libraries.
A LibraryManager manages a bundle of XML Libraries and federates resources like memory caches. It can be seen as the core of a server.
User sessions (Library
) are obtained from a LibraryManager, by calling
the openLibrary(String)
methods.
A LibraryManager instance can be obtained through the bootstrap class
Configuration
:
Configuration.openLibraryGroup(java.io.File)
).
Configuration.createLibraryGroup(java.io.File)
).
Configuration.createManager()
) where
Libraries can be dynamically added (advanced use).
A Library Group is merely a directory that contains a sub-directory for each XML Library belonging to the group. Note that there is no delete method for a group: to delete it, simply delete its storage directory.
Field Summary | |
---|---|
static int |
CHECK_CONTENTS
Mask for sanityCheck(com.qizx.api.util.logging.Log, boolean, boolean) : fully check the document contents |
static int |
CHECK_INDEXES
Mask for sanityCheck(com.qizx.api.util.logging.Log, boolean, boolean) : check the indexes for integrity & consistency |
static int |
CHECK_STORAGE
Mask for sanityCheck(com.qizx.api.util.logging.Log, boolean, boolean) : fully check the document storage |
Method Summary | |
---|---|
void |
addLibraryObserver(LibraryMemberObserver observer)
Adds an observer for access and update operations. |
void |
addLogHandler(Handler handler)
Adds a Logger handler which is used both by the Library Manager and all the managed Libraries. |
void |
addPostCommitTrigger(String libraryName,
PostCommitTrigger trigger)
Adds a post-commit Trigger. |
boolean |
closeAllLibraries(int graceTimeMillis)
Shuts down the manager by unmanaging all the Libraries and releasing resources. |
void |
collectStatistics(com.qizx.api.util.logging.Statistic.Map targetMap)
Returns a list of statistics collected from the managed XML Libraries and from shared resources (caches, disk I/O etc). |
boolean |
configure(Configuration.Property property,
Object value)
Configures a XQuerySessionManager with a Configuration.Property . |
boolean |
configure(Properties properties)
Configures a LibraryManager with a set of properties. |
com.qizx.api.util.backup.BackupTarget |
createBackup(File location,
String libraryName,
int version,
boolean incremental)
Opens or creates a Library used as backup output. |
void |
createLibrary(String libraryName,
File libraryDirectory)
Creates a new XML Library and manages it in this LibraryManager. |
boolean |
deleteLibrary(String libraryName)
Physically destroys a Library. |
XQuerySession |
findSession(int id)
Finds a session (Library) by its public identifier. |
Map<Configuration.Property,Object> |
getConfiguration()
Gets the current configuration properties of the LibraryManager. |
FullTextFactory |
getFullTextFactory()
Returns the FullTextFactory specified by setFullTextFactory(FullTextFactory) . |
File |
getGroupDirectory()
Returns the top-level directory of the Library Group. |
Logger |
getLibraryLogger(String libraryName)
Returns the logger associated with a Library. |
LibraryMemberObserver[] |
getLibraryObservers()
Returns a list of active LibraryMemberObserver's. |
Logger |
getLogger()
Returns the logger associated with the LibraryManager. |
long |
getMemoryLimit()
Defines the maximum memory size the generated LibraryManager can use. |
ModuleResolver |
getModuleResolver()
Returns the current ModuleResolver . |
PostCommitTrigger[] |
getPostCommitTriggers(String libraryName)
Returns a list of post-commit Triggers. |
com.qizx.xdm.DocumentPool |
getTransientDocumentCache()
Gets the document cache. |
long |
getTransientDocumentCacheSize()
Gets the current maximum memory size for the document cache. |
List<BackgroundTask> |
listBackgroundTasks(int timeline)
Returns a list of past- or current maintenance tasks. |
String[] |
listLibraries()
Returns the names of XML Libraries managed by this object. |
List<Library> |
listSessions()
Returns a list of active (non closed) sessions. |
void |
manageLibrary(String libraryName,
File libraryDirectory)
Starts managing an existing XML Library in this LibraryManager. |
com.qizx.api.util.backup.BackupSession |
openForBackup(String libraryName)
Opens a backup session on a Library: a BackupSession is the source
of a backup operation and allows comparison of contents with a
BackupTarget in order to perform incremental backup or Replication. |
Library |
openLibrary(String libraryName)
Opens a new session on a Library. |
Library |
openLibrary(String libraryName,
AccessControl accessControl,
User user)
Opens a new session on a Library. |
void |
removeLibraryObserver(LibraryMemberObserver observer)
Removes an observer of access and update operations. |
void |
removePostCommitTrigger(String libraryName,
PostCommitTrigger trigger)
Removes a post-commit Trigger. |
void |
sanityCheck(com.qizx.api.util.logging.Log log,
boolean deep,
boolean allowFixing)
Performs a validity check of all managed Libraries. |
void |
sanityCheck(com.qizx.api.util.logging.Log log,
int modeMask,
boolean allowFixing)
Performs a validity check of all managed Libraries. |
void |
saveConfiguration()
Saves the current configuration properties of the LibraryManager onto a file attached to the Library Group (named group.conf). |
void |
setFullTextFactory(FullTextFactory factory)
Defines a default FullTextFactory for all the XML Libraries opened or created from this Library Manager. |
void |
setGroupDirectory(File directory)
Sets the top-level directory of the Library Group. |
void |
setMemoryLimit(long size)
Defines the maximum memory size the generated LibraryManager can use. |
void |
setModuleResolver(ModuleResolver resolver)
Sets the resolver used for resolving a module into actual locations. |
long |
setTransientDocumentCacheSize(long size)
Sets the maximum memory size for the document cache. |
boolean |
unmanageLibrary(String libraryName,
int graceTimeMillis)
Closes and detaches a XML Library from this LibraryManager. |
Field Detail |
---|
static final int CHECK_STORAGE
sanityCheck(com.qizx.api.util.logging.Log, boolean, boolean)
: fully check the document storage
static final int CHECK_CONTENTS
sanityCheck(com.qizx.api.util.logging.Log, boolean, boolean)
: fully check the document contents
static final int CHECK_INDEXES
sanityCheck(com.qizx.api.util.logging.Log, boolean, boolean)
: check the indexes for integrity & consistency
Method Detail |
---|
String[] listLibraries() throws DataModelException
DataModelException
- if there is a system access problem.void createLibrary(String libraryName, File libraryDirectory) throws LibraryException
libraryName
- symbolic name of a Library.libraryDirectory
- the location of the new Library. It represents a
directory. If the directory exists, it must be empty. If value is
null, the Library will be created as a sub-directory of the 'group
directory' of this LibraryManager, which must be defined (see
setGroupDirectory(java.io.File)
. The sub-directory will have the name of
the Library (parameter libraryName).
DataModelException
- if specified library already exists, if
specified library name already used.
LibraryException
boolean deleteLibrary(String libraryName) throws LibraryException
libraryName
- symbolic name of the Library to destroy
true
if specified library has been deleted;
false
otherwise (because such library does not exist)
DataModelException
- if there is a system access problem, if no
managed Library has the specified name.
LibraryException
void manageLibrary(String libraryName, File libraryDirectory) throws LibraryException
openLibrary(java.lang.String, com.qizx.api.AccessControl, com.qizx.api.User)
.
libraryName
- symbolic name of a Library. Must not clash with an
already managed Library.libraryDirectory
- the location of the Library. If value is null and
if the Group directory is defined (see setGroupDirectory(java.io.File)
),
the LibraryManager will look for a Library located at
group-directory/library-name.
DataModelException
- if specified library name already used, if
Library cannot be located.
LibraryException
boolean unmanageLibrary(String libraryName, int graceTimeMillis) throws LibraryException
openLibrary(java.lang.String, com.qizx.api.AccessControl, com.qizx.api.User)
. All sessions if any are
automatically closed after a delay.
libraryName
- symbolic name of a managed Library.graceTimeMillis
- a time in milliseconds for which the method will
wait if there are Library sessions with unfinished transactions.
After that time a rollback will be forced on all uncommitted
transactions.
true
if all sessions have been closed without forced
rollback.
DataModelException
- if there is a system access problem.
LibraryException
boolean closeAllLibraries(int graceTimeMillis) throws DataModelException
graceTimeMillis
- a time in milliseconds for which the method will wait
if there are Library sessions with unfinished transactions. After
that time a rollback will be forced on all uncommitted transactions.
true
if all sessions have been closed without forced
rollback.
DataModelException
- if there is a system access problem.Library openLibrary(String libraryName, AccessControl accessControl, User user) throws DataModelException
Notice that no authentication is performed at this level. The user name is used by the AccessControl to check the permissions of the user.
libraryName
- symbolic name of a LibraryaccessControl
- an implementation of AccessControlException
.
this instance can be specific to this session, or specific to the
concerned Library: this is under the control of the implementation.user
- represents an authentified User. If null, then the
AccessControl must be null too (corresponds to the simplified
version without access control).
null
if such a
Library does not exist.
DataModelException
- if there is a system access problem. This
happens normally only when the XML Library is already locked by
another application.Library openLibrary(String libraryName) throws DataModelException
Simplified version used when there is no Access Control.
libraryName
- symbolic name of a Library
null
if such
a Library does not exist
DataModelException
- if there is a system access problem. This
happens normally only when the XML Library is already used by another
application.List<Library> listSessions()
XQuerySession findSession(int id)
id
- a public identifier returned by XQuerySession.getIdentifier()
.
com.qizx.api.util.backup.BackupSession openForBackup(String libraryName) throws DataModelException
BackupSession
is the source
of a backup operation and allows comparison of contents with a
BackupTarget
in order to perform incremental backup or Replication.
libraryName
- symbolic name of a Library
DataModelException
com.qizx.api.util.backup.BackupTarget createBackup(File location, String libraryName, int version, boolean incremental) throws DataModelException, IOException
Used for implementing backup. Advanced use, not for usual applications.
location
- physical location of the XML Libraryincremental
- true if the backup is incremental. If not incremental,
or if the storage versions differ, then a previously existing backup
Library is erased and recreated.version
- storage version number
DataModelException
IOException
File getGroupDirectory()
Configuration.openLibraryGroup(java.io.File)
.
void setGroupDirectory(File directory)
directory
- a File which is the root location of the Library Group
managed by this object.boolean configure(Properties properties) throws Exception
properties
- a set of properties. Properties are
defined by Configuration.Property
.
Unknown properties are silently ignored.
QizxException
- When one or several invalid property values are specified. An invalid value does not prevent valid properties to be taken into account.
Exception
boolean configure(Configuration.Property property, Object value) throws Exception
Configuration.Property
.
property
- a Property.value
- see each Property
Exception
Map<Configuration.Property,Object> getConfiguration()
The configuration is loaded from the property file group.conf
located in the main directory of the XML Library Group (this file is
normally created by saveConfiguration()
). It is loaded
only if the LibraryManager has a root directory and if this file exists.
The returned values reflect the changes made with the
configure()
methods.
void saveConfiguration() throws DataModelException
The LibraryManager must have a defined root directory.
DataModelException
void collectStatistics(com.qizx.api.util.logging.Statistic.Map targetMap)
targetMap
- a map that can aggregate or discard some queriesvoid setMemoryLimit(long size)
size
- maximum size in bytes of memory allocated to the
LibraryManager.getMemoryLimit()
long getMemoryLimit()
setMemoryLimit(long)
com.qizx.xdm.DocumentPool getTransientDocumentCache()
long setTransientDocumentCacheSize(long size)
size
- maximum memory size in bytes. Decreasing this size will flush
the cache accordingly.
long getTransientDocumentCacheSize()
void setModuleResolver(ModuleResolver resolver)
DefaultModuleResolver
.
resolver
- replacement for the current resolverModuleResolver getModuleResolver()
ModuleResolver
.
void setFullTextFactory(FullTextFactory factory)
A FullTextFactory provides access to- or allows redefining full-text resources such as text tokenizer, stemming, thesaurus and scoring method.
factory
- an implementation of FullTextFactory. A new instance is
cloned for each Library. A factory can also be defined for a specific
Library.FullTextFactory getFullTextFactory()
setFullTextFactory(FullTextFactory)
.
setFullTextFactory(FullTextFactory)
or null if none has been defined.Logger getLogger()
This logger logs starts and shutdowns, and incidents on managed Libraries. It is created with level INFO.
Logger getLibraryLogger(String libraryName)
This logger logs internal events of each XML Library.
It is created with a daily rolling file output in library/logs/lib.log at level WARNING.
void addLogHandler(Handler handler)
handler
- void addLibraryObserver(LibraryMemberObserver observer)
A LibraryMemberObserver
is a pre-commit trigger whose actions are
part of a transaction.
observer
- an object implementing the LibraryMemberObserver interface.void removeLibraryObserver(LibraryMemberObserver observer)
observer
- an object implementing the LibraryMemberObserver
interface.LibraryMemberObserver[] getLibraryObservers()
void addPostCommitTrigger(String libraryName, PostCommitTrigger trigger)
libraryName
- the name of a managed Library, or null
. A
null value acts as a wildcard: the trigger is added to all currently
managed Libraries.trigger
- an object implementing the PostCommitTrigger
interface.void removePostCommitTrigger(String libraryName, PostCommitTrigger trigger)
libraryName
- the name of a managed Library, or null
. A
null value acts as a wildcard: the trigger is removed from all currently
managed Libraries.trigger
- an object implementing the PostCommitTrigger
interface.PostCommitTrigger[] getPostCommitTriggers(String libraryName)
libraryName
- the name of a managed Library. A
null value is not allowed here.
void sanityCheck(com.qizx.api.util.logging.Log log, boolean deep, boolean allowFixing)
log
- interface reporting errors and messagesdeep
- perform deep inspection if trueallowFixing
- if true and errors are detected, perform fixes if
possible. Requires the Libraries to be writable.void sanityCheck(com.qizx.api.util.logging.Log log, int modeMask, boolean allowFixing)
log
- interface reporting errors and messagesmodeMask
- a bit combination of CHECK_STORAGE
(for a full
check of the contents storage),
CHECK_CONTENTS
CHECK_INDEXES
. .allowFixing
- if true and errors are detected, perform fixes if
possible. Requires the Libraries to be writable.List<BackgroundTask> listBackgroundTasks(int timeline)
timeline
- timeline=0 for "current tasks".
if timeline > 0 list all tasks that started within
this number of hours in the past. For example timeline=24 returns all tasks
that started in the past 24 hours.
|
© 2010 Axyana Software | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |