Custom Java processor

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

Custom Java processor

ibiddles
Hi,

I am new to Orbeon and I have been trying to get a pipeline of two custom Java processors working.

The problem is that one of the processors (the last in the pipeline) gets run but the other processor does not. I presume that I am not defining the input to processor 2 as the output from processor 1 correctly.

Here is my XPL file:

<p:config xmlns:p=http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors"
          xmlns:in-xs="http://www.my_company.com/ops/processors">
   <p:param type="input"  name="data">
   <p:param type="output" name="data">

   <p:processor name="in-xs:localizer">
      <p:input  name="data" href="#data"/>
      <p:output name="data"   id="localizer"/>
   </p:processor>

   <p:processor name="in-xs:assembler">
      <p:input  name="data" href="#localizer"/>
      <p:output name="data"  ref="data"/>
   </p:processor>

</p:config>

The processors are both defined in custom-processors.xml and one of them is actually invoked. Can anyone see what I'm doing wrong here?

Best wishes,
            Ivan



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Custom Java processor

Alessandro  Vernet
Administrator
Hi Ivan,

Your XPL code looks good; the connections are done correctly. Is you
second processor in your pipeline (in-xs:assembler) always reading its
input when it runs?

I am asking the question because as you may know XPL evaluation is
done is a lazy way: if the second processor does not need the data
generated by the first one to generate its output, then the first one
is just not going to run.

Alex

On 11/9/05, [hidden email] <[hidden email]> wrote:

> Hi,
>
> I am new to Orbeon and I have been trying to get a pipeline of two custom Java processors working.
>
> The problem is that one of the processors (the last in the pipeline) gets run but the other processor does not. I presume that I am not defining the input to processor 2 as the output from processor 1 correctly.
>
> Here is my XPL file:
>
> <p:config xmlns:p=http://www.orbeon.com/oxf/pipeline"
>           xmlns:oxf="http://www.orbeon.com/oxf/processors"
>           xmlns:in-xs="http://www.my_company.com/ops/processors">
>    <p:param type="input"  name="data">
>    <p:param type="output" name="data">
>
>    <p:processor name="in-xs:localizer">
>       <p:input  name="data" href="#data"/>
>       <p:output name="data"   id="localizer"/>
>    </p:processor>
>
>    <p:processor name="in-xs:assembler">
>       <p:input  name="data" href="#localizer"/>
>       <p:output name="data"  ref="data"/>
>    </p:processor>
>
> </p:config>
>
> The processors are both defined in custom-processors.xml and one of them is actually invoked. Can anyone see what I'm doing wrong here?
>
> Best wishes,
>             Ivan
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Custom Java processor

ibiddles
In reply to this post by ibiddles
Dear Allessandro,

You were spot on. I had created two dummy processors not realizing that the lazy instantiation was at the point of actually reading the stream, so that cleared up my problem.

I do have one other issue. My processor is now using the inputs and outputs correctly but one of its functions is to decide, based upon user selection, his locale and which specific form we need to display to him.

Currently, I have not found a way to create the XPL without a hardcoded view file in the XPL. My processor makes its decisions and selects and populates a document, that I can print out,  but then the view in the XPL is always the one that is displayed.

What am I doing wrong?

Best wishes, Ivan



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Custom Java processor

Alessandro  Vernet
Administrator
Hi Ivan,

I am not sure that I fully understand your question but will try to
give you a few pointers. Is your XPL file setup as the view in the
page flow? Is your processor choosing a different form to use
depending on the user, where is this form stored? If each form is
stored in a file, you could have your processor output the URL of the
file (e.g. oxf:/forms/english-form.xml) and then use the URL generator
to generate this file. Let me know if this not exactly what you were
looking for.

http://www.orbeon.com/ops/doc/processors-generators-url

Alex

On 11/14/05, [hidden email] <[hidden email]> wrote:

> Dear Allessandro,
>
> You were spot on. I had created two dummy processors not realizing that the lazy instantiation was at the point of actually reading the stream, so that cleared up my problem.
>
> I do have one other issue. My processor is now using the inputs and outputs correctly but one of its functions is to decide, based upon user selection, his locale and which specific form we need to display to him.
>
> Currently, I have not found a way to create the XPL without a hardcoded view file in the XPL. My processor makes its decisions and selects and populates a document, that I can print out,  but then the view in the XPL is always the one that is displayed.
>
> What am I doing wrong?
>
> Best wishes, Ivan
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Custom Java processor

ibiddles
Dear Alex,

Here is exactly what I'm trying to do. I apologize if I am not yet "thinking" with Orbeon.

1. The user logins in so I save his username and his preferred language (locale) in the session.

2. He gets a menu of forms that are specific to him in his preferred language.

3. He selects the form he wants to fill out and that form-id comes to me as his instance data.

4. I am using a Scope Generator to pull his username and locale into an XML document which I then aggregate with the instance data (form-id) using the Identity processor.

