View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.tests.services.security.server;
18  
19  import org.slf4j.Logger;
20  import org.slf4j.LoggerFactory;
21  import org.springframework.context.ConfigurableApplicationContext;
22  
23  import ch.elca.el4j.core.context.ModuleApplicationContext;
24  
25  // Checkstyle: UncommentedMain off
26  
27  /**
28   * The server part for <code>AuthorizationTestDistributed</code>.
29   *
30   * @svnLink $Revision: 3873 $;$Date: 2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/security/src/test/java/ch/elca/el4j/tests/services/security/server/AuthorizationServer.java $
31   *
32   * @author Andreas Pfenninger (APR)
33   */
34  public class AuthorizationServer {
35  
36  	/**
37  	 * Logger.
38  	 */
39  	private static Logger s_logger = LoggerFactory.getLogger(AuthorizationServer.class);
40  
41  	/** The application context. */
42  	private static ConfigurableApplicationContext s_appContext;
43  
44  	/**
45  		 * Hide constructor.
46  		 *
47  		 */
48  	protected AuthorizationServer() {
49  	}
50  
51  	/**
52  	 * The main method.
53  	 *
54  	 * @param args
55  	 *            Command line parameters.
56  	 */
57  	public static void main(String[] args) {
58  		s_appContext = new ModuleApplicationContext(args, false);
59  		String[] str = s_appContext.getBeanDefinitionNames();
60  		for (int i = 0; i < str.length; i++) {
61  			s_logger.info(str[i]);
62  		}
63  	}
64  	
65  	/**
66  	 * Returns the Spring Application Context for this Authorization Server.
67  	 * 
68  	 * @return The ApplicationContext for this authorization.
69  	 */
70  	public static ConfigurableApplicationContext getApplicationContext() {
71  		
72  		return s_appContext;
73  	}
74  	
75  	/**
76  	 * Close the application context after the AuthorizationServer has been
77  	 * used.
78  	 */
79  	public static void close() {
80  		if (s_appContext != null) {
81  			s_appContext.close();
82  		}
83  	}
84  }
85  // Checkstyle: UncommentedMain on