Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package RA;
- import ...
- /**
- * @author Nelson Rodrigues
- */
- public class RA extends Agent implements GraceAgent {
- private formRA_ myGui = null;
- private boolean isMyGuiON = false;
- @Override
- protected void setup(){
- initialization(); //t2
- // alocate the behaviour to handle the receive the messages
- WaitingMessages waitingMessages = new WaitingMessages(this, isMyGuiON, myGui);
- addBehaviour(waitingMessages);
- }
- @Override
- public void initialization(){
- loadProfile();
- registerAtDF();
- createGui();
- connectToLocalDB();
- }
- /**
- * Register the Resource_Agent service in the yellow pages
- * @return return the result of the operation
- */
- @Override
- public boolean registerAtDF(){
- boolean res = false;
- DFAgentDescription dfd = new DFAgentDescription();
- dfd.setName(getAID());
- ServiceDescription service = new ServiceDescription();
- service.setType("servico_RA");
- service.setName(getLocalName());
- dfd.addServices(service);
- // *log -> notify the view result of registration ?
- // -> notify the view the type of registration ?
- try {
- DFService.register(this, dfd);
- //*log
- res = true;
- }
- catch (FIPAException ex) {
- Logger.getLogger(RA.class.getName()).log(Level.SEVERE, null, ex);
- return false;
- }
- return res;
- }
- /**
- * Connect to local BD
- *
- */
- @Override
- public boolean connectToLocalDB()
- {
- //ver qual a base de dados pois sera com as ontologias isto
- throw new UnsupportedOperationException("Not supported yet.");
- }
- /**
- * //NOT DONE YET
- *
- * @return
- */
- @Override
- public boolean loadProfile()
- {
- //load profile de um ficheiro xml ?
- throw new UnsupportedOperationException("Not supported yet.");
- }
- @Override
- protected void takeDown()
- {
- //Deregistar das paginas amarelas
- //kill GUI
- }
- /**
- * //NOT DONE YET see book
- *
- */
- @Override
- public void createGui()
- {
- if (String.valueOf(getArguments()[0]).equals("gui")) {
- isMyGuiON = true;
- this.myGui = new formRA_(this);
- }
- }
- /**
- * //NOT DONE YET
- *
- * @return
- */
- @Override
- public void killGui()
- {
- //this.myGui.dispose();
- //kill the agent ??
- }
- }
Add Comment
Please, Sign In to add comment