Archived

This forum has been archived. Please start a new discussion on GitHub.

Minor RFE : Property expansion

Ice configurations files have nearly the same format as Java property files making them, for us, extremely useful. A common extension, used in Spring, Ant, etc., is property expansion.

This has become an issue when porting an IceGrid application to Windows. Not having relative file paths means that it is now necessary to specify several absolute paths like this:
IceGrid.Node.Data=c:\omero-3.0-Beta3\var\master
Ice.StdOut=c:\omero-3.0-Beta3\var\log\master.out
Ice.StdErr=c:\omero-3.0-Beta3\var\log\master.err
...

Property expansion would allow:
Omero.Home=C:\omero-3.0-Beta3
IceGrid.Node.Data=${Omero.Home}\var\master
Ice.StdOut=${Omero.Home}\var\log\master.out
Ice.StdErr=${Omero.Home}\var\log\master.err

Where "Omero.Home" could be specified in a separate file, making our porting as simple as:
#etc/master.cfg:
IceGrid.Node.Data=${Omero.Home}/...

#etc/Windows.cfg:
Omero.Home=c:\omero-3.0-Beta3

#etc/Linux.cfg
Omero.Home=.

Comments

  • This may be helpful

    you may be able to build this in yourself using something like

    OSSP: OSSP var

    Ive compiled it under Win32 (MSVC6 SP5)
  • Good link, thanks.

    But I'm assuming this would require substantial changes for the Ice runtime to also use these properties on initialize(), combining the command-line properties, "--Ice.Grid.Node=", the ICE_CONFIG config file, as well as any PropertiesI() which are passsed in.

    Certainly something I'd rather see built in.
  • xdm
    xdm La Coruña, Spain
    Hi Josh

    Note that you can use IceGrid templates and parameters to do that.

    You can review IceGrid template docs in IceManual
    http://www.zeroc.com/doc/Ice-3.3.0/manual/IceGrid.36.7.html
  • Thanks XDM. Of course, you are right. The example I gave is doable in IceGrid. But other configuration, say in the client, do not allow this. One example might be:
    Ice.Default.Router=OMERO.Glacier2/router:tcp -p 4063 -h ${host}
    

    which would allow a user to enter the "host" value, but without the need for the developer to do any string parsing on the "Ice.Default.Router" value nor to store the base of that string elsewhere, say:
    # Config
    String.For.Router=OMERO.Glacier2/router:tcp -p 4063
    
    # Code
    base = properties.getProperty("String.For.Router")
    routr = base + host_from_user
    ...