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/17 06:47:12 UTC
svn commit: r924167 -
/servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java
Author: jbonofre
Date: Wed Mar 17 05:47:11 2010
New Revision: 924167
URL: http://svn.apache.org/viewvc?rev=924167&view=rev
Log:
The XPath behavior will be embedded in a dedicated endpoint.
Modified:
servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java
Modified: 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=924167&r1=924166&r2=924167&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java (original)
+++ servicemix/components/engines/servicemix-pdfcomposer/trunk/src/main/java/org/apache/servicemix/pdfcomposer/PdfComposerEndpoint.java Wed Mar 17 05:47:11 2010
@@ -57,7 +57,6 @@ public class PdfComposerEndpoint extends
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;
@@ -125,52 +124,35 @@ public class PdfComposerEndpoint extends
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);
+ 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);
}
}
@@ -192,48 +174,12 @@ public class PdfComposerEndpoint extends
return;
} else {
// exchange is active
- if (!xpath) {
- handleProviderExchange(exchange);
- } else {
- handleProviderExchangeWithXpath(exchange);
- }
+ handleProviderExchange(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>
*