Re: File utilities on exproc.org

Geert Josten <geert.josten@dayon.nl> writes:
> +1 for changing the output ports. I'm pretty sure I have mentioned before
> on occasion that things like logging, and file i/o integrate best if they
> effectively do an identity transform, and just have logging and file i/o
> as side effect.

Changing the file utility steps so that they do an identity transform
with the side effect of, for example, deleting a file, is an
interesting idea.

It would be a fairly radical departure (not that that's important)
From the current design in which they don't have input ports at all.

I can imagine what you mean about making integration easier though.

  <p:load href="somefile.xml"/>
  <cxf:delete href="somefile.html"/>
  <p:xslt ...>

Of course, if cxf:delete does the identity transform, then I guess it
needs a secondary output port (which wouldn't have to be connected)
where it sends the "what I did" message.

It's an interesting idea...

> +1 for just throwing error in case of failure
>
> In case you want to ignore the failure, I would expect the output either
> to still be identity of the input (as far as that makes sense), or simply
> empty. If I wanted to do something with c:error, I would want to jump to
> somewhere else (with try-catch), and take properly care of that there in a
> general way, not inline at each step that could fail..

The default value for fail-on-error is true. So they do simply throw an
error in the case of failure. But suppose I don't care if somefile.html
doesn't exist in the preceding example. I find this:

  <p:load href="somefile.xml"/>
  <cxf:delete href="somefile.html" fail-on-error="false"/>
  <p:xslt ...>

Much less onerous than:

  <p:load href="somefile.xml"/>

  <p:try>
    <p:group>
      <cxf:delete href="somefile.html"/>
    </p:group>
    <p:catch>
      <p:identity/>
    </p:catch>
  </p:try>

  <p:xslt ...>

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 512 761 6676
www.marklogic.com

Received on Tuesday, 26 March 2013 13:31:47 UTC