/*********************************************************************/
/* */
/* AgentService Framework */
/* www.agentservice.it */
/* */
/* Copyright (C) 2007 l.i.d.o. - DIST, University of Genoa, Italy */
/* GNU Lesser General Public License */
/* */
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public */
/* License as published by the Free Software Foundation, */
/* version 2.1 of the License. */
/* */
/* This library is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public */
/* License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/* */
/*********************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using AgentService.Platform.Modules.Default;
namespace AgentService.Platform.MTS
{
///
/// Class MessageReceivedEventArgs. It contains the args of an event.
///
[Serializable()]
public class MessageReceivedEventArgs: EventArgs
{
///
/// The message send by a remote platform.
///
protected AgentMessage message;
///
/// The message send by a remote platform.
///
public AgentMessage Message
{
get
{
return this.message;
}
}
///
/// Costructs a MessageReceivedEventArgs
///
///
public MessageReceivedEventArgs(AgentMessage message)
{
this.message = message;
}
}
public delegate void MessageReceivedEventHandler(object sender, MessageReceivedEventArgs args);
///
/// Class RemotingSend. It receives the message sent by the remote platform and raises an event.
///
public class RemotingSend : MarshalByRefObject, IRemotingSend
{
///
/// The event handler for the event raised when a message is received.
///
public event MessageReceivedEventHandler MessageReceived;
///
/// Costructs a default RemotingSend.
///
public RemotingSend()
{
}
///
/// Sends a message to the remote platform.
///
/// The message to send.
public void SendMessage(AgentMessage message)
{
if (this.MessageReceived != null)
{
this.MessageReceived(this, new MessageReceivedEventArgs(message));
}
}
public override object InitializeLifetimeService()
{
return null;
}
}
///
/// Exception raised in case of remoting faults.
///
public class RemotingSendException: AgentService.Generic.AgentServiceException
{
///
/// AgentService default exception message
///
public new readonly static string DefaultMessage = "Remoting Send Exception";
///
/// Constructs a RemotingSendException object with the default message
///
public RemotingSendException()
: base(RemotingSendException.DefaultMessage)
{
}
///
/// Constructs a RemotingSendException object
///
public RemotingSendException(string message)
: base(message)
{
}
}
}