@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 { }
/** * Create a service binding. */ protected RequiredServiceBinding createBinding(Binding bd) { return bd==null || Implementation.BINDING_NULL.equals(bd.name()) ? null: new RequiredServiceBinding(bd.name(), bd.componentname().length()==0? null: bd.componentname(), bd.componenttype().length()==0? null: bd.componenttype(), bd.dynamic(), bd.scope(), bd.create(), bd.recover(), createUnparsedExpressions(bd.interceptors()), bd.proxytype(), bd.creationinfo().type().length()>0? createComponentInstanceInfo(bd.creationinfo()): null); }
/** * Agent that can process generate requests. */ @Description("Agent offering a generate service.") @ProvidedServices(@ProvidedService(type=IGenerateService.class, implementation=@Implementation(GenerateService.class))) @RequiredServices({ @RequiredService(name="displayservice", type=IDisplayService.class, binding=@Binding(create=true, dynamic=true, creationinfo=@CreationInfo(type="Display"))), @RequiredService(name="calculateservices", type=ICalculateService.class, multiple=true, binding=@Binding(scope=RequiredServiceInfo.SCOPE_GLOBAL)), @RequiredService(name="cmsservice", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM)), @RequiredService(name="generateservice", type=IGenerateService.class) }) @Agent public class GenerateAgent { }
/** * Create a service binding. */ protected RequiredServiceBinding createBinding(Binding bd) { return bd==null || Implementation.BINDING_NULL.equals(bd.name()) ? null: new RequiredServiceBinding(bd.name(), bd.componentname().length()==0? null: bd.componentname(), bd.componenttype().length()==0? null: bd.componenttype(), bd.dynamic(), bd.scope(), bd.create(), bd.recover(), createUnparsedExpressions(bd.interceptors()), bd.proxytype(), bd.creationinfo().type().length()>0? createComponentInstanceInfo(bd.creationinfo()): null); }
/** * Chat micro agent provides a basic chat service. */ @Description("This agent provides a basic chat service.") @Agent @ProvidedServices(@ProvidedService(type=IChatService.class, implementation=@Implementation(ChatServiceD2.class))) @RequiredServices({ @RequiredService(name="clockservice", type=IClockService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)), @RequiredService(name="chatservices", type=IChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_PLATFORM)) }) public class ChatD2Agent { }
/** * Chat micro agent offers profile information. */ @Description("This agent offers profile information.") @Agent @ProvidedServices(@ProvidedService(type=IExtendedChatService.class, implementation=@Implementation(ChatServiceD3.class))) @RequiredServices({ @RequiredService(name="clockservice", type=IClockService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)), @RequiredService(name="chatservices", type=IExtendedChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_PLATFORM)) }) public class ChatD3Agent { }
/** * Chat micro agent with a . */ @Description("This agent provides a basic chat service.") @Agent @ProvidedServices(@ProvidedService(type=IChatService.class, implementation=@Implementation(value=ChatServiceD5.class))) @RequiredServices({ @RequiredService(name="clockservice", type=IClockService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)), @RequiredService(name="chatservices", type=IChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_GLOBAL)) }) public class ChatD5Agent { }
binding=@Binding(scope=Binding.SCOPE_GLOBAL))) public class TimeUserAgent
/** * Chat micro agent with a spam interceptor. */ @Description("This agent provides a basic chat service.") @Agent @ProvidedServices(@ProvidedService(type=IExtendedChatService.class, implementation=@Implementation(value=ChatServiceD4.class, interceptors=@Value(clazz=SpamInterceptorD4.class)))) @RequiredServices({ @RequiredService(name="clockservice", type=IClockService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)), @RequiredService(name="chatservices", type=IExtendedChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_PLATFORM)) }) public class ChatD4Agent { }
binding=@Binding(scope=Binding.SCOPE_PLATFORM))) public class ServicePreyAgent
@RequiredServices( @RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM)), @RequiredService(name="ts", type=ITestService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_GLOBAL)), @RequiredService(name="aser", type=ITestService.class, multiple=true, binding=@Binding(scope=RequiredServiceInfo.SCOPE_GLOBAL, dynamic=true), nfprops=@NFRProperty(value=LatencyProperty.class, methodname="methodA", methodparametertypes=long.class)) })
/** * 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
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
@RequiredService(name="raw", type=IServiceCallService.class, binding=@Binding(proxytype=Binding.PROXYTYPE_RAW, dynamic=true, scope=Binding.SCOPE_GLOBAL)), @RequiredService(name="direct", type=IServiceCallService.class, binding=@Binding(proxytype=Binding.PROXYTYPE_DIRECT, dynamic=true, scope=Binding.SCOPE_GLOBAL)), @RequiredService(name="decoupled", type=IServiceCallService.class, binding=@Binding(proxytype=Binding.PROXYTYPE_DECOUPLED, dynamic=true, scope=Binding.SCOPE_GLOBAL)), @RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM)) }) @Agent
@RequiredServices(@RequiredService(name="clock", type=IClockService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) @Results(@Result(name="testresults", clazz=Testcase.class)) public class RequiredServicesAgent @AgentService(lazy=false, requiredservice=@RequiredService(name="", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) protected IComponentManagementService cms;
@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())); } }
@RequiredServices( @RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM)), @RequiredService(name="exaser", type=IExampleService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM)) }) @Results(@Result(name="testresults", clazz=Testcase.class))