Java Reference
In-Depth Information
NegotiationAgent client #
new NegotiationAgent (this,clientURL,preference);
// create a mediation agent and start the negotiation
// process
startActivity(new MediationAgent(this,client,provider));
The class NegotiationAgent is responsible for the interaction with the
remote actor, either the client or the provider of the service. It implements
the Negotiatior interface. The preference can be either a preference object
passed by a client or a reference to a ProviderPreference object that is remote.
The methods of the Negotiator interface are implemented as a delegation to
a BasicNegotiator object, in addition they send messages to the client to keep
it updated about the progress and result of the negotiation. Since the agent
must extend class DActivity to be remotely visible and Java forbids multiple
inheritance we are forced to used delegation.
package agent;
import mmi.DActivity;
import mmi.DProcess;
import mmi.DEvent;
import Negotiation.*;
import java.rmi.RemoteException;
public class NegotiationAgent extends DActivity implements
Negotiator {
// the preference of the negotiator
// (either the service provider or the service client)
private Preference preference;
// the URL of the negotiation client that will be notified
// about the progress of the negotiation
private String proxyURL;
// the negotiator object that is encapsulated by this
// agent
private Negotiator negotiator;
private boolean started;
public NegotiationAgent(DProcess process, String proxyURL,
Preference preference)
throws RemoteException{
super (process);
this .proxyURL # proxyURL;
this .preference # preference;
started # false ;
public void init(){
negotiator # new BasicNegotiator(preference);
Search WWH ::

Custom Search