@RequiredServices(@RequiredService(name="timeservices", type=ITimeService.class, multiple=true, binding=@Binding(scope=Binding.SCOPE_GLOBAL))) public class TimeUserAgent
@RequiredServices(@RequiredService(name="env", type=IHunterPreyEnvironmentService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM))) public class ServicePreyAgent
@Description("This agent is an empty minimal calculator.") @RequiredServices({ @RequiredService(name="addservice", type=IAddService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)), @RequiredService(name="subservice", type=ISubService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)) }) @Agent public class EmptyCalculatorAgent { }
/** * Service 1 agent. * Calls service 2 on agent 2. */ @Agent(autoprovide=true) @Service @RequiredServices({@RequiredService(name = "ser2", type=IService2.class, binding = @Binding(dynamic = true, scope = Binding.SCOPE_PLATFORM))}) public class Service1Agent implements IService1 { @Agent protected IInternalAccess agent; public IFuture<Void> service() { IService2 ser2 = (IService2)agent.getComponentFeature(IRequiredServicesFeature.class).getRequiredService("ser2").get(); ser2.service().get(); return IFuture.DONE; } }
@Agent @RequiredServices(@RequiredService(name="ls", type=ILotteryService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_GLOBAL))) public class HumanPlayerAgent
@RequiredServices(@RequiredService(name="timeservices", type=ITimeService.class, multiple=true, binding=@Binding(scope=Binding.SCOPE_GLOBAL))) public class NonblockingTimeUserAgent
@Agent @RequiredServices(@RequiredService(name="ls", type=ILotteryService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_GLOBAL))) public class PlayerAgent
@Description("This agent uses the clock service.") @Agent @RequiredServices(@RequiredService(name = "clockservice", type = IClockService.class, binding = @Binding(scope = Binding.SCOPE_PLATFORM))) public class ChatC1Agent { @Agent protected IInternalAccess agent; // Lazy false means that agent init waits for service search being done @AgentService(lazy=false) protected IClockService clockservice; @AgentBody public void executeBody() { System.out.println("Time for a chat, buddy: "+ new Date(clockservice.getTime())); } }
@Agent @RequiredServices({@RequiredService(name = "testService", type = ITestService.class, multiple = true, binding = @Binding(scope = RequiredServiceInfo.SCOPE_PLATFORM)) }) public class UserAgent
/** * Chat micro agent that uses the clock service. */ @Description("This agent uses the clock service.") @Agent @RequiredServices(@RequiredService(name="clockservice", type=IClockService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM))) public class ChatC2Agent { /** The required services feature. */ @AgentFeature protected IRequiredServicesFeature requiredServicesFeature; /** * Execute the functional body of the agent. * Is only called once. */ @AgentBody public void executeBody() { IFuture<IClockService> fut = requiredServicesFeature.getRequiredService("clockservice"); fut.addResultListener(new DefaultResultListener<IClockService>() { public void resultAvailable(IClockService cs) { System.out.println("Time for a chat, buddy: "+new Date(cs.getTime())); } }); } }
/** * Daemon agent provides functionalities for managing platforms. */ @Description("This agent offers the daemon service.") @GuiClassName("jadex.tools.daemon.DaemonViewerPanel") @RequiredServices(@RequiredService(name = "libservice", type = ILibraryService.class, binding = @Binding(scope = RequiredServiceInfo.SCOPE_PLATFORM))) @ProvidedServices(@ProvidedService(type = IDaemonService.class, implementation = @Implementation(DaemonService.class))) @Agent public class DaemonAgent //extends MicroAgent { }
@RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) public class KillAgent
@RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM))) public class ChatC3Agent
/** * Agent that wraps a normal web service as Jadex service. * In this way the web service can be used by active components * in the same way as normal Jadex component services. */ @Agent @RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) @ComponentTypes(@ComponentType(name="invocation", filename="jadex/platform/service/ws/WebServiceInvocationAgent.class")) public class WebServiceAgent { //-------- attributes -------- /** The micro agent. */ @Agent protected MicroAgent agent; //-------- methods -------- /** * Create a wrapper service implementation based on the JAXB generated * Java service class and the service mapping information. */ public Object createServiceImplementation(Class<?> type, WebServiceMappingInfo mapping) { return Proxy.newProxyInstance(agent.getClassLoader(), new Class[]{type}, new WebServiceWrapperInvocationHandler(agent, mapping)); } }
/** * Convenience agent that wraps a normal rest web service as Jadex service. * In this way the web service can be used by active components * in the same way as normal Jadex component services. */ @Agent @RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) @ComponentTypes(@ComponentType(name="invocation", filename="jadex/extension/rs/invoke/RestServiceInvocationAgent.class")) public class RestServiceAgent { //-------- attributes -------- /** The micro agent. */ @Agent protected MicroAgent agent; //-------- methods -------- /** * Create a wrapper service implementation based on mapping information. */ public Object createServiceImplementation(Class<?> type, Class<?> impl) { return Proxy.newProxyInstance(agent.getClassLoader(), new Class[]{type}, RSFactory.getInstance().createRSWrapperInvocationHandler(agent, impl)); } }
@Imports( { "jadex.bridge.service.types.factory.*", "jadex.bridge.service.types.cms.*" }) @Arguments(@Argument(name="extensions", clazz=String.class)) @ProvidedServices(@ProvidedService(type=IExtensionLoaderService.class, implementation=@Implementation(ExtensionLoaderService.class))) @RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM))) @Agent public class ExtensionsAgent { }