@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 { }
/** * 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 { }
/** * 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 { }
/** * 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 { }
/** * 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; } }
@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())); } }
/** * 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 { }
/** * 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 { }
@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 { }
/** * Chat micro agent. */ @Description("This agent offers a chat service.") @ProvidedServices({ @ProvidedService(name="chat", type=IChatService.class, implementation=@Implementation(ChatService.class)), @ProvidedService(type=IChatGuiService.class, implementation=@Implementation(expression="$component.getRawService(\"chat\")")) }) @RequiredServices( @RequiredService(name="chatservices", type=IChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_GLOBAL)) ) public class ChatAgent extends MicroAgent { }
@Agent @Goals(@Goal(clazz=StampGoal.class)) @RequiredServices(@RequiredService(name="stampser", type=IStampService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) @Plans(@Plan(trigger=@Trigger(goals=StampGoal.class), body=@Body(service=@ServicePlan(name="stampser")))) public class WorkpieceBDI { @AgentBody public void body(IInternalAccess agent) { agent.getComponentFeature(IBDIAgentFeature.class).dispatchTopLevelGoal(new StampGoal(agent.getComponentIdentifier(), "date: "+System.currentTimeMillis())).get(); } }
/** * Test if pojo services can be passed as local parameters. */ @Agent @ProvidedServices(@ProvidedService(type=IDService.class, implementation=@Implementation(PojoDService.class))) @RequiredServices(@RequiredService(name="cms", type=IComponentManagementService.class, binding=@Binding(scope=Binding.SCOPE_PLATFORM))) @Results(@Result(name="testresults", clazz=Testcase.class)) @Configurations({@Configuration(name="first"), @Configuration(name="second")}) public class ServiceParameterAgent { }
/** * Chat micro agent. */ @Description("This agent offers a chat service.") @ProvidedServices({ @ProvidedService(name="chat", type=IChatService.class, implementation=@Implementation(ChatService.class)), @ProvidedService(type=IChatGuiService.class, implementation=@Implementation(expression="$component.getRawService(\"chat\")")) }) @RequiredServices( @RequiredService(name="chatservices", type=IChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_GLOBAL)) ) @Arguments(@Argument(name="nosave", clazz=boolean.class, description="Don't save settings.")) public class ChatAgent extends MicroAgent { }
/** * Base class agent. */ @Agent @Description("Base description") @Imports({"b1", "b2"}) @Properties({@NameValue(name="a", value="\"ba\""), @NameValue(name="b", value="\"bb\"")}) @RequiredServices(@RequiredService(name="clock", type=IClockService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) @ProvidedServices(@ProvidedService(name="myservice", type=IAService.class, implementation=@Implementation(Object.class))) @Arguments(@Argument(name="arg1", defaultvalue="\"bval\"", clazz=String.class)) @Results(@Result(name="res1", defaultvalue="\"bres\"", clazz=String.class)) @Configurations({@Configuration(name="config1"), @Configuration(name="config2")}) public abstract class BaseAgent { }
/** * Chat micro agent. */ @Description("This agent offers a chat service.") @ProvidedServices({ @ProvidedService(name="chat", type=IChatService.class, implementation=@Implementation(ChatService.class)), @ProvidedService(name="chatgui", type=IChatGuiService.class, implementation=@Implementation(expression="$component.getComponentFeature(jadex.bridge.service.component.IProvidedServicesFeature.class).getProvidedServiceRawImpl(\"chat\")")) }) @RequiredServices( @RequiredService(name="chatservices", type=IChatService.class, multiple=true, binding=@Binding(dynamic=true, scope=Binding.SCOPE_GLOBAL)) ) @Arguments(@Argument(name="nosave", clazz=boolean.class, description="Don't save settings.")) @Agent @Properties(@NameValue(name="system", value="\"system\".equals($config)")) @Configurations({@Configuration(name="system"), @Configuration(name="user")}) public class ChatAgent { // @Agent // protected IInternalAccess agent; // // @AgentCreated // public void body() // { // System.out.println("config: "+agent.getConfiguration()); // } }