5. This data then arrives in my custom Java processor, which does the following:

   a. Gets the basic form (using the form-id and the locale) by reading the file at {filestore}/{locale}/{form-id}.xml

   b. Checks to see if there was any data from last week's submission by that user. If so I merge the previous data into the basic form for every tag that has an attribute of "persist=true".

   c. This is the form that I write to the output.

When the person submits his form, the pipeline is:

1. Scope Generator for username/locale aggregated with the instance data piped to both a "persistor" to save the submitted data by that user and form-id for pre-filling next week's form and a "delivery processor" to ensure that the filled-out form and user-data is also transmitted as a file to a legacy system.

I am primarily an architect and Java developer so I am probably not thinking with Orbeon properly yet, as I said, but that is what I am trying to accomplish.

My ides is to handle internationalization by creating a single source in English with tags to identify what needs to be translated but doing an off-line generation of all 50 language versions to speed the runtime response.

The forms would be deployed to the file system one directory per locale, again so that the process of selecting the appropriate file is simple and quick.

The only complication is the merging of last week's data. I want the file to be created generically so that I only have to maintain one pipeline for all my forms.

That's it in a nutshell and it seems that it would be a fairly common sort of requirement, so please let me know what the correct Orbeon approach would be.

Thanks,  Ivan

2.



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Custom Java processor

Alessandro  Vernet
Administrator
Hi Ivan,

I think I understand better what you are trying to do. So let's get
back to the question in your previous email, which was:

"Currently, I have not found a way to create the XPL without a
hardcoded view file in the XPL. My processor makes its decisions and
selects and populates a document, that I can print out,  but then the
view in the XPL is always the one that is displayed."

I assume that you are referring above to a pipeline that would
dynamically generate form data. In general, in the XForms examples,
the form is just a static file on disk, and you will find in the page
flow something like:

<page path-info="/path/form" view="form.xhtml"/>

In your case you will have 2 pages: one to select the form; one to
view the form. The user starts at the first page, makes a selection,
and an instance with the form id is submitted to the second page. Here
are how those two pages could look like in your page flow:

<page path-info="/select-form" view="forms-list.xhtml"/>
<page path-info="/form" view="form.xpl"/>

So the view for the second page (form.xpl) receives the form id and is
responsible of generating the form based on the locale of the user and
that form id. if you are doing all this in your own processor, it
could look like:

<p:config>
    <p:param name="instance" type="input"/>
    <p:param name="data" type="output"/>

    <p:processor name="oxf:scope-generator">
        <p:input name="config">...</p:input>
        <p:output name="data" id="locale"/>
    </p:processor>

    <p:processor name="ivan:my-processor">
        <p:input name="form-id" href="#instance"/>
        <p:input name="locale" href="#locale"/>
        <p:output name="data" ref="data/>
    </p:processor>
</p:config>

The important thing above is that the pipeline has an input named
"instance", and an output named "data". The "instance" input is where
you get the submitted instance from. The "data" output is where you
generate the form data (XHTML+XForms). I hope that this help,

Alex

On 11/14/05, [hidden email] <[hidden email]> wrote:

> Dear Alex,
>
> Here is exactly what I'm trying to do. I apologize if I am not yet "thinking" with Orbeon.
>
> 1. The user logins in so I save his username and his preferred language (locale) in the session.
>
> 2. He gets a menu of forms that are specific to him in his preferred language.
>
> 3. He selects the form he wants to fill out and that form-id comes to me as his instance data.
>
> 4. I am using a Scope Generator to pull his username and locale into an XML document which I then aggregate with the instance data (form-id) using the Identity processor.
>
> 5. This data then arrives in my custom Java processor, which does the following:
>
>    a. Gets the basic form (using the form-id and the locale) by reading the file at {filestore}/{locale}/{form-id}.xml
>
>    b. Checks to see if there was any data from last week's submission by that user. If so I merge the previous data into the basic form for every tag that has an attribute of "persist=true".
>
>    c. This is the form that I write to the output.
>
> When the person submits his form, the pipeline is:
>
> 1. Scope Generator for username/locale aggregated with the instance data piped to both a "persistor" to save the submitted data by that user and form-id for pre-filling next week's form and a "delivery processor" to ensure that the filled-out form and user-data is also transmitted as a file to a legacy system.
>
> I am primarily an architect and Java developer so I am probably not thinking with Orbeon properly yet, as I said, but that is what I am trying to accomplish.
>
> My ides is to handle internationalization by creating a single source in English with tags to identify what needs to be translated but doing an off-line generation of all 50 language versions to speed the runtime response.
>
> The forms would be deployed to the file system one directory per locale, again so that the process of selecting the appropriate file is simple and quick.
>
> The only complication is the merging of last week's data. I want the file to be created generically so that I only have to maintain one pipeline for all my forms.
>
> That's it in a nutshell and it seems that it would be a fairly common sort of requirement, so please let me know what the correct Orbeon approach would be.
>
> Thanks,  Ivan
>
> 2.
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: Re: Re: Custom Java processor

