
jadex.platform.service.remote.ProxyAgent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-platform Show documentation
Show all versions of jadex-platform Show documentation
The Jadex platform package contains implementations of
platform services as well as the platform component itself.
The newest version!
package jadex.platform.service.remote;
import jadex.bridge.IComponentIdentifier;
import jadex.bridge.IExternalAccess;
import jadex.bridge.ServiceCall;
import jadex.bridge.nonfunctional.INFMixedPropertyProvider;
import jadex.bridge.nonfunctional.annotation.NFProperties;
import jadex.bridge.nonfunctional.annotation.NFProperty;
import jadex.bridge.sensor.service.LatencyProperty;
import jadex.bridge.service.IService;
import jadex.bridge.service.IServiceContainer;
import jadex.bridge.service.RequiredServiceInfo;
import jadex.bridge.service.annotation.Service;
import jadex.bridge.service.types.cms.IComponentManagementService;
import jadex.bridge.service.types.remote.IProxyAgentService;
import jadex.commons.future.ExceptionDelegationResultListener;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import jadex.commons.future.IResultListener;
import jadex.micro.MicroAgent;
import jadex.micro.annotation.Argument;
import jadex.micro.annotation.Arguments;
import jadex.micro.annotation.Description;
import jadex.micro.annotation.ProvidedService;
import jadex.micro.annotation.ProvidedServices;
import java.util.Map;
/**
* A proxy agent is a pseudo component that mirrors services of a remote platform (or component).
*/
@Description("This agent represents a proxy for a remote component.")
@Arguments(@Argument(name="component", clazz=IComponentIdentifier.class, defaultvalue="null", description="The component id of the remote component/platform."))
@ProvidedServices(@ProvidedService(type=IProxyAgentService.class))
@NFProperties(@NFProperty(ProxyLatencyProperty.class))
@Service
//@RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, multiple=true,
// binding=@Binding(scope=RequiredServiceInfo.SCOPE_GLOBAL, dynamic=true),
// nfprops=@NFRProperty(value=LatencyProperty.class, methodname="getConnectionState")))
public class ProxyAgent extends MicroAgent implements IProxyAgentService
{
//-------- attributes --------
/** The remote component identifier. */
protected IComponentIdentifier rcid;
/** The remote cms. */
protected IComponentManagementService rcms;
/** The injected flag. */
protected boolean injected;
//-------- methods --------
/**
* The agent created method.
*/
public IFuture agentCreated()
{
getServiceContainer().getService(IComponentManagementService.class, rcid.getRoot())
.addResultListener(new IResultListener()
{
public void resultAvailable(IComponentManagementService cms)
{
rcms = cms;
// ServiceCall next = ServiceCall.getOrCreateNextInvocation();
// next.setProperty("debugsource", "ProxyAgent.agentCreated()");
cms.getExternalAccess(getComponentIdentifier().getRoot())
.addResultListener(new IResultListener()
{
public void resultAvailable(IExternalAccess pl)
{
pl.getArguments().addResultListener(createResultListener(new IResultListener
© 2015 - 2025 Weber Informatics LLC | Privacy Policy