[kepler-users] kepler parameters
Christopher Brooks
cxh at eecs.berkeley.edu
Mon Oct 24 20:46:02 PDT 2011
Hi Kianwee,
Usually the classpath is set when the Java process is started up.
Consult the web for more information about the Java classpath.
Basically, the classpath is a set of directories, jar files and zip
files that Java searches to find Java class files and resources. I've
found that referring to resources using $CLASSPATH is necessary when
models are delivered as Java Web Start applications or as applets. The
problem is somewhat complex, but has to do with jar urls and caching.
The xxxxxxCLASSPATHxxxxxxx is a hack and should not appear. If you send
me a model that shows xxxxxxxCLASSPATHxxxxx, I'll take a look.
Kepler uses kar files that contain Ptolemy models that are xml files.
I'm not that familiar with kar files, but I believe you could use the
jar command to unjar a kar file and then use a file editor to edit the
.xml file.
You can also export a .xml file from Kepler and then edit that using a
file editor and then open the .xml file from within Kepler.
_Christopher
On 10/24/11 8:22 PM, kianwee chen wrote:
> Thanks for the quick reply
> I often end up using $CLASSPATH, which looks inthe classpath for the
> resource.
>
> I type in the $CLASSPATH and this is what is return "
> xxxxxxCLASSPATHxxxxxx " is there a way to set the classpath ?
>
> For a CompositeActor, you would probably need to edit the MoML by hand
> and add a Parameter:
>
> How do you edit the MoML of a composite actor by hand ? I right click
> and try all the options but did not get any options that allow me to
> edit the MoML
>
> thanks
> ckw
>
> I typed in the $CLASSPATH and I only get this
> On Tue, Oct 25, 2011 at 12:46 AM, Christopher Brooks
> <cxh at eecs.berkeley.edu <mailto:cxh at eecs.berkeley.edu>> wrote:
>
> Hi Kianwee,
> My comments are interspersed with your text below.
>
>
> On 10/24/11 8:39 AM, Edward A. Lee wrote:
>>
>> The documentation for FileParameter says:
>>
>> "If this attribute contains a parameter named allowFiles with
>> value false, then when a file browser is used to select a file,
>> that file browser will be set to not show files (only directories
>> will be shown). If this attribute contains a parameter named
>> allowDirectories with value true, then the file browser will
>> permit the user to select directories (the default behavior is
>> that when a directory is selected, that directory is opened and
>> its contained files and directories are listed)."
>>
>> (I'm not sure about Kepler, but in Ptolemy, just drag in a
>> FileParameter
>> from the Utilities menu, right click on it, and select
>> Documentation.)
>>
>> I'm not sure what you mean by "list parameter." Can you cite a
>> specific
>> example?
>>
>> Edward
>>
>>
>> On 10/24/11 3:22 AM, kianwee chen wrote:
>>> Hi everyone, I am trying to create a composite actor and trying
>>> to setup
>>> the parameters for the composite actor. Thus I have some
>>> question on
>>> adding parameters in composite actors.
>>>
>>> 1.) Directory parameter:
>>>
>>> -I would like to let the users specify a directory on the composite
>>> actor parameters interface, I know there is a file parameter but
>>> I need
>>> a directory parameter. How can I customise a directory parameter ?
>
> See Edward's explanation above.
>
>>>
>>> -I have a problem with relative path too, when I setup a file
>>> parameter
>>> it returns the string of the path relative to my current kepler
>>> file
>>> that is open. Is there a way to get the base file path ?
>>> Something like
>>> $CWD, but instead the file path of my currently open file ?
>
> The FileParameter documentation says:
>
> <p>If the model containing this
> attribute has been saved to a MoML file, then the file name can be
> given relative to the directory containing that MoML file.
> If the model has not been saved to a file,
> then the classpath is used for identifying relative file names.</p>
>
> <p>Files can be given relative to a <i>base</i>, where the baseis
> the URI of the first container above this one that has a
> URIAttribute.
> Normally, this URI specifies the file or URL containing the model
> definition. Thus, files that are referred to here can be kept in the
> same directory as the model, or in a related directory, and can
> moved together with the model.</p>
>
> So, if you type in a relative path, then the file should be
> relative to the model.
>
> There is a Ptolemy test at
> ptolemy/actor/lib/io/test/auto/FileReader.xml
> that illustrates the various possibilities. If this test is run
> in the ptolemy/actor/lib/io/test
> directory, then it will work. If the test is run elsewhere, then
> the "FileReader Relative to CWD"
> actor will fail because that actor uses $CWD, which is expected to
> be ptolemy/actor/lib/io/test
> in that test.
>
> In Java, the value of the user.dir property is the " User's
> current working directory".
> However, when a Java program is opened in a graphical windowing
> system by clicking on
> a menu choice, then the value of user.dir is not clearly defined.
> It should probably be
> the same value as the user's home directory, but I've seen various
> values.
> For a FileParameter, the value of $CWD is set to the value of the
> user.dir property,
> which is probably not what you want. I often end up using
> $CLASSPATH, which looks in
> the classpath for the resource. The file chooser does not have a
> way to add $CLASSPATH,
> you have to type it in manually.
>
>
>
>>>
>>> 2.) List Parameter:
>>> - I have seen some actor have List parameters how do I customise
>>> one for
>>> my composite actor too ?
>
> For atomic actors, the ptolemy/actor/lib/MathFunction.java uses
> the addChoice() method:
>
> // Parameters
> function = new StringParameter(this, "function");
> function.setExpression("exp");
> function.addChoice("exp");
> function.addChoice("log");
> function.addChoice("modulo");
> function.addChoice("sign");
> function.addChoice("square");
> function.addChoice("sqrt");
> _function = _EXP;
>
> I believe that addChoice() is defined in ptolemy/gui/Query.java
>
> For a CompositeActor, you would probably need to edit the MoML by
> hand and add a Parameter:
>
> <property name="function"
> class="ptolemy.data.expr.StringParameter" value="square">
> <property name="style" class="ptolemy.actor.gui.style.ChoiceStyle">
> <property name="exp" class="ptolemy.kernel.util.StringAttribute"
> value="exp">
> </property>
> <property name="log" class="ptolemy.kernel.util.StringAttribute"
> value="log">
> </property>
> <property name="modulo"
> class="ptolemy.kernel.util.StringAttribute" value="modulo">
> </property>
> <property name="sign" class="ptolemy.kernel.util.StringAttribute"
> value="sign">
> </property>
> <property name="square"
> class="ptolemy.kernel.util.StringAttribute" value="square">
> </property>
> <property name="sqrt" class="ptolemy.kernel.util.StringAttribute"
> value="sqrt">
> </property>
> </property>
> </property>
>
> _Christopher
>
>>>
>>> Thanks alot !!
>>> ckw
>>>
>>>
>>> _______________________________________________
>>> Kepler-users mailing list
>>> Kepler-users at kepler-project.org
>>> <mailto:Kepler-users at kepler-project.org>
>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>
>>
>> _______________________________________________
>> Kepler-users mailing list
>> Kepler-users at kepler-project.org <mailto:Kepler-users at kepler-project.org>
>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>
> --
> Christopher Brooks, PMP University of California
> CHESS Executive Director US Mail: 337 Cory Hall
> Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
> ph:510.643.9841 <tel:510.643.9841> (Office: 545Q Cory)
> home: (F-Tu)707.665.0131 <tel:707.665.0131> cell:707.332.0670 <tel:707.332.0670>
>
>
--
Christopher Brooks, PMP University of California
CHESS Executive Director US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
ph: 510.643.9841 (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20111024/a7d50260/attachment.html>
More information about the Kepler-users
mailing list