ibiddles
Dear Alex,

Here is a zip file. There is a text file inside with a little more data.

I sent the source code for my custom processor which you could probably
get working by stripping out all but the necessary data.

Please don't hesitate to call if you have any questions. I want to get
this running as soon as possible. I'm at 323-953-3330 and I'll be here
till late.

Best wishes, Ivan
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 6/2/2004
 
 


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

to-orbeon.zip (37K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Custom Java processor

Alessandro  Vernet
Administrator
Hi Ivan,

On 11/15/05, Ivan Biddles <[hidden email]> wrote:
> Here is a zip file. There is a text file inside with a little more data.

Could you attach as well the log with the exception you are getting,
and the output from your view (what you get in the log file if you put
a "debug" on the <p:param type="input" name="data"/>).

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: Re: Re: Custom Java processor

ibiddles
Dear Alex,

Sorry, I completely forgot about the log file. I got log4j to log to a
file so that is in the zip file together with the HTML error page.

Thanks, Ivan

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Tuesday, November 15, 2005 5:54 PM
To: [hidden email]
Subject: Re: Re: [ops-users] Re: Custom Java processor

Hi Ivan,

On 11/15/05, Ivan Biddles <[hidden email]> wrote:
> Here is a zip file. There is a text file inside with a little more
data.

Could you attach as well the log with the exception you are getting,
and the output from your view (what you get in the log file if you put
a "debug" on the <p:param type="input" name="data"/>).

Alex
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 6/2/2004
 
 


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

orbeon-logs.zip (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Custom Java processor

Alessandro  Vernet
Administrator
Ivan,

I will look this in more details tomorrow, but what's happening here
is that the XForms engine runs in backward compatibility mode, which
you don't want. The reason seems to be that there is no <xforms:model>
in the form that gets generated. You should have an <xforms:model>
under <xhtml:head>. Try to correct this and let us know how it works.

Alex

On 11/15/05, Ivan Biddles <[hidden email]> wrote:

> Dear Alex,
>
> Sorry, I completely forgot about the log file. I got log4j to log to a
> file so that is in the zip file together with the HTML error page.
>
> Thanks, Ivan
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Alessandro Vernet
> Sent: Tuesday, November 15, 2005 5:54 PM
> To: [hidden email]
> Subject: Re: Re: [ops-users] Re: Custom Java processor
>
> Hi Ivan,
>
> On 11/15/05, Ivan Biddles <[hidden email]> wrote:
> > Here is a zip file. There is a text file inside with a little more
> data.
>
> Could you attach as well the log with the exception you are getting,
> and the output from your view (what you get in the log file if you put
> a "debug" on the <p:param type="input" name="data"/>).
>
> Alex
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.698 / Virus Database: 455 - Release Date: 6/2/2004
>
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Custom Java processor

Alessandro  Vernet
Administrator
Ivan,

Adding to my previous email: it seems like
examples/in-xs/forms/en_ZA/form1503.xsl is the XForms document that
does not contain an XForms model.

Normally, if you were not running your code through the "examples
portal", XForms processing would just not happen and the data sent to
the browser would still contain the XForms elements. However, as you
going through the examples portal, the behavior is a little different
and your XForms elements end up being processed by the pre-3.0 XForms
engine which complains that it can't find the node your are making a
reference to in the ref="..." attributes.

Making sure you have the appropriate XForms model in your forms should
solve this problem.

Alex

On 11/15/05, Alessandro Vernet <[hidden email]> wrote:

> Ivan,
>
> I will look this in more details tomorrow, but what's happening here
> is that the XForms engine runs in backward compatibility mode, which
> you don't want. The reason seems to be that there is no <xforms:model>
> in the form that gets generated. You should have an <xforms:model>
> under <xhtml:head>. Try to correct this and let us know how it works.
>
> Alex
>
> On 11/15/05, Ivan Biddles <[hidden email]> wrote:
> > Dear Alex,
> >
> > Sorry, I completely forgot about the log file. I got log4j to log to a
> > file so that is in the zip file together with the HTML error page.
> >
> > Thanks, Ivan
> >
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of
> > Alessandro Vernet
> > Sent: Tuesday, November 15, 2005 5:54 PM
> > To: [hidden email]
> > Subject: Re: Re: [ops-users] Re: Custom Java processor
> >
> > Hi Ivan,
> >
> > On 11/15/05, Ivan Biddles <[hidden email]> wrote:
> > > Here is a zip file. There is a text file inside with a little more
> > data.
> >
> > Could you attach as well the log with the exception you are getting,
> > and the output from your view (what you get in the log file if you put
> > a "debug" on the <p:param type="input" name="data"/>).
> >
> > Alex
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.698 / Virus Database: 455 - Release Date: 6/2/2004
> >
> >
> >
> >
> >
> > --
> > 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
> > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
> >
> >
> >
> >
>
>
> --
> Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet