org.jwarp.service
Class ContextFactory

java.lang.Object
  |
  +--org.jwarp.service.ContextFactory
All Implemented Interfaces:
IContextFactory

public class ContextFactory
extends java.lang.Object
implements 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.
static IContextFactory getInstance()
          Returns the one and only instance of the ContextFactory
 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.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static IContextFactory getInstance()
Returns the one and only instance of the ContextFactory
Returns:
The JWeb's context factory of this VM instance

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.
Specified by:
login in interface IContextFactory
Following copied from interface: org.jwarp.service.IContextFactory
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.
Specified by:
getContextNames in interface IContextFactory
Following copied from interface: org.jwarp.service.IContextFactory
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
Specified by:
createContext in interface IContextFactory
Parameters:
configuration - the configuration containing one context
Returns:
The context's system ticket
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.
Specified by:
createContexts in interface IContextFactory
Parameters:
configuration - the configuration containing a list of contexts
Returns:
The context's system tickets
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.
Specified by:
removeContext in interface IContextFactory
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