com.almende.eve.agent.example
Class TestAgent

java.lang.Object
  extended by com.almende.eve.agent.Agent
      extended by com.almende.eve.agent.example.TestAgent
All Implemented Interfaces:
AgentInterface, TestAgentInterface

public class TestAgent
extends Agent
implements TestAgentInterface


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.almende.eve.agent.example.TestAgentInterface
TestAgentInterface.STATUS
 
Constructor Summary
TestAgent()
           
 
Method Summary
 Double add(Double a, Double b)
           
 String callMyself(String method, com.fasterxml.jackson.databind.node.ObjectNode params)
           
 void cancelTask(String id)
           
 String cascade()
           
 Person cascade2()
           
 void complexParameter(Map<String,List<Double>> values)
           
 void create()
          This method is called once in the life time of an agent, at the moment the agent is being created by the AgentFactory.
 String createTask(long delay)
           
 void delete()
          This method is called once in the life time of an agent, at the moment the agent is being deleted by the AgentFactory.
 void deleteMySelf()
           
 void destroy()
          This method can is called when the agent is uninitialized, and is needed finalize the state of the agent.
 Double divide(Double a, Double b)
           
 String get(String key)
           
 String getDescription()
          Retrieve a description of the agents functionality
 Object getEverything()
           
 com.fasterxml.jackson.databind.node.ArrayNode getListOfMerlin()
           
 Double getMarksAvg(Person person)
           
 String getName(Person person)
           
 Person getPerson(String name)
           
 Set<String> getTasks()
           
 com.fasterxml.jackson.databind.node.ArrayNode getUrlsOfGloria()
           
 com.fasterxml.jackson.databind.node.ArrayNode getUrlsOfJos()
           
 com.fasterxml.jackson.databind.node.ArrayNode getUrlsOfMerlin()
           
 void getUrlsOfMerlinAsync()
           
 String getVersion()
          Retrieve the agents version number
 Double increment()
           
 void init()
          This method is called directly after the agent and its state is initiated.
 String invalidMethod(String param1, int param2)
           
 void methodVersionOne()
           
 void methodVersionOne(String param)
           
 Double multiply(Double a, Double b)
           
 void myTask(String message)
           
 void onEvent(String subscriptionId, String agent, String event, com.fasterxml.jackson.databind.node.ObjectNode params)
           
 String ping(String message, String sender)
           
 void pingCallback(com.fasterxml.jackson.databind.node.ObjectNode params)
           
 String printParams(com.fasterxml.jackson.databind.node.ObjectNode params)
           
 void put(String key, String value)
           
 void registerPingEvent()
           
 String subscribeToAgent(String url)
           
 Double subtract(Double a, Double b)
           
 Double sum(List<Double> values)
           
 Double sumArray(Double[] values)
           
 Double testAgentProxy()
           
 Double testAgentProxy2()
           
 List<Object> testAgentProxy3(Boolean asJSON)
           
 Double testAgentProxy4()
           
 void testAgentProxy5()
           
 void testAsyncHTTP()
           
 void testAsyncXMPP(String url)
           
 TestAgentInterface.STATUS testEnum(TestAgentInterface.STATUS status)
           
 TestAgentInterface.STATUS testEnumProxy()
           
 TestAgentInterface.STATUS testEnumSend()
           
 void testGetContacts(String url)
           
 Object testSend(String url, String method)
           
 String testSendNonExistingMethod()
           
 void testSyncXMPP(String url)
           
 void testVoid()
           
 void testVoidProxy()
           
 void throwException()
           
 void throwJSONRPCException()
           
 void triggerDataChanged()
           
 void triggerPingEvent(String message)
           
 void unregisterPingEvent()
           
 void unsubscribeFromAgent(String url, String subscriptionId)
           
 void xmppConnect(String username, String password)
           
 void xmppDisconnect()
           
 
Methods inherited from class com.almende.eve.agent.Agent
clear, createAgentProxy, finalize, getAgentFactory, getContext, getId, getMethods, getScheduler, getState, getType, getUrls, onSubscribe, onTrigger, onUnsubscribe, send, send, send, send, sendAsync, sendAsync, setAgentFactory, setState, subscribe, toString, trigger, unsubscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.almende.eve.agent.AgentInterface
getId, getMethods, getType, getUrls, onSubscribe, onUnsubscribe
 

Constructor Detail

TestAgent

public TestAgent()
Method Detail

ping

public String ping(String message,
                   String sender)
            throws Exception
Throws:
Exception

create

public void create()
Description copied from class: Agent
This method is called once in the life time of an agent, at the moment the agent is being created by the AgentFactory. It can be overridden and used to perform some action when the agent is create, in that case super.create() should be called in the overridden create().

Overrides:
create in class Agent

delete

public void delete()
Description copied from class: Agent
This method is called once in the life time of an agent, at the moment the agent is being deleted by the AgentFactory. It can be overridden and used to perform some action when the agent is deleted, in that case super.delete() should be called in the overridden delete().

Overrides:
delete in class Agent

init

public void init()
Description copied from class: Agent
This method is called directly after the agent and its state is initiated. It can be overridden and used to perform some action when the agent is initialized, in that case super.init() should be called in the overridden init().

Overrides:
init in class Agent

destroy

public void destroy()
Description copied from class: Agent
This method can is called when the agent is uninitialized, and is needed finalize the state of the agent. It can be overridden and used to perform some action when the agent is uninitialized, in that case super.destroy() should be called in the overridden destroy().

Overrides:
destroy in class Agent

getName

public String getName(Person person)

getMarksAvg

public Double getMarksAvg(Person person)

callMyself

