本文整理汇总了Java中jade.wrapper.ControllerException类的典型用法代码示例。如果您正苦于以下问题:Java ControllerException类的具体用法?Java ControllerException怎么用?Java ControllerException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControllerException类属于jade.wrapper包,在下文中一共展示了ControllerException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComboBoxModelContainer
import jade.wrapper.ControllerException; //导入依赖的package包/类
private DefaultComboBoxModel<String> getComboBoxModelContainer() {
if (comboBoxModelContainer==null) {
comboBoxModelContainer = new DefaultComboBoxModel<>();
if (Application.getJadePlatform().isMainContainerRunning(false)==true) {
// --- Get the known container ------------
try {
comboBoxModelContainer.addElement(Application.getJadePlatform().getMainContainer().getContainerName());
for (AgentContainer container : Application.getJadePlatform().getAgentContainerList()) {
comboBoxModelContainer.addElement(container.getContainerName());
}
} catch (ControllerException e) {
e.printStackTrace();
}
} else {
// --- Just take the Main-Container -------
comboBoxModelContainer.addElement(jade.core.AgentContainer.MAIN_CONTAINER_NAME);
}
}
return comboBoxModelContainer;
}
示例2: stopSimulation
import jade.wrapper.ControllerException; //导入依赖的package包/类
public ACLMessage stopSimulation(String status) {
ACLMessage message = null;
if (status.equals(Message.STOP_RESUMED)) {
message = Message.prepareMessage(ACLMessage.INFORM, null, Message.STOP_RESUMED, this.getSounds());
} else {
AgentController ac;
for (AID sound : this.getSounds().values()) {
try {
ac = cc.getAgent(sound.getLocalName());
ac.kill();
} catch (ControllerException e) {
}
}
message = Message.prepareMessage(ACLMessage.INFORM, null, Message.ALREADY_STOPED, this.getSounds());
}
return message;
}
示例3: startContainerWithArguments
import jade.wrapper.ControllerException; //导入依赖的package包/类
/**
* Method which creates a new container, with the given command line arguments
*
* @param _args
* - arguments, as specified in the command line. The <code>-container</code> option is not mandatory
*/
@Deprecated
public void startContainerWithArguments(String _args)
{
String args = _args;
if(_args.indexOf("-container") == -1)
args = (new String("-container ")) + _args;
AgentContainer container = runJadeWithArguments(args);
try
{
containerList.put(container.getContainerName(), container);
} catch(ControllerException e)
{
e.printStackTrace();
}
}
示例4: doMove
import jade.wrapper.ControllerException; //导入依赖的package包/类
/**
* new do move behavior
*/
@Override
public void doMove(Location dest)
{
try
{
if(!dest.getName().equals(this.getContainerController().getContainerName()))
{
log.info("moving to [" + dest.getName() + "]");
super.doMove(dest);
}
} catch(ControllerException e)
{
e.printStackTrace();
}
}
示例5: agentFound
import jade.wrapper.ControllerException; //导入依赖的package包/类
/**
* Checks if an agent can be found locally.
*
* @param cc the local ContainerController
* @param nickName the local agent name to search for
* @return true, if successful
*/
private boolean agentFound(ContainerController cc, String nickName) {
try {
cc.getAgent(nickName);
return true;
} catch (ControllerException e) {
//e.printStackTrace();
return false;
}
}
示例6: isFaultlessProcess
import jade.wrapper.ControllerException; //导入依赖的package包/类
@Override
public boolean isFaultlessProcess() {
// --- 0. Is the platform still running? --------------------
if (this.isPlatformRunning()==false) {
this.unregisterTask();
return false;
}
// --- 1. Try to find the agent in the container ------------
AgentController agentController = null;
try {
agentController = this.containerController.getAgent(this.agentName);
} catch (ControllerException ce) {
//ce.printStackTrace();
return false;
}
// --- 2. Try to get the agent's state ----------------------
boolean isRunning;
try {
agentController.getState();
isRunning = true;
} catch (Exception ex) {
// ex.printStackTrace();
isRunning = false;
}
return isRunning;
}
示例7: action
import jade.wrapper.ControllerException; //导入依赖的package包/类
@Override
public void action() {
// --- Wait for the start of the LoadMeasureAgent -----------
AgentController ageCont = null;
while (ageCont==null) {
try {
ageCont = myAgent.getContainerController().getAgent(loadAgentName);
} catch (ControllerException e1) {
block(100);
//e1.printStackTrace();
}
}
myAgent.getContentManager().registerLanguage(new SLCodec(), FIPANames.ContentLanguage.FIPA_SL0);
myAgent.getContentManager().registerOntology(JADEManagementOntology.getInstance());
AID receiver = new AID();
receiver.setLocalName(loadAgentName);
ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
msg.addReceiver(receiver);
msg.setOntology(JADEManagementOntology.NAME);
msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
Action a = new Action();
a.setActor( receiver );
a.setAction(new ShowThreadGUI());
try {
myAgent.getContentManager().fillContent(msg,a);
} catch (Exception e) {
e.printStackTrace();
}
myAgent.send(msg);
myAgent.doDelete();
}
示例8: action
import jade.wrapper.ControllerException; //导入依赖的package包/类
@Override
public void action() {
// --- Wait for the start of the LoadMeasureAgent -----------
long waitTimeMax = System.currentTimeMillis() + (1000 * 7);
AgentController ageCont = null;
while (ageCont==null) {
if (System.currentTimeMillis()>=waitTimeMax) break;
try {
ageCont = myAgent.getContainerController().getAgent(loadAgentName);
} catch (ControllerException e1) {
block(100);
}
}
this.myAgent.getContentManager().registerLanguage(new SLCodec(), FIPANames.ContentLanguage.FIPA_SL0);
this.myAgent.getContentManager().registerOntology(JADEManagementOntology.getInstance());
AID receiver = new AID();
receiver.setLocalName(loadAgentName);
ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
msg.addReceiver(receiver);
msg.setOntology(JADEManagementOntology.NAME);
msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
Action a = new Action();
a.setActor( receiver );
a.setAction( new ShowMonitorGUI() );
try {
this.myAgent.getContentManager().fillContent(msg,a);
} catch (Exception e) {
e.printStackTrace();
}
this.myAgent.send(msg);
this.myAgent.doDelete();
}
示例9: isAgentRunning
import jade.wrapper.ControllerException; //导入依赖的package包/类
/**
* Checks, whether one Agent is running (or not) in the specified container.
*
* @param localAgentName the agent name
* @param agentContainer the agent container
* @return true, if the agent is running
*/
public boolean isAgentRunning(String localAgentName, AgentContainer agentContainer) {
if (this.isMainContainerRunning()==false) return false;
if (localAgentName==null) return false;
if (agentContainer==null) return false;
// --- 1. Try to find the agent in the container ------------
AgentController agentController = null;
try {
agentController = agentContainer.getAgent(localAgentName);
} catch (ControllerException ce) {
// ce.printStackTrace();
return false;
}
// --- 2. Try to get the agent's state ----------------------
boolean isRunning;
try {
agentController.getState();
isRunning = true;
} catch (StaleProxyException spex) {
// spex.printStackTrace();
isRunning = false;
}
return isRunning;
}
示例10: getContainer
import jade.wrapper.ControllerException; //导入依赖的package包/类
/**
* Returns the {@link AgentContainer} given by it's name.
*
* @param containerNameSearch the container name search
* @return the agent container
*/
public AgentContainer getContainer(String containerNameSearch ) {
// --- If JADE is not already running -------------------
if (this.isMainContainerRunning()==false) {
return null;
}
// --- Searching for the 'Main-Container'? -------------
if (containerNameSearch.equals(this.mainContainerName)==true) {
return this.jadeMainContainer;
}
// --- Get the right container -------------------------
for (int i=0; i < this.getAgentContainerList().size(); i++) {
AgentContainer agentContainer = this.getAgentContainerList().get(i);
try {
String acName = agentContainer.getContainerName();
if (acName!=null && acName.equalsIgnoreCase(containerNameSearch)==true) {
return agentContainer;
}
} catch (ControllerException ex) {
ex.printStackTrace();
}
}
return null;
}
示例11: stopMAS
import jade.wrapper.ControllerException; //导入依赖的package包/类
public void stopMAS() throws Exception {
if (cc != null) {
new Thread() { // this command should not block the agent!
public void run() {
try {
cc.getPlatformController().kill();
} catch (ControllerException e) {
e.printStackTrace();
}
}
}.start();
}
}
示例12: stopMAS
import jade.wrapper.ControllerException; //导入依赖的package包/类
public void stopMAS() throws Exception {
if (cc != null) {
new Thread() { // this command should not block the agent!
public void run() {
try {
cc.getPlatformController().kill();
} catch (ControllerException e) {
e.printStackTrace();
}
}
} .start();
}
}
示例13: initAgent
import jade.wrapper.ControllerException; //导入依赖的package包/类
public static void initAgent(PlatformController container, Object[] args, String path, String id){
final AgentController agentController;
try {
agentController = container.createNewAgent(id, path, args);
agentController.start();
} catch (ControllerException e ) {
e.printStackTrace();
}
}
示例14: resumeAllSounds
import jade.wrapper.ControllerException; //导入依赖的package包/类
public boolean resumeAllSounds() {
AgentController ac;
boolean resumed = false;
for (AID sound : this.getSounds().values()) {
try {
ac = cc.getAgent(sound.getLocalName());
ac.activate();
resumed = true;
} catch (ControllerException e) {
}
}
return resumed;
}
示例15: killSoundSource
import jade.wrapper.ControllerException; //导入依赖的package包/类
public void killSoundSource(String id){
AgentController ac;
try {
ac = getCc().getAgent(soundSources.get(id).getLocalName());
ac.kill();
} catch (ControllerException e) {
e.printStackTrace();
}
}