Home Comments

Request: Allow parameters as refid in property sets

jharrisjharris Member John HarrisOrganization: HTG Capital PartnersProject: Trading
I really like the templates idea for deployment, but unless I'm missing something, it seems the named property set implementation is missing a crucial feature.

An obvious use that doesn't seem to be supported is to have the refid come from a variable or a parameter, so you could pull in one set of properties (e.g. Debug) or another in the instantiation of the template. But it seems refid can only be a hard-coded string literal.

The only workaround I could come up with is to copy/paste the template code and give it a different name, which defeats the purpose of having a template.

I'd like to be able to do this:
<server-template id="SRVR">
  <parameter name="mode" default="Debug"/>

  <server ...>
     <properties>
        <properties refid="${mode}"/>
        <property...>

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi John,

    A refid can only refer to a property-set, and not to a parameter. See Properties Descriptor Element for details.

    You can however refer to a template parameter in a property, e.g.:
    <server-template id="SRVR">
      <parameter name="mode" default="Debug"/>
    
      <server ...>
         <properties>
            <property name="mode" value="${mode}"/>
    

    See Using Descriptor Variables and Parameters for more examples.

    Best regards,
    Bernard
  • joshmoorejoshmoore GermanyMember Josh MooreOrganization: Glencoe Software, Inc.Project: OME, http://openmicroscopy.org
    Hi John

    I like the idea of supporting more locations for variable and property resolution, see "Minor RFE : Property expansion"

    There are a couple of other options. We use targets and properties rather heavily in OMERO. One properties definition there contains several targets for adjusting what gets pulled in via the refid:
        <properties id="JavaServer">
          <target name="adh">
            <property name="Ice.Default.Protocol" value="ssl"/>
            <property name="Ice.Plugin.IceSSL" value="IceSSL.PluginFactory"/>
            <property name="IceSSL.Ciphers" value="NONE (DH_anon)"/>
            <property name="IceSSL.VerifyPeer" value="0"/>
          </target>
          <target name="ssl">
            <property name="Ice.Default.Protocol" value="ssl"/>
            <property name="Ice.Plugin.IceSSL" value="IceSSL.PluginFactory"/>
            <property name="IceSSL.DefaultDir" value="etc/certs"/>
            <property name="IceSSL.CertFile" value="pubkey.pem"/>
            <property name="IceSSL.KeyFile" value="privkey.pem"/>
            <property name="IceSSL.CertAuthFile" value="ca.pem"/>
          </target>
        </properties>
    

    Another option would be to optionally include your properties element in the template:
       <server-template id="IndexerTemplate">
            ...
            <properties>
                <target name="Debug">
                  <properties refid="Profile"/>
                </target>
            </properties>
    
    

    Cheers,
    ~Josh.
  • jharrisjharris Member John HarrisOrganization: HTG Capital PartnersProject: Trading
    Thanks, Josh. I hadn't run across targets until I saw your post.

    The documentation is pretty thin on that feature. It looks like the only place you can select them, though, is through the icegridadmin utility when you do the deployment and through the <include> element. Still, I think I could use targets to clean up my template design a little.

    But a simple variable expansion in the refid for property sets would be ideal to eliminate copy-paste repetition of templates.
Sign In or Register to comment.