[kepler-dev] Export Archive Context Menu

Chad Berkley berkley at nceas.ucsb.edu
Fri Oct 6 12:18:07 PDT 2006


I think I've finally figured out why this is happening.  The class 
ptolemy.actor.TypeAttribute has two constructors:

public TypeAttribute(Workspace workspace)
public TypeAttribute(TypedIOPort container, String name)

The second one is what is causing problems for kepler.  TypeAttribute 
assumes that only a TypedIOPort can be its container, which makes sense 
for PTII but not for kepler.  Kepler has a PortAttribute that keeps 
track of ports within the kar files.  The parser was dying because 
Kepler was trying to assign a PortAttribute (which is not a TypedIOPort) 
as the container.  A simple fix is just to add another constructor to 
TypeAttribute that allows an Attribute to be a container like so:

public TypeAttribute(Attribute container, String name)

I tried this and it works fine.  Is it ok if I check this change into 
the PTII tree, or should I put it in the kepler/src/exp tree (I'd rather 
put it in PTII).

chad


Edward A. Lee wrote:
> 
> The MoML parser will only use a two-argument constructor that
> takes a container and a name.  The right way to set a port type
> in a MoML file is with a type attribute.
> 
> I'm happy to look at a concrete case, if you send me one...
> 
> Edward
> 
> At 01:38 PM 10/5/2006, Chad Berkley wrote:
> 
>> Hey Dan,
>>
>> I fixed the ontology problem.  It now loads correctly unless you change
>> the type of the port.  This seems to be a ptolemy bug or something.  I
>> remember this happening before and I could never figure it out.  The
>> error is thrown from the MoMLParser and I have no idea why it can't find
>> the correct constructor for a port with a type.  the constructor exists.
>>   I'll keep digging into it.
>>
>> chad
>>
>> Dan Higgins wrote:
>> > Hi Chad,
>> >    Yes, the 'Export Archive (KAR)...' actor context menu is just what I
>> > was asking for!
>> >
>> >    I tested it by creating a customized RExpression actor where I added
>> > 2 input ports and one output port. It writes the kar file with no
>> > problem, but I did have several problems when I tried loading the
>> > exported KAR file back into Kepler (using the 'File/Import 
>> Archive(KAR)'
>> > menu.
>> >    First, if I set the 'Type' of the output port to something like
>> > '{int}' I see an error (Cannot find suitable constructor...')
>> >    If I do not set  a type, I get a different error - "There are no
>> > semantic types defined in this KAR file..." even though there were
>> > semantic types defined in the orginal RExpression actor. Shouldn't the
>> > saved KAR include sematic types from the original actor? (Or ask for 
>> new
>> > ones?)
>> >
>> > Dan
>> >
>> _______________________________________________
>> Kepler-dev mailing list
>> Kepler-dev at ecoinformatics.org
>> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
> 
> 
> ------------
> Edward A. Lee
> Professor, Chair of EECS
> 231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
> phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
> eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal 
> 


More information about the Kepler-dev mailing list