WebLab POJO Chain

From WebLab Wiki
Jump to navigationJump to search

Getting Started

This part explains how to create a simple processing chain using a POJO (Plain Old Java Object). Before reading this tutorial, you should have a good knowledge on WebLab architecture, WSDL, maven, java and PEtALS ESB. Of course you should read first: WebLab developer guide.

Installation

PEtALS (Can be skipped if already installed, BE CAREFUL, YOU NEED TO INSTALL PETALS-SE-POJO)

Before starting, you must have installed PEtALS. If you want to chain two web services (which are connected to the bus using SOAP), you must have installed BC-SOAP. Of course, you must install also SE-POJO:

  • to install PEtALS unzip petals-platform-3.1.3.zip
  • to launch PEtALS, goto petals-platform-3.1.3/bin and launch ./petals-esb start
  • to install BC-SOAP, copy petals-bc-soap-4.0.8.zip to petals-platform-3.1.3/install
  • to install SE-POJO, copy petals-se-pojo-2.2.6.zip to petals-platform-3.1.3/install

You sould have something similar to this in your logs (logs/petals-out.log)

 -----------------------------------------------------------
|                                                           |
|             OW2 PEtALS Enterprise Service Bus             |
|                   http://petals.ow2.org                   |
|                                                           |
 -----------------------------------------------------------

PEtALS ESB is starting...
[Petals.Communication.RMIConnectorImpl]-INFO 2012-01-10 15:32:44,773 JMX RMI server started at : 
service:jmx:rmi:///jndi/rmi://localhost:7700/jmxRmiConnector
[Petals.JBI-Messaging.EndpointRegistryImpl]-INFO 2012-01-10 15:32:46,562 The registry is ready process requests on  http://localhost:7900
[Petals.System.PersistenceServiceImpl]-INFO 2012-01-10 15:32:46,741 Creating database tables
[Petals.Transporter.NioTransportProtocol.NioServerAgent]-INFO 2012-01-10 15:32:46,894 The NIO transporter server is ready to process request on port 7800
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:46,968 Kernel Web service 'ArtifactRepositoryService' has been added and is available at 
'http://localhost:7600/petals/ws/ArtifactRepositoryService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,018 Kernel Web service 'DeploymentService' has been added and is available at 
'http://localhost:7600/petals/ws/DeploymentService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,049 Kernel Web service 'InstallationService' has been added and is available at 
'http://localhost:7600/petals/ws/InstallationService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,211 Kernel Web service 'TopologyService' has been added and is available at 
'http://localhost:7600/petals/ws/TopologyService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,240 Kernel Web service 'EndpointService' has been added and is available at 
'http://localhost:7600/petals/ws/EndpointService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,300 Kernel Web service 'JBIArtefactsService' has been added and is available at 
'http://localhost:7600/petals/ws/JBIArtefactsService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,440 Kernel Web service 'ExecutionEnvironmentManager' has been added and is available at 
'http://localhost:7600/petals/ws/ExecutionEnvironmentManager'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,475 Kernel Web service 'ServiceAssemblyStateService' has been added and is available at 
'http://localhost:7600/petals/ws/ServiceAssemblyStateService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,495 Kernel Web service 'RuntimeService' has been added and is available at 
'http://localhost:7600/petals/ws/RuntimeService'
[Petals.Tools.WebServiceManagerImpl]-INFO 2012-01-10 15:32:47,521 Kernel Web service 'InformationService' has been added and is available at 
'http://localhost:7600/petals/ws/InformationService'