public String callMyself(String method,
                         com.fasterxml.jackson.databind.node.ObjectNode params)
                  throws IOException,
                         JSONRPCException,
                         Exception
Throws:
IOException
JSONRPCException
Exception

testEnum

public TestAgentInterface.STATUS testEnum(TestAgentInterface.STATUS status)
Specified by:
testEnum in interface TestAgentInterface

testEnumProxy

public TestAgentInterface.STATUS testEnumProxy()

testVoid

public void testVoid()
Specified by:
testVoid in interface TestAgentInterface

testVoidProxy

public void testVoidProxy()

testEnumSend

public TestAgentInterface.STATUS testEnumSend()
                                       throws Exception
Throws:
Exception

cascade

public String cascade()
               throws IOException,
                      JSONRPCException,
                      Exception
Throws:
IOException
JSONRPCException
Exception

cascade2

public Person cascade2()
                throws IOException,
                       JSONRPCException,
                       Exception
Throws:
IOException
JSONRPCException
Exception

getPerson

public Person getPerson(String name)

add

public Double add(Double a,
                  Double b)
Specified by:
add in interface TestAgentInterface

subtract

public Double subtract(Double a,
                       Double b)

multiply

public Double multiply(Double a,
                       Double b)
Specified by:
multiply in interface TestAgentInterface

divide

public Double divide(Double a,
                     Double b)

printParams

public String printParams(com.fasterxml.jackson.databind.node.ObjectNode params)

throwException

public void throwException()
                    throws Exception
Throws:
Exception

throwJSONRPCException

public void throwJSONRPCException()
                           throws Exception
Throws:
Exception

sum

public Double sum(List<Double> values)

sumArray

public Double sumArray(Double[] values)

complexParameter

public void complexParameter(Map<String,List<Double>> values)

increment

public Double increment()
Specified by:
increment in interface TestAgentInterface

get

public String get(String key)

put

public void put(String key,
                String value)

registerPingEvent

public void registerPingEvent()
                       throws Exception
Throws:
Exception

unregisterPingEvent

public void unregisterPingEvent()
                         throws Exception
Throws:
Exception

pingCallback

public void pingCallback(com.fasterxml.jackson.databind.node.ObjectNode params)

triggerPingEvent

public void triggerPingEvent(String message)
                      throws Exception
Throws:
Exception

cancelTask

public void cancelTask(String id)

createTask

public String createTask(long delay)
                  throws Exception
Throws:
Exception

getTasks

public Set<String> getTasks()

myTask

public void myTask(String message)
            throws Exception
Throws:
Exception

testSend

public Object testSend(String url,
                       String method)
                throws Exception
Throws:
Exception

testSendNonExistingMethod

public String testSendNonExistingMethod()
                                 throws Exception
Throws:
Exception

subscribeToAgent

public String subscribeToAgent(String url)
                        throws Exception
Throws:
Exception

unsubscribeFromAgent

public void unsubscribeFromAgent(String url,
                                 String subscriptionId)
                          throws Exception
Throws:
Exception

triggerDataChanged

public void triggerDataChanged()
                        throws Exception
Throws:
Exception

getEverything

public Object getEverything()

onEvent

public void onEvent(String subscriptionId,
                    String agent,
                    String event,
                    com.fasterxml.jackson.databind.node.ObjectNode params)
             throws Exception
Throws:
Exception

methodVersionOne

public void methodVersionOne()

methodVersionOne

public void methodVersionOne(String param)

invalidMethod

public String invalidMethod(String param1,
                            int param2)

testAsyncXMPP

public void testAsyncXMPP(String url)
                   throws Exception
Throws:
Exception

testSyncXMPP

public void testSyncXMPP(String url)
                  throws Exception
Throws:
Exception

testGetContacts

public void testGetContacts(String url)
                     throws Exception
Throws:
Exception

testAsyncHTTP

public void testAsyncHTTP()
                   throws Exception
Throws:
Exception

xmppConnect

public void xmppConnect(String username,
                        String password)
                 throws Exception
Throws:
Exception

xmppDisconnect

public void xmppDisconnect()
                    throws Exception
Throws:
Exception

deleteMySelf

public void deleteMySelf()
                  throws Exception
Throws:
Exception

testAgentProxy

public Double testAgentProxy()

testAgentProxy2

public Double testAgentProxy2()

testAgentProxy3

public List<Object> testAgentProxy3(Boolean asJSON)

testAgentProxy5

public void testAgentProxy5()

testAgentProxy4

public Double testAgentProxy4()

getUrlsOfGloria

public com.fasterxml.jackson.databind.node.ArrayNode getUrlsOfGloria()
                                                              throws Exception
Throws:
Exception

getUrlsOfMerlinAsync

public void getUrlsOfMerlinAsync()
                          throws Exception
Throws:
Exception

getUrlsOfMerlin

public com.fasterxml.jackson.databind.node.ArrayNode getUrlsOfMerlin()
                                                              throws Exception
Throws:
Exception

getUrlsOfJos

public com.fasterxml.jackson.databind.node.ArrayNode getUrlsOfJos()
                                                           throws Exception
Throws:
Exception

getListOfMerlin

public com.fasterxml.jackson.databind.node.ArrayNode getListOfMerlin()
                                                              throws Exception
Throws:
Exception

getVersion

public String getVersion()
Description copied from interface: AgentInterface
Retrieve the agents version number

Specified by:
getVersion in interface AgentInterface
Specified by:
getVersion in class Agent
Returns:
version

getDescription

public String getDescription()
Description copied from interface: AgentInterface
Retrieve a description of the agents functionality

Specified by:
getDescription in interface AgentInterface
Specified by:
getDescription in class Agent
Returns:
description


Copyright © 2013 Almende BV. All Rights Reserved.