001    /*
002     * Copyright 2002-2004 the original author or authors.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005     * use this file except in compliance with the License. You may obtain a copy of
006     * the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013     * License for the specific language governing permissions and limitations under
014     * the License.
015     */
016    package org.springframework.richclient.samples.showcase;
017    
018    import org.apache.commons.logging.Log;
019    import org.apache.commons.logging.LogFactory;
020    import org.springframework.richclient.application.ApplicationLauncher;
021    
022    /**
023     * This is an archetype application using the Spring Richclient platform.
024     * <p>
025     * The Spring Rich platform relies on the <a href="http://www.springframework.org/">Spring</a>
026     * project to manage the application context with all the associated benefits it offers.
027     * <p>
028     * A start at the Spring Rich Client documentation can be found on the <a
029     * href="http://opensource.atlassian.com/confluence/spring/display/RCP/Home">wiki</a>.
030     * </p>
031     *
032     * @author Larry Streepy
033     * @see The <a
034     *      href="http://www.springframework.org/">Spring project</a>
035     * @see The <a
036     *      href="http://opensource.atlassian.com/confluence/spring/display/RCP/Home">Spring
037     *      Rich Wiki</a>
038     */
039    public class ShowcaseMain {
040    
041        private static final Log logger = LogFactory.getLog(ShowcaseMain.class);
042    
043        /**
044         * Main routine for the simple sample application.
045         *
046         * @param args
047         */
048        public static void main( String[] args ) {
049            logger.info("Showcase application starting up");
050    
051            // In order to launch the platform, we have to construct an
052            // application context that defines the beans (services) and
053            // wiring. This is pretty much straight Spring.
054            //
055            // Part of this configuration will indicate the initial page to be
056            // displayed.
057    
058            String rootContextDirectoryClassPath = "/org/springframework/richclient/samples/showcase/ctx";
059    
060            // The startup context defines elements that should be available
061            // quickly such as a splash screen image.
062    
063            String startupContextPath = rootContextDirectoryClassPath + "/richclient-startup-context.xml";
064    
065            String richclientApplicationContextPath = rootContextDirectoryClassPath
066                    + "/richclient-application-context.xml";
067    
068            // The ApplicationLauncher is responsible for loading the contexts,
069            // presenting the splash screen, initializing the Application
070            // singleton instance, creating the application window to display
071            // the initial page.
072            try {
073                new ApplicationLauncher(startupContextPath, new String[] { richclientApplicationContextPath });
074            } catch (RuntimeException e) {
075                logger.error("RuntimeException during startup", e);
076            }
077        }
078    
079    }