From ddomingue at gmail.com Mon Jun 4 08:39:38 2007 From: ddomingue at gmail.com (daniel domingue) Date: Mon, 4 Jun 2007 14:39:38 +0200 Subject: Question about dynamic agent creation during cougaar execution In-Reply-To: <465C5F1E.7000009@bbn.com> References: <465C5F1E.7000009@bbn.com> Message-ID: Thank you for the information, I have been able to obtain a working prototype that enables dynamic creation of agents at runtime. Reading through the different threads you pointed me towards, I saw there were issues with the .xml specification file when creating many different agents . I use a simple solution where the agent plugin that creates the new agent writes a .xml with the required plugins in the local directory before calling the mobilityFactory.createAgentControl(), and the created agent has the responsibility to remove the aforementioned file, enabling. I would like to know if using this method had any design/performance issues, it seems to be working ok for me with acceptable time for the whole step of creating an agent with its own .xml file. Also, in the AddExampleAgentPlugin.java you redirected me to, the blackboard.startTransaction() and blackboard.closeTransaction() calls were missing around the blackboard.publishAdd(ac); Thanks again for your time, -- Daniel Domingue From twright at bbn.com Mon Jun 4 19:13:21 2007 From: twright at bbn.com (Todd Wright) Date: Mon, 04 Jun 2007 19:13:21 -0400 Subject: Question about dynamic agent creation during cougaar execution In-Reply-To: References: <465C5F1E.7000009@bbn.com> Message-ID: <46649C91.2030500@bbn.com> daniel domingue wrote: > Thank you for the information, > > I have been able to obtain a working prototype that enables dynamic > creation of agents at runtime. > > Reading through the different threads you pointed me towards, I saw > there were issues with the .xml specification file when creating many > different agents . > > I use a simple solution where the agent plugin that creates the new > agent writes a .xml with the required plugins in the > local directory before calling the > mobilityFactory.createAgentControl(), and the created agent has the > responsibility to remove the aforementioned file, enabling. > > I would like to know if using this method had any design/performance > issues, it seems to be working ok for me with acceptable time for the > whole step of creating an agent with its own .xml file. Your solution should work fine. That's currently our best solution. Long-term, in addition to supporting a per-agent XML file to specify each agent's list of plugins, we'd like to support an in-memory data structure -based specification. > > Also, in the AddExampleAgentPlugin.java you redirected me to, > the blackboard.startTransaction() and > blackboard.closeTransaction() calls were missing around the > blackboard.publishAdd(ac); That shouldn't be necessary. The above example code is: public class AddAgentExamplePlugin extends ComponentPlugin { ... protected void setupSubscriptions() { ... addAgent(newAgent, destNode); ... } protected void execute() { ... } protected void addAgent(String newAgent, String destNode) { ... blackboard.publishAdd(ac); ... } } The "setupSubscriptions()" method is always called from inside a transaction, so you shouldn't wrap the "publishAdd" within yet another transaction. In fact, I'd expect the extra transaction would cause the following an error to be logged: ERROR - Opened nested transaction (level=2) Did you find that you were required to add the above "start/close" transaction calls? Todd > > Thanks again for your time, From ddomingue at gmail.com Wed Jun 6 05:12:03 2007 From: ddomingue at gmail.com (daniel domingue) Date: Wed, 6 Jun 2007 11:12:03 +0200 Subject: Question about dynamic agent creation during cougaar execution In-Reply-To: <46649C91.2030500@bbn.com> References: <465C5F1E.7000009@bbn.com> <46649C91.2030500@bbn.com> Message-ID: > > The "setupSubscriptions()" method is always called from inside a > transaction, so you shouldn't wrap the "publishAdd" within yet another > transaction. In fact, I'd expect the extra transaction would cause the > following an error to be logged: > ERROR - Opened nested transaction (level=2) > > Did you find that you were required to add the above "start/close" > transaction calls? > No it's working fine, I wasn't sure about the transaction so that's why I pointed it out. -- Daniel Domingue From twright at bbn.com Fri Jun 15 12:31:42 2007 From: twright at bbn.com (Todd Wright) Date: Fri, 15 Jun 2007 12:31:42 -0400 Subject: [Support-csc-info] GUI in Cougaar In-Reply-To: <837843.52530.qm@web33310.mail.mud.yahoo.com> References: <837843.52530.qm@web33310.mail.mud.yahoo.com> Message-ID: <4672BEEE.6080806@bbn.com> majid yahyaei wrote: > Hi, > > I want to create a GUI either SWT or swing as a plugin > to send objects to blackboard. We typically use Servlets to create our UIs, but Swing and SWT also work. > I tried to call a GUI > within a plugin execution() but it does not work. What > is the best way of having a GUI working as a plugin to > iteract with user and access the black board. I've attached an example below. Todd > > It is very urgent for me and I appreciate your help. > > thanks, > > majid > > > > ____________________________________________________________________________________ > Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. > http://farechase.yahoo.com/ > > _______________________________________________ > Support-csc-info mailing list > Support-csc-info at cougaar.org > http://cougaarforge.cougaar.org/mailman/listinfo/support-csc-info > -------------- next part -------------- A non-text attachment was scrubbed... Name: ExampleSwingPlugin.java Type: text/x-java Size: 3954 bytes Desc: not available Url : http://cougaar.org/pipermail/cougaar-developers/attachments/20070615/3bde44c0/ExampleSwingPlugin.bin From majid2140 at yahoo.com Fri Jun 15 20:18:55 2007 From: majid2140 at yahoo.com (majid yahyaei) Date: Fri, 15 Jun 2007 17:18:55 -0700 (PDT) Subject: GUI in Cougaar Message-ID: <36778.73349.qm@web33310.mail.mud.yahoo.com> Hello I need to have an interface to send object to blackboard by user request. I tried to use swing and SWT GUI, but I couldnt make it. What is the best way?I know using servlet is recommended ,but I dont know how to access blackboard from servlet. Can someone help me with that? It is very urgent for me and I appreciate your help. thanks, majid ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html From majid2140 at yahoo.com Sun Jun 17 18:52:56 2007 From: majid2140 at yahoo.com (majid yahyaei) Date: Sun, 17 Jun 2007 15:52:56 -0700 (PDT) Subject: Publish to blackboard from servlet Message-ID: <188548.35581.qm@web33309.mail.mud.yahoo.com> Hi, I am looking for a way to publish an object to blackboard from a servlet GUI. If anybody has a sample code or can give me some hints, I appreciate it. thanks, majid ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html From twright at bbn.com Mon Jun 18 19:44:12 2007 From: twright at bbn.com (Todd Wright) Date: Mon, 18 Jun 2007 19:44:12 -0400 Subject: Publish to blackboard from servlet In-Reply-To: <188548.35581.qm@web33309.mail.mud.yahoo.com> References: <188548.35581.qm@web33309.mail.mud.yahoo.com> Message-ID: <467718CC.5040704@bbn.com> majid yahyaei wrote: > Hi, > > I am looking for a way to publish an object to > blackboard from a servlet GUI. If anybody has a sample > code or can give me some hints, I appreciate it. Here's an example: ------------------------------------------------------------- package whatever; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.cougaar.core.plugin.ServletPlugin; // load using: // // // // // access using: // http://localhost:8800/$MyAgentName/myTest // public class YourServlet extends ServletPlugin { protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { // get url parameters here, e.g.: // String s = req.getParameter("foo"); // optionally query here, e.g.: // Collection c = query(new UnaryPredicate() { // public boolean execute(Object o) { // return (o instanceof ExampleClass); // }}); // publish here, e.g.: // blackboard.publishAdd(someObject); // write back a response, e.g.: // PrintWriter out = resp.getWriter(); // out.write("did it"); // out.close(); } } ------------------------------------------------------------- For more servlet examples, see: http://cougaar.org/cgi-bin/viewcvs.cgi/core/examples/org/cougaar/core/examples/servlet/?cvsroot=core Todd