[kepler-dev] problem when adding dynamically created actors with latest cvs copies of PTII and KEPLER version ....

Chad Berkley berkley at nceas.ucsb.edu
Tue Dec 13 15:26:57 PST 2005


Hey jagan,

I just changed this whole system, so try it now.  I'm going to still be 
working on it all week, so don't be suprised if it breaks again.

chad

jagan wrote:
> Hi Ilkay,
> 
> I hope you have reached safely back to US.
> 
> As we discussed I tried to use latest copies of PTII and KEPLER from cvs 
> repository.
> 
> 
> As I have shown you I create an application specific actor dynamically 
> with a number of specified input and output ports at runtime.
> 
>  I am finding the following problems when I try to create new actors 
> dynamically.
> 
> Procedure for creating new actors,
> 
> 1. After downloading latest copies of  PTII and KEPLER  run the commands 
> in order
> 2. ant ptolemy,  ant buildkarlib,  ant run
> 3. Now I see all the actors and directors in the list
> 4. Next, I drag PN Director and  JGridletCreater actor from 
> "Acotrs/Griddles/Gridlets"  repository on to the canvas
> 5. When I run click button, I can see an actor named "localActorName"  
> in the folder "Acotrs/Griddles/Gridlets", this actor is a command line 
> actor with a specified number of input and output ports in this case 
> default one additional input port and an output port.
> 6. When I drag this actor "localActorName" on to the canvas and run it 
> prodces stderr and stdout which emits through the error and output ports 
> ( note remove previous dragged JGridletCreater and put this actor on to 
> the screen). Sofar it is good.
> 7. When I exit from Kepler and rerun Kepler with "ant run" command, I 
> can see a number of Directors and Actors missing from the screen. It 
> seems to me that annotations are causing some problem with the latest 
> versions of the Kepler while adding actors dynamically.
> 8. I have tested and was working perfectly fine before using new 
> packaging system (karlib).
> =============================================================
> My fire method of "JGridletCreater"  is as follows
> -------------------------------------------------------------------------------------------
>   public void fire() throws IllegalActionException {
>     super.fire();
>     boolean http_access = false;
>     HttpURLConnection urlconn = null;
>     try  {                       
>       GriddlesExec wss = null;         
>       KeplerLocalLSIDService service = KeplerLocalLSIDService.instance();
>       AnnotationEngine engine = 
> AnnotationEngine.instance();                     
>       _actorNameStr = actorName.getExpression();
>                    
>       wss = new GriddlesExec(new EntityLibrary(), 
> _actorNameStr);            
>      
>       String inPortsStr = inPortsList.getExpression();
>       if(inPortsStr.length() > 1) {
>         String inPortsArray[] = inPortsStr.split(":");
>         for(int j=0;j<inPortsArray.length;j++) {
>           TypedIOPort inp = (TypedIOPort) wss.newPort(inPortsArray[j]);
>       inp.setTypeEquals(BaseType.STRING);
>           //Change the line above with:
>       // inp.setTypeEquals(convertTypeToPTIIType(typestr));
>           //inp.setTypeEquals(convertTypeToPTIIType(BaseType.STRING));
>       inp.setInput(true);
>           StringParameter inPortParam = 
> (StringParameter)wss.newStringParameter(inPortsArray[j]);
>           inPortParam.setExpression(inPortsArray[j]);
>           }
>         }
>       String outPortsStr = outPortsList.getExpression(); 
>       if(outPortsStr.length() > 1) {
>         String outPortsArray[] = outPortsStr.split(":");
>         for(int j=0;j<outPortsArray.length;j++)
>           {
>           TypedIOPort outp = (TypedIOPort) wss.newPort(outPortsArray[j]);
>       outp.setTypeEquals(BaseType.STRING);             
>       //Change the line above with:
>       //outp.setTypeEquals(convertTypeToPTIIType(BaseType.STRING));
>       outp.setOutput(true);
>           StringParameter outPortParam = 
> (StringParameter)wss.newStringParameter(outPortsArray[j]);
>           outPortParam.setExpression(outPortsArray[j]);
>           }
>         }                
>       String strParametersArray[] 
> ="modelReference:executionHost:webServicePort".split(":");
>       for(int j=0;j<strParametersArray.length;j++) {
>         StringParameter addParam = 
> (StringParameter)wss.newStringParameter(strParametersArray[j]);
>         addParam.setExpression(strParametersArray[j]);
>         }
>       /*
>       for(int j=0;j<addParametersArray.length;j++)
>         {
>          StringParameter addParam = 
> (StringParameter)wss.newStringParameter(addParametersArray[j]);
>          addParam.setExpression(addParametersArray[j]);
>          }
>       */  
>      
>       String 
> keyLSID="urn:lsid:localhost:"+_actorNameStr+":LOCALID0";       
>       Iterator lsidIter = service.getLSIDFor(wss);
>       boolean isUpdated=false;
>       while (lsidIter.hasNext()) {
>     String nextLSID = (String) lsidIter.next();
>         if(keyLSID.equals(nextLSID)) {
>       service.updateLSID(nextLSID, wss);
>       engine.addActorAnnotation(nextLSID, "PreConfiguredGridletActor");
>       System.out.println("UPDATE: " + nextLSID);
>           isUpdated=true;
>           break;
>           }
>     }
>       if(!(isUpdated)) {
>         String newLSID = 
> service.createLocallyUniqueLSID(_actorNameStr);          
>         service.assignLSID(newLSID, wss);
>     engine.addActorAnnotation(newLSID, "PreConfiguredGridletActor");
>     System.out.println("NEW: " + newLSID);       
>         }
>       service.commitChanges();
>       }
>     catch (Exception e) {
>       System.out.println(e);
>       }
>     } // end of fire
> ----------------------------------------------------------------------------------------------
> Do you have any idea what is happening? Whether anyone has any solution 
> to fix this problem.
> 
> with regards,
> 
> Jagan Kommineni
> 
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at ecoinformatics.org
> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev


More information about the Kepler-dev mailing list