org.jwarp.service
Interface IContextFactory

All Known Implementing Classes:
ContextFactory

public interface IContextFactory

The context factory is the basic class of all JWeb applicatrions. This singleton class is the one and only capaböe of registereing and loading application contexts. If you want to load an application it must be registered to this component.

Version:
1.0
Author:
ORCA Systems GmbH, Martin Schäfer, ORCA Systems GmbH, Anatole Tresch

Method Summary
 ITicket createContext(org.jdom.Element configuration)
          Create a context from the given configuration
 ITicket[] createContexts(org.jdom.Element configuration)
          Creates several contexts from the given configuration.
 java.lang.String[] getContextNames()
          Return the names of all defined contexts.
 ITicket login(java.lang.String user, java.lang.String pwd, java.lang.String context)
          login for the given user (ticket) returns the context for this user.
 IContext removeContext(java.lang.String name, ITicket ticket)
          This method removes a context.
 

Method Detail

login

public ITicket login(java.lang.String user,
                     java.lang.String pwd,
                     java.lang.String context)
              throws InvalidContextException,
                     java.lang.SecurityException
login for the given user (ticket) returns the context for this user. Returns null if the user could not be logged in.
Parameters:
user - The user's id
pwd - The user's password
context - The target context where this user want to get access to
Returns:
a valid ticket for using the context. The ticket itself has a method to get the context's instance for accessing the context's services.

getContextNames

public java.lang.String[] getContextNames()
Return the names of all defined contexts.
Returns:
An array with the currently available contexts.

createContext

public ITicket createContext(org.jdom.Element configuration)
                      throws ConfigurationException,
                             java.lang.SecurityException
Create a context from the given configuration
Parameters:
configuration - the configuration containing one context
Throws:
ConfigurationException - If the configuration of the context failed
java.lang.SecurityException - If the context could not be established, e.g. another context with the same name is running yet.

createContexts

public ITicket[] createContexts(org.jdom.Element configuration)
                         throws ConfigurationException,
                                java.lang.SecurityException
Creates several contexts from the given configuration. Exceptions should not prevent creating the contexts that were confugred well or did not caused any security exceptions.
Parameters:
configuration - the configuration containing a list of contexts
Throws:
ConfigurationException - If the configuration of a context failed
java.lang.SecurityException - If a context could not be established, e.g. another context with the same name is running yet.

removeContext

public IContext removeContext(java.lang.String name,
                              ITicket ticket)
                       throws InvalidContextException,
                              java.lang.SecurityException
This method removes a context. The user must have the according security rights to remove the context. This is determined by the contexts security itself thus a context not allowing its removal can not be removed.
Parameters:
ticket - The securityTicket
Throws:
InvalidContextException - The context of the ticket was not found, e.g. was removed yet.
java.lang.SecurityException - The context did not allow the user to remove it..

©   O R C A   S y s t e m s