|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.gouv.culture.sdx.utils.AbstractSdxObject fr.gouv.culture.sdx.application.Application
public class Application
An SDX application, from which searches can be done.
This class represents an SDX 2 application. There can be many applications
within an SDX installation. The applications within the installation are referenced
and managed by the Framework
.
The aim of an application is to make documents available and searchable.
An application is created from an XML configuration file. This file and all other files needed by the application must reside within one and only one directory hierarchy on the server. BTW, there is also a reference to the application in {TOMCAT_HOME}/webapps/sdx/WEB-INF/sdx/applications -pb This directory is called the base directory, a directory hierarchy, and must be directly within the SDX installation directory.
All files created by SDX regarding the management of an application and it's users and groups will be placed in subdirectories within the directory where the configuration file is located. it could look like this (for an application whose id is 'sdxworld') :
-webapps -sdx -sdxworld -conf application.xconf -dbs (databases
needed by SDX) -repos (repositories
needed by SDX) -users index.xsp (or any valid 'welcome page') ... -xsl index.xsl ...
An application can be either public, private or restricted. A public application is searchable from other applications. A private application is not searchable from other applications. A restricted application may be searchable from other applications, if they qualify. Qualification is done from hosts and public ids. This could change in the future.
An appplication has four identification properties :
id
, which should be unique amongst SDX applications anywhere as would be a Java package
Other than basic properties, an application manages document bases
,
users
and groups
. It
keeps track of the objects using Database objects and a filesystem store.
An application can also be used to search document bases within other applications.
After creating an Application object, you must remember to :
1) provide a super.getLog()
2) configure the application
3) initialize the application
The methods are enableLogging()
, configure()
and init()
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject |
---|
SdxObject.ConfigurationNode |
Field Summary | |
---|---|
static java.lang.String |
APP_CONFIG_FILENAME
The configuration file name of an application. |
static java.lang.String |
APPLICATION_CONFIGURATION_DIRECTORY
The directory name where application configuration files reside. |
static java.lang.String |
CLASS_NAME_SUFFIX
|
java.lang.String |
DATABASES_DIR_NAME
The name for the directory that contains the databases |
static java.lang.String |
ELEMENT_NAME_USER_DOCUMENT_BASE
The element used to define a user document base. |
protected int |
sessionObjectLimit
The number of results and terms objects that will be stored in session before being subject our first-in first-out removal strategy |
static java.lang.String |
USER_DATABASE_ID
The *fixed* id of the user document base for this application. |
static java.lang.String |
USER_DOCUMENT_BASE_ID
The *fixed* id of the user document base for this application. |
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized |
Fields inherited from interface fr.gouv.culture.sdx.utils.save.Saveable |
---|
ALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAM |
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable |
---|
DEFAULT_ENCODING |
Constructor Summary | |
---|---|
Application()
Builds an application that must be configured afterwards. |
Method Summary | |
---|---|
void |
addIdentity(Identity identity,
java.lang.String password,
Repository repository,
IndexParameters params,
org.xml.sax.ContentHandler handler)
Adds a user or group to this application. |
void |
addMember(Group group,
java.lang.String id)
Adds a member to a group. |
void |
addMembers(Group group,
java.lang.String[] ids)
Adds members to a group. |
void |
backup(SaveParameters save_config)
Save the application data objects |
boolean |
changePassword(java.lang.String username,
java.lang.String oldPass,
java.lang.String newPass)
|
void |
checkIntegrity()
Check the application integrity |
void |
checkIntegrity(java.lang.String dbId)
Optimize an application's documentbase |
void |
checkIntegrity(java.lang.String[] dbIds)
Optimize the application by optimizing the documentbases sent in the array |
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
Sets the configuration options to build the application. |
protected void |
configureEntityCatalogs(org.apache.avalon.framework.configuration.Configuration configuration)
Configures the entity catalogs of the application if needed. |
protected void |
configureFieldLists(org.apache.avalon.framework.configuration.Configuration configuration)
Configures the fields lists of the application. |
protected void |
configureSessionObjectLimit(org.apache.avalon.framework.configuration.Configuration configuration)
Configures the maximum number of objects should be store in session. |
protected void |
configureUserDocumentBase(org.apache.avalon.framework.configuration.Configuration configuration)
Configures the SDX users document base if needed. |
void |
deleteIdentity(Identity identity)
Removes an identity (user or group) from this application. |
protected java.lang.String |
getClassNameSuffix()
Sub classes should element this method to return their class name suffix for SAX output |
java.lang.String |
getDataDirPath()
Gets the path of the directory wich contains system datas (ie, databases, Lucene indexes, SDX user database, SDX thesaurus, etc.) |
java.lang.String |
getDefaultAdminGroupId()
Returns the id of the default admin group. |
java.lang.String |
getDefaultAdminUserId()
Returns the id of the default admin user. |
DocumentBase |
getDefaultDocumentBase()
Gets the default DocumentBase for this application. |
DocumentBase |
getDocumentBase(java.lang.String dbId)
Gets a DocumentBase in this application. |
java.util.Enumeration |
getDocumentBasesIds()
Gets an enumeration of DocumentBase ids in this application. |
org.apache.avalon.framework.logger.Logger |
getLogger()
Gets the application's super.getLog(). |
java.lang.String[] |
getMembers(java.lang.String groupname)
Returns the members of a group. |
java.util.Hashtable |
getParents(java.lang.String id)
Returns the parents of an identity. |
java.lang.String |
getPath()
Gets the name of the subdirectory in which this application's data resides. |
Repository |
getRepository(java.lang.String id)
Gets a repository in this document base. |
Searchable |
getSearchable(java.lang.String id)
|
int |
getSessionObjectLimit()
|
org.apache.excalibur.source.SourceValidity |
getSourceValidity()
Gets the source validity of the application. |
SDXThesaurus |
getThesaurus(java.lang.String id)
Gets the SDXThesaurus of an application identified by its id. |
UserDatabase |
getUserDatabase()
Return userDatabase for special usages, should be unuseful |
void |
getUserDocument(java.lang.String username,
java.util.Hashtable groups,
org.apache.cocoon.xml.XMLConsumer consumer)
Returns the document where the user information is stored. |
UserInformation |
getUserInformation()
Returns information about an anonymous user. |
UserInformation |
getUserInformation(java.lang.String username)
Returns information about a user. |
void |
init()
Initializes the application and makes the necessary data structures available. |
protected boolean |
initToSax()
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML |
protected void |
initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called |
boolean |
isMember(Identity identity,
java.lang.String groupName)
Checks if an identity (user or group) belongs to a group. |
boolean |
isUsingSDXUserDatabase()
Indicates if this application uses the internal SDX users database. |
void |
loadApplication(java.lang.String file_path)
Load the application from a previous backup, restoring all functionnality If file path is null, get the most recent backup file found. |
void |
optimize()
Optimize the application by optimizing all documentbases |
void |
optimize(java.lang.String dbId)
Optimize an application's documentbase |
void |
optimize(java.lang.String[] dbIds)
Optimize the application by optimizing the documentbases sent in the array |
void |
replaceMembers(Group group,
java.lang.String[] ids)
Replace members of a group. |
void |
restore(SaveParameters save_config)
Restore the application data objects |
void |
restoreDocumentBases(SaveParameters save_config)
|
void |
restoreThesauri(SaveParameters save_config)
|
void |
saveApplication()
Save the application for backup or quick deployment purpose |
boolean |
validateUser(java.lang.String username,
java.lang.String password)
Checks if a user and a plain text password match. |
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String USER_DOCUMENT_BASE_ID
public static final java.lang.String USER_DATABASE_ID
public static final java.lang.String APPLICATION_CONFIGURATION_DIRECTORY
public static final java.lang.String APP_CONFIG_FILENAME
public static final java.lang.String ELEMENT_NAME_USER_DOCUMENT_BASE
public java.lang.String DATABASES_DIR_NAME
protected int sessionObjectLimit
public static final java.lang.String CLASS_NAME_SUFFIX
Constructor Detail |
---|
public Application()
Method Detail |
---|
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
configure
in class AbstractSdxObject
configuration
- The configuration object, previously populated in
FrameworkImpl
,
that will allow the application to configure itself.
org.apache.avalon.framework.configuration.ConfigurationException
we should link to this in the future when we have better documentation capabilities
protected void configureEntityCatalogs(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
-
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureFieldLists(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
-
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureUserDocumentBase(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
-
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureSessionObjectLimit(org.apache.avalon.framework.configuration.Configuration configuration)
configuration
- public void init() throws SDXException, org.apache.avalon.framework.configuration.ConfigurationException, org.apache.avalon.framework.service.ServiceException, org.apache.avalon.framework.context.ContextException
SDXException
org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.service.ServiceException
org.apache.avalon.framework.context.ContextException
public org.apache.avalon.framework.logger.Logger getLogger()
public java.lang.String getPath()
public java.lang.String getDataDirPath()
public Repository getRepository(java.lang.String id) throws SDXException
id
- The repository's id, null for getting default repository
SDXException
public DocumentBase getDocumentBase(java.lang.String dbId) throws SDXException
dbId
- The documentBase's id.
SDXException
public java.util.Enumeration getDocumentBasesIds()
public DocumentBase getDefaultDocumentBase()
public SDXThesaurus getThesaurus(java.lang.String id) throws SDXException
id
- The id of the SDXThesaurus
SDXException
public Searchable getSearchable(java.lang.String id)
public boolean isUsingSDXUserDatabase()
public UserDatabase getUserDatabase()
public java.lang.String getDefaultAdminGroupId()
null
if the group has been deleted
from the application after start-up
public java.lang.String getDefaultAdminUserId()
null
if the user has been deleted
from the application after start-up.
public void addMember(Group group, java.lang.String id) throws SDXException
group
- The group.id
- Id of an identity to add as a member.
SDXException
public void addMembers(Group group, java.lang.String[] ids) throws SDXException
group
- The group.ids
- Array of ids to add as a member.
SDXException
public void replaceMembers(Group group, java.lang.String[] ids) throws SDXException
group
- The group.ids
- Array of ids to add as a member.
SDXException
public java.util.Hashtable getParents(java.lang.String id) throws SDXException
id
- name of the user (or the group).
SDXException
public java.lang.String[] getMembers(java.lang.String groupname) throws SDXException
groupname
- The groupname.
SDXException
public void addIdentity(Identity identity, java.lang.String password, Repository repository, IndexParameters params, org.xml.sax.ContentHandler handler) throws SDXException, org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
identity
- The user or group.password
- The unencoded password given to this user (may be null).repository
- The repository where the user document is stored (if null, default repository will be used).params
- The parameters of this adding process (may be null).handler
- A content handler where information on the adding process will be sent (may be null).
SDXException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public boolean changePassword(java.lang.String username, java.lang.String oldPass, java.lang.String newPass) throws SDXException
SDXException
public void deleteIdentity(Identity identity) throws SDXException
identity
- The identity to remove (only it's name is needed).
SDXException
public boolean validateUser(java.lang.String username, java.lang.String password) throws SDXException
If the password is null, there is a match if no password has been given to the user. If the password is an empty string, then an empty string must have been given as a password for this user at creation time.
Otherwise, there is a match if the password exactly matches (including case) the user password.
username
- The username to check.password
- The password to check (may be null).
SDXException
public boolean isMember(Identity identity, java.lang.String groupName) throws SDXException
identity
- The username to check.groupName
- The password to check (may be null).
SDXException
public UserInformation getUserInformation(java.lang.String username) throws SDXException
username
- The username (if null, anonymous user information is returned).
SDXException
public UserInformation getUserInformation() throws SDXException
SDXException
public void getUserDocument(java.lang.String username, java.util.Hashtable groups, org.apache.cocoon.xml.XMLConsumer consumer) throws SDXException
username
- The username (if null
, anonymous user information will be sent).groups
- The groups the user belongs to (may be null
).consumer
- The XMLconsumer to feed with the information.
SDXException
public int getSessionObjectLimit()
protected java.lang.String getClassNameSuffix()
AbstractSdxObject
getClassNameSuffix
in class AbstractSdxObject
protected boolean initToSax()
AbstractSdxObject
initToSax
in class AbstractSdxObject
protected void initVolatileObjectsToSax()
initVolatileObjectsToSax
in class AbstractSdxObject
public void optimize()
public void optimize(java.lang.String[] dbIds)
public void optimize(java.lang.String dbId)
public void checkIntegrity()
public void checkIntegrity(java.lang.String[] dbIds)
public void checkIntegrity(java.lang.String dbId)
public void saveApplication()
public void loadApplication(java.lang.String file_path) throws SDXException
SDXException
public void backup(SaveParameters save_config) throws SDXException
backup
in interface Saveable
SDXException
Saveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)
public void restore(SaveParameters save_config) throws SDXException
restore
in interface Saveable
SDXException
Saveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)
public void restoreDocumentBases(SaveParameters save_config) throws SDXException
SDXException
public void restoreThesauri(SaveParameters save_config) throws SDXException
SDXException
public org.apache.excalibur.source.SourceValidity getSourceValidity()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |