View Javadoc

1   /*
2    * RemoteEventListener.java Created @ Mar 24, 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  
11  package nl.tudelft.simulation.event.remote;
12  
13  import java.rmi.RemoteException;
14  import java.rmi.server.UnicastRemoteObject;
15  import java.util.logging.Logger;
16  
17  import nl.tudelft.simulation.event.EventInterface;
18  import nl.tudelft.simulation.event.EventListenerInterface;
19  
20  /***
21   * The RemoteEventListener class embodies a remoteEventListener. <br>
22   * (c) copyright 2004 <a href="http://www.simulation.tudelft.nl">Delft
23   * University of Technology </a>, the Netherlands. <br>
24   * See for project information <a href="http://www.simulation.tudelft.nl">
25   * 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   * @version 1.0 Mar 24, 2004 <br>
30   * @author <a
31   *         href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
32   *         van Houten </a>
33   */
34  public class RemoteEventListener implements RemoteEventListenerInterface
35  {
36  	/*** the owner of the remote listener */
37  	private EventListenerInterface owner = null;
38  
39  	/***
40  	 * Constructs a new RemoteListener.
41  	 * 
42  	 * @param owner The owner of the listener.
43  	 */
44  	public RemoteEventListener(final EventListenerInterface owner)
45  	{
46  		super();
47  		try
48  		{
49  			UnicastRemoteObject.exportObject(this);
50  		} catch (RemoteException remoteException)
51  		{
52  			Logger.getLogger("nl.tudelft.simulation.event").severe(
53  					remoteException.getMessage());
54  		}
55  
56  		this.owner = owner;
57  	}
58  
59  	/***
60  	 * @see nl.tudelft.simulation.event.EventListenerInterface#
61  	 *      notify(nl.tudelft.simulation.event.EventInterface)
62  	 */
63  	public void notify(final EventInterface event) throws RemoteException
64  	{
65  		this.owner.notify(event);
66  	}
67  }