Commit df540df2 by Juan Montilla

Primer commit

parents
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
\ No newline at end of file
( ap-description :name "192.168.56.1:1099/JADE" :ap-services (set ( ap-service :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://DESKTOP-E06R5MJ:7778/acc))))
This diff is collapsed. Click to expand it.
http://DESKTOP-E06R5MJ:7778/acc
This diff is collapsed. Click to expand it.
File mode changed
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<config-data xmlns="http://www.netbeans.org/ns/maven-config-data/1">
<configurations>
<configuration id="Jade" profiles="">
<property name="maven.wagon.http.ssl.allowall">true</property>
<property name="maven.wagon.http.ssl.insecure">true</property>
</configuration>
</configurations>
</config-data>
</project-shared-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.executable>java</exec.executable>
<exec.appArgs>-gui -host localhost -agents demo:com.uja.ssmmaa.primeragente.agentes.AgenteDemo</exec.appArgs>
<exec.vmArgs></exec.vmArgs>
<exec.mainClass>jade.Boot</exec.mainClass>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.appArgs>-gui -host localhost -agents demo:com.uja.ssmmaa.primeragente.agentes.AgenteDemo</exec.appArgs>
<exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.mainClass>jade.Boot</exec.mainClass>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.executable>java</exec.executable>
<exec.appArgs>-gui -host localhost -agents demo:com.uja.ssmmaa.primeragente.agentes.AgenteDemo</exec.appArgs>
<exec.vmArgs></exec.vmArgs>
<exec.mainClass>jade.Boot</exec.mainClass>
</properties>
</action>
</actions>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.uja.ssmmaa</groupId>
<artifactId>AgenteDemo</artifactId>
<version>v2.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>tilab</id>
<url>https://jade.tilab.com/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.tilab.jade</groupId>
<artifactId>jade</artifactId>
<version>4.5.0</version>
</dependency>
</dependencies>
<name>PrimerAgente</name>
<description>Ejemplo para el inicio de los proyectos de agentes JADE</description>
</project>
\ No newline at end of file
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.uja.ssmmaa.primeragente.agentes;
import com.uja.ssmmaa.primeragente.gui.AgenteDemoJFrame;
import jade.core.Agent;
import jade.core.behaviours.TickerBehaviour;
import jade.domain.DFService;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;
import jade.domain.FIPAException;
/**
*
* @author pedroj
*/
public class AgenteDemo extends Agent {
// Constantes
public static final long TIEMPO_CICLO = 10000; // 10 seg.
// Variables del agente
private AgenteDemoJFrame myGui;
private int ejecuciones;
/**
* Se ejecuta cuando se inicia el agente
*/
@Override
protected void setup() {
//Configuración del GUI y presentación
myGui = new AgenteDemoJFrame(this);
myGui.setVisible(true);
myGui.presentarSalida("Se inicia la ejecución de " + this.getName() + "\n");
//Incialización de variables
ejecuciones = 0;
//Registro de la Ontología
//Registro en Página Amarillas
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setType("Tipo de Servicio");
sd.setName("Nombre del Servicio");
dfd.addServices(sd);
try {
DFService.register(this, dfd);
}
catch (FIPAException fe) {
fe.printStackTrace();
}
// Se añaden las tareas principales
addBehaviour(new TareaEjemplo(this, TIEMPO_CICLO));
}
/**
* Se ejecuta al finalizar el agente
*/
@Override
protected void takeDown() {
//Desregistro de las Páginas Amarillas
try {
DFService.deregister(this);
}
catch (FIPAException fe) {
fe.printStackTrace();
}
//Se liberan los recuros y se despide
myGui.dispose();
System.out.println("Finaliza la ejecución de " + this.getName());
}
//Métodos del agente
//Clases que representan las tareas del agente
public class TareaEjemplo extends TickerBehaviour {
//Tarea de ejemplo que se repite cada 10 segundos
public TareaEjemplo(Agent a, long period) {
super(a, period);
}
@Override
protected void onTick() {
ejecuciones++;
myGui.presentarSalida("\nEjecución número: " + ejecuciones);
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.uja.ssmmaa.primeragente.agentes;
import jade.core.Agent;
/**
*
* @author pedroj
* Esqueleto de agente para la estructura general que deben tener todos los
* agentes
*/
public class AgentePlantilla extends Agent {
//Variables del agente
@Override
protected void setup() {
//Inicialización de las variables del agente
//Configuración del GUI
//Registro del agente en las Páginas Amarrillas
//Registro de la Ontología
System.out.println("Se inicia la ejecución del agente: " + this.getName());
//Añadir las tareas principales
}
@Override
protected void takeDown() {
//Eliminar registro del agente en las Páginas Amarillas
//Liberación de recursos, incluido el GUI
//Despedida
System.out.println("Finaliza la ejecución del agente: " + this.getName());
}
//Métodos de trabajo del agente
//Clases internas que representan las tareas del agente
}
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="0"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="botonFin" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="474" max="-2" attributes="0"/>
<EmptySpace pref="32" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="355" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="botonFin" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="salidaTexto">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
<Property name="focusable" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="botonFin">
<Properties>
<Property name="text" type="java.lang.String" value="Finalizar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="botonFinActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.uja.ssmmaa.primeragente.gui;
import com.uja.ssmmaa.primeragente.agentes.AgenteDemo;
/**
*
* @author pedroj
*/
public class AgenteDemoJFrame extends javax.swing.JFrame {
private AgenteDemo myAgent;
private FinalizacionDialog finalizacion;
/**
* Creates new form AgenteDemoJFrame
*/
public AgenteDemoJFrame(AgenteDemo myAgent) {
initComponents();
this.myAgent = myAgent;
this.setTitle(this.myAgent.getName());
}
public void presentarSalida (String msg) {
salidaTexto.append(msg);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
salidaTexto = new javax.swing.JTextArea();
botonFin = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
salidaTexto.setEditable(false);
salidaTexto.setColumns(20);
salidaTexto.setRows(5);
salidaTexto.setFocusable(false);
jScrollPane1.setViewportView(salidaTexto);
botonFin.setText("Finalizar");
botonFin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botonFinActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(botonFin)
.addGap(23, 23, 23))
.addGroup(layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(32, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(botonFin)
.addGap(19, 19, 19))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
finalizacion = new FinalizacionDialog(this, true, myAgent);
finalizacion.setVisible(true);
}//GEN-LAST:event_formWindowClosing
private void botonFinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonFinActionPerformed
// TODO add your handling code here:
myAgent.doDelete();
}//GEN-LAST:event_botonFinActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton botonFin;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea salidaTexto;
// End of variables declaration//GEN-END:variables
}
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" value="Finalizar"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Component id="botonCancelar" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="87" max="32767" attributes="0"/>
<Component id="botonFin" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="37" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="botonFin" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="botonCancelar" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="21" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="botonFin">
<Properties>
<Property name="text" type="java.lang.String" value="Finalizar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="botonFinActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="botonCancelar">
<Properties>
<Property name="text" type="java.lang.String" value="Cancelar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="botonCancelarActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.uja.ssmmaa.primeragente.gui;
import com.uja.ssmmaa.primeragente.agentes.AgenteDemo;
/**
*
* @author pedroj
*/
public class FinalizacionDialog extends javax.swing.JDialog {
private AgenteDemo myAgent;
/**
* Creates new form SalidaDialog
*/
public FinalizacionDialog(java.awt.Frame parent, boolean modal, AgenteDemo myAgent) {
super(parent, modal);
initComponents();
this.myAgent = myAgent;
this.setTitle("Finalizar " + this.myAgent.getName());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
botonFin = new javax.swing.JButton();
botonCancelar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Finalizar");
botonFin.setText("Finalizar");
botonFin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botonFinActionPerformed(evt);
}
});
botonCancelar.setText("Cancelar");
botonCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
botonCancelarActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(botonCancelar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
.addComponent(botonFin)
.addGap(37, 37, 37))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(botonFin)
.addComponent(botonCancelar))
.addContainerGap(21, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void botonFinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonFinActionPerformed
// TODO add your handling code here:
myAgent.doDelete();
}//GEN-LAST:event_botonFinActionPerformed
private void botonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCancelarActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_botonCancelarActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton botonCancelar;
private javax.swing.JButton botonFin;
// End of variables declaration//GEN-END:variables
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment