View Javadoc

1   /*
2    * @(#) RemoteContextListenerClient.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  
14  import javax.naming.event.NamingEvent;
15  import javax.naming.event.NamingExceptionEvent;
16  
17  import nl.tudelft.simulation.logger.Logger;
18  
19  /***
20   * The local wrapper for remoteContextListeners.
21   * <p>
22   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
23   * University of Technology </a>, the Netherlands. <br>
24   * See for project information <a
25   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
26   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
27   * License (GPL) </a>, no warranty <br>
28   * 
29   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
30   *         Jacobs </a>
31   * @version 1.2 Apr 14, 2004
32   * @since 1.4
33   */
34  public class RemoteContextListenerClient implements ContextListenerInterface
35  {
36  	/*** the target to use */
37  	private RemoteContextListenerInterface target = null;
38  
39  	/***
40  	 * constructs a new RemoteContextListenerClient
41  	 * 
42  	 * @param target the remote target on which method invocation must be
43  	 *        tunneled.
44  	 */
45  	public RemoteContextListenerClient(
46  			final RemoteContextListenerInterface target)
47  	{
48  		super();
49  		this.target = target;
50  	}
51  
52  	/***
53  	 * @see javax.naming.event.NamingListener
54  	 *      #namingExceptionThrown(javax.naming.event.NamingExceptionEvent)
55  	 */
56  	public void namingExceptionThrown(NamingExceptionEvent evt)
57  	{
58  		try
59  		{
60  			this.target.namingExceptionThrown(evt);
61  		} catch (RemoteException remoteException)
62  		{
63  			Logger.warning(this, "objectChanged", remoteException);
64  		}
65  	}
66  
67  	/***
68  	 * @see javax.naming.event.NamespaceChangeListener#objectAdded(javax.naming.event.NamingEvent)
69  	 */
70  	public void objectAdded(NamingEvent evt)
71  	{
72  		try
73  		{
74  			this.target.objectAdded(evt);
75  		} catch (RemoteException remoteException)
76  		{
77  			Logger.warning(this, "objectAdded", remoteException);
78  		}
79  	}
80  
81  	/***
82  	 * @see javax.naming.event.NamespaceChangeListener#objectRemoved(javax.naming.event.NamingEvent)
83  	 */
84  	public void objectRemoved(NamingEvent evt)
85  	{
86  		try
87  		{
88  			this.target.objectRemoved(evt);
89  		} catch (RemoteException remoteException)
90  		{
91  			Logger.warning(this, "objectRemoved", remoteException);
92  		}
93  	}
94  
95  	/***
96  	 * @see javax.naming.event.NamespaceChangeListener#objectRenamed(javax.naming.event.NamingEvent)
97  	 */
98  	public void objectRenamed(NamingEvent evt)
99  	{
100 		try
101 		{
102 			this.target.objectRenamed(evt);
103 		} catch (RemoteException remoteException)
104 		{
105 			Logger.warning(this, "objectRenamed", remoteException);
106 		}
107 	}
108 
109 	/***
110 	 * *
111 	 * 
112 	 * @see javax.naming.event.ObjectChangeListener#objectChanged(javax.naming.event.NamingEvent)
113 	 */
114 	public void objectChanged(NamingEvent evt)
115 	{
116 		try
117 		{
118 			this.target.objectChanged(evt);
119 		} catch (RemoteException remoteException)
120 		{
121 			Logger.warning(this, "objectChanged", remoteException);
122 		}
123 	}
124 }