View Javadoc

1   /*
2    * EmailApplication.java Created @ Feb 27, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   */
13  
14  package nl.tudelft.simulation.messaging.devices.reference;
15  
16  import java.rmi.RemoteException;
17  
18  import nl.tudelft.simulation.dsol.experiment.TimeUnit;
19  import nl.tudelft.simulation.dsol.experiment.TimeUnitInterface;
20  import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
21  import nl.tudelft.simulation.jstats.distributions.DistTriangular;
22  import nl.tudelft.simulation.messaging.comparators.FiFo;
23  import nl.tudelft.simulation.messaging.devices.components.DelaySendingDevice;
24  import nl.tudelft.simulation.messaging.devices.components.ReceivingDevice;
25  import nl.tudelft.simulation.messaging.devices.components.SendingReceivingDevice;
26  import nl.tudelft.simulation.messaging.devices.types.DeviceType;
27  import nl.tudelft.simulation.messaging.queues.MessageQueue;
28  
29  /***
30   * A reference implementation of an email application. <br>
31   * <br>
32   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
33   * Delft, the Netherlands. All rights reserved.
34   * 
35   * See for project information <a href="http://www.simulation.tudelft.nl/">
36   * www.simulation.tudelft.nl </a>.
37   * 
38   * The source code and binary code of this software is proprietary information
39   * of Delft University of Technology.
40   * 
41   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
42   *         Jacobs </a>, <a
43   *         href="mailto:s.p.a.vanhouten@tbm.tudelft.nl">Stijn-Pieter van Houten
44   *         </a>, <a
45   *         href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
46   *         Verbraeck </a>
47   * @version $$Revision: 1.3 $$ $$Date: 2005/04/08 11:29:12 $$
48   */
49  public class EmailApplication extends SendingReceivingDevice
50  {
51  	/*** the serial version uid */
52  	private static final long serialVersionUID = 12L;
53  
54  	/***
55  	 * Constructs a new EmailApplication.
56  	 * 
57  	 * @param name the name of the email application
58  	 * @param simulator the simulator to use
59  	 * @throws RemoteException on network failure
60  	 */
61  	public EmailApplication(final String name,
62  			final DEVSSimulatorInterface simulator) throws RemoteException
63  	{
64  		super(name, new ReceivingDevice(name + "-R", DeviceType.EMAIL,
65  				new MessageQueue(new FiFo())), new DelaySendingDevice(name
66  				+ "-S", DeviceType.EMAIL, simulator, new DistTriangular(
67  				simulator.getReplication().getStream("default"), TimeUnit
68  						.convert(1.0, TimeUnitInterface.SECOND, simulator),
69  				TimeUnit.convert(5.0, TimeUnitInterface.SECOND, simulator),
70  				TimeUnit.convert(15.0, TimeUnitInterface.SECOND, simulator))));
71  	}
72  }