You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by jb...@apache.org on 2010/03/16 17:31:54 UTC
svn commit: r923848 - in
/servicemix/components/engines/servicemix-pdfcomposer/trunk: ./ src/
src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/servicemix/
src/main/java/org/apache/servicemix/pdfcomposer/ sr...
Author: jbonofre
Date: Tue Mar 16 16:31:53 2010
New Revision: 923848
URL: http://svn.apache.org/viewvc?rev=923848&view=rev
Log:
Initial import.
Added:
servicemix/components/engines/servicemix-pdfcomposer/trunk/LICENSE
servicemix/components/engines/servicemix-pdfcomposer/trunk/NOTICE
servicemix/components/engines/servicemix-pdfcomposer/trunk/pom.xml
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerComponent.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshaler.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerDataField.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerMarshalerSupport.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.class (with props)
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerResponse.class (with props)
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/spring/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/spring/servicemix-pdfcomposer.xml
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/servicemix-pdfcomposer.wsdl
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpointTest.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/marshaler/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshalerTest.java
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/xbean/
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/xbean/xbean.xml
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/LICENSE
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/LICENSE?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/LICENSE (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/LICENSE Tue Mar 16 16:31:53 2010
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/NOTICE
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/NOTICE?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/NOTICE (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/NOTICE Tue Mar 16 16:31:53 2010
@@ -0,0 +1,9 @@
+ =========================================================================
+ == NOTICE file for use with the Apache License, Version 2.0, ==
+ == in this case for the Apache ServiceMix distribution. ==
+ =========================================================================
+
+ This product contains software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/pom.xml?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/pom.xml (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/pom.xml Tue Mar 16 16:31:53 2010
@@ -0,0 +1,158 @@
+<?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">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>components-pom</artifactId>
+ <version>5-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-pdfcomposer</artifactId>
+ <version>2010.01-SNAPSHOT</version>
+ <packaging>jbi-component</packaging>
+
+ <name>ServiceMix :: PDF Composer</name>
+ <description>
+ A service engine generating PDF documents using incoming messages and PDF templates. It uses iText library.
+ </description>
+
+ <properties>
+ <itext.version>2.1.7</itext.version>
+ <jdom.version>1.0</jdom.version>
+ <servicemix.osgi.import>
+ !org.apache.servicemix.pdfcomposer*,
+ org.apache.servicemix.common,
+ org.apache.servicemix.common.osgi,
+ org.apache.servicemix.executors.impl,
+ org.apache.servicemix.jbi.container*;resolution:=optional,
+ org.apache.servicemix.jbi.framework*;resolution:=optional,
+ org.apache.xbean.spring.context.v2,
+ org.springframework.beans.factory.xml,
+ javax.xml.bind.*,
+ com.lowagie*,
+ org.jdom*,
+ sun.misc;resolution:=optional,
+ *
+ </servicemix.osgi.import>
+ <servicemix.osgi.export>
+ org.apache.servicemix.pdfcomposer*;version=${project.version},
+ META-INF.services.org.apache.xbean.spring.http.servicemix.apache.org.pdfcomposer
+ </servicemix.osgi.export>
+ <servicemix.osgi.bundles>
+ org.springframework.core,
+ org.springframework.beans,
+ org.springframework.context,
+ </servicemix.osgi.bundles>
+ </properties>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/servicemix/components/engines/servicemix-pdfcomposer/trunk</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/servicemix/components/engines/servicemix-pdfcomposer/trunk</developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/servicemix/components/engines/servicemix-pdfcomposer/trunk</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-shared</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>${itext.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>${jdom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <!-- Testing stuff -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-core</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jmx</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>jbi-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <type>service-engine</type>
+ <component>org.apache.servicemix.pdfcomposer.PdfComposerComponent</component>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>maven-xbean-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>mapping</goal>
+ </goals>
+ <configuration>
+ <namespace>http://servicemix.apache.org/pdfcomposer/1.0</namespace>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerComponent.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerComponent.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerComponent.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerComponent.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer;
+
+import java.util.List;
+
+import org.apache.servicemix.common.DefaultComponent;
+
+/**
+ * <p>
+ * A JBI component which generated PDF documents populating fields in a PDF template using incoming messages.
+ * </p>
+ *
+ * @author jbonofre
+ * @org.apache.xbean.XBean element="component" description="PDFComposer Component"
+ */
+public class PdfComposerComponent extends DefaultComponent {
+
+ private PdfComposerEndpoint[] endpoints;
+
+ /**
+ * <p>
+ * Get the component endpoints.
+ * </p>
+ *
+ * @return the component endpoints.
+ */
+ public PdfComposerEndpoint[] getEndpoints() {
+ return this.endpoints;
+ }
+
+ /**
+ * <p>
+ * Set the component endpoints.
+ * </p>
+ *
+ * @param endpoints the component endpoints.
+ */
+ public void setEndpoints(PdfComposerEndpoint[] endpoints) {
+ this.endpoints = endpoints;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.servicemix.common.DefaultComponent#getConfiguredEndpoints()
+ */
+ @Override
+ protected List getConfiguredEndpoints() {
+ return asList(endpoints);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.servicemix.common.DefaultComponent#getEndpointClasses()
+ */
+ @Override
+ protected Class[] getEndpointClasses() {
+ return new Class[] { PdfComposerEndpoint.class };
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer;
+
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+
+import javax.jbi.management.DeploymentException;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.servicemix.common.endpoints.ProviderEndpoint;
+import org.apache.servicemix.pdfcomposer.marshaler.DefaultPdfComposerMarshaler;
+import org.apache.servicemix.pdfcomposer.marshaler.PdfComposerDataField;
+import org.apache.servicemix.pdfcomposer.marshaler.PdfComposerMarshalerSupport;
+import org.apache.servicemix.pdfcomposer.marshaler.PdfComposerRequest;
+import org.apache.servicemix.soap.util.DomUtil;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import com.lowagie.text.pdf.AcroFields;
+import com.lowagie.text.pdf.PdfReader;
+import com.lowagie.text.pdf.PdfStamper;
+
+/**
+ * <p>
+ * Represents a PDFComposer endpoint.
+ * </p>
+ *
+ * @author jbonofre
+ * @org.apache.xbean.XBean element="endpoint"
+ */
+public class PdfComposerEndpoint extends ProviderEndpoint {
+
+ public final static String DEFAULT_WSDL = "servicemix-pdfcomposer.wsdl"; // the default abstract WSDL
+
+ private String template; // the template can be static (define in the endpoint descriptor) or provided in the "in" message
+ private String templatesBasedir = "."; // the location where to looking for template files
+ private Resource wsdl; // the abstract WSDL describing the endpoint behavior
+ private PdfComposerMarshalerSupport marshaler = new DefaultPdfComposerMarshaler();
+ private boolean xpath = false; // define if the endpoint use xpath (ignoring the WSDL and marshaler)
+
+ public String getTemplate() {
+ return this.template;
+ }
+
+ /**
+ * <p>
+ * This attribute specifies the template to use if it's not defined in the incoming message.
+ * </p>
+ * <i> The default value is <code>null</code>.
+ *
+ * @param template the default template file path.
+ */
+ public void setTemplate(String template) {
+ this.template = template;
+ }
+
+ public String getTemplatesBasedir() {
+ return this.templatesBasedir;
+ }
+
+ /**
+ * <p>
+ * This attribute specifies the basedir where to looking for template files.
+ * </p>
+ * <i> The default value is <code>.</code>.
+ *
+ * @param templatesBasedir the basedir path.
+ */
+ public void setTemplatesBasedir(String templatesBasedir) {
+ this.templatesBasedir = templatesBasedir;
+ }
+
+ public Resource getWsdl() {
+ return this.wsdl;
+ }
+
+ /**
+ * <p>
+ * This attribute specifies the abstract WSDL describing the endpoint behavior.
+ * </p>
+ * <i> The default value is <code>null</code>.
+ *
+ * @param wsdl the WSDL <code>Resource</code>.
+ */
+ public void setWsdl(Resource wsdl) {
+ this.wsdl = wsdl;
+ }
+
+ public PdfComposerMarshalerSupport getMarshaler() {
+ return this.marshaler;
+ }
+
+ /**
+ * <p>
+ * With this method you can specify a marshaler class which provides the
+ * logic for converting a message into a PDF Composer request. This class has
+ * to implement the interface <code>PdfComposerMarshalerSupport</code>. If you don't
+ * specify a marshaler, the <code>DefaultPdfComposerMarshaler</code> will be used.
+ * </p>
+ *
+ * @param marshaller
+ */
+ public void setMarshaler(PdfComposerMarshalerSupport marshaler) {
+ this.marshaler = marshaler;
+ }
+
+ public boolean isXpath() {
+ return this.xpath;
+ }
+
+ /**
+ * <p>
+ * This attribute
+ * </p>
+ *
+ * @param xpath
+ */
+ public void setXpath(boolean xpath) {
+ this.xpath = xpath;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.servicemix.common.endpoints.AbstractEndpoint#validate()
+ */
+ @Override
+ public void validate() throws DeploymentException {
+ if (!xpath) {
+ try {
+ if (wsdl == null) {
+ // the user hasn't provided the WSDL, we use the default one
+ wsdl = new ClassPathResource(DEFAULT_WSDL);
+ }
+
+ // load the WSDL in the endpoint
+ description = DomUtil.parse(wsdl.getInputStream());
+ definition = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(null, description);
+
+ // cleanup WSDL to be sure thats it's an abstract one
+ // cleanup services
+ QName[] qnames = (QName[]) definition.getServices().keySet().toArray(new QName[0]);
+ for (int i = 0; i < qnames.length; i++) {
+ definition.removeService(qnames[i]);
+ }
+ // cleanup binding
+ qnames = (QName[]) definition.getBindings().keySet().toArray(new QName[0]);
+ for (int i = 0; i < qnames.length; i++) {
+ definition.removeBinding(qnames[i]);
+ }
+ } catch (Exception e) {
+ throw new DeploymentException("Can't load WSDL.", e);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.servicemix.common.endpoints.ProviderEndpoint#process(javax.jbi.messaging.MessageExchange)
+ */
+ @Override
+ public void process(MessageExchange exchange) throws Exception {
+ // The component acts as a provider, it means that another components
+ // requests our service.
+ // As this exchange is active, this is either an "in" or a "fault" (out
+ // is sent by this component)
+ if (exchange.getStatus() == ExchangeStatus.DONE) {
+ // exchange is finished
+ return;
+ } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+ // exchange has been aborted with an exception
+ return;
+ } else {
+ // exchange is active
+ if (!xpath) {
+ handleProviderExchange(exchange);
+ } else {
+ handleProviderExchangeWithXpath(exchange);
+ }
+ }
+ }
+
+ /**
+ * <p>
+ * Handles the message exchange (provider role) using XPath.
+ * </p>
+ *
+ * @param exchange the <code>MessageExchange</code>.
+ * @throws Exception
+ */
+ protected void handleProviderExchangeWithXpath(MessageExchange exchange) throws Exception {
+ // fault message
+ if (exchange.getFault() != null) {
+ done(exchange);
+ return;
+ }
+
+ // check if we have an InOut MEP
+ if (!(exchange instanceof InOut)) {
+ throw new IllegalStateException("PdfComposer only supports InOut MEP.");
+ }
+
+ // check if we have an "in" message
+ if (exchange.getMessage("in") == null) {
+ throw new MessagingException("No \"in\" message.");
+ }
+
+ // get the "in" message
+ NormalizedMessage in = exchange.getMessage("in");
+
+ // create SAXBuilder
+
+ }
+
+ /**
+ * <p>
+ * Handles the message exchange (provider role) using the marshaler.
+ * </p>
+ *
+ * @param exchange the <code>MessageExchange</code>.
+ * @throws Exception
+ */
+ protected void handleProviderExchange(MessageExchange exchange) throws Exception {
+ // fault message
+ if (exchange.getFault() != null) {
+ done(exchange);
+ return;
+ }
+
+ // check if we have an InOut MEP
+ if (!(exchange instanceof InOut)) {
+ throw new IllegalStateException("PdfComposer only supports InOut MEP.");
+ }
+
+ // check if we have an in message
+ if (exchange.getMessage("in") == null) {
+ throw new MessagingException("No \"in\" message.");
+ }
+
+ // get the in message
+ NormalizedMessage in = exchange.getMessage("in");
+ // unmarshal the PDF Composer request in the "in" message
+ PdfComposerRequest request = marshaler.unmarshal(in);
+
+ // if the template is not contained in the request, fall back to the default one
+ String templateToUse = request.getTemplate();
+ if (templateToUse == null) {
+ templateToUse = this.template;
+ }
+ if (templateToUse == null) {
+ throw new IllegalArgumentException("No template provided in the in message or in the endpoint descriptor.");
+ }
+ if (templatesBasedir != null) {
+ templateToUse = templatesBasedir + "/" + templateToUse;
+ }
+
+ // load PDF template
+ PdfReader templateReader = new PdfReader(templateToUse);
+
+ // create "out" message
+ NormalizedMessage out = exchange.createMessage();
+
+ // create a stamper to populate the target document using pipe
+ PipedInputStream stream = new PipedInputStream();
+ PdfStamper stamper = new PdfStamper(templateReader, new PipedOutputStream(stream));
+
+ // get the acrofields
+ AcroFields fields = stamper.getAcroFields();
+ // replace the field
+ for (PdfComposerDataField field:request.getData()) {
+ fields.setField(field.getName(), field.getValue());
+ }
+
+ // close the stamper
+ stamper.setFormFlattening(true);
+ stamper.close();
+
+ // set the "out" message content with the piped stream
+ out.setContent(new StreamSource(stream));
+
+ // set the "out" message of the exchange
+ exchange.setMessage(out, "out");
+
+ // send back the exchange
+ send(exchange);
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshaler.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshaler.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshaler.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer.marshaler;
+
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * <p>
+ * Default PDF Composer marshaler that uses JAXB to marshal and unmarshal PdfComposerRequest/Response.
+ * </p>
+ *
+ * @author jbonofre
+ */
+public class DefaultPdfComposerMarshaler implements PdfComposerMarshalerSupport {
+
+ private final static transient Log LOG = LogFactory.getLog(DefaultPdfComposerMarshaler.class);
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.servicemix.pdfcomposer.marshaler.PdfComposerMarshalerSupport#unmarshal(javax.jbi.messaging.NormalizedMessage)
+ */
+ public PdfComposerRequest unmarshal(NormalizedMessage in) throws Exception {
+
+ // create a JAXB context for the PdfComposerRequest
+ LOG.debug("Create a JAXB context with PdfComposerRequest class.");
+ JAXBContext jaxbContext = JAXBContext.newInstance(PdfComposerRequest.class);
+
+ // create the JAXB unmarshaller
+ LOG.debug("Create the JAXB unmarshaller.");
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+
+ // unmarshal in the "in" message content
+ LOG.debug("Unmarshal the \"in\" message content.");
+ return (PdfComposerRequest) unmarshaller.unmarshal(in.getContent());
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerDataField.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerDataField.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerDataField.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerDataField.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer.marshaler;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * <p>
+ * Data container of the PdfComposer.
+ * </p>
+ *
+ * @author jbonofre
+ */
+public class PdfComposerDataField {
+
+ private String name;
+ private String value;
+
+ public String getName() {
+ return name;
+ }
+
+ @XmlAttribute
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @XmlAttribute
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerMarshalerSupport.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerMarshalerSupport.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerMarshalerSupport.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerMarshalerSupport.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer.marshaler;
+
+import javax.jbi.messaging.NormalizedMessage;
+
+/**
+ * <p>
+ * This interface describes the behavior of the PDFComposer marshaller.
+ * </p>
+ *
+ * @author jbonofre
+ */
+public interface PdfComposerMarshalerSupport {
+
+ /**
+ * <p>
+ * Unmarshal the content of the in <code>NormalizedMessage</code> to a <code>PdfComposerRequest</code>.
+ * </p>
+ *
+ * @param in the "in" message.
+ * @return the <code>PdfComposerRequest</code>.
+ * @throws Exception in case of unmarshalling message.
+ */
+ public PdfComposerRequest unmarshal(NormalizedMessage in) throws Exception;
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.class
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.class?rev=923848&view=auto
==============================================================================
Binary file - no diff available.
Propchange: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerRequest.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer.marshaler;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * <p>
+ * Represents a PdfComposer request including template and data.
+ * </p>
+ *
+ * @author jbonofre
+ *
+ */
+@XmlRootElement(namespace="http://servicemix.apache.org/pdfcomposer")
+public class PdfComposerRequest {
+
+ private String template;
+ private List<PdfComposerDataField> data;
+
+ public String getTemplate() {
+ return template;
+ }
+
+ @XmlElement(name="template")
+ public void setTemplate(String template) {
+ this.template = template;
+ }
+
+ public List<PdfComposerDataField> getData() {
+ return data;
+ }
+
+ @XmlElementWrapper(name="data")
+ @XmlElement(name="field")
+ public void setData(List<PdfComposerDataField> data) {
+ this.data = data;
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerResponse.class
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerResponse.class?rev=923848&view=auto
==============================================================================
Binary file - no diff available.
Propchange: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/marshaler/PdfComposerResponse.class
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/spring/servicemix-pdfcomposer.xml
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/spring/servicemix-pdfcomposer.xml?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/spring/servicemix-pdfcomposer.xml (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/META-INF/spring/servicemix-pdfcomposer.xml Tue Mar 16 16:31:53 2010
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ctx="http://www.springframework.org/schema/context"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/osgi-compendium
+ http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
+
+ <bean id="servicemix-pdfcomposer" class="org.apache.servicemix.pdfcomposer.PdfComposerComponent">
+ <property name="executorFactory" ref="executorFactory"/>
+ </bean>
+
+ <bean id="executorFactory" class="org.apache.servicemix.executors.impl.ExecutorFactoryImpl">
+ <property name="defaultConfig">
+ <bean class="org.apache.servicemix.executors.impl.ExecutorConfig">
+ <property name="corePoolSize" value="${threadPoolCorePoolSize}"/>
+ <property name="maximumPoolSize" value="${threadPoolMaximumPoolSize}"/>
+ <property name="queueSize" value="${threadPoolQueueSize}"/>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="endpoint-tracker" class="org.apache.servicemix.common.osgi.EndpointTracker">
+ <property name="component" ref="servicemix-pdfcomposer"/>
+ </bean>
+
+ <osgi:list id="endpoints"
+ interface="org.apache.servicemix.common.osgi.EndpointWrapper"
+ cardinality="0..N">
+ <osgi:listener ref="endpoint-tracker" bind-method="register" unbind-method="unregister"/>
+ </osgi:list>
+
+ <osgi:service ref="servicemix-pdfcomposer" interface="javax.jbi.component.Component">
+ <osgi:service-properties>
+ <entry key="NAME" value="servicemix-pdfcomposer"/>
+ <entry key="TYPE" value="service-engine"/>
+ </osgi:service-properties>
+ </osgi:service>
+
+ rty name="component" ref="servicemix-exec"/>
+ </bean>
+
+ <osgi:list id="endpoints"
+ interface="org.apache.servicemix.common.osgi.EndpointWrapper"
+ cardinality="0..N">
+ <osgi:listener ref="endpoint-tracker" bind-method="register" unbind-method="unregister"/>
+ </osgi:list>
+
+ <osgi:service ref="servicemix-exec" interface="javax.jbi.component.Component">
+ <osgi:service-properties>
+ <entry key="NAME" value="servicemix-exec"/>
+ <entry key="TYPE" value="service-engine"/>
+ </osgi:service-properties>
+ </osgi:service>
+
+ <osgix:cm-properties id="cmProps" persistent-id="org.apache.servicemix.components.exec">
+ <prop key="threadPoolCorePoolSize">8</prop>
+ <prop key="threadPoolMaximumPoolSize">32</prop>
+ <prop key="threadPoolQueueSize">256</prop>
+ </osgix:cm-properties>
+
+ <ctx:property-placeholder properties-ref="cmProps"/>
+
+</beans>
\ No newline at end of file
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/servicemix-pdfcomposer.wsdl
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/servicemix-pdfcomposer.wsdl?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/servicemix-pdfcomposer.wsdl (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/resources/servicemix-pdfcomposer.wsdl Tue Mar 16 16:31:53 2010
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions name="servicemix-pdfcomposer"
+ targetNamespace="http://servicemix.apache.org/pdfcomposer"
+ xmlns:tns="http://servicemix.apache.org/pdfcomposer"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <wsdl:types>
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://servicemix.apache.org/pdfcomposer"
+ xmlns:tns="http://servicemix.apache.org/pdfcomposer"
+ attributeFormDefault="unqualified"
+ elementFormDefault="unqualified">
+
+ <xs:complexType name="pdfComposerRequest">
+ <xs:sequence>
+ <xs:element name="data" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="data" type="tns:pdfComposerData" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="template" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="pdfComposerData">
+ <xs:sequence/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="value" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:element name="pdfComposerResponse" type="xs:base64Binary"/>
+ </xs:schema>
+
+ </wsdl:types>
+
+ <wsdl:message name="pdfComposerRequest">
+ <wsdl:part name="parameters" element="tns:pdfComposerRequest"/>
+ </wsdl:message>
+
+ <wsdl:message name="pdfComposerResponse">
+ <wsdl:part name="parameters" element="tns:pdfComposerResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="PdfComposerPortType">
+ <wsdl:operation name="compose">
+ <wsdl:input message="tns:pdfComposerRequest"/>
+ <wsdl:output message="tns:pdfComposerResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpointTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpointTest.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpointTest.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpointTest.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.jbi.container.JBIContainer;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * Test the PdfComposer XBean descriptor.
+ * </p>
+ *
+ * @author jbonofre
+ */
+public class PdfComposerEndpointTest extends TestCase {
+
+ private JBIContainer container;
+
+ /*
+ * (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ // start ServiceMix JBI container
+ container = new JBIContainer();
+ container.setUseMBeanServer(false);
+ container.setCreateMBeanServer(false);
+ container.setEmbedded(true);
+ container.init();
+ // deploy the pdfcomposer component
+ PdfComposerComponent component = new PdfComposerComponent();
+ container.activateComponent(component, "PdfComposerComponent");
+ // start the JBI container
+ container.start();
+ // deploy a PdfComposer SU
+ URL url = getClass().getClassLoader().getResource("xbean/xbean.xml");
+ File path = new File(new URI(url.toString()));
+ path = path.getParentFile();
+ component.getServiceUnitManager().deploy("xbean", path.getAbsolutePath());
+ component.getServiceUnitManager().init("xbean", path.getAbsolutePath());
+ component.getServiceUnitManager().start("xbean");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ if (container != null) {
+ container.shutDown();
+ }
+ }
+
+ /**
+ * <p>
+ * Test if the endpoints in the xbean have been correctly deployed.
+ * </p>
+ * @throws Exception
+ */
+ public void testDeployment() throws Exception {
+ // test if the {http://test/service}pdfcomposer endpoint is deployed
+ assertNotNull("The endpoint {http://test/service}pdfcomposer is not found in the JBI container.", container.getRegistry().getEndpoint(new QName("http://test", "service"), "pdfcomposer"));
+
+ // test if the {http://test/service}pdfcomposer endpoint descriptor contains the abstract WSDL
+ assertNotNull("The endpoint {http://test/service}pdfcomposer descriptor is null.", container.getRegistry().getEndpointDescriptor(container.getRegistry().getEndpoint(new QName("http://test", "service"), "pdfcomposer")));
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshalerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshalerTest.java?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshalerTest.java (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/java/org/apache/servicemix/pdfcomposer/marshaler/DefaultPdfComposerMarshalerTest.java Tue Mar 16 16:31:53 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.pdfcomposer.marshaler;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.id.IdGenerator;
+import org.apache.servicemix.jbi.helper.MessageExchangePattern;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.messaging.MessageExchangeFactoryImpl;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * Unit tests of the PdfComposer marshaler.
+ * </p>
+ *
+ * @author jbonofre
+ */
+public class DefaultPdfComposerMarshalerTest extends TestCase {
+
+ private PdfComposerMarshalerSupport marshaler;
+ private MessageExchangeFactory factory;
+
+ /*
+ * (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() {
+ this.marshaler = new DefaultPdfComposerMarshaler();
+ this.factory = new MessageExchangeFactoryImpl(new IdGenerator(), new AtomicBoolean(false));
+ }
+
+ /**
+ * <p>
+ * Test the unmarshaling of a valid message content.
+ * </p>
+ *
+ * @throws Exception if the unmarshaling fails.
+ */
+ public void testUnmarshaling() throws Exception {
+ MessageExchange exchange = factory.createExchange(MessageExchangePattern.IN_ONLY);
+ NormalizedMessage message = exchange.createMessage();
+ message.setContent(new StringSource(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<pdfcomposer:pdfComposerRequest xmlns:pdfcomposer=\"http://servicemix.apache.org/pdfcomposer\">" +
+ "<template>test</template>" +
+ "<data>" +
+ "<field name=\"test\" value=\"test\"/>" +
+ "</data>" +
+ "</pdfcomposer:pdfComposerRequest>"
+ ));
+
+ exchange.setMessage(message, "in");
+
+ PdfComposerRequest request = marshaler.unmarshal(message);
+
+ assertEquals("test", request.getTemplate());
+ assertEquals("test", ((PdfComposerDataField) request.getData().get(0)).getName());
+ assertEquals("test", ((PdfComposerDataField) request.getData().get(0)).getValue());
+ }
+
+}
Added: servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/xbean/xbean.xml
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/xbean/xbean.xml?rev=923848&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/xbean/xbean.xml (added)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/test/resources/xbean/xbean.xml Tue Mar 16 16:31:53 2010
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns:pdfcomposer="http://servicemix.apache.org/pdfcomposer/1.0"
+ xmlns:test="http://test">
+
+ <pdfcomposer:endpoint service="test:service"
+ endpoint="pdfcomposer"/>
+
+</beans>
\ No newline at end of file