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.core.contextpassing;
18  
19  import java.util.Map;
20  
21  /**
22   * Registry for implicit context passers. This registry has to be set up with
23   * the remote module to enable implicit context passing. Every bean that uses
24   * passing of implicit contexts needs to have a context passer bean extending
25   * <code>ImplicitContextPasser</code> and register it in the registry.
26   * In the client - server scenario, one registry instance on the client side and
27   * another one on the server side is needed.
28   *
29   * @svnLink $Revision: 3875 $;$Date: 2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/core/src/main/java/ch/elca/el4j/core/contextpassing/ImplicitContextPassingRegistry.java $
30   *
31   * @author Andreas Pfenninger (APR)
32   */
33  public interface ImplicitContextPassingRegistry {
34  
35  	/**
36  	 * Register a new implicit context passer to the registry.
37  	 *
38  	 * @param passer
39  	 *           The implicit context passer to register.
40  	 */
41  	public void registerImplicitContextPasser(
42  			ImplicitContextPasser passer);
43  	
44  	/**
45  	 * Unregister a registered implicit context passer.
46  	 *
47  	 * @param passer
48  	 *            The implicit context passer to unregister.
49  	 */
50  	public void unregisterImplicitContextPasser(
51  			ImplicitContextPasser passer);
52  
53  	/**
54  	 * This method is used by remoting infrastructures on the client side to
55  	 * collect what needs to be added to the context. This method calls the
56  	 * <code>getImplicitlyPassedContext</code> method of all registered
57  	 * implicit context passers.
58  	 * It returns a map with the "id -> context" mapping that needs to be
59  	 * passed with the remote invocation.
60  	 *
61  	 * @return The implicit context map.
62  	 */
63  	public Map<String,Object> getAssembledImplicitContext();
64  
65  	/**
66  	 * This method is used by remoting infrastructures on the server side to
67  	 * push the context to the beans. It calls the
68  	 * <code>pushImplicitlyPassedContext</code> method on all registered
69  	 * implicit context passers.
70  	 * Its context's parameter holds the "id -> context" mappings that are
71  	 * passed with the remote invocation.
72  	 *
73  	 * @param contexts
74  	 *            The received implicit context map that holds the
75  	 *            "id -> context" mappings that are passed with the remote
76  	 *            invocation.
77  	 */
78  	public void pushAssembledImplicitContext(Map<String,Object> contexts);
79  
80  }