Results 1 to 3 of 3

Thread: Question on default values in parameters

  1. #1
    grembo is offline Registered User
    Name: Michael Gmelin
    Organization: Grem Equity GmbH
    Project: E-Commerce platform
    Join Date
    Jan 2009
    Posts
    85

    Question on default values in parameters

    Hi,

    it seems like that it's not possible to use parameters as default values for other parameters in icegrids XML templating language.

    Example:
    HTML Code:
    <server-template id="MyTemplate">
      <icebox id="${id}Box" exe="/usr/local/bin/icebox" activation="on-demand">
        <parameter name="id"/>
        <parameter name="providedBy" default="${id}"/>
        <service name="${name}Service" entry="${providedBy}Service:create">
          <adapter name="${service}" id="${name}" endpoints="ssl"/>
        </service>
      </icebox>
    </server-template>
    Unfortunately this leads to the following exception on update:
    Code:
    error: IceGrid::DeploymentException:
    node `Node1':
    invalid value for attribute `default parameter `providedBy'':
    invalid variable `${id}':
     undefined variable `id'
    Is there any other way to model this in an elegant way, or will I have to define two separate templates? (the background is that there are many similar icebox services, providing one service per instance but a few libraries can provide different services depending on configuration.) So the way I intended to use this would be:

    HTML Code:
    <server-instance id="Simple1" template="MyTemplate" />
    <server-instance id="Simple2" template="MyTemplate" />
    <server-instance id="Simple3" template="MyTemplate" />
    <server-instance id="Red" providedBy="Colors" template="MyTemplate">
      <properties service="${id}Service">
        <property name="ColorHex" value="F00"/>
      </properties>
    </server-instance>
    <server-instance id="Green" providedBy="Colors" template="MyTemplate">
      <properties service="${id}Service">
        <property name="ColorHex" value="0F0"/>
      </properties>
    </server-instance>
    <server-instance id="Blue" providedBy="Colors" template="MyTemplate">
      <properties service="${id}Service">
        <property name="ColorHex" value="00F"/>
      </properties>
    </server-instance>
    cheers
    Michael

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Yes, a parameter can't depend on another parameter, see here for the semantics of variables and parameters in IceGrid descriptors.

    I would use 2 server templates instead:
    Code:
    <icegrid>
      <application name="MyApp">
    
        <server-template id="MyTemplate">
          <parameter name="id"/>
          <icebox id="${id}Box" exe="/usr/local/bin/icebox" activation="on-demand">
            <service name="Service" entry="${id}Service:create">
              <adapter name="${service}" endpoints="ssl"/>
            </service>
          </icebox>
        </server-template>
    
        <server-template id="MyColorsTemplate">
          <parameter name="id"/>
          <parameter name="color"/>
          <icebox id="${id}Box" exe="/usr/local/bin/icebox" activation="on-demand">
            <service name="Service" entry="ColorsService:create">
              <adapter name="${service}" endpoints="ssl"/>
              <property name="ColorHex" value="${color}"/>
            </service>
          </icebox>
        </server-template>
    
        <node name="node1">
          <server-instance id="Simple1" template="MyTemplate"/>
          <server-instance id="Red" color="0F0" template="MyColorsTemplate"/>
        </node>
    
      </application>
    </icegrid>
    Cheers,
    Benoit.

  3. #3
    grembo is offline Registered User
    Name: Michael Gmelin
    Organization: Grem Equity GmbH
    Project: E-Commerce platform
    Join Date
    Jan 2009
    Posts
    85
    Hi Benoit,

    what a pity. Colors was of course just an example, in practice there are many different of those and the general question was about having dynamic default values for parameters (deployed by somebody who can just use an existing template in the UI and add the properties as required). Well, in the end it's just an inconvenience

    Thanks for your answer anyway.

    cheers
    Michael

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-03-2008, 11:10 PM
  2. question about default host of endpoints
    By canyoudink in forum Help Center
    Replies: 0
    Last Post: 04-26-2007, 10:20 AM
  3. Slashes in property values kills icegridadmin
    By ctennis in forum Bug Reports
    Replies: 8
    Last Post: 04-19-2007, 10:43 AM
  4. Replies: 1
    Last Post: 05-30-2006, 05:58 PM
  5. Replies: 4
    Last Post: 07-15-2005, 07:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •