org.springframework.richclient.application
Class ApplicationLauncher

Show UML class diagram
java.lang.Object
  extended by org.springframework.richclient.application.ApplicationLauncher

public class ApplicationLauncher
extends Object

The main driver for a Spring Rich Client application.

This class displays a configurable splash screen and launches a rich client Application. Both the splash screen and the application to be launched are expected to be defined as beans, under the names SPLASH_SCREEN_BEAN_ID and APPLICATION_BEAN_ID respectively, in one of the application contexts provided to the constructor.

For quick loading and display of the splash screen while the rest of the application is being initialized, constructors are provided that take a separate startup context. The startup context will be searched for the SPLASH_SCREEN_BEAN_ID bean, which will then be displayed before the main application context is loaded and the application launched. If no startup context is provided or it doesn't contain an appropriately named splash screen bean, an attempt will be made to load a splash screen from the main application context. This can only happen after the main application context has been loaded in its entirety so it is not the recommended approach for displaying a splash screen.

Author:
Keith Donald
See Also:
Application

Field Summary
static String APPLICATION_BEAN_ID
          The name of the bean that defines the Application that this class will launch.
static String SPLASH_SCREEN_BEAN_ID
          The name of the bean that defines the application's splash screen.
 
Constructor Summary
ApplicationLauncher(ApplicationContext rootApplicationContext)
          Launches the application from the pre-loaded application context.
ApplicationLauncher(String rootContextPath)
          Launches the application defined by the Spring application context file at the provided classpath-relative location.
ApplicationLauncher(String[] rootContextConfigLocations)
          Launches the application defined by the Spring application context files at the provided classpath-relative locations.
ApplicationLauncher(String startupContextPath, ApplicationContext rootApplicationContext)
          Launch the application using a startup context from the given location and a pre-loaded application context.
ApplicationLauncher(String startupContextPath, String rootContextPath)
          Launches the application defined by the Spring application context files at the provided classpath-relative locations.
ApplicationLauncher(String startupContextPath, String[] rootContextConfigLocations)
          Launches the application defined by the Spring application context files at the provided classpath-relative locations.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPLASH_SCREEN_BEAN_ID

public static final String SPLASH_SCREEN_BEAN_ID
The name of the bean that defines the application's splash screen. "splashScreen"

See Also:
Constant Field Values

APPLICATION_BEAN_ID

public static final String APPLICATION_BEAN_ID
The name of the bean that defines the Application that this class will launch. "application"

See Also:
Constant Field Values
Constructor Detail

ApplicationLauncher

public ApplicationLauncher(String rootContextPath)
Launches the application defined by the Spring application context file at the provided classpath-relative location.

Parameters:
rootContextPath - The classpath-relative location of the application context file.
Throws:
IllegalArgumentException - if rootContextPath is null or empty.

ApplicationLauncher

public ApplicationLauncher(String[] rootContextConfigLocations)
Launches the application defined by the Spring application context files at the provided classpath-relative locations.

Parameters:
rootContextConfigLocations - the classpath-relative locations of the application context files.
Throws:
IllegalArgumentException - if rootContextPath is null or empty.

ApplicationLauncher

public ApplicationLauncher(String startupContextPath,
                           String rootContextPath)
Launches the application defined by the Spring application context files at the provided classpath-relative locations. The application context file specified by startupContext is loaded first to allow for quick loading of the application splash screen. It is recommended that the startup context only contains the bean definition for the splash screen and any other beans that it depends upon. Any beans defined in the startup context will not be available to the main application once launched.

Parameters:
startupContextPath - The classpath-relative location of the startup application context file. May be null or empty.
rootContextPath - The classpath-relative location of the main application context file.
Throws:
IllegalArgumentException - if rootContextPath is null or empty.

ApplicationLauncher

public ApplicationLauncher(String startupContextPath,
                           String[] rootContextConfigLocations)
Launches the application defined by the Spring application context files at the provided classpath-relative locations. The application context file specified by startupContextPath is loaded first to allow for quick loading of the application splash screen. It is recommended that the startup context only contains the bean definition for the splash screen and any other beans that it depends upon. Any beans defined in the startup context will not be available to the main application once launched.

Parameters:
startupContextPath - The classpath-relative location of the startup context file. May be null or empty.
rootContextConfigLocations - The classpath-relative locations of the main application context files.
Throws:
IllegalArgumentException - if rootContextConfigLocations is null or empty.

ApplicationLauncher

public ApplicationLauncher(ApplicationContext rootApplicationContext)
Launches the application from the pre-loaded application context.

Parameters:
rootApplicationContext - The main application context.
Throws:
IllegalArgumentException - if rootApplicationContext is null.

ApplicationLauncher

public ApplicationLauncher(String startupContextPath,
                           ApplicationContext rootApplicationContext)
Launch the application using a startup context from the given location and a pre-loaded application context.

Parameters:
startupContextPath - the classpath-relative location of the starup application context file. If null or empty, no splash screen will be displayed.
rootApplicationContext - the main application context.
Throws:
IllegalArgumentException - if rootApplicationContext is null.


Copyright © 2004-2009 The Spring Framework. All Rights Reserved.