PEtALS ESB platform distribution successfully started - 1/10/12 3:32 PM
System Information : Petals JBI Container - version: 3.1.3
[Petals.JBI-Management.InstallationServiceImpl]-INFO 2012-01-10 16:01:11,849 A new installer for the component 'petals-bc-soap' is loaded
[Petals.Container.Components.petals-bc-soap.bootstrap.petals-bc-soap]-INFO 2012-01-10 16:01:11,853 Install component
[Name : petals-bc-soap, Version : 4.0.8]
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:13,504 Init component...
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:15,751 The JMS transport layer configuration is not complete. It is disabled.
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:17,025 Component initialized
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:17,025 Start component...
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:17,058 Storage Service is now running to process persisted notifications
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,222 Starting Jetty server...
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,625 Hosts : 127.0.0.1 (localhost)  ...
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,625 jetty-6.1.9
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,667 ServicesListServlet: init
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,667 AxisServlet: init
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,686 WelcomeServlet: init
[Petals.Container.Components.petals-bc-soap.jetty]-INFO 2012-01-10 16:01:17,694 Started {}
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:17,706 Component Information is available at ...
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-10 16:01:17,706 Component started
[Petals.JBI-Management.InstallationServiceImpl]-INFO 2012-01-10 16:01:26,468 A new installer for the component 'petals-se-pojo' is loaded
[Petals.Container.Components.petals-se-pojo.bootstrap.petals-se-pojo]-INFO 2012-01-10 16:01:26,472 Install component
[Name : petals-se-pojo, Version : 2.2.6]
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-10 16:01:27,331 Init component...
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-10 16:01:29,196 Component initialized
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-10 16:01:29,196 Start component...
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-10 16:01:29,225 Storage Service is now running to process persisted notifications
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-10 16:01:29,225 Component started

Tomcat (Can be skipped, BE CAREFUL, YOU NEED A TOMCAT WITH THE 3 SERVICES DEPLOYED AND CONFIGURED)

Install Tomcat by unzipping it in a selected folder. Launch tomcat:

  • move to apache-tomcat-7.0.23/bin
  • allow execution of files (bat or sh, for linux: chmod +x *.sh)
  • launch tomcat (./startup.sh)

Now download the three services that we want to chain:

Folder Crawler Service

This service will listen to a folder and when the method will be invoked, this service will generate a WebLab resource linked to the next file in a configured folder.

