Optional input in a Java custom processor

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Optional input in a Java custom processor

Florent Georges-3
  Hi

  I have a custom processor that has an optional input.  I
mean one can write either of the following:

    <p:processor name="my:custom-processor">
       <p:input name="in">
          ...
       </p:input>
       <p:output name="data" ref="..."/>
    </p:processor>

    <p:processor name="my:custom-processor">
       <p:output name="data" ref="..."/>
    </p:processor>


  The relevant parts look like this:

    public class CustomProcessor
            extends SimpleProcessor
    {
        public CustomProcessor()
        {
            addInputInfo(new ProcessorInputOutputInfo("in"));
            addOutputInfo(new ProcessorInputOutputInfo("data"));
        }

        public void generateData(PipelineContext ctxt,
                                 ContentHandler out)
                throws SAXException
        {
            ContentHandler handler = ...;
            readInputAsSAX(context, "in", handler);
        }
    }

  But in the case the XPL doesn't pass the optional input
"in", the methods readInput*() throw an exception: «Cannot
find input "in".»

  Is there any way to tag the input as optional in a custom
processor?

  Regards,

--drkm





















__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Optional input in a Java custom processor

Erik Bruchez
Administrator
You can't tag it, but you call getConnectedInputs() to find out what  
inputs are actually connected at runtime.

-Erik

On Apr 24, 2008, at 4:52 AM, Florent Georges wrote:

>  Hi
>
>  I have a custom processor that has an optional input.  I
> mean one can write either of the following:
>
>    <p:processor name="my:custom-processor">
>       <p:input name="in">
>          ...
>       </p:input>
>       <p:output name="data" ref="..."/>
>    </p:processor>
>
>    <p:processor name="my:custom-processor">
>       <p:output name="data" ref="..."/>
>    </p:processor>
>
>
>  The relevant parts look like this:
>
>    public class CustomProcessor
>            extends SimpleProcessor
>    {
>        public CustomProcessor()
>        {
>            addInputInfo(new ProcessorInputOutputInfo("in"));
>            addOutputInfo(new ProcessorInputOutputInfo("data"));
>        }
>
>        public void generateData(PipelineContext ctxt,
>                                 ContentHandler out)
>                throws SAXException
>        {
>            ContentHandler handler = ...;
>            readInputAsSAX(context, "in", handler);
>        }
>    }
>
>  But in the case the XPL doesn't pass the optional input
> "in", the methods readInput*() throw an exception: «Cannot
> find input "in".»
>
>  Is there any way to tag the input as optional in a custom
> processor?
>
>  Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> En finir avec le spam? Yahoo! Mail vous offre la meilleure  
> protection possible contre les messages non sollicités
> http://mail.yahoo.fr Yahoo! Mail
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Optional input in a Java custom processor

Florent Georges-3
Erik Bruchez wrote:

  Erik,

> You can't tag it, but you call getConnectedInputs() to find
> out what inputs are actually connected at runtime.

  Thank you, that's exactly what I was after.

  As a side comment, I found the Javadoc that comes with Orbeon doesn't
include enough classes.  For instance, the class SimpleProcessor is
included in the Javadoc, but neither ProcessorImpl class nor Processor
interface are.  Maybe it would be worth adding them?

  Thanks for your answer,

--drkm

























__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Optional input in a Java custom processor

Erik Bruchez
Administrator
>  As a side comment, I found the Javadoc that comes with Orbeon doesn't
> include enough classes.  For instance, the class SimpleProcessor is
> included in the Javadoc, but neither ProcessorImpl class nor Processor
> interface are.  Maybe it would be worth adding them?

I think we've had the plan for a long time to properly expose the  
processor API, but that hasn't happened yet.

In the meanwhile, I already add these two files. Please let us know if  
there is more!

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Optional input in a Java custom processor

Florent Georges-3
Erik Bruchez wrote:

> Please let us know if there is more!

  I will of course.  Thank you for the adding.

--drkm

























__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws