javadatabasejavaagentsagents-jademulti-agent

How do intelligent Agents work with data base?


I am working with JADE framework and I want to know is there any way for intelligent agents to work with some kind of data base, where they can read from it and write some information?..

I tried to make a connection between excel (using jxl) and my project but there is a problem: below is the code for writing in excel file:

public static void write(String[] args) throws Exception {
    // TODO code application logic here
    File f = new File("C:\\Users\\Mastisa\\Desktop\\Master.xls");
    WritableWorkbook  Master = Workbook.createWorkbook(f);
    WritableSheet History_Table = Master.createSheet("History_Table", 0);

    Label L00 = new Label (0,0,"RUN#");

    History_Table.addCell(L00);


    Master.write();

    System.out.println("finished...");

    Master.close();
}

}

but I want agents to do something like this:

Database D;
D.add(myAgent.getLocalName);

but it is not possible as jxl doesn't provide functions for working with agents. and it looks like that everything must be written in that excel file manually.... but it is not what I want.. I want agents comfortably read and write...

Is there any other way?


Solution

  • Yes basically when you create a JADE agent, you can add behaviors to those Agents, There are several types of behaviors, you should be choosing them based on your requirement. You can find the list of behaviors here

    For an Example,

    public class MyAgent extends Agent
    {
        @Override
        protected void setup()
        {
             addBehaviour( new InformBehaviour() );
        }
        private class InformBehaviour extends CyclicBehaviour
        {
            //dostuff
        }
    }
    

    So basic idea is you need to do all these inside a behavior of a agent.

    Make sure you choose right behaviour which suites your requirement.