INFO [pool-2-thread-4] (ReflectionServiceFactoryBean.java:405) - Creating Service
{http://impl.folder.crawler.services.weblab.ow2.org/}FolderCrawlerServiceService from class org.ow2.weblab.services.crawler.folder.impl.FolderCrawlerService
INFO [pool-2-thread-4] (ServerImpl.java:93) - Setting the server's publish address to be /crawler
INFO [pool-2-thread-4] (ContextLoader.java:214) - Root WebApplicationContext: initialization completed in 1655 ms
  • Stop tomcat (apache-tomcat-7.0.23/bin/shutdown.sh)
  • Edit file apache-tomcat-7.0.23/webapps/folder-crawler-service-1.5.3-SNAPSHOT/WEB-INF/classes/FolderCrawlerService.config
  • Change de default configuration file (folder):
folders=PUT YOUR FOLDER

Ff1.png

Tika normalizer

This service will take a WebLab document and extract metadata and text from its native content (PDF, DOC, HTML, ...)

[INFO] org.apache.cxf.endpoint.ServerImpl 19:03:16,652 : Setting the server's publish address to be /analyser
[INFO] org.springframework.web.context.ContextLoader 19:03:16,679 : Root WebApplicationContext: initialization completed in 1754 ms
[INFO] org.springframework.web.context.support.XmlWebApplicationContext 19:03:16,684 : Refreshing Root WebApplicationContext: startup date
[Tue Jan 10 19:03:16 CET 2012]; parent: Root WebApplicationContext
[INFO] org.springframework.beans.factory.xml.XmlBeanDefinitionReader 19:03:16,686 : Loading XML bean definitions from URL
[jndi:/localhost/tika-normaliser-1.7.2-RC1/WEB-INF/cxf-servlet.xml]
[INFO] org.springframework.beans.factory.xml.XmlBeanDefinitionReader 19:03:16,717 : Loading XML bean definitions from class path resource
[META-INF/cxf/cxf.xml]
[INFO] org.springframework.beans.factory.xml.XmlBeanDefinitionReader 19:03:16,737 : Loading XML bean definitions from class path resource
[META-INF/cxf/cxf-servlet.xml]

Ff2.png

SOLR Indexer (embeded)

This service is able to index WebLab document into a efficient full text index structure which enable text on key words and meta data.

19:11:00,448 INFO  [ReflectionServiceFactoryBean:405] Creating Service {http://impl.indexer.services.weblab.ow2.org/}SolrIndexerService
from class org.ow2.weblab.core.services.Indexer
19:11:00,492 INFO  [ServerImpl:93] Setting the server's publish address to be /indexer
19:11:00,495 INFO  [ReflectionServiceFactoryBean:405] Creating Service {http://impl.searcher.services.weblab.ow2.org/}SolrSearcherService
from class org.ow2.weblab.core.services.Searcher
19:11:00,540 INFO  [ServerImpl:93] Setting the server's publish address to be /searcher

Ff3.png

PEtALS Studio

In order to import WebLab services into PEtALS we will use PEtALS Studio.

Import WebLab services inside the BUS

We are going to create 3 endpoints inside the bus corresponding to the 3 services we have to orchestrate. Each endpoint will be package in a service unit.

Create a service unit to import a SOAP WebLab Web Service

The first thing that we need is the WSDL file which explain how the service works, the service contract. For example this file is located at http://localhost:8080/folder-crawler-service-1.5.3-SNAPSHOT/crawler?wsdl for the QueueManager service interface implemented by the folder resource iterator service.

  • in PEtALS Studio click on: File->New->Service Unit
  • select SOAP as component and import service as action, like in the picture

Screenshot-New Service Unit.png

Screenshot-New Service Unit2.png

  • click on next, next, ... and finish

Import other needed services

Repeat this for the other services:

Now you should have three service units in your PEtALS Studio workspace:

Petals studio WS.png

Create POJO service unit

The POJO service engine, provided by PEtALS, calls a simple java Object when an endpoint is called inside the bus. This is the easiest way to quickly code processing chains.

Import in PEtALS Studio

First you need to create the future chain contract. Here is a sample of a generic chain contract, save it somewhere on your hard drive (for example ChainDefinition.wsdl).

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ChainDefinition" targetNamespace="http://weblab.ow2.org/Chain/" xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:tns="http://weblab.ow2.org/Chain/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
targetNamespace="http://weblab.ow2.org/Chain/" xmlns="http://www.w3.org/2001/XMLSchema"
 xmlns:petals="http://weblab.ow2.org/Chain/">
      <element name="ChainRequest" type="petals:ChainRequest"/>
      <complexType name="ChainRequest"/>
      <element name="ChainResponse" type="petals:ChainResponse"/>
      <complexType name="ChainResponse">
        <sequence>
          <element maxOccurs="1" minOccurs="1" name="nbDocOK" type="int"/>
          <element maxOccurs="1" minOccurs="1" name="nbDocSkipped" type="int"/>
          <element maxOccurs="1" minOccurs="1" name="nbDocError" type="int"/>
        </sequence>
      </complexType>
    </schema>
  </types>
  <message name="ChainResponseMessage">
    <part name="payload" element="tns:ChainResponse">
    </part>
  </message>
  <message name="ChainRequestMessage">
    <part name="payload" element="tns:ChainRequest">
    </part>
  </message>
  <portType name="ChainPortType">
    <operation name="process">
      <input name="processInput" message="tns:ChainRequestMessage">
    </input>
      <output name="processOutput" message="tns:ChainResponseMessage">
    </output>
    </operation>
  </portType>
  <binding name="ChainBinding" type="tns:ChainPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="process">
      <soap:operation soapAction="http:petals.ow2.org/process"/>
      <input name="processInput">
        <soap:body use="literal"/>
      </input>
      <output name="processOutput">
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="ChainService">
    <port name="ChainEndpoint" binding="tns:ChainBinding">
      <soap:address location="ChainEndpoint"/>
    </port>
  </service>
</definitions>

PEtALS is a JBI compatible service bus, so it uses the standard JBI API. This API uses the MessageExchange mechanism to allow XML based communication. In order to simplify this part, we provide a simple library that allow you to directly uses WebLab interfaces, model and Helpers.

  • First click on File->New->Service Unit and select the se-pojo like in this picture:

Petals studio WS2.png

  • After that, select the previously created WSDL file corresponding to the contract of your processing chain (its parameters).

Petals studio WS3.png

  • Next, next, next and finish
  • In PEtALS Studio you should now have something similar to this:

Petals studio WS4.png

Now you have to write your POJO which is a simple Java file:

  • Right click on the POJO project su-POJO-ChainService-provide
  • New->Class and enter this (enter the package and the class name):

Petals studio WS5.png

  • Click on finish
  • Refresh the project
  • In PEtALS Studio you should now have something similar to this:

Petals studio WS6.png

Configure POJO

  • Edit jbi.xml file to add the POJO Java class:
			<pojo:class-name>org.ow2.weblab.petals.pojo.tutorial.ProcessingChain</pojo:class-name>

Add WebLab dependency

In order to simplify processing chain development and to hide JBI complexity, you should add a dependency to you POJO project.

 <dependency>
  <groupId>org.ow2.weblab.petals</groupId>
  <artifactId>pojo-utils</artifactId>
  <version>1.1-SNAPSHOT</version>
 </dependency>
 <dependency>
  <groupId>org.ow2.weblab.core</groupId>
  <artifactId>annotator</artifactId>
  <version>1.2.4</version>
 </dependency>
  • Add in plugins part a plugin to compile using Java 6:
 <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.0.2</version>
  <configuration>
   <source>1.6</source>
   <target>1.6</target>
  </configuration>
 </plugin>
  • Go to the folder su-POJO-ChainService-provide and launch
mvn eclipse:eclipse
  • Close PEtALS Studio and open Eclipse

Code your processing chain

  • Import su-POJO-ChainService-provide into Eclipse (File->Import->Existing Projects into workspace)

Eclipse-Import.png

  • Edit the java code:
package org.ow2.weblab.petals.pojo.tutorial;

import java.io.StringReader;
import java.util.logging.Logger;

import javax.jbi.component.ComponentContext;
import javax.jbi.messaging.MessagingException;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;

import org.ow2.petals.component.framework.api.exception.PEtALSCDKException;
import org.ow2.petals.component.framework.api.message.Exchange;
import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.core.services.Analyser;
import org.ow2.weblab.core.services.Indexer;
import org.ow2.weblab.core.services.QueueManager;
import org.ow2.weblab.core.services.analyser.ProcessArgs;
import org.ow2.weblab.core.services.analyser.ProcessReturn;
import org.ow2.weblab.core.services.indexer.IndexArgs;
import org.ow2.weblab.core.services.queuemanager.NextResourceArgs;
import org.ow2.weblab.petals.JbiAnalyser;
import org.ow2.weblab.petals.JbiIndexer;
import org.ow2.weblab.petals.JbiQueueManager;
import org.ow2.weblab.petals.bean.ResponseBean;
import org.ow2.weblab.rdf.Value;
import org.purl.dc.elements.DublinCoreAnnotator;

public class ProcessingChain {

	Logger logger;
	ComponentContext ctx;

	/*
	 * services used in the processing chain instanciate in initServices method
	 */
	protected QueueManager folderQueueManager;
	protected Analyser tika;
	protected Indexer solr;

	public void setComponentContext(ComponentContext ctx) throws JAXBException {
		this.logger.info("Setting component ctx: " + ctx);
		this.ctx = ctx;
		initServices();
	}

	public void setLogger(Logger logger) {
		this.logger = logger;
	}

	public boolean onExchange(Exchange exchange) throws MessagingException,
			PEtALSCDKException, InterruptedException, JAXBException {
		initServices();
		/*
		 * just contains response message (ok, passed, error)
		 */
		ResponseBean responseBean = new ResponseBean();
		try {
			/*
			 * initialize folderCrawlerRequest with a usageContext (only
			 * mandatory for the folderCrawler)
			 */
			NextResourceArgs nextResourceArgs = new NextResourceArgs();

			nextResourceArgs.setUsageContext("urn:tutorial");

			/*
			 * call the folderCrawler and get the next resource to process
			 */
			Resource currentResource = this.folderQueueManager.nextResource(
					nextResourceArgs).getResource();
			/*
			 * log source extract from WebLab resource, this value has been
			 * added by the folderCrawler we just use classic WebLab helpers
			 * (Annotator) to read source annotation
			 */
			DublinCoreAnnotator dublinCoreAnnotator = new DublinCoreAnnotator(
					currentResource);
			String source = dublinCoreAnnotator.readSource().firstTypedValue();
			this.logger.info("Processing document: " + source);

			/*
			 * call tika to extract text and meta in this resource
			 */
			ProcessArgs processArgs = new ProcessArgs();
			processArgs.setResource(currentResource);
			ProcessReturn processReturn = tika.process(processArgs);

			/*
			 * update currentResource is now the response from Tika service
			 */
			currentResource = processReturn.getResource();

			/*
			 * log document format and title extract from WebLab resource, this
			 * value has been added by the tika. we just use classic WebLab
			 * helpers (Annotator) to read document annotation
			 */

			// we have to create another annotator beacause the variable
			// currentResource have changed
			dublinCoreAnnotator = new DublinCoreAnnotator(currentResource);
			Value<String> readFormat = dublinCoreAnnotator.readFormat();
			String format = "No format";
			if (readFormat != null) {
				format = readFormat.firstTypedValue();
			}

			Value<String> readTitle = dublinCoreAnnotator.readTitle();
			String title = "No title";
			if (readTitle != null) {
				title = readTitle.firstTypedValue();
			}

			/*
			 * just log some information extract from Tika
			 */
			this.logger.info("Title: " + title + " - Format: " + format);

			/*
			 * index into SOLR
			 */
			IndexArgs indexArgs = new IndexArgs();
			indexArgs.setResource(currentResource);
			this.solr.index(indexArgs);
			this.logger.info("File: " + source + " indexed.");
			
			/*
			 * for the response
			 */
			responseBean.setNbDocOk(1);

		} catch (Exception e) {
			/*
			 * something wrong during service calling
			 */
			this.logger
					.warning("Error during chain calling: " + e.getMessage());
			responseBean.setNbDocError(1);
		}

		/*
		 * reply using response bean
		 */
		exchange.setOutMessageContent(new StreamSource(new StringReader(
				responseBean.toXmlChainString())));

		return true;
	}

	private void initServices() throws JAXBException {

		this.folderQueueManager = JbiServiceFactory.getProxy(
				QueueManager.class, new QName(
						"http://impl.folder.crawler.services.weblab.ow2.org/",
						"FolderCrawlerServiceService"), this.ctx, this.logger);

		this.tika = JbiServiceFactory.getProxy(Analyser.class, new QName(
				"http://tika.normaliser.services.weblab.ow2.org/",
				"TikaExtractorServiceService"), this.ctx, this.logger);

		this.solr = JbiServiceFactory.getProxy(Indexer.class, new QName(
				"http://impl.indexer.services.weblab.ow2.org/",
				"SolrIndexerService"), this.ctx, this.logger);
	}
}
  • Now close Eclipse

Expose the chain as a Web Service on the BUS

  • Reopen PEtALS Studio
  • Right click on Service Units->New->Service Unit
  • Select SOAP and Consumes (expose an endpoint outside the bus, in our case, the processing chain)

PEtALS Studio Consumes.png

  • Next
  • Click on select a service from petals services
  • Choose the chain (on the POJO component)

PEtALS Studio Consumes2.png

  • Next, Next, Choose MEP InOut

PEtALS Studio Consumes3.png

  • Finish

A new service unit has been generated.

Deploy on the bus

Create a service assembly containing all the service units

  • Right click on Service Assemblies->New->Service Assembly
  • Fill the form:

Screenshot-New Service Assembly.png

  • And select all service units

Screenshot-New Service Assembly2.png

  • Click on finish

You can close PEtALS Studio

Package and deploy it

The package is done by maven which will generate a PEtALS compatible service assembly (a zip) containing all the previously configured SUs. So maven need that each service unit is installed inside the local maven repository before starting to package all the service assembly. In order to simplify this part, you can create a pom module directly in the PEtALS Studio workspace folder. To do this, save this file as pom.xml in the workspace folder:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	
	<groupId>org.ow2.weblab.petals.pojo.sample</groupId>
	<artifactId>parent</artifactId>
	<packaging>pom</packaging>
	<version>1</version>
	<name>parent</name>

	<modules>
		<module>su-POJO-ChainService-provide</module>
		<module>su-SOAP-FolderCrawlerServiceService-provide</module>
		<module>su-SOAP-TikaExtractorServiceService-provide</module>
		<module>su-SOAP-ChainService-consume</module>
		<module>su-SOAP-SolrIndexerService-provide</module>

		<module>sa-pojo-sample</module>
	</modules>
</project>
  • Now just call maven install directly in the workspace directory
mvn clean install
  • Checks the logs
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] su-POJO-ChainService-provide .......................... SUCCESS [4.801s]
[INFO] su-SOAP-FolderCrawlerServiceService-provide ........... SUCCESS [4.104s]
[INFO] su-SOAP-TikaExtractorServiceService-provide ........... SUCCESS [0.874s]
[INFO] su-SOAP-ChainService-consume .......................... SUCCESS [0.319s]
[INFO] su-SOAP-SolrIndexerService-provide .................... SUCCESS [0.384s]
[INFO] sa-pojo-sample ........................................ SUCCESS [0.508s]
[INFO] parent ................................................ SUCCESS [2.184s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Thu Jan 12 14:22:00 CET 2012
[INFO] Final Memory: 32M/650M
[INFO] ------------------------------------------------------------------------


All the module will be recompiled and installed and the generated service assembly will contain up to date service assembly.

  • To deploy the generated service assembly on PEtALS copy sa-pojo-sample/target/sa-pojo-sample-1.0-SNAPSHOT.zip to petals-platform-3.1.3/install
  • Now checks that everything is deployed on PEtALS:
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 10:48:24,944 Deploy Service Unit 'su-POJO-ChainService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 10:48:25,221 New Service Endpoint deployed : 
{http://weblab.ow2.org/Chain/}ChainService ->ChainEndpoint (INTERNAL):subdomain1/0/petals-se-pojo
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 10:48:25,221 Service Unit 'su-POJO-ChainService-provide-1.0-SNAPSHOT' deployed
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,222 Deploy Service Unit 'su-SOAP-FolderResourceQMService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,396 New Service Endpoint deployed : 
{http://iterator.services.weblab.ow2.org/}FolderResourceQMService ->FolderResourceQMPort (INTERNAL):subdomain1/0/petals-bc-soap
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,396 Service Unit 'su-SOAP-FolderResourceQMService-provide-1.0-SNAPSHOT' deployed
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,396 Deploy Service Unit 'su-SOAP-SolrIndexerService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,493 New Service Endpoint deployed : 
{http://impl.indexer.services.weblab.ow2.org/}SolrIndexerService ->SolrIndexerPort (INTERNAL):subdomain1/0/petals-bc-soap
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,494 Service Unit 'su-SOAP-SolrIndexerService-provide-1.0-SNAPSHOT' deployed
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,494 Deploy Service Unit 'su-SOAP-ChainService-consume-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,498 Service Unit 'su-SOAP-ChainService-consume-1.0-SNAPSHOT' deployed
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,498 Deploy Service Unit 'su-SOAP-TikaExtractorServiceService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,600 New Service Endpoint deployed : 
{http://tika.normaliser.services.weblab.ow2.org/}TikaExtractorServiceService ->TikaExtractorServicePort (INTERNAL):subdomain1/0/petals-bc-soap
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,601 Service Unit 'su-SOAP-TikaExtractorServiceService-provide-1.0-SNAPSHOT' deployed
[Petals.JBI-Management.DeploymentServiceImpl]-INFO 2012-01-12 10:48:25,626 Service Assembly 'sa-pojo-sample-1.0-SNAPSHOT' deployed
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 10:48:25,626 Init Service Unit 'su-POJO-ChainService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 10:48:25,713 Setting component ctx:
org.ow2.petals.jbi.component.context.ComponentContextImpl@397ac43d
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,876 Init Service Unit 'su-SOAP-FolderResourceQMService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,876 Init Service Unit 'su-SOAP-SolrIndexerService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,876 Init Service Unit 'su-SOAP-ChainService-consume-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,890 Init Service Unit 'su-SOAP-TikaExtractorServiceService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 10:48:25,890 Start Service Unit 'su-POJO-ChainService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:25,891 Start Service Unit 'su-SOAP-FolderResourceQMService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:26,020 Start Service Unit 'su-SOAP-SolrIndexerService-provide-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:26,090 Start Service Unit 'su-SOAP-ChainService-consume-1.0-SNAPSHOT'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:26,210 The Axis2 service 'ChainService'
has been registered and is available at 'http://localhost:8084/petals/services/ChainService'
[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:26,237 Start Service Unit 'su-SOAP-TikaExtractorServiceService-provide-1.0-SNAPSHOT'
[Petals.JBI-Management.DeploymentServiceImpl]-INFO 2012-01-12 10:48:26,284 Service Assembly 'sa-pojo-sample-1.0-SNAPSHOT' started

Test your processing chain

One line is important is this log:

[Petals.Container.Components.petals-bc-soap]-INFO 2012-01-12 10:48:26,210 The Axis2 service 'ChainService'
has been registered and is available at 'http://localhost:8084/petals/services/ChainService'

This explains that your exposed processing chain is available through the BUS at this URL: 'http://localhost:8084/petals/services/ChainService' In PEtALS every exposed endpoint is listed http://localhost:8084/petals/services/listServices, so you should have something similar to this in your favourite browser: Bc-soap-exposed.png

Test in SOAP UI

SOAPUI.png

  • Double click on request1
  • Launch the query
  • See the result:

SOAPUI2.png

  • Check the PEtALS logs:
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:10,549 Calling:
{http://impl.folder.crawler.services.weblab.ow2.org/}FolderCrawlerServiceService
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:10,995 Get reply from:
{http://impl.folder.crawler.services.weblab.ow2.org/}FolderCrawlerServiceService
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:11,004 Processing document: .../weblab/toCrawl/WISS13.pdf
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:11,005 Calling:
{http://tika.normaliser.services.weblab.ow2.org/}TikaExtractorServiceService
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:16,233 Get reply from:
{http://tika.normaliser.services.weblab.ow2.org/}TikaExtractorServiceService
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:16,322 Title: No title - Format: application/pdf
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:16,336 Calling: {http://impl.indexer.services.weblab.ow2.org/}SolrIndexerService
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:18,702 Get reply from:
{http://impl.indexer.services.weblab.ow2.org/}SolrIndexerService
[Petals.Container.Components.petals-se-pojo]-INFO 2012-01-12 15:08:18,703 File: .../weblab/toCrawl/WISS13.pdf indexed.


Great you are now WebLab lvl 2 ;-)