[kepler-dev] Determine whether -nogui was specified

David Welker david.v.welker at gmail.com
Wed Aug 12 16:21:07 PDT 2009


Hi Michal,

I have added a fix to this. Now, if you want to know what command-line  
args were passed, you can cycle through them. For example, here is  
code that would allow you to see if -nogui was specified.


import org.kepler.CommandLineArgs;

....



public void fire() throws IllegalActionException
{
	
	....
	
	boolean noguiSpecified = false;

	for( String arg : CommandLineArgs.get() )
		if( arg.equals("-nogui") )
                 {
			noguiSpecified = true;
                         break;
                 }	

	....

}

Hope that helps. It certainly is a little cleaner that looking at  
stack traces.

David



On Aug 12, 2009, at 12:10 PM, Michal Owsiak wrote:

> Thanks for the info.
>
> The hack-way is not a pretty solution, but it will do a thing - I will
> check that and tell you whether it works fine.
>
> What I am trying to accomplish is creating an actor that is able to  
> show
> dialog window - when GUI mode is enabled, and skip showing it, when
> -nogui is passed. This way I can easily (without changing actor's
> parameters within workflow) use the same scenario for both cases.
> Otherwise I have to enable/disable some parameter.
>
> But as I have mentioned, I will check the "stack thing" - it should  
> work.
>
> Anyway, if it is possible to add this feature it would be fine.
>
> Another useful feature (in case of -nogui mode) would be providing
> Kepler developers with an access to command line arguments. This way  
> it
> would be possible to parametrize workflow from outside through the
> application's parameters - this would useful whenever Kepler is  
> started
> as a part of a process.
>
> Regards
>
> michal
>
>> There is no really good way to do this at present.
>>
>> If -nogui passed in as an argument, then that affects what is called
>> (either org.kepler.KeplerConfigurationApplication or
>> ptolemy.moml.MoMLCommandLineApplication) but unfortunately the fact  
>> that
>> -nogui was passed in is not otherwise stored.
>>
>> A hackish way to detect whether new -nogui was passed in that should
>> work (I haven't tried it) would be to examine the current stack trace
>> and see if either of the following is present.
>>
>> org.kepler.KeplerConfigurationApplication.main(String[] args)
>>
>> OR
>>
>> ptolemy.moml.MoMLCommandLineApplication(String[] args)
>>
>> One of these classes is called if and only if -nogui was passed in  
>> as a
>> command-line argument.
>>
>> What are you trying to accomplish? Should we make it more  
>> convenient to
>> determine whether -nogui has been passed in on the command line?
>>
>> -David
>>
>>
>>
>> On Aug 12, 2009, at 2:38 AM, Michal Owsiak wrote:
>>
>>> Hello all,
>>>
>>> I want to check within the actor's fire() method whether Kepler was
>>> started with "-nogui" argument. Is it possible to determine  
>>> whether this
>>> switch was used during Kepler execution? How this information can be
>>> retrieved?
>>>
>>> Regards
>>>
>>> Michal
>>>
>>> -- 
>>> Michal Owsiak <michalo at man.poznan.pl>
>>> Poznan Supercomputing and Networking Center
>>> ul. Noskowskiego 10, 61-704 Poznan, POLAND
>>> http://www.man.poznan.pl
>>> _______________________________________________
>>> Kepler-dev mailing list
>>> Kepler-dev at kepler-project.org
>>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>
>
>
> -- 
> Michal Owsiak <michalo at man.poznan.pl>
> Poznan Supercomputing and Networking Center
> ul. Noskowskiego 10, 61-704 Poznan, POLAND
> http://www.man.poznan.pl



More information about the Kepler-dev mailing list