Re: Parameters redux

/ Alessandro Vernet <avernet@orbeon.com> was heard to say:
| On 5/14/07, Norman Walsh <ndw@nwalsh.com> wrote:
|> [...]
|> Maybe I've overlooked some corners, but this seems better to me
|> than the current status-quo.
|
| Let me start with a simple question: in what use cases would you use
| parameters vs. options in pipelines? My understanding is that
| parameters are used in pipelines (just like in components) in cases
| where we don't know the names in advance. When we know the names in
| advance, we will use options instead. Is this correct?

When the *step designer* knows the names in advance, then options make
sense. But there may be many steps which can usefully take name/value
pairs that the step designer didn't know anything about even though the
pipeline author does.

For example, we might say that parameters to the p:http-request step
are turned into headers. We can't make options for all of them because
the set of headers is open-ended. Nevertheless, the pipeline author
knows what headers to send:

<p:http-request>
  <p:parameter name="Set-Cookie" value="remember-me=ndw;path=/"/>
  <p:parameter name="Authorization" value="Basic: yadayadayad"/>
  ...
</p:http-request>

It's also possible that implementors will want to use parameters to
specify implementation-specific extensions to standard components. (For
testing threading, I want to be able to control the order of execution
for components; I'm tempted to do this by making each of them accept a
px:wait parameter that causes them to sleep for "n" seconds.)

Parameter sets come into play if I have more than one set of components:

<p:pipeline>
  <p:option name="xsltauth" value="None"/>
  <p:parameter-set name="xsltparam">
    <p:parameter name="Authorization" select="$xsltauth"/>
    <p:parameter name="format" value="html"/>
  </p:parameter-set>
  <p:parameter-set name="wsparam">
    <p:parameter name="Authorization" value="Basic: yadayadayad"/>
    <p:parameter name="Set-Cookie" value="remember-me=ndw;path=/"/>
  </p:parameter-set>

  ...

  <p:http-request use-parameters="wsparam"/>

  ...

  <p:xslt1 use-parameters="xsltparam"/>

  ...

</p:pipeline>

| I imagine a case where a pipeline receives a set of name/value pairs
| for HTTP headers and name/value pairs to be used as HTTP request
| parameters. The pipeline needs to call a first step passing only the
| HTTP headers parameters. How would it do that? One way was to have
| each set of parameters in a different namespace, and have a way in the
| pipeline language to pass all the parameters in a particular namespace
| to a step. Another way is to use a structured document instead of
| parameters, both at the pipeline level and at the component level.

Because the p:http-request step has a structured input, it's probably
always possible to use that input to achieve the desired result. And if
the data is coming from a pipe, that's probably the *easiest* way, but
for many pipelines, the parameters will be known by the pipeline author
in advance, I thik.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Everything should be made as simple as
http://nwalsh.com/            | possible, but no simpler.

Received on Wednesday, 16 May 2007 13:20:03 UTC