[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] OSGi and parameters

Would there be any interest in adding a command line or paramters service to OSGi?  I realise that everything likely could be done via -D but this not very natural for applications.  For example, there are various stages of running a system like Eclipse.  Various arguments are specific to these stages.  A good example is the AntRunner.  Eclipse itself has a number of args which Pascal outlined.  if you spec "-application ...antrunner" then there are a set of args which are passed to the standard Ant code.  Part of this is a freeform argument list which is in turn passed to whatever ant scripts are running.  

Several things to note...

- Ant gets confused by the Eclipse args and so should not see them.  (Eclipse does this by striping off the args as it consumes them.  By the time it gets to the application only the non-eclipse args are left.  This is not entirely satisfactory since there could be arg overlaps  and so the need to strip would be ambiguous)
- We don't control the ant code so need to present a command line it understands
- the ant command line is relatively freeform so we can't just look for pre-defined args...

A simple framework service would allow for variations in the implementation of command lines but standardize the usage model so bundles caring about command lines would run anywhere.


Benjamin Reed <breed@xxxxxxxxxxxxxxx>
Sent by: equinox-dev-admin@xxxxxxxxxxx

06/25/2003 01:34 PM

        To:        Pascal Rapicault/Ottawa/IBM@IBMCA
        cc:        equinox-dev@xxxxxxxxxxx
        Subject:        Re: [equinox-dev] OSGi and parameters

Currently, the only way command line parameters get passed is if the -D
flag is used to set a system property. Otherwise, the concept of a
command line is totally absent from OSGi.

If I understand you properly, you would have a framework service that
would expose the command line with something like:

package org.eclipse.osgi;
public interface CommandLine {
                public String []getArgs();

That would be the OSGi style.

The other option is that you could stick with the
BootLoader.getCommandLineArgs() way. and just have interested bundles
import the package.

Either way, as you point out, you will need to do something
implementation dependent. Although, it really isn't that big of a deal,
since you will just be modifying the launching code.


Pascal Rapicault wrote:
> Hello,
> I would like to know what is the usual way of passing parameters to
> "application" and/or "bundle" running in OSGi.
> Basically the case I'm trying to resolve is the following:
>         today in eclipse: a set of parameters are passed on startup (on
> the command line), and those parameters are
>         then surfaced in eclipse through the Boot plugin. This gives a
> uniform way for people to access parameters.
> How can I give the bundles access to the command line parameters, in a
> nice way?
> My current idea is to create a implementation depend service that would
> surface parameters.
> Any suggestions? Any ideas? Any comments?
>         PaScaL

equinox-dev mailing list