View Javadoc

1   /*
2    * @(#) RemoteContextListener.java Apr 14, 2004
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.naming.listener;
11  
12  import java.rmi.RemoteException;
13  import java.rmi.server.UnicastRemoteObject;
14  
15  import javax.naming.event.NamingEvent;
16  import javax.naming.event.NamingExceptionEvent;
17  
18  /***
19   * A RemoteContextListener.
20   * <p>
21   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
22   * University of Technology </a>, the Netherlands. <br>
23   * See for project information <a
24   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
25   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
26   * License (GPL) </a>, no warranty <br>
27   * 
28   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
29   *         Jacobs </a>
30   * @version 1.2 Apr 14, 2004
31   * @since 1.4
32   */
33  public class RemoteContextListener extends UnicastRemoteObject implements
34  		RemoteContextListenerInterface
35  {
36  	/*** the listener */
37  	private ContextListenerInterface listener = null;
38  
39  	/***
40  	 * constructs a new RemoteContextListener
41  	 * 
42  	 * @param listener the target.
43  	 * @throws RemoteException on network failure.
44  	 */
45  	public RemoteContextListener(final ContextListenerInterface listener)
46  			throws RemoteException
47  	{
48  		super();
49  		this.listener = listener;
50  	}
51  
52  	/***
53  	 * @see nl.tudelft.simulation.naming.listener.RemoteContextListenerInterface
54  	 *      #objectChanged(javax.naming.event.NamingEvent)
55  	 */
56  	public void objectChanged(NamingEvent evt)
57  	{
58  		this.listener.objectChanged(evt);
59  	}
60  
61  	/***
62  	 * @see nl.tudelft.simulation.naming.listener.RemoteContextListenerInterface#objectAdded(javax.naming.event.NamingEvent)
63  	 */
64  	public void objectAdded(NamingEvent evt)
65  	{
66  		this.listener.objectAdded(evt);
67  	}
68  
69  	/***
70  	 * @see nl.tudelft.simulation.naming.listener.RemoteContextListenerInterface#objectRemoved(javax.naming.event.NamingEvent)
71  	 */
72  	public void objectRemoved(NamingEvent evt)
73  	{
74  		this.listener.objectRemoved(evt);
75  	}
76  
77  	/***
78  	 * @see nl.tudelft.simulation.naming.listener.RemoteContextListenerInterface#objectRenamed(javax.naming.event.NamingEvent)
79  	 */
80  	public void objectRenamed(NamingEvent evt)
81  	{
82  		this.listener.objectRemoved(evt);
83  	}
84  
85  	/***
86  	 * @see nl.tudelft.simulation.naming.listener.RemoteContextListenerInterface
87  	 *      #namingExceptionThrown(javax.naming.event.NamingExceptionEvent)
88  	 */
89  	public void namingExceptionThrown(NamingExceptionEvent evt)
90  	{
91  		this.listener.namingExceptionThrown(evt);
92  	}
93  }