/
CC EBM WebSourcing  This work is licensed under the CreativeCommons A CC EBM WebSourcing  This work is licensed under the CreativeCommons A

CC EBM WebSourcing This work is licensed under the CreativeCommons A - PDF document

audrey
audrey . @audrey
Follow
342 views
Uploaded On 2021-08-07

CC EBM WebSourcing This work is licensed under the CreativeCommons A - PPT Presentation

PEtALSSEPojo This document explain how to install and configure the petalssepojo JBI componentPEtALS TeamMarie Sauvage x0000 June 2007 PETALSSEPOJOPEtALSSEPojo4PETALSSEPOJOThe POJO Plain O ID: 858884

service pojo component petals pojo service petals component jbi class unit engine 149 java exchange method configuration logger public

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "CC EBM WebSourcing This work is license..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1 (CC) EBM WebSourcing - This work is lice
(CC) EBM WebSourcing - This work is licensed under the CreativeCommons Attribution-NonCommercial-ShareAlike License. To view a copyof this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ PEtALS-SE-Pojo This document explain how to install and configure the petals-se-pojo JBI component.PEtALS TeamMarie Sauvage �- June 2007 - PETALS-SE-POJO PEtALS-SE-Pojo4 PETALS-SE-POJOThe POJO (Plain Old Java Object) Service Engine allows to deploy Java classes as Services. It can be usefull to developsimple business processes or workflows.A POJO service is deployed as a ServiceUnit on the petals-engine-pojo component.The POJO serviceEndpoint is activated in the JBI environment with the information contained in the ServiceUnitdescriptor file.The POJO service can interact with the JBI environment as a JBI component. Component Configuration PEtALS-SE

2 -Pojo5 Chapter 1. Component Configuratio
-Pojo5 Chapter 1. Component ConfigurationThe following attributes can be set during the installation phase to configure the component, using the params elementof the jbi-install-component ANT task:no configuration for this componentTable 1.1. component installation configuration attributes Attribute Description Default Required Service Configuration PEtALS-SE-Pojo6 Chapter 2. Service Configuration2.1. Expose a Java class as servicePROVIDE SERVICE : Expose a Java class as a Service2.1.1. Service Unit descriptorThe POJO class and other required libraries have to be compiled and available as JAR files at the top directory of thestructure of the service unit.Take a look at Service Assembly pojoService.zip. It contains a Helloworld POJO that log the In message and return, ifthe MEP allows a response, a helloworld message.The Service Unit descriptor file (jbi.x

3 ml) looks like this : version="1.0" &#x
ml) looks like this : version="1.0" &#x?xml;&#x 000;encoding="UTF-8"? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:petals="http://petals.ow2.org/extensions" xmlns:jbi="http://java.sun.com/xml/ns/jbi" &#xjbi:;&#xjbi ;version="1.0" &#xjbi:;&#xserv;&#xices;&#x 000;binding-component="true" interface-name="petals:Pojo" service-name="petals:servicePojo" &#xjbi:;&#xprov;&#xides;&#x 000;endpoint-name="endpointPojo" &#xpeta;&#xls:p; ram;&#xs000; &#xpeta;&#xls:p; ram;&#x 000;name="class-name"org.ow2.petals.samples.pojo.SamplePojoService&#x/pet; ls:;&#xpara;&#xm000; &#x/pet; ls:;&#xpara;&#xms00; &#x/jbi;&#x:pro;&#xvide;&#xs000; &#x/jbi;&#x:ser;&#xvice;&#xs000;&#x/jbi;&#x:jbi;JMS communication attributes :Table 2.1. service-unit attributes to provide services Attribute Description Default Required provides Name of

4 the JBI service that will be activated
the JBI service that will be activated to expose the JMSDestination into the JBI environment. interface (qname), service (qname)and endpoint (string) name are required. class-name the name of the Java class to use. Yes2.1.2. Service Unit contentThe Service Unit has to contain the following elements, packaged in an archive:•The META-INF/jbi.xml descriptor file, has described above,•A jar containing the java class to expose service-unit.zip + META-INF - jbi.xml (as defined above) - mypojoclasses.jar PEtALS-SE-Pojo PEtALS-SE-Pojo3 List of Tables1.1. component installation configuration attributes ....................................................................................... 52.1. service-unit attributes to provide services .............................................................................................. 6 POJO Se

5 rvice Specifications PEtALS-SE-Pojo7 Cha
rvice Specifications PEtALS-SE-Pojo7 Chapter 3. POJO Service SpecificationsA Java class acting as a POJO service must follow the rules :•no specific interface implementationis required.•if a setXXX(ComponentContext context) setter method is defined, it is called with the ComponentContext of the petals-engine-pojo component.•if a setXXX(DeliveryChannel channel) setter method is defined, it is called with the DeliveryChannel of the petals-engine-pojo component.•if a setXXX(Logger logger) setter method is defined, it is called with the Logger of the petals-engine-pojo component.•if a void init() method is defined, it is called when the service unit has been deployed.•a boolean onXXX(Exchange exchange) MUST be provided.•all methods can throw exceptions.A sample class following those rules : public class SamplePojoService {

6 public void setChannel(DeliveryChannel c
public void setChannel(DeliveryChannel channel) { this.channel = channel; } public void setCtx(ComponentContext ctx) { this.ctx = ctx; } public void setLogger(Logger logger) { this.logger = logger; } public boolean onExchange(Exchange exchange) throws Exception { [...] channel.sendSync(anotherExchange); [...] return false; } public void init() { logger.log(Level.INFO, "SamplePojo inits."); }}The method onXXX(Exchange exchange) is called when a MessageExchange for the activated serviceEndpoint is receivedon the petals-engine-pojo component. The POJO service has to do its process here.If the POJO service sets a response on the exchange and the exchange pattern is InOut or InOptionalOut, the method hasto return true. Then the petals-engine-pojo component sends the exchange back.Otherwise, the method has to return false and

7 the petals-engine-pojo component sends
the petals-engine-pojo component sends a DONE status back.If the method throws an exception, the petals-engine-pojo component sends a Fault message back, if the pattern permits it. Samples PEtALS-SE-Pojo8 Chapter 4. SamplesSee the following Service Assemblies samples that illustrate the configuration of this component :http://wiki.petals.objectweb.org/xwiki/bin/download/Components.Engine/pojo/pojoService.zip This sample contains a Helloworld POJO that log the In message and return, if the MEP allows a response, a helloworldmessage. PEtALS-SE-Pojo PEtALS-SE-Pojo2 Table of ContentsPETALS-SE-POJO .................................................................................................................................. 41. Component Configuration ..........................................................................................................

8 ........... 52. Service Configuration ..
........... 52. Service Configuration ........................................................................................................................... 62.1. Expose a Java class as service ..................................................................................................... 62.1.1. Service Unit descriptor .................................................................................................... 62.1.2. Service Unit content ....................................................................................................... 63. POJO Service Specifications ................................................................................................................. 74. Samples .............................................................................................................................................