/** * The translation agent A1. * * Empty agent that can be loaded and started. */ @Agent @Description("The translation agent A1. <br> Empty agent that can be loaded and started.") public class TranslationBDI { }
/** * Chat micro agent. */ @Description("This agent offers a chat service.") @Agent public class ChatB2Agent { }
/** * Agent that produces an exception during init. */ @Description("Agent that produces an exception during init.") @Agent public class PojoBrokenInitAgent { /** * Init the agent. */ @AgentCreated public IFuture<Void> agentCreated() { throw new RuntimeException("Exception in init."); } }
/** * Agent that produces an exception during init. */ @Description("Agent that produces an exception during init.") @Agent public class BrokenInitAgent { /** * Init the agent. */ @AgentCreated public IFuture<Void> agentCreated() { throw new RuntimeException("Exception in init."); } }
/** * Agent with protected body method. */ @Agent @Description("Agent with protected body method.") public class ProtectedBodyAgent { /** * Init the agent. */ @AgentCreated public void agentCreated() { // System.out.println("invoked created"); } /** * Perform the tests */ @AgentBody protected void executeBody() { System.out.println("invoked body"); } }
@Agent(keepalive=Boolean3.FALSE) @Description("Hello world agent that creates a hello plan.") public abstract class HelloWorldPlan2BDI implements IBDIAgent { /** * The agent body. */ @AgentBody public void body() { adoptPlan("printHello").get(); } /** * Plan that prints out goal text and passes. */ @Plan protected void printHello(IPlan plan) { System.out.println("Hello World."); plan.waitFor(1000).get(); System.out.println("Good bye."); } }
/** * Chat micro agent with a registry service. */ @Description("This agent provides a registry service.") @Agent @ProvidedServices(@ProvidedService(type=IRegistryServiceE3.class, implementation=@Implementation(RegistryServiceE3.class))) public class RegistryE3Agent { }
/** * A minimal test case agent serving as a demonstrator. */ @Description("A simple test showing how the test center works with micro agents.") @Results(@Result(name="testresults", clazz=Testcase.class)) @Agent public class SimpleTestAgent { @Agent protected IInternalAccess agent; /** * Just finish the test by setting the result and killing the agent. */ @AgentBody public void executeBody() { TestReport tr = new TestReport("#1", "Simple micro test."); tr.setSucceeded(true); agent.getComponentFeature(IArgumentsResultsFeature.class).getResults().put("testresults", new Testcase(1, new TestReport[]{tr})); agent.killComponent(); } }
@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 { }
/** * Calculator component that provides all services by itself. */ @Description("This agent is a minimal calculator.") @ProvidedServices({ //@ProvidedService(type=IAddService.class, expression="new AddService($component)"), @ProvidedService(type=IAddService.class, implementation=@Implementation(PojoAddService.class)), @ProvidedService(type=ISubService.class, implementation=@Implementation(expression="new SubService($component)")) }) @Agent public class CalculatorAgent { }
@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())); } }
/** * 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 { }
/** * 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 { }
/** * 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 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 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 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 { }
/** * 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 { }
/** * 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 { }
/** * 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 { }