|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.gouv.culture.sdx.application.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 logger
2) configure the application
3) initialize the application
The methods are enableLogging()
, configure()
and init()
.
Field Summary | |
static java.lang.String |
APPLICATION_FIELD_LISTS
String representation for a key in the Properties object : application-level repositories. |
static java.lang.String |
APPLICATION_ID
String representation for a key in the Properties object : application's id. |
static java.lang.String |
APPLICATION_REPOSITORIES
String representation for a key in the Properties object : application-level repositories. |
java.lang.String |
DATABASES_DIR_NAME
The name for the directory that contains the databases |
static java.lang.String |
DEFAULT_DATABASE_CONF
The key name for the default database type this application in the "props" object. |
static java.lang.String |
DOCUMENTBASES_DIR_PATH
String representation for a key in the Properties object : directory for the location of the DBs. |
static java.lang.String |
ELEMENT_NAME_USER_DOCUMENT_BASE
The element used to define a user document base. |
static java.lang.String |
HSQL_DATABASE
The key name for the potention hsql db of this application in the "props" object. |
static java.lang.String |
REPOSITORIES_DIR_PATH
String representation for a key in the Properties object : directory for the location of the repositories. |
static java.lang.String |
SDX_DATABASE_DIR_PATH
The key name for the database directory of this application in the "props" object. |
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 |
THESAURI_DIR_PATH
String representation for a key in the Properties object : directory for the location of the thesauri. |
static java.lang.String |
USER_DOCUMENT_BASE_ID
The *fixed* id of the user document base for this application. |
static java.lang.String |
USERS_DIR_PATH
String representation for a key in the Properties object : directory for the location of the users info. |
static java.lang.String |
USERS_DOCUMENTBASE_DIR_PATH
String representation for a key in the Properties object : directory for the location of the users' documents. |
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. |
boolean |
changePassword(java.lang.String username,
java.lang.String oldPass,
java.lang.String newPass)
|
void |
compose(org.apache.avalon.framework.component.ComponentManager componentManager)
Sets the application ComponentManager. |
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
Sets the configuration options to build the application. |
protected void |
configureFieldLists(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
configureSessionObjectLimit(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
configureUserDocumentBase(org.apache.avalon.framework.configuration.Configuration configuration)
|
void |
contextualize(org.apache.avalon.framework.context.Context context)
Contextualize this class. |
void |
deleteIdentity(Identity identity)
Removes an identity (user or group) from this application. |
void |
enableLogging(org.apache.avalon.framework.logger.Logger logger)
Sets the logger for this application. |
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. |
java.lang.String |
getId()
Gets the id of this application. |
java.util.Locale |
getLocale()
Returns the locale for the application |
org.apache.avalon.framework.logger.Logger |
getLogger()
Gets the application's logger. |
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()
|
SDXThesaurus |
getThesaurus(java.lang.String 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. |
java.lang.String |
getXmlLang()
Returns the xml:lang attibute value from the configuration |
void |
init()
Initializes the application and makes the necessary data structures available. |
boolean |
isMember(Identity identity,
java.lang.String groupName)
Checks if an identity (user or group) belongs to a group. |
void |
replaceMembers(Group group,
java.lang.String[] ids)
Replace members of a group. |
void |
setProperties(java.util.Hashtable props)
Sets the properties object. |
void |
toSAX(org.xml.sax.ContentHandler handler)
Could send an XML representation of something, but currently has no function. |
boolean |
validateUser(java.lang.String username,
java.lang.String password)
Checks if a user and a plain text password match. |
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 APPLICATION_ID
public static final java.lang.String APPLICATION_REPOSITORIES
public static final java.lang.String APPLICATION_FIELD_LISTS
public static final java.lang.String DOCUMENTBASES_DIR_PATH
public static final java.lang.String REPOSITORIES_DIR_PATH
public static final java.lang.String USERS_DIR_PATH
public static final java.lang.String USERS_DOCUMENTBASE_DIR_PATH
public static final java.lang.String THESAURI_DIR_PATH
public static final java.lang.String ELEMENT_NAME_USER_DOCUMENT_BASE
public static final java.lang.String DEFAULT_DATABASE_CONF
public static final java.lang.String SDX_DATABASE_DIR_PATH
public static final java.lang.String HSQL_DATABASE
public java.lang.String DATABASES_DIR_NAME
protected int sessionObjectLimit
Constructor Detail |
public Application()
Method Detail |
public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
enableLogging
in interface org.apache.avalon.framework.logger.LogEnabled
logger
- The logger.public void contextualize(org.apache.avalon.framework.context.Context context) throws org.apache.avalon.framework.context.ContextException
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
context
- The context provided by Cocoon.
org.apache.avalon.framework.context.ContextException
public void compose(org.apache.avalon.framework.component.ComponentManager componentManager) throws org.apache.avalon.framework.component.ComponentException
compose
in interface org.apache.avalon.framework.component.Composable
componentManager
- The componentManager. Provided by the framework
component.
org.apache.avalon.framework.component.ComponentException
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
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 configureFieldLists(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureUserDocumentBase(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected void configureSessionObjectLimit(org.apache.avalon.framework.configuration.Configuration configuration)
public void init() throws SDXException, org.apache.avalon.framework.configuration.ConfigurationException, org.apache.avalon.framework.component.ComponentException
SDXException
org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.component.ComponentException
public void setProperties(java.util.Hashtable props)
props
- The properties.public org.apache.avalon.framework.logger.Logger getLogger()
public java.lang.String getId()
public java.lang.String getPath()
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 java.lang.String getXmlLang()
public java.util.Locale getLocale()
public SDXThesaurus getThesaurus(java.lang.String id) throws SDXException
SDXException
public Searchable getSearchable(java.lang.String id)
public UserDatabase getUserDatabase()
public java.lang.String getDefaultAdminGroupId()
null
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 void toSAX(org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException, org.apache.cocoon.ProcessingException
toSAX
in interface org.apache.cocoon.xml.XMLizable
handler
- A SAX content handler to feed with events.
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException
public int getSessionObjectLimit()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |