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) 2006 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.remoting.loadbalancing.common;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.slf4j.Logger;
23  import org.slf4j.LoggerFactory;
24  
25  import ch.elca.el4j.core.contextpassing.ImplicitContextPasser;
26  import ch.elca.el4j.core.contextpassing.ImplicitContextPassingRegistry;
27  
28  /**
29   * Defines the context that is implicitly passed to the server.
30   *
31   * @svnLink $Revision: 3884 $;$Date: 2009-08-04 15:48:31 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/tests/remoting/apps/common/src/test/java/ch/elca/el4j/tests/services/remoting/loadbalancing/common/TestImplicitContext.java $
32   *
33   * @author Stefan Pleisch (SPL)
34   */
35  public class TestImplicitContext implements ImplicitContextPassingRegistry {
36  
37  	/** Defines the value of the key if it has not yet been initialized. */
38  	public static final String NOT_INITIALIZED_KEY = "NOT_INITIALIZED";
39  	
40  	/**
41  	 * {@inheritDoc}
42  	 */
43  	public void registerImplicitContextPasser(
44  		ImplicitContextPasser passer) {
45  		// Do nothing.
46  	}
47  
48  	/**
49  	 * {@inheritDoc}
50  	 */
51  	public void unregisterImplicitContextPasser(
52  		ImplicitContextPasser passer) {
53  		// Do nothing.
54  	}
55  	
56  	/**
57  	 * {@inheritDoc}
58  	 */
59  	public Map getAssembledImplicitContext() {
60  		Map map = new HashMap();
61  		map.put(UNIQUE_KEY, "testString");
62  		return map;
63  	}
64  
65  	/**
66  	 * {@inheritDoc}
67  	 */
68  	public void pushAssembledImplicitContext(Map contexts) {
69  		s_logger.debug("Retrieving context: " + contexts.get(UNIQUE_KEY));
70  	}
71  
72  	/** Name used for the unique key in the context map. */
73  	private static final String UNIQUE_KEY = "UNIQUE_KEY";
74  	
75  	/**
76  	 * Private logger.
77  	 */
78  	private static Logger s_logger
79  		= LoggerFactory.getLogger(TestImplicitContext.class);
80   
81  
82  } // Class IdempotenceImplicitContext