Jive API (3.0.13) Core Javadocs

com.jivesoftware.community.lifecycle
Class JiveApplication

java.lang.Object
  extended by com.jivesoftware.community.lifecycle.JiveApplication

public class JiveApplication
extends Object

This class is one main entry point for the system. Almost all uses of this class will be concerned solely with the getEffectiveContext() method which is used to get an instance of the JiveContext interface. This will return a context which will apply the permissions for the current authentication as received from AuthenticationProvider#getAuthentication.

Fine-grained pluggability of the user and group system is also available. See the UserManager and GroupManager classes for more information.

See Also:
AuthenticationProvider, JiveContext

Method Summary
protected static void clearTestContext()
          For testing purposes only.
static void destroy()
          Destroys the application.
static void destroy(ServletContext servletContext)
          Destroys the web application.
static void finishContextRefresh(SpringJiveContextImpl springJiveContext)
          This is called by the SpringJiveContextImpl when the context is done initializing but before any Spring contextRefresh events are fired, so calls done on that event don't wind up with a null JiveApplication.getContext() reference.
static ApplicationState getApplicationState()
           
static JiveContext getContext()
          Returns the raw jive context (spring context).
static JiveContext getEffectiveContext()
          Returns a jive context with the appropriate permissions of the effective user (which is not necessarily the same as the authenticated user.
static void initialize()
          Initializes the application.
static void initialize(ServletContext servletContext)
          Initializes the web application.
static boolean isContextInitialized()
          Returns true if the Spring Context is initialized, false otherwise.
static boolean isDatabaseAvailable()
          Checks to see if the database is available.
static boolean isInitialized()
          Returns true if the application is initialized, false otherwise.
static ApplicationState setApplicationState(ApplicationState previousState, ApplicationState newState)
          Transition the application from the previous to a new state.
static void setContextLoader(JiveContextLoader loader)
          Specifically set the context loader to use, overwriting the jive/spring loader.
 void setDispatcher(EventDispatcher d)
           
protected static void setTestContext(JiveContext context)
          For testing purposes only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setDispatcher

public void setDispatcher(EventDispatcher d)

setContextLoader

public static void setContextLoader(JiveContextLoader loader)
Specifically set the context loader to use, overwriting the jive/spring loader.

Parameters:
loader -

isInitialized

public static boolean isInitialized()
Returns true if the application is initialized, false otherwise.

Returns:
true if the application is initialized, false otherwise.

isContextInitialized

public static boolean isContextInitialized()
Returns true if the Spring Context is initialized, false otherwise.

Returns:
true if the application is initialized, false otherwise.

isDatabaseAvailable

public static boolean isDatabaseAvailable()
Checks to see if the database is available.

Returns:
true if a connection to the database is available, false otherwise.

initialize

public static void initialize()
Initializes the application. Normal users of the API will not need to call this as this is a method called internally.


initialize

public static void initialize(ServletContext servletContext)
Initializes the web application. Normal users of the API will not need to call this as this is a method called internally. To get an instance of the application, call getEffectiveContext().


destroy

public static void destroy()
Destroys the application. Normal users of the API will not need to call this as this is a method called internally.


destroy

public static void destroy(ServletContext servletContext)
Destroys the web application. Normal users of the API will not need to call this as this is a method called internally.


getEffectiveContext

public static JiveContext getEffectiveContext()
Returns a jive context with the appropriate permissions of the effective user (which is not necessarily the same as the authenticated user. If the effective user is the system, an unproxied context will be returned.

This method will not function until the application has been properly initialized or if a security context does not exist for the current call stack.

Returns:
Since:
2.0

getContext

public static JiveContext getContext()
Returns the raw jive context (spring context).

Returns:

setTestContext

protected static void setTestContext(JiveContext context)
For testing purposes only. Used to override the jivecontext returned.

Make sure to run clearTestContext() after you are done.

Parameters:
context - The test jive context

clearTestContext

protected static void clearTestContext()
For testing purposes only. Used to reset the jivecontext after using setTestContext.


getApplicationState

public static ApplicationState getApplicationState()

setApplicationState

public static ApplicationState setApplicationState(ApplicationState previousState,
                                                   ApplicationState newState)
Transition the application from the previous to a new state. The intent of the previous state parameter is to prevent invalid transitions - client code can request a transition but that the application will only honor certain to-from conditions.

Parameters:
newState - the state being transitioned to.
previousState - the state which is being transitioned from
Returns:
State of the application after the operation.

finishContextRefresh

public static void finishContextRefresh(SpringJiveContextImpl springJiveContext)
This is called by the SpringJiveContextImpl when the context is done initializing but before any Spring contextRefresh events are fired, so calls done on that event don't wind up with a null JiveApplication.getContext() reference.

Parameters:
springJiveContext -

Jive Product Page

Copyright © 1999-2007 Jive Software.