Details
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RequestBeliefGoalPlanBody.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RequestBeliefGoalPlanBody.java
index 6d556df..3856bc7 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RequestBeliefGoalPlanBody.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RequestBeliefGoalPlanBody.java
@@ -21,6 +21,8 @@
//----------------------------------------------------------------------------
package br.ufrgs.inf.bdinetr.agent;
+import jade.content.ContentElement;
+import jade.content.lang.sl.SLCodec;
import jade.core.messaging.TopicManagementHelper;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;
@@ -28,11 +30,15 @@ import jade.lang.acl.MessageTemplate;
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import bdi4jade.belief.Belief;
import bdi4jade.goal.BeliefGoal;
import bdi4jade.plan.Plan.EndState;
import bdi4jade.plan.planbody.BeliefGoalPlanBody;
import br.ufrgs.inf.bdinetr.domain.Role;
+import br.ufrgs.inf.bdinetr.domain.ontology.BDINetROntology;
/**
* @author Ingrid Nunes
@@ -41,11 +47,14 @@ public class RequestBeliefGoalPlanBody extends BeliefGoalPlanBody {
public static final int MSG_TIME_OUT = 100;
public static final int ANSWER_TIME_OUT = 1000;
+ public static final String LANGUAGE = new SLCodec().getName();
private enum State {
Resquesting, ReceivingResponses, Selecting, AchievingGoal, Ended;
}
+ private static final Log log = LogFactory
+ .getLog(RequestBeliefGoalPlanBody.class);
private static final long serialVersionUID = -1833810388789537049L;
private MessageTemplate mt;
@@ -59,7 +68,9 @@ public class RequestBeliefGoalPlanBody extends BeliefGoalPlanBody {
switch (state) {
case Resquesting:
ACLMessage msg = new ACLMessage(ACLMessage.CFP);
- msg.setContentObject(getGoal());
+ msg.setLanguage(LANGUAGE);
+ msg.setOntology(BDINetROntology.ONTOLOGY_NAME);
+ myAgent.getContentManager().fillContent(msg, getGoal());
// FIXME send request to specific role
TopicManagementHelper topicHelper = (TopicManagementHelper) myAgent
@@ -81,14 +92,13 @@ public class RequestBeliefGoalPlanBody extends BeliefGoalPlanBody {
case ReceivingResponses:
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
- Object content = reply.getContentObject();
- if (content instanceof Boolean) {
- log.info("Agent " + reply.getSender() + "'s reply: "
- + content);
- if ((Boolean) content) {
- positiveAnswers.add(reply);
- log.info("Answers: " + positiveAnswers);
- }
+ if (ACLMessage.PROPOSE == reply.getPerformative()) {
+ log.info("Agent " + reply.getSender()
+ + "sent a proposal");
+ positiveAnswers.add(reply);
+ } else {
+ log.info("Agent " + reply.getSender()
+ + "refused the request");
}
} else {
block(MSG_TIME_OUT);
@@ -114,7 +124,6 @@ public class RequestBeliefGoalPlanBody extends BeliefGoalPlanBody {
reply.setPerformative(ACLMessage.ACCEPT_PROPOSAL);
reply.setReplyWith("cfp"
+ System.currentTimeMillis());
- reply.setContentObject(getGoal());
this.mt = MessageTemplate.and(MessageTemplate
.MatchConversationId(reply
.getConversationId()),
@@ -135,8 +144,9 @@ public class RequestBeliefGoalPlanBody extends BeliefGoalPlanBody {
case AchievingGoal:
reply = myAgent.receive(mt);
if (reply != null) {
- Object content = reply.getContentObject();
- if (content instanceof Belief) {
+ if (ACLMessage.INFORM == reply.getPerformative()) {
+ ContentElement content = myAgent.getContentManager()
+ .extractContent(reply);
getBeliefBase().addBelief((Belief<?, ?>) content);
assert ((BeliefGoal<?>) getGoal())
.isAchieved(getBeliefBase());
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RespondBeliefGoalPlanBody.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RespondBeliefGoalPlanBody.java
index 5af8f6e..f65d67a 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RespondBeliefGoalPlanBody.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RespondBeliefGoalPlanBody.java
@@ -21,8 +21,13 @@
//----------------------------------------------------------------------------
package br.ufrgs.inf.bdinetr.agent;
+import jade.content.ContentElement;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import bdi4jade.annotation.Parameter;
import bdi4jade.annotation.Parameter.Direction;
import bdi4jade.belief.Belief;
@@ -41,6 +46,8 @@ public class RespondBeliefGoalPlanBody extends AbstractPlanBody {
SendingResponse, ReceivingReply, AchievingBeliefGoal, Ended;
}
+ private static final Log log = LogFactory
+ .getLog(RespondBeliefGoalPlanBody.class);
private static final long serialVersionUID = -4231465068344668721L;
private ACLMessage beliefGoalMsg;
@@ -56,15 +63,20 @@ public class RespondBeliefGoalPlanBody extends AbstractPlanBody {
switch (state) {
case SendingResponse:
outcomingMsg = beliefGoalMsg.createReply();
- Object content = beliefGoalMsg.getContentObject();
+ log.info(beliefGoalMsg);
+ ContentElement content = myAgent.getContentManager()
+ .extractContent(beliefGoalMsg);
if (content instanceof BeliefGoal) {
beliefGoal = (BeliefGoal<?>) content;
Boolean canAchieve = getCapability().canAchieve(beliefGoal);
+ outcomingMsg
+ .setPerformative(canAchieve ? ACLMessage.PROPOSE
+ : ACLMessage.REFUSE);
outcomingMsg.setContentObject(canAchieve);
log.info("Agent " + myAgent + " can achieve " + content
+ ": " + canAchieve);
} else {
- outcomingMsg.setContentObject(Boolean.FALSE);
+ outcomingMsg.setPerformative(ACLMessage.REFUSE);
}
outcomingMsg.setReplyWith("cfp" + System.currentTimeMillis());
this.myAgent.send(outcomingMsg);
@@ -95,14 +107,14 @@ public class RespondBeliefGoalPlanBody extends AbstractPlanBody {
GoalEvent event = getGoalEvent();
if (event != null) {
outcomingMsg = incomingMsg.createReply();
- outcomingMsg.setPerformative(ACLMessage.INFORM);
if (GoalStatus.ACHIEVED.equals(event.getStatus())) {
+ outcomingMsg.setPerformative(ACLMessage.INFORM);
Belief<?, ?> belief = (getBeliefBase()
.getBelief(beliefGoal.getBeliefName()));
- outcomingMsg.setContentObject((Belief<?, ?>) belief
- .clone());
+ myAgent.getContentManager().fillContent(outcomingMsg,
+ (Belief<?, ?>) belief.clone());
} else {
- outcomingMsg.setContentObject(null);
+ outcomingMsg.setPerformative(ACLMessage.FAILURE);
}
this.myAgent.send(outcomingMsg);
this.state = State.Ended;
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java
index a8f2cb3..d6ab52d 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java
@@ -21,6 +21,7 @@
//----------------------------------------------------------------------------
package br.ufrgs.inf.bdinetr.agent;
+import jade.content.lang.sl.SLCodec;
import jade.core.AID;
import jade.core.messaging.TopicManagementHelper;
import jade.lang.acl.ACLMessage;
@@ -31,6 +32,9 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import bdi4jade.annotation.Parameter;
import bdi4jade.annotation.Parameter.Direction;
import bdi4jade.belief.Belief;
@@ -48,9 +52,10 @@ import br.ufrgs.inf.bdinetr.domain.Classifier;
import br.ufrgs.inf.bdinetr.domain.FlowExporter;
import br.ufrgs.inf.bdinetr.domain.Ip;
import br.ufrgs.inf.bdinetr.domain.LinkMonitor;
-import br.ufrgs.inf.bdinetr.domain.Router;
import br.ufrgs.inf.bdinetr.domain.RateLimiter;
import br.ufrgs.inf.bdinetr.domain.Role;
+import br.ufrgs.inf.bdinetr.domain.Router;
+import br.ufrgs.inf.bdinetr.domain.ontology.BDINetROntology;
/**
* @author Ingrid Nunes
@@ -78,7 +83,6 @@ public class RouterAgent extends SingleCapabilityAgent implements
}
public static final String ROUTER_BELIEF = "router";
-
private static final long serialVersionUID = -2156730094556459899L;
@bdi4jade.annotation.Plan
@@ -99,8 +103,7 @@ public class RouterAgent extends SingleCapabilityAgent implements
@Override
public boolean match(ACLMessage msg) {
try {
- return (msg.getContentObject() != null && msg
- .getContentObject() instanceof BeliefGoal<?>);
+ return (ACLMessage.CFP == msg.getPerformative());
} catch (Exception exc) {
log.error(exc);
return false;
@@ -111,10 +114,12 @@ public class RouterAgent extends SingleCapabilityAgent implements
}
+ private static final Log log = LogFactory.getLog(RouterAgent.class);
private static final long serialVersionUID = 6534875498063013722L;
public RouterAgent(Router router) {
super(new RootCapability(router));
+
if (router.hasRole(Role.LINK_MONITOR)) {
this.getCapability().addPartCapability(
new LinkMonitorCapability((LinkMonitor) router
@@ -159,6 +164,9 @@ public class RouterAgent extends SingleCapabilityAgent implements
}
}
}
+
+ getContentManager().registerLanguage(new SLCodec());
+ getContentManager().registerOntology(BDINetROntology.getInstance());
}
@Override
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgentCapability.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgentCapability.java
index 7a8bff0..cf05092 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgentCapability.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgentCapability.java
@@ -21,6 +21,9 @@
//----------------------------------------------------------------------------
package br.ufrgs.inf.bdinetr.agent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import bdi4jade.belief.TransientPropositionalBelief;
import bdi4jade.core.Capability;
import bdi4jade.goal.BeliefPresentGoal;
@@ -34,9 +37,10 @@ import br.ufrgs.inf.bdinetr.domain.Role;
public abstract class RouterAgentCapability extends Capability {
public static final String ROLE_BELIEF = "role";
-
private static final long serialVersionUID = -3491170777812144486L;
+ protected final Log log = LogFactory.getLog(getClass());
+
protected void belief(Object proposition, Boolean value) {
if (value == null) {
getWholeCapability().getBeliefBase().removeBelief(proposition);
@@ -49,13 +53,19 @@ public abstract class RouterAgentCapability extends Capability {
}
protected Goal createGoal(Object proposition) {
- log.debug("goal(?" + proposition + "))");
- return new BeliefPresentGoal(proposition);
+ Goal goal = new BeliefPresentGoal(proposition);
+ if (!getMyAgent().hasGoal(goal)) {
+ log.debug("goal(?" + proposition + "))");
+ }
+ return goal;
}
protected Goal createGoal(Object proposition, Boolean value) {
- log.debug("goal(" + (value ? "" : "not ") + proposition + "))");
- return new PropositionalBeliefValueGoal(proposition, value);
+ Goal goal = new PropositionalBeliefValueGoal(proposition, value);
+ if (!getMyAgent().hasGoal(goal)) {
+ log.debug("goal(" + (value ? "" : "not ") + proposition + "))");
+ }
+ return goal;
}
public abstract Role getRole();
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Flow.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Flow.java
index b7e8b0a..c091e3f 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Flow.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Flow.java
@@ -24,10 +24,12 @@ package br.ufrgs.inf.bdinetr.domain;
import jade.content.Concept;
import jade.content.ContentElement;
+import java.io.Serializable;
+
/**
* @author Ingrid Nunes
*/
-public class Flow implements ContentElement, Concept {
+public class Flow implements Serializable, Concept, ContentElement {
private static final long serialVersionUID = 9016750269033135868L;
@@ -37,6 +39,10 @@ public class Flow implements ContentElement, Concept {
private Ip srcIp;
private int srcPort;
+ public Flow() {
+
+ }
+
public Flow(Ip srcIp, int srcPort, Ip dstIp, int dstPort, String protocol) {
this.srcIp = srcIp;
this.srcPort = srcPort;
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Ip.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Ip.java
index 493bbf1..2cbb711 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Ip.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Ip.java
@@ -24,14 +24,20 @@ package br.ufrgs.inf.bdinetr.domain;
import jade.content.Concept;
import jade.content.ContentElement;
+import java.io.Serializable;
+
/**
* @author Ingrid Nunes
*/
-public class Ip implements ContentElement, Concept {
+public class Ip implements Serializable, Concept, ContentElement {
private static final long serialVersionUID = -6397439243662425210L;
- private final String address;
+ private String address;
+
+ public Ip() {
+
+ }
public Ip(String address) {
this.address = address;
@@ -55,6 +61,10 @@ public class Ip implements ContentElement, Concept {
return address == null ? 0 : address.hashCode();
}
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
@Override
public String toString() {
return address;
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Link.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Link.java
index 82dfe08..7e58813 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Link.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Link.java
@@ -24,14 +24,20 @@ package br.ufrgs.inf.bdinetr.domain;
import jade.content.Concept;
import jade.content.ContentElement;
+import java.io.Serializable;
+
/**
* @author Ingrid Nunes
*/
-public class Link implements ContentElement, Concept {
+public class Link implements Serializable, Concept, ContentElement {
private static final long serialVersionUID = 8547078610455643585L;
- private final String id;
+ private String id;
+
+ public Link() {
+
+ }
public Link(String id) {
this.id = id;
@@ -55,6 +61,10 @@ public class Link implements ContentElement, Concept {
return id == null ? 0 : id.hashCode();
}
+ public void setId(String id) {
+ this.id = id;
+ }
+
@Override
public String toString() {
return id;
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDI4JADEOntology.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDI4JADEOntology.java
new file mode 100644
index 0000000..47e188c
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDI4JADEOntology.java
@@ -0,0 +1,129 @@
+package br.ufrgs.inf.bdinetr.domain.ontology;
+
+import jade.content.onto.BasicOntology;
+import jade.content.onto.Ontology;
+import jade.content.onto.OntologyException;
+import jade.content.schema.ConceptSchema;
+import jade.content.schema.PredicateSchema;
+import jade.content.schema.PrimitiveSchema;
+import bdi4jade.belief.AbstractBelief;
+import bdi4jade.belief.AbstractBeliefSet;
+import bdi4jade.belief.Belief;
+import bdi4jade.belief.BeliefSet;
+import bdi4jade.belief.PersistentBelief;
+import bdi4jade.belief.PropositionalBelief;
+import bdi4jade.belief.TransientBelief;
+import bdi4jade.belief.TransientBeliefSet;
+import bdi4jade.belief.TransientPropositionalBelief;
+import bdi4jade.goal.BeliefGoal;
+import bdi4jade.goal.BeliefPresentGoal;
+import bdi4jade.goal.BeliefSetHasValueGoal;
+import bdi4jade.goal.BeliefValueGoal;
+import bdi4jade.goal.PropositionalBeliefValueGoal;
+
+public class BDI4JADEOntology extends Ontology implements BDI4JADEVocabulary {
+
+ /**
+ * <p>
+ * UID generated.
+ * </p>
+ */
+ private static final long serialVersionUID = 6113260660006024268L;
+
+ public static final String ONTOLOGY_NAME = "BDI4JADEOntology";
+ private static Ontology theInstance = new BDI4JADEOntology();
+
+ /**
+ * This method grants access to the unique instance of the ontology.
+ *
+ * @return An <code>Ontology</code> object, containing the concepts of the
+ * ontology.
+ */
+ public static Ontology getInstance() {
+ return theInstance;
+ }
+
+ public BDI4JADEOntology() {
+ super(ONTOLOGY_NAME, new Ontology[] { BasicOntology.getInstance() },
+ new Introspector());
+
+ try {
+ add(new ConceptSchema(OBJECT_CONCEPT), Object.class);
+ add(new PredicateSchema(OBJECT_PREDICATE), Object.class);
+
+ // add(new EnumerationSchema(DATEFORMAT), DateFormat.class);
+ // cs.add(CALENDARUSERSERVICE_EVENTS, (PredicateSchema)
+ // getSchema(CALENDAREVENT), 0, ObjectSchema.UNLIMITED,
+ // BasicOntology.SET);
+
+ add(new PredicateSchema(BELIEF), Belief.class);
+ add(new PredicateSchema(BELIEF_SET), BeliefSet.class);
+ add(new PredicateSchema(PROPOSITIONAL_BELIEF), PropositionalBelief.class);
+
+ add(new PredicateSchema(ABSTRACT_BELIEF), AbstractBelief.class);
+ add(new PredicateSchema(ABSTRACT_BELIEF_SET), AbstractBeliefSet.class);
+ add(new PredicateSchema(TRANSIENT_BELIEF), TransientBelief.class);
+ add(new PredicateSchema(TRANSIENT_BELIEF_SET), TransientBeliefSet.class);
+ add(new PredicateSchema(PERSISTENT_BELIEF), PersistentBelief.class);
+ add(new PredicateSchema(TRANSIENT_PROPOSITIONAL_BELIEF), TransientPropositionalBelief.class);
+
+ PredicateSchema cs = (PredicateSchema) getSchema(BELIEF);
+ cs.add(BELIEF_NAME, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ cs.add(BELIEF_VALUE, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ cs.addSuperSchema((PredicateSchema) getSchema(OBJECT_PREDICATE));
+
+ cs = (PredicateSchema) getSchema(BELIEF_SET);
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF));
+
+ cs = (PredicateSchema) getSchema(PROPOSITIONAL_BELIEF);
+ cs.add(BELIEF_NAME, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ cs.add(BELIEF_VALUE, (PrimitiveSchema) getSchema(BasicOntology.BOOLEAN));
+ cs.addSuperSchema((PredicateSchema) getSchema(OBJECT_PREDICATE));
+
+ cs = (PredicateSchema) getSchema(ABSTRACT_BELIEF);
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF));
+ cs = (PredicateSchema) getSchema(PERSISTENT_BELIEF);
+ cs.addSuperSchema((PredicateSchema) getSchema(ABSTRACT_BELIEF));
+ cs = (PredicateSchema) getSchema(TRANSIENT_BELIEF);
+ cs.addSuperSchema((PredicateSchema) getSchema(ABSTRACT_BELIEF));
+
+ cs = (PredicateSchema) getSchema(ABSTRACT_BELIEF_SET);
+ cs.addSuperSchema((PredicateSchema) getSchema(ABSTRACT_BELIEF));
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF_SET));
+ cs = (PredicateSchema) getSchema(TRANSIENT_BELIEF_SET);
+ cs.addSuperSchema((PredicateSchema) getSchema(ABSTRACT_BELIEF_SET));
+
+ cs = (PredicateSchema) getSchema(TRANSIENT_PROPOSITIONAL_BELIEF);
+ cs.addSuperSchema((PredicateSchema) getSchema(PROPOSITIONAL_BELIEF));
+ cs.addSuperSchema((PredicateSchema) getSchema(TRANSIENT_BELIEF));
+
+ add(new PredicateSchema(BELIEF_GOAL), BeliefGoal.class);
+ add(new PredicateSchema(BELIEF_PRESENT_GOAL), BeliefPresentGoal.class);
+ add(new PredicateSchema(BELIEF_SET_HAS_VALUE_GOAL), BeliefSetHasValueGoal.class);
+ add(new PredicateSchema(BELIEF_VAUE_GOAL), BeliefValueGoal.class);
+ add(new PredicateSchema(PROPOSITIONAL_BELIEF_VAUE_GOAL), PropositionalBeliefValueGoal.class);
+
+ cs = (PredicateSchema) getSchema(BELIEF_GOAL);
+ cs.add(BELIEF_GOAL_BELIEF_NAME, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ cs.addSuperSchema((PredicateSchema) getSchema(OBJECT_PREDICATE));
+
+ cs = (PredicateSchema) getSchema(BELIEF_PRESENT_GOAL);
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF_GOAL));
+
+ cs = (PredicateSchema) getSchema(BELIEF_SET_HAS_VALUE_GOAL);
+ cs.add(BELIEF_SET_HAS_VALUE_GOAL_VALUE, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF_GOAL));
+
+ cs = (PredicateSchema) getSchema(BELIEF_VAUE_GOAL);
+ cs.add(BELIEF_VAUE_GOAL_VALUE, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF_GOAL));
+
+ cs = (PredicateSchema) getSchema(PROPOSITIONAL_BELIEF_VAUE_GOAL);
+ cs.add(PROPOSITIONAL_BELIEF_VAUE_GOAL_VALUE, (PrimitiveSchema) getSchema(BasicOntology.BOOLEAN));
+ cs.addSuperSchema((PredicateSchema) getSchema(BELIEF_GOAL));
+ } catch (OntologyException oe) {
+ oe.printStackTrace();
+ }
+ }
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDI4JADEVocabulary.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDI4JADEVocabulary.java
new file mode 100644
index 0000000..0288b32
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDI4JADEVocabulary.java
@@ -0,0 +1,34 @@
+package br.ufrgs.inf.bdinetr.domain.ontology;
+
+public interface BDI4JADEVocabulary {
+
+ /** Concepts **/
+
+ public static final String OBJECT_CONCEPT = "ObjectConcept";
+ public static final String OBJECT_PREDICATE = "ObjectPredicate";
+
+ public static final String BELIEF = "Belief";
+ public static final String BELIEF_NAME = "name";
+ public static final String BELIEF_VALUE = "value";
+ public static final String BELIEF_SET = "BeliefSet";
+ public static final String PROPOSITIONAL_BELIEF = "PropositionalBelief";
+
+ public static final String ABSTRACT_BELIEF = "AbstractBelief";
+ public static final String ABSTRACT_BELIEF_SET = "AbstractBeliefSet";
+ public static final String TRANSIENT_BELIEF = "TransientBelief";
+ public static final String TRANSIENT_BELIEF_SET = "TransientBeliefSet";
+ public static final String PERSISTENT_BELIEF = "PersistentBelief";
+ public static final String TRANSIENT_PROPOSITIONAL_BELIEF = "TransientPropositionalBelief";
+
+ public static final String BELIEF_GOAL = "BeliefGoal";
+ public static final String BELIEF_PRESENT_GOAL = "BeliefPresentGoal";
+ public static final String BELIEF_SET_HAS_VALUE_GOAL = "BeliefSetHasValueGoal";
+ public static final String BELIEF_VAUE_GOAL = "BeliefValueGoal";
+ public static final String PROPOSITIONAL_BELIEF_VAUE_GOAL = "PropositionalBeliefValueGoal";
+
+ public static final String BELIEF_GOAL_BELIEF_NAME = "beliefName";
+ public static final String BELIEF_SET_HAS_VALUE_GOAL_VALUE = "value";
+ public static final String BELIEF_VAUE_GOAL_VALUE = "value";
+ public static final String PROPOSITIONAL_BELIEF_VAUE_GOAL_VALUE = "value";
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDINetROntology.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDINetROntology.java
new file mode 100644
index 0000000..fcff540
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDINetROntology.java
@@ -0,0 +1,140 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+package br.ufrgs.inf.bdinetr.domain.ontology;
+
+import jade.content.onto.BasicOntology;
+import jade.content.onto.Ontology;
+import jade.content.onto.OntologyException;
+import jade.content.schema.ConceptSchema;
+import jade.content.schema.PrimitiveSchema;
+import br.ufrgs.inf.bdinetr.domain.Flow;
+import br.ufrgs.inf.bdinetr.domain.Ip;
+import br.ufrgs.inf.bdinetr.domain.Link;
+import br.ufrgs.inf.bdinetr.domain.predicate.Anomalous;
+import br.ufrgs.inf.bdinetr.domain.predicate.AttackPrevented;
+import br.ufrgs.inf.bdinetr.domain.predicate.Benign;
+import br.ufrgs.inf.bdinetr.domain.predicate.BinaryPredicate;
+import br.ufrgs.inf.bdinetr.domain.predicate.FlowRateLimited;
+import br.ufrgs.inf.bdinetr.domain.predicate.FullyOperational;
+import br.ufrgs.inf.bdinetr.domain.predicate.OverUsage;
+import br.ufrgs.inf.bdinetr.domain.predicate.OverUsageCause;
+import br.ufrgs.inf.bdinetr.domain.predicate.RateLimited;
+import br.ufrgs.inf.bdinetr.domain.predicate.RegularUsage;
+import br.ufrgs.inf.bdinetr.domain.predicate.Restricted;
+import br.ufrgs.inf.bdinetr.domain.predicate.Threat;
+import br.ufrgs.inf.bdinetr.domain.predicate.ThreatResponded;
+import br.ufrgs.inf.bdinetr.domain.predicate.UnaryPredicate;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class BDINetROntology extends Ontology implements BDINetRVocabulary {
+
+ /**
+ * <p>
+ * UID generated.
+ * </p>
+ */
+ private static final long serialVersionUID = 6113260660006024268L;
+
+ public static final String ONTOLOGY_NAME = "BDINetROntology";
+ private static Ontology theInstance = new BDINetROntology();
+
+ /**
+ * This method grants access to the unique instance of the ontology.
+ *
+ * @return An <code>Ontology</code> object, containing the concepts of the
+ * ontology.
+ */
+ public static Ontology getInstance() {
+ return theInstance;
+ }
+
+ public BDINetROntology() {
+ super(ONTOLOGY_NAME, new Ontology[] { BDI4JADEOntology
+ .getInstance() }, new Introspector());
+
+ try {
+ add(new ConceptSchema(FLOW), Flow.class);
+ add(new ConceptSchema(IP), Ip.class);
+ add(new ConceptSchema(LINK), Link.class);
+
+ ConceptSchema cs = (ConceptSchema) getSchema(FLOW);
+ cs.add(FLOW_DST_IP, (ConceptSchema) getSchema(IP));
+ cs.add(FLOW_DST_PORT, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
+ cs.add(FLOW_PROTOCOL, (PrimitiveSchema) getSchema(BasicOntology.STRING));
+ cs.add(FLOW_IP, (ConceptSchema) getSchema(IP));
+ cs.add(FLOW_PORT, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
+ cs.addSuperSchema((ConceptSchema) getSchema(OBJECT_CONCEPT));
+
+ cs = (ConceptSchema) getSchema(IP);
+ cs.add(IP_ADDRESS, (PrimitiveSchema) getSchema(BasicOntology.STRING));
+ cs.addSuperSchema((ConceptSchema) getSchema(OBJECT_CONCEPT));
+
+ cs = (ConceptSchema) getSchema(LINK);
+ cs.add(LINK_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING));
+ cs.addSuperSchema((ConceptSchema) getSchema(OBJECT_CONCEPT));
+
+ add(new ConceptSchema(UNARY_PREDICATE), UnaryPredicate.class);
+ add(new ConceptSchema(BINARY_PREDICATE), BinaryPredicate.class);
+
+ add(new ConceptSchema(ANOMALOUS), Anomalous.class);
+ add(new ConceptSchema(ATTACK_PREVENTED), AttackPrevented.class);
+ add(new ConceptSchema(BENIGN), Benign.class);
+ add(new ConceptSchema(FLOW_RATE_LIMITED), FlowRateLimited.class);
+ add(new ConceptSchema(FULLY_OPERATIONAL), FullyOperational.class);
+ add(new ConceptSchema(OVER_USAGE), OverUsage.class);
+ add(new ConceptSchema(OVER_USAGE_CAUSE), OverUsageCause.class);
+ add(new ConceptSchema(RATE_LIMITED), RateLimited.class);
+ add(new ConceptSchema(REGULAR_USAGE), RegularUsage.class);
+ add(new ConceptSchema(RESTRICTED), Restricted.class);
+ add(new ConceptSchema(THREAT), Threat.class);
+ add(new ConceptSchema(THREAT_RESPONDED), ThreatResponded.class);
+
+ ConceptSchema ps = (ConceptSchema) getSchema(UNARY_PREDICATE);
+ ps.add(UNARY_PREDICATE_CONCEPT, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ ps.addSuperSchema((ConceptSchema)getSchema(OBJECT_CONCEPT));
+
+ ((ConceptSchema) getSchema(ANOMALOUS)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(ATTACK_PREVENTED)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(BENIGN)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(FLOW_RATE_LIMITED)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(FULLY_OPERATIONAL)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(OVER_USAGE)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(RATE_LIMITED)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(REGULAR_USAGE)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(RESTRICTED)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(THREAT)).addSuperSchema(ps);
+ ((ConceptSchema) getSchema(THREAT_RESPONDED)).addSuperSchema(ps);
+
+ ps = (ConceptSchema) getSchema(BINARY_PREDICATE);
+ ps.add(BINARY_PREDICATE_FIRST, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ ps.add(BINARY_PREDICATE_SECOND, (ConceptSchema) getSchema(OBJECT_CONCEPT));
+ ps.addSuperSchema((ConceptSchema)getSchema(OBJECT_CONCEPT));
+
+ ((ConceptSchema) getSchema(OVER_USAGE_CAUSE)).addSuperSchema(ps);
+ } catch (OntologyException oe) {
+ oe.printStackTrace();
+ }
+ }
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDINetRVocabulary.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDINetRVocabulary.java
new file mode 100644
index 0000000..2e5a844
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/BDINetRVocabulary.java
@@ -0,0 +1,66 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+package br.ufrgs.inf.bdinetr.domain.ontology;
+
+/**
+ * @author Ingrid Nunes
+ */
+public interface BDINetRVocabulary extends BDI4JADEVocabulary {
+
+ /** Concepts **/
+
+ public static final String FLOW = "Flow";
+ public static final String FLOW_DST_IP = "dstIp";
+ public static final String FLOW_DST_PORT = "dstPort";
+ public static final String FLOW_PROTOCOL = "protocol";
+ public static final String FLOW_IP = "srcIp";
+ public static final String FLOW_PORT = "srcPort";
+
+ public static final String IP = "Ip";
+ public static final String IP_ADDRESS = "address";
+
+ public static final String LINK = "Link";
+ public static final String LINK_ID = "id";
+
+ /** Predicates **/
+
+ public static final String UNARY_PREDICATE = "UnaryPredicate";
+ public static final String UNARY_PREDICATE_CONCEPT = "concept";
+
+ public static final String BINARY_PREDICATE = "BinaryPredicate";
+ public static final String BINARY_PREDICATE_FIRST = "first";
+ public static final String BINARY_PREDICATE_SECOND = "second";
+
+ public static final String ANOMALOUS = "Anomalous";
+ public static final String ATTACK_PREVENTED = "AttackPrevented";
+ public static final String BENIGN = "Benign";
+ public static final String FLOW_RATE_LIMITED = "FlowRateLimited";
+ public static final String FULLY_OPERATIONAL = "FullyOperational";
+ public static final String OVER_USAGE = "OverUsage";
+ public static final String OVER_USAGE_CAUSE = "OverUsageCause";
+ public static final String RATE_LIMITED = "RateLimited";
+ public static final String REGULAR_USAGE = "RegularUsage";
+ public static final String RESTRICTED = "Restricted";
+ public static final String THREAT = "Threat";
+ public static final String THREAT_RESPONDED = "ThreatResponded";
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/EnumerationSchema.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/EnumerationSchema.java
new file mode 100644
index 0000000..4d6c569
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/EnumerationSchema.java
@@ -0,0 +1,53 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+package br.ufrgs.inf.bdinetr.domain.ontology;
+
+import jade.content.onto.BasicOntology;
+import jade.content.schema.PrimitiveSchema;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class EnumerationSchema extends PrimitiveSchema {
+
+ private static final long serialVersionUID = 5325383716309666689L;
+
+ public EnumerationSchema(String typeName) {
+ super(typeName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jade.content.schema.ObjectSchemaImpl#toString()
+ */
+ @Override
+ public String toString() {
+ try {
+ return BasicOntology.getInstance().getSchema(BasicOntology.STRING)
+ .toString();
+ } catch (Exception e) {
+ return super.toString();
+ }
+ }
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/Introspector.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/Introspector.java
new file mode 100644
index 0000000..68c0f74
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/ontology/Introspector.java
@@ -0,0 +1,79 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+package br.ufrgs.inf.bdinetr.domain.ontology;
+
+import jade.content.abs.AbsObject;
+import jade.content.abs.AbsPrimitive;
+import jade.content.onto.BCReflectiveIntrospector;
+import jade.content.onto.Ontology;
+import jade.content.onto.OntologyException;
+import jade.content.schema.ObjectSchema;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Introspector extends BCReflectiveIntrospector {
+
+ /**
+ * <p>
+ * UID generated.
+ * </p>
+ */
+ private static final long serialVersionUID = 2464170261735572000L;
+
+ @Override
+ public AbsObject externalizeSpecialType(Object obj, ObjectSchema schema,
+ Class javaClass, Ontology referenceOnto) throws OntologyException {
+ if (schema instanceof EnumerationSchema) {
+ return AbsPrimitive.wrap(obj.toString());
+ } else {
+ return super.externalizeSpecialType(obj, schema, javaClass,
+ referenceOnto);
+ }
+ }
+
+ @Override
+ protected void invokeSetterMethod(Method method, Object obj, Object value)
+ throws OntologyException {
+ if (method.getParameterTypes()[0].isEnum()) {
+ Object[] enumContants = method.getParameterTypes()[0]
+ .getEnumConstants();
+ for (Object enumValue : enumContants) {
+ if (value.equals(enumValue.toString())) {
+ Object[] params = new Object[] { enumValue };
+ try {
+ method.invoke(obj, params);
+ return;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+ }
+
+ super.invokeSetterMethod(method, obj, value);
+ }
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Anomalous.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Anomalous.java
index ef275a0..05c8d2d 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Anomalous.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Anomalous.java
@@ -6,6 +6,10 @@ public class Anomalous extends UnaryPredicate<Ip> {
private static final long serialVersionUID = -5495943806870470494L;
+ public Anomalous() {
+
+ }
+
public Anomalous(Ip ip) {
super(ip);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/AttackPrevented.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/AttackPrevented.java
index cfe874f..aab6d4b 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/AttackPrevented.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/AttackPrevented.java
@@ -6,6 +6,10 @@ public class AttackPrevented extends UnaryPredicate<Link> {
private static final long serialVersionUID = -5495943806870470494L;
+ public AttackPrevented() {
+
+ }
+
public AttackPrevented(Link link) {
super(link);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Benign.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Benign.java
index cc953bf..91c6f67 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Benign.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Benign.java
@@ -6,6 +6,10 @@ public class Benign extends UnaryPredicate<Ip> {
private static final long serialVersionUID = -5495943806870470494L;
+ public Benign() {
+
+ }
+
public Benign(Ip ip) {
super(ip);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/BinaryPredicate.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/BinaryPredicate.java
index ec71524..1750a10 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/BinaryPredicate.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/BinaryPredicate.java
@@ -3,13 +3,20 @@ package br.ufrgs.inf.bdinetr.domain.predicate;
import jade.content.Concept;
import jade.content.ContentElement;
-public abstract class BinaryPredicate<T, U> implements ContentElement, Concept {
+import java.io.Serializable;
+
+public abstract class BinaryPredicate<T, U> implements Serializable, Concept,
+ ContentElement {
private static final long serialVersionUID = -1506723105103606268L;
protected T first;
protected U second;
+ public BinaryPredicate() {
+
+ }
+
public BinaryPredicate(T first, U second) {
this.first = first;
this.second = second;
@@ -43,6 +50,14 @@ public abstract class BinaryPredicate<T, U> implements ContentElement, Concept {
return result;
}
+ public void setFirst(T first) {
+ this.first = first;
+ }
+
+ public void setSecond(U second) {
+ this.second = second;
+ }
+
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FlowRateLimited.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FlowRateLimited.java
index cf47227..499f729 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FlowRateLimited.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FlowRateLimited.java
@@ -6,6 +6,10 @@ public class FlowRateLimited extends UnaryPredicate<Flow> {
private static final long serialVersionUID = -5495943806870470494L;
+ public FlowRateLimited() {
+
+ }
+
public FlowRateLimited(Flow flow) {
super(flow);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FullyOperational.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FullyOperational.java
index 32955af..d12f8fd 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FullyOperational.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/FullyOperational.java
@@ -6,6 +6,10 @@ public class FullyOperational extends UnaryPredicate<Link> {
private static final long serialVersionUID = -5495943806870470494L;
+ public FullyOperational() {
+
+ }
+
public FullyOperational(Link link) {
super(link);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsage.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsage.java
index 90cafff..c793bc2 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsage.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsage.java
@@ -6,6 +6,10 @@ public class OverUsage extends UnaryPredicate<Link> {
private static final long serialVersionUID = -5495943806870470494L;
+ public OverUsage() {
+
+ }
+
public OverUsage(Link link) {
super(link);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsageCause.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsageCause.java
index a731ab4..a638eb6 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsageCause.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/OverUsageCause.java
@@ -7,6 +7,10 @@ public class OverUsageCause extends BinaryPredicate<Ip, Link> {
private static final long serialVersionUID = -5495943806870470494L;
+ public OverUsageCause() {
+
+ }
+
public OverUsageCause(Ip ip, Link link) {
super(ip, link);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RateLimited.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RateLimited.java
index 89e87b2..2d6b8a2 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RateLimited.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RateLimited.java
@@ -6,6 +6,10 @@ public class RateLimited extends UnaryPredicate<Ip> {
private static final long serialVersionUID = -5495943806870470494L;
+ public RateLimited() {
+
+ }
+
public RateLimited(Ip ip) {
super(ip);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RegularUsage.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RegularUsage.java
index 2cabc67..549cf1c 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RegularUsage.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/RegularUsage.java
@@ -6,6 +6,10 @@ public class RegularUsage extends UnaryPredicate<Link> {
private static final long serialVersionUID = -5495943806870470494L;
+ public RegularUsage() {
+
+ }
+
public RegularUsage(Link link) {
super(link);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Restricted.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Restricted.java
index 9bf374c..cc13a78 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Restricted.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Restricted.java
@@ -6,6 +6,10 @@ public class Restricted extends UnaryPredicate<Ip> {
private static final long serialVersionUID = -5495943806870470494L;
+ public Restricted() {
+
+ }
+
public Restricted(Ip ip) {
super(ip);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Threat.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Threat.java
index 8aa89f8..6cb9503 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Threat.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/Threat.java
@@ -6,6 +6,10 @@ public class Threat extends UnaryPredicate<Flow> {
private static final long serialVersionUID = -5495943806870470494L;
+ public Threat() {
+
+ }
+
public Threat(Flow flow) {
super(flow);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/ThreatResponded.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/ThreatResponded.java
index 1ab6a13..1c53afb 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/ThreatResponded.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/ThreatResponded.java
@@ -6,6 +6,10 @@ public class ThreatResponded extends UnaryPredicate<Flow> {
private static final long serialVersionUID = -5495943806870470494L;
+ public ThreatResponded() {
+
+ }
+
public ThreatResponded(Flow flow) {
super(flow);
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/UnaryPredicate.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/UnaryPredicate.java
index 1934275..41c506b 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/UnaryPredicate.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/predicate/UnaryPredicate.java
@@ -3,12 +3,19 @@ package br.ufrgs.inf.bdinetr.domain.predicate;
import jade.content.Concept;
import jade.content.ContentElement;
-public abstract class UnaryPredicate<T> implements ContentElement, Concept {
+import java.io.Serializable;
+
+public abstract class UnaryPredicate<T> implements Serializable, Concept,
+ ContentElement {
private static final long serialVersionUID = -1506723105103606268L;
protected T concept;
+ public UnaryPredicate() {
+
+ }
+
public UnaryPredicate(T concept) {
this.concept = concept;
}
@@ -36,6 +43,10 @@ public abstract class UnaryPredicate<T> implements ContentElement, Concept {
return result;
}
+ public void setConcept(T concept) {
+ this.concept = concept;
+ }
+
@Override
public String toString() {
StringBuffer sb = new StringBuffer();