You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2008/10/02 01:44:38 UTC
svn commit: r700972 [1/2] - in /ode/trunk: ./
axis2-war/src/test/java/org/apache/ode/axis2/
axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/
axis2-war/src/test/resources/TestEndpointProperties/
axis2/src/main/java/org/apache/ode/axis2/ axis2/s...
Author: midon
Date: Wed Oct 1 16:44:37 2008
New Revision: 700972
URL: http://svn.apache.org/viewvc?rev=700972&view=rev
Log:
Support multiple property file for endpoint configuration.
Added:
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java
- copied, changed from r700885, ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf.endpoint
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_1.endpoint
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_2.endpoint
ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap
ode/trunk/utils/src/test/resources/hierarchical-1.properties
- copied, changed from r700885, ode/trunk/utils/src/test/resources/hierarchical.properties
ode/trunk/utils/src/test/resources/hierarchical-2.properties
Removed:
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java
ode/trunk/utils/src/main/java/org/apache/ode/utils/fs/FileWatchDog.java
ode/trunk/utils/src/test/resources/hierarchical.properties
Modified:
ode/trunk/Rakefile
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
ode/trunk/utils/src/main/java/org/apache/ode/utils/HierarchicalProperties.java
ode/trunk/utils/src/main/java/org/apache/ode/utils/WatchDog.java
ode/trunk/utils/src/test/java/org/apache/ode/utils/HierarchicalPropertiesTest.java
Modified: ode/trunk/Rakefile
URL: http://svn.apache.org/viewvc/ode/trunk/Rakefile?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/Rakefile (original)
+++ ode/trunk/Rakefile Wed Oct 1 16:44:37 2008
@@ -250,6 +250,8 @@
cp project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd"), _("target/test/webapp/WEB-INF")
mkdir_p _("target/test/webapp/WEB-INF/processes")
rm_rf Dir[_("target/test/webapp") + "/**/.svn"]
+ # move around some property files for test purpose
+ mv Dir[_("target/test-classes/TestEndpointProperties/*_global_conf*.endpoint")], _("target/test/webapp/WEB-INF/conf")
end
test.setup unzip(_("target/test/webapp/WEB-INF")=>project("dao-jpa-db").package(:zip))
test.exclude('*') unless Buildr.environment != 'test'
Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java Wed Oct 1 16:44:37 2008
@@ -0,0 +1,71 @@
+/*
+ * 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.ode.axis2;
+
+import junit.framework.TestCase;
+import org.apache.ode.axis2.JettyWrapper;
+
+import java.util.concurrent.CountDownLatch;
+
+/**
+ *
+ *
+ */
+public class EndpointPropertiesTest extends Axis2TestBase {
+ protected JettyWrapper jettyWrapper;
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final CountDownLatch latch = new CountDownLatch(1);
+ jettyWrapper = new JettyWrapper(7070);
+ new Thread("HttpBindingJetty") {
+ public void run() {
+ try {
+ jettyWrapper.start();
+ latch.countDown();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }.start();
+ // wait for jetty to be ready
+ latch.await();
+ }
+
+ public void testEndpointProperties(){
+ String bundleName = "TestEndpointProperties";
+ if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+ server.deployProcess(bundleName);
+ try {
+ String response = server.sendRequestFile("http://localhost:8080/processes/helloWorld",
+ bundleName, "testRequest.soap");
+ assertTrue(response.contains("helloResponse") && response.contains("OK!!!"));
+ } finally {
+ server.undeployProcess(bundleName);
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ jettyWrapper.stop();
+ super.tearDown();
+ }
+
+}
Copied: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java (from r700885, ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java)
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java?p2=ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java&p1=ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java&r1=700885&r2=700972&rev=700972&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java (original)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java Wed Oct 1 16:44:37 2008
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.ode.axis2.httpbinding;
+package org.apache.ode.axis2;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.jetty.handler.ContextHandler;
@@ -27,6 +27,8 @@
import org.mortbay.jetty.Request;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.StreamUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.axis2.transport.http.HTTPConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -35,14 +37,22 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
-import javax.xml.namespace.QName;
import java.io.IOException;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.ArrayList;
/**
* @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
*/
public class JettyWrapper {
+ static List REQUEST_HEADERS = new ArrayList();
+
+ static {
+ REQUEST_HEADERS.add("");
+ }
+
protected Server server;
private ContextHandlerCollection handlerColl;
@@ -52,8 +62,6 @@
public JettyWrapper(int port) throws Exception {
server = new Server(port);
-
- // Arithmetics Service
ContextHandler arithmeticsContext = new ContextHandler();
arithmeticsContext.setContextPath("/HttpBindingTest/ArithmeticsService");
arithmeticsContext.setHandler(new ArithmeticsServiceHandler());
@@ -62,25 +70,62 @@
blogContext.setContextPath("/HttpBindingTest/BlogService");
blogContext.setHandler(new BlogServiceHandler());
+ ContextHandler echoContext = new ContextHandler();
+ echoContext.setContextPath("/EchoService");
+ echoContext.setHandler(new EchoServiceHandler());
+
handlerColl = new ContextHandlerCollection();
- Handler[] handlers = {arithmeticsContext, blogContext};
+ Handler[] handlers = {arithmeticsContext, blogContext, echoContext};
handlerColl.setHandlers(handlers);
server.addHandler(handlerColl);
}
+ public void start() throws Exception {
+ if (!server.isStarted())
+ server.start();
+ }
- private Document parseBody(ServletInputStream bodyStream, HttpServletResponse response) throws IOException {
- if (bodyStream == null) {
- response.sendError(400, "Missing body!");
- } else {
- try {
- return DOMUtils.parse(bodyStream);
- } catch (SAXException e) {
- response.sendError(400, "Failed to parse body! " + e.getMessage());
+ public void stop() throws Exception {
+ server.stop();
+ }
+
+ private class EchoServiceHandler extends AbstractHandler {
+
+
+ public void handle(String s, HttpServletRequest request, HttpServletResponse response, int i) throws IOException, ServletException {
+ String method = request.getMethod();
+ if (StringUtils.isNotEmpty(request.getParameter("ping"))) {
+ response.setStatus(200);
+ response.getOutputStream().println("Yep, I'm here!");
+ } else {
+ if (!"GET".equals(method) && !"POST".equals(method)) {
+ response.setStatus(405);
+ response.setHeader("Allow", "GET, POST");
+ } else {
+ Enumeration h = request.getHeaderNames();
+ // send back all headers
+ while (h.hasMoreElements()) {
+ String hname = (String) h.nextElement();
+ Enumeration values = request.getHeaders(hname);
+ while (values.hasMoreElements()) {
+ String next = (String) values.nextElement();
+ System.out.println(hname + ": " + next);
+ response.addHeader(hname, next);
+ }
+ }
+
+ // send back the body if any
+ String body = new String(StreamUtils.read(request.getInputStream()));
+ if (StringUtils.isNotEmpty(body))
+ response.getOutputStream().println(body);
+
+ }
}
+
+
+ ((Request) request).setHandled(true);
}
- return null;
}
private class ArithmeticsServiceHandler extends AbstractHandler {
@@ -105,76 +150,89 @@
if ("/HttpBindingTestService/".equals(uri)) {
response.getWriter().println("HttpBindingTestService ready!");
} else if (uri.contains("OlaElMundo-GET") || uri.contains("OlaElMundo-DELETE")) {
- if (!uri.contains("plus") && !uri.contains("minus")) {
- response.sendError(404);
+// if (!"GET".equalsIgnoreCase(method)) {
+ if (false) {
+ response.sendError(405, "Expecting method is GET");
} else {
- boolean ok = true;
- int left = 0, right = 0;
- try {
- if (uri.contains("plus")) {
- int index = uri.lastIndexOf("/");
- String[] op = uri.substring(index + 1).split(":");
- left = Integer.parseInt(op[0]);
- right = Integer.parseInt(op[1]);
- } else if (uri.contains("minus")) {
- left = Integer.parseInt(request.getParameter("left"));
- right = -1 * Integer.parseInt(request.getParameter("right"));
- } else {
+ if (!uri.contains("plus") && !uri.contains("minus")) {
+ response.sendError(404);
+ } else {
+ boolean ok = true;
+ int left = 0, right = 0;
+ try {
+ if (uri.contains("plus")) {
+ int index = uri.lastIndexOf("/");
+ String[] op = uri.substring(index + 1).split(":");
+ left = Integer.parseInt(op[0]);
+ right = Integer.parseInt(op[1]);
+ } else if (uri.contains("minus")) {
+ left = Integer.parseInt(request.getParameter("left"));
+ right = -1 * Integer.parseInt(request.getParameter("right"));
+ } else {
+ ok = false;
+ }
+ } catch (NumberFormatException e) {
ok = false;
}
- } catch (NumberFormatException e) {
- ok = false;
- }
- if (!ok) {
- response.sendError(400);
- } else {
- Document doc = DOMUtils.newDocument();
- Element resElt = doc.createElement("theresult");
- resElt.setTextContent(String.valueOf(left + right));
- response.getOutputStream().print(DOMUtils.domToString(resElt));
- response.getOutputStream().close();
- response.setStatus(200);
+ if (!ok) {
+ response.sendError(400);
+ } else {
+ Document doc = DOMUtils.newDocument();
+ Element resElt = doc.createElement("theresult");
+ resElt.setTextContent(String.valueOf(left + right));
+ response.getOutputStream().print(DOMUtils.domToString(resElt));
+ response.getOutputStream().close();
+ response.setStatus(200);
+ }
}
}
} else if (uri.contains("OlaElMundo-POST") || uri.contains("OlaElMundo-PUT")) {
- if (!uri.contains("plus") && !uri.contains("minus")) {
- response.sendError(404);
+// if (!"POST".equalsIgnoreCase(method)) {
+ if (false) {
+ response.sendError(405, "Expecting method is POST");
+ return;
} else {
- // parse body, form-urlencoded
- int res = Integer.MIN_VALUE;
- boolean ok = true;
- String body = new String(StreamUtils.read(request.getInputStream()));
- if (!body.matches("[^=]*=[+-]?\\d*&[^=]*=[+-]?\\d*")) {
- ok = false;
+ String operation;
+ if (!uri.contains("plus") && !uri.contains("minus")) {
+ response.sendError(404);
} else {
- String[] sp = body.split("&");
- String[] op0 = sp[0].split("=");
- String[] op1 = sp[1].split("=");
- try {
- int left, right;
- if (op0[0].equals("left")) {
- left = Integer.valueOf(op0[1]);
- right = Integer.valueOf(op1[1]);
- } else {
- left = Integer.valueOf(op1[1]);
- right = Integer.valueOf(op0[1]);
- }
- if (uri.contains("minus")) {
- right = -1 * right;
- }
- res = left + right;
- } catch (NumberFormatException e) {
+ // parse body, form-urlencoded
+ int res = Integer.MIN_VALUE;
+ boolean ok = true;
+ StringBuffer sb = null;
+ String body = new String(StreamUtils.read(request.getInputStream()));
+ if (!body.matches("[^=]*=[+-]?\\d*&[^=]*=[+-]?\\d*")) {
ok = false;
+ } else {
+ String[] sp = body.split("&");
+ String[] op0 = sp[0].split("=");
+ String[] op1 = sp[1].split("=");
+ try {
+ int left, right;
+ if (op0[0].equals("left")) {
+ left = Integer.valueOf(op0[1]);
+ right = Integer.valueOf(op1[1]);
+ } else {
+ left = Integer.valueOf(op1[1]);
+ right = Integer.valueOf(op0[1]);
+ }
+ if (uri.contains("minus")) {
+ right = -1 * right;
+ }
+ res = left + right;
+ } catch (NumberFormatException e) {
+ ok = false;
+ }
+ }
+ if (!ok) {
+ response.sendError(400);
+ } else {
+ Element resElt = DOMUtils.newDocument().createElement("theresult");
+ resElt.setTextContent(String.valueOf(res));
+ response.getOutputStream().print(DOMUtils.domToString(resElt));
+ response.setStatus(200);
}
- }
- if (!ok) {
- response.sendError(400);
- } else {
- Element resElt = DOMUtils.newDocument().createElement("theresult");
- resElt.setTextContent(String.valueOf(res));
- response.getOutputStream().print(DOMUtils.domToString(resElt));
- response.setStatus(200);
}
}
} else if (uri.contains("SalutLaTerre")) {
@@ -234,9 +292,20 @@
}
}
+ private Document parseBody(ServletInputStream bodyStream, HttpServletResponse response) throws IOException {
+ if (bodyStream == null) {
+ response.sendError(400, "Missing body!");
+ } else {
+ try {
+ return DOMUtils.parse(bodyStream);
+ } catch (SAXException e) {
+ response.sendError(400, "Failed to parse body! " + e.getMessage());
+ }
+ }
+ return null;
+ }
}
-
private class BlogServiceHandler extends AbstractHandler {
public void handle(String s, HttpServletRequest request, HttpServletResponse response, int i) throws IOException, ServletException {
@@ -261,7 +330,7 @@
if ("400_not_found".equals(faultType)) {
response.setStatus(400);
} else if ("500_operation_with_no_fault_failed".equals(faultType)) {
- response.setStatus(500);
+ response.setStatus(500);
} else if ("200_missing_part_in_header".equals(faultType)) {
// a part is bound to a custom header
// this test does not set it on purpose
@@ -367,7 +436,6 @@
}
}
-
public static void main(String[] args) {
try {
new JettyWrapper().server.start();
@@ -375,4 +443,5 @@
e.printStackTrace();
}
}
+
}
Modified: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java (original)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java Wed Oct 1 16:44:37 2008
@@ -1,6 +1,7 @@
package org.apache.ode.axis2.httpbinding;
import org.apache.ode.axis2.Axis2TestBase;
+import org.apache.ode.axis2.JettyWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -35,7 +36,7 @@
new Thread("HttpBindingJetty") {
public void run() {
try {
- jettyWrapper.server.start();
+ jettyWrapper.start();
latch.countDown();
} catch (Exception e) {
e.printStackTrace();
@@ -47,7 +48,7 @@
}
protected void tearDown() throws Exception {
- jettyWrapper.server.stop();
+ jettyWrapper.stop();
super.tearDown();
}
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl Wed Oct 1 16:44:37 2008
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:tns="http://ode/bpel/test/properties"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:odex="http://www.apache.org/ode/type/extension/http"
+ targetNamespace="http://ode/bpel/test/properties">
+
+
+ <!--
+ The goal of this test is to make sure endpoint properties are properly passed around.
+ Endpoint properties might be set with property files matching *.endpoint.
+ These files might be located in 2 different places:
+ . the global BPMS config directory i.e. $BPMS_HOME/var/config (A)
+ . the unit deployment directory i.e. $BPMS_HOME/var/processes/MyProcess (B)
+ If a given property is defined in the deployment unit and in the global config directory, the latter takes precedence.
+ HTTP headers could be set this way, but also with a message part. This is a third options (C). A message part would have precedence over the 2 other ways, A & B.
+
+ The testcase would use various combinations of these solutions to set HTTP headers and make sure the expected value is properly assigned.
+
+ The EchoService is a basic service that send back the headers and body received in the request.
+ -->
+ <wsdl:message name="Message">
+ <wsdl:part name="header_A" type="xsd:string"/>
+ <wsdl:part name="header_B" type="xsd:string"/>
+ <wsdl:part name="header_C" type="xsd:string"/>
+ <wsdl:part name="header_ABC" type="xsd:string"/>
+ <wsdl:part name="header_AB" type="xsd:string"/>
+ <wsdl:part name="header_AC" type="xsd:string"/>
+ <wsdl:part name="header_BC" type="xsd:string"/>
+ <wsdl:part name="header_AA" type="xsd:string"/>
+ <wsdl:part name="header_BB" type="xsd:string"/>
+ </wsdl:message>
+
+
+ <wsdl:portType name="PropertiesPortType">
+ <wsdl:operation name="GET">
+ <wsdl:input message="tns:Message"/>
+ <wsdl:output message="tns:Message"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="binding" type="tns:PropertiesPortType">
+ <wsdl:operation name="GET">
+ <http:operation location=""/>
+ <odex:binding verb="GET"/>
+ <wsdl:input>
+ <http:urlReplacement/>
+ <odex:header name="header_A" part="header_A" />
+ <odex:header name="header_B" part="header_B" />
+ <odex:header name="header_C" part="header_C" />
+ <odex:header name="header_ABC" part="header_ABC"/>
+ <odex:header name="header_AB" part="header_AB"/>
+ <odex:header name="header_AC" part="header_AC"/>
+ <odex:header name="header_BC" part="header_BC"/>
+ <odex:header name="header_AA" part="header_AA"/>
+ <odex:header name="header_BB" part="header_BB"/>
+ </wsdl:input>
+ <wsdl:output>
+ <odex:header name="header_A" part="header_A" />
+ <odex:header name="header_B" part="header_B" />
+ <odex:header name="header_C" part="header_C" />
+ <odex:header name="header_ABC" part="header_ABC"/>
+ <odex:header name="header_AB" part="header_AB"/>
+ <odex:header name="header_AC" part="header_AC"/>
+ <odex:header name="header_BC" part="header_BC"/>
+ <odex:header name="header_AA" part="header_AA"/>
+ <odex:header name="header_BB" part="header_BB"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="PropertiesService">
+ <wsdl:port name="PropertiesPort" binding="tns:binding">
+ <http:address location="http://localhost:7070/EchoService/"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml Wed Oct 1 16:44:37 2008
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:pns="http://ode/bpel/unit-test"
+ xmlns:wns="http://ode/bpel/unit-test.wsdl"
+ xmlns:dns="http://ode/bpel/test/properties">
+
+
+ <process name="pns:test-endpoint-properties">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ <invoke partnerLink="propertiesPartnerLink">
+ <service name="dns:PropertiesService" port="PropertiesPort"/>
+ </invoke>
+ </process>
+</deploy>
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint Wed Oct 1 16:44:37 2008
@@ -0,0 +1,7 @@
+
+alias.myns=http://ode/bpel/test/properties
+
+myns.PropertiesService.ode.http.default-headers.header_B=from_deployment_unit_directory_only
+myns.PropertiesService.ode.http.default-headers.header_BC=from_deployment_unit_directory_BC
+myns.PropertiesService.ode.http.default-headers.header_AB=from_deployment_unit_directory_AB
+myns.PropertiesService.ode.http.default-headers.header_ABC=from_deployment_unit_directory_ABC
\ No newline at end of file
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint Wed Oct 1 16:44:37 2008
@@ -0,0 +1,4 @@
+
+alias.myns1=http://ode/bpel/test/properties
+
+myns1.PropertiesService.ode.http.default-headers.header_BB=from_deployment_unit#file1
\ No newline at end of file
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint Wed Oct 1 16:44:37 2008
@@ -0,0 +1,4 @@
+
+alias.myns2=http://ode/bpel/test/properties
+
+myns2.PropertiesService.ode.http.default-headers.header_BB=from_deployment_unit#file2
\ No newline at end of file
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel Wed Oct 1 16:44:37 2008
@@ -0,0 +1,183 @@
+<!--
+ ~ 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.
+ -->
+<process name="test-endpoint-properties"
+ targetNamespace="http://ode/bpel/unit-test"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tns="http://ode/bpel/unit-test"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://ode/bpel/unit-test.wsdl"
+ xmlns:dummy="http://ode/bpel/test/properties"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="test-endpoint-properties.wsdl"
+ namespace="http://ode/bpel/unit-test.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink"
+ partnerLinkType="test:HelloPartnerLinkType" myRole="me"/>
+ <partnerLink name="propertiesPartnerLink"
+ partnerLinkType="test:PropertiesLinkType" partnerRole="you"/>
+ </partnerLinks>
+
+ <variables>
+ <variable name="inputVar" messageType="test:HelloMessage"/>
+ <variable name="reqMsg" messageType="dummy:Message"/>
+ <variable name="respMsg" messageType="dummy:Message"/>
+ </variables>
+
+ <sequence>
+ <receive name="start" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+ operation="hello" variable="inputVar" createInstance="yes"/>
+
+ <!--
+ A, B, C denote the 3 different way to assign a property (a header in that particular case):
+ A. value set in the global configuration directory
+ B. value set in the deployment unit directory
+ C. value set in the BPEL process with an assignment
+ This order is also order the precedence order. Meaning that B has precedence over A, C over B.
+ -->
+ <!--
+ <odex:header name="header_A" part="header_A" />
+ <odex:header name="header_B" part="header_B" />
+ <odex:header name="header_C" part="header_C" />
+ <odex:header name="header_ABC" part="header_ABC"/>
+ <odex:header name="header_AB" part="header_AB"/>
+ <odex:header name="header_AC" part="header_AC"/>
+ <odex:header name="header_BC" part="header_BC"/>
+ <odex:header name="header_CC" part="header_AA"/>
+ <odex:header name="header_BB" part="header_BB"/>
+ -->
+
+ <!-- Assign all header parts -->
+ <assign>
+ <!-- header_A will be set through a property file in the global config dir -->
+ <!-- header_B will be set through a property file in the deployment unit dir -->
+
+ <copy>
+ <from>$inputVar.TestPart</from>
+ <to>$reqMsg.header_C</to>
+ </copy>
+ <!-- header_ABC is set with the 3 ways, the expected value is the one from the BPEL assignment -->
+ <copy>
+ <from>'from_bpel_assignment_ABC'</from>
+ <to>$reqMsg.header_ABC</to>
+ </copy>
+ <!-- header_AC is set from a global property file and from the BPRL process, the expected value is the one from the BPEL assignment -->
+ <copy>
+ <from>'from_bpel_assignment_AC'</from>
+ <to>$reqMsg.header_AC</to>
+ </copy>
+ <!-- header_BC is set from a deploy-unit property file and from the BPRL process, the expected value is the one from the BPEL assignment -->
+ <copy>
+ <from>'from_bpel_assignment_BC'</from>
+ <to>$reqMsg.header_BC</to>
+ </copy>
+ </assign>
+
+
+ <invoke partnerLink="propertiesPartnerLink" portType="dummy:PropertiesPortType"
+ operation="GET" inputVariable="reqMsg" outputVariable="respMsg"/>
+
+
+ <if>
+ <condition>$respMsg.header_A = 'from_global_conf_directory_only'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_global_conf_directory_only"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_B = 'from_deployment_unit_directory_only'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_deployment_unit_directory_only"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_C = $inputVar.TestPart</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_bpel_process_only"/>
+ </else>
+ </if>
+
+
+ <if>
+ <condition>$respMsg.header_ABC = 'from_bpel_assignment_ABC'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_bpel_assignment_ABC"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_AB = 'from_deployment_unit_directory_AB'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_deployment_unit_directory_AB"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_AC = 'from_bpel_assignment_AC'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_bpel_assignment_AC"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_BC = 'from_bpel_assignment_BC'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_bpel_assignment_BC"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_AA = 'from_global_conf#file2'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_global_conf#file2"/>
+ </else>
+ </if>
+
+ <if>
+ <condition>$respMsg.header_BB = 'from_deployment_unit#file2'</condition>
+ <empty/>
+ <else>
+ <throw faultName="FAILED-from_deployment_unit#file2"/>
+ </else>
+ </if>
+
+ <assign>
+ <copy>
+ <from>'OK!!!'</from>
+ <to>$inputVar.TestPart</to>
+ </copy>
+ </assign>
+ <reply name="end" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+ operation="hello" variable="inputVar"/>
+ </sequence>
+
+</process>
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl Wed Oct 1 16:44:37 2008
@@ -0,0 +1,73 @@
+<?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
+ targetNamespace="http://ode/bpel/unit-test.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://ode/bpel/unit-test.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:dummy="http://ode/bpel/test/properties"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+ <wsdl:import namespace="http://axis2.ode.apache.org"
+ location="Echo.wsdl"/>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part name="TestPart" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body
+ namespace="http://ode/bpel/unit-test.wsdl"
+ use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8080/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+ <plnk:partnerLinkType name="PropertiesLinkType">
+ <plnk:role name="you" portType="dummy:PropertiesPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf.endpoint?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf.endpoint Wed Oct 1 16:44:37 2008
@@ -0,0 +1,7 @@
+
+alias.myns1=http://ode/bpel/test/properties
+
+myns1.PropertiesService.ode.http.default-headers.header_A=from_global_conf_directory_only
+myns1.PropertiesService.ode.http.default-headers.header_ABC=from_global_conf_directory_ABC
+myns.PropertiesService.ode.http.default-headers.header_AB=from_global_conf_directory_AB
+myns1.PropertiesService.ode.http.default-headers.header_AC=from_global_conf_directory_AC
\ No newline at end of file
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_1.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_1.endpoint?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_1.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_1.endpoint Wed Oct 1 16:44:37 2008
@@ -0,0 +1,4 @@
+
+alias.myns1=http://ode/bpel/test/properties
+
+myns1.PropertiesService.ode.http.default-headers.header_AA=from_global_conf#file1
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_2.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_2.endpoint?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_2.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties_global_conf_headerAA_2.endpoint Wed Oct 1 16:44:37 2008
@@ -0,0 +1,5 @@
+
+alias.myns1=http://ode/bpel/test/properties
+
+myns1.PropertiesService.ode.http.default-headers.header_AA=from_global_conf#file2
+
Added: ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap?rev=700972&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap Wed Oct 1 16:44:37 2008
@@ -0,0 +1,28 @@
+<?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.
+ -->
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <!-- test soap message -->
+ <SOAP-ENV:Body>
+ <ns1:hello xmlns:ns1="http://ode/bpel/unit-test.wsdl">
+ <TestPart xmlns="">100</TestPart>
+ </ns1:hello>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Wed Oct 1 16:44:37 2008
@@ -95,6 +95,7 @@
private static final Messages __msgs = Messages.getMessages(Messages.class);
protected File _appRoot;
+ protected File _configRoot;
protected File _workRoot;
protected BpelServerImpl _server;
protected ProcessStoreImpl _store;
@@ -125,8 +126,8 @@
__log.debug("Loading properties");
String confDir = System.getProperty("org.apache.ode.configDir");
- if (confDir == null) _odeConfig = new ODEConfigProperties(new File(_appRoot, "conf"));
- else _odeConfig = new ODEConfigProperties(new File(confDir));
+ _configRoot = confDir == null ? new File(_appRoot, "conf") : new File(confDir);
+ _odeConfig = new ODEConfigProperties(_configRoot);
try {
_odeConfig.load();
@@ -449,6 +450,7 @@
_store = createProcessStore(eprContext, _db.getDataSource());
_store.registerListener(new ProcessStoreListenerImpl());
_store.setDeployDir(new File(_workRoot, "processes"));
+ _store.setConfigDir(_configRoot);
}
protected ProcessStoreImpl createProcessStore(EndpointReferenceContext eprContext, DataSource ds) {
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java Wed Oct 1 16:44:37 2008
@@ -231,7 +231,8 @@
p.setBooleanParameter(PROP_HTTP_REQUEST_CHUNK, Boolean.parseBoolean(properties.get(PROP_HTTP_REQUEST_CHUNK)));
}
if (properties.containsKey(PROP_HTTP_REQUEST_GZIP)) {
- if (log.isWarnEnabled()) log.warn("Property not supported by HTTP External Services: " + PROP_HTTP_REQUEST_GZIP);
+ if (log.isWarnEnabled())
+ log.warn("Property not supported by HTTP External Services: " + PROP_HTTP_REQUEST_GZIP);
}
if (Boolean.parseBoolean(properties.get(PROP_HTTP_ACCEPT_GZIP))) {
@@ -239,7 +240,8 @@
// HttpClient does not support compression natively
// Additional code would be necessary to handle it.
// ((Collection) p.getParameter(HostParams.DEFAULT_HEADERS)).add(new Header("Accept-Encoding", "gzip"));
- if (log.isWarnEnabled()) log.warn("Property not supported by HTTP External Services: " + PROP_HTTP_ACCEPT_GZIP);
+ if (log.isWarnEnabled())
+ log.warn("Property not supported by HTTP External Services: " + PROP_HTTP_ACCEPT_GZIP);
}
if (properties.containsKey(PROP_HTTP_MAX_REDIRECTS)) {
@@ -259,8 +261,79 @@
((Collection) p.getParameter(HostParams.DEFAULT_HEADERS)).addAll(headers);
if (proxy != null) p.setParameter(PROP_HTTP_PROXY_PREFIX, proxy);
- return p;
+ return new UnmodifiableHttpParams(p);
}
+ static class UnmodifiableHttpParams implements HttpParams {
+
+ final HttpParams p;
+ private UnmodifiableHttpParams(HttpParams p) {
+ this.p = p;
+ }
+
+ public void setBooleanParameter(String name, boolean value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setDefaults(HttpParams params) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setDoubleParameter(String name, double value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setIntParameter(String name, int value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setLongParameter(String name, long value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setParameter(String name, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean getBooleanParameter(String name, boolean defaultValue) {
+ return p.getBooleanParameter(name, defaultValue);
+ }
+
+ public HttpParams getDefaults() {
+ return null;
+ }
+
+ public double getDoubleParameter(String name, double defaultValue) {
+ return p.getDoubleParameter(name, defaultValue);
+ }
+
+ public int getIntParameter(String name, int defaultValue) {
+ return p.getIntParameter(name, defaultValue);
+ }
+
+ public long getLongParameter(String name, long defaultValue) {
+ return p.getLongParameter(name, defaultValue);
+ }
+
+ public Object getParameter(String name) {
+ return p.getParameter(name);
+ }
+
+ public boolean isParameterFalse(String name) {
+ return p.isParameterFalse(name);
+ }
+
+ public boolean isParameterSet(String name) {
+ return p.isParameterSet(name);
+ }
+
+ public boolean isParameterSetLocally(String name) {
+ return p.isParameterSetLocally(name);
+ }
+
+ public boolean isParameterTrue(String name) {
+ return p.isParameterTrue(name);
+ }
+ }
}
}
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Wed Oct 1 16:44:37 2008
@@ -24,6 +24,9 @@
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.URIException;
import org.apache.commons.httpclient.params.HttpParams;
+import org.apache.commons.httpclient.params.DefaultHttpParams;
+import org.apache.commons.httpclient.params.HostParams;
+import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.axis2.ExternalService;
@@ -52,6 +55,7 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Map;
+import java.util.Collections;
import java.util.concurrent.Callable;
@@ -139,11 +143,9 @@
// create a client
HttpClient client = new HttpClient(connections);
- // don't forget to wire params so that EPR properties are passed around
- client.getParams().setDefaults(params);
// configure the client (proxy, security, etc)
- HttpHelper.configure(client.getHostConfiguration(), client.getState(), method.getURI(), params);
+ HttpHelper.configure(client, method.getURI(), params);
// this callable encapsulates the http method execution and the process of the response
final Callable executionCallable;
@@ -268,7 +270,7 @@
private void _4xx_5xx_error() throws Exception {
int status = method.getStatusCode();
- if(HttpHelper.isFaultOrFailure(status)>0){
+ if (HttpHelper.isFaultOrFailure(status) > 0) {
// reply with a fault, meaning the request should not be repeated
replyWithFault();
} else {
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java Wed Oct 1 16:44:37 2008
@@ -28,9 +28,11 @@
import org.apache.commons.httpclient.StatusLine;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.params.HttpParams;
+import org.apache.commons.httpclient.params.HostParams;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.lang.StringUtils;
@@ -44,22 +46,40 @@
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.Collections;
public class HttpHelper {
private static final Log log = LogFactory.getLog(HttpHelper.class);
- public static void configure(HostConfiguration hostConfig, HttpState state, URI targetURI, HttpParams params) throws URIException {
+ public static void configure(HttpClient client, URI targetURI, HttpParams params) throws URIException {
if (log.isDebugEnabled()) log.debug("Configuring http client...");
+
+
+ /* Do not forget to wire params so that endpoint properties are passed around
+ Down the road, when the request will be executed, the hierarchy of parameters will be the following:
+ (-> means "is parent of")
+ default params -> params from endpoint properties -> HttpClient -> HostConfig -> Method
+ This wiring is done by HttpClient.
+ */
+ client.getParams().setDefaults(params);
+
+ // Here we make sure HttpClient will not handle the default headers.
+ // Actually HttpClient *appends* default headers while we want them to be ignored if the process assign them
+ client.getParams().setParameter(HostParams.DEFAULT_HEADERS, Collections.EMPTY_LIST);
+
+
// proxy configuration
if (ProxyConf.isProxyEnabled(params, targetURI.getHost())) {
if (log.isDebugEnabled()) log.debug("ProxyConf");
- ProxyConf.configure(hostConfig, state, (HttpTransportProperties.ProxyProperties) params.getParameter(Properties.PROP_HTTP_PROXY_PREFIX));
+ ProxyConf.configure(client.getHostConfiguration(), client.getState(), (HttpTransportProperties.ProxyProperties) params.getParameter(Properties.PROP_HTTP_PROXY_PREFIX));
}
// security
// ...
+
+
}
/**
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java Wed Oct 1 16:44:37 2008
@@ -28,6 +28,7 @@
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.params.HostParams;
import org.apache.commons.httpclient.params.HttpParams;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -41,7 +42,7 @@
import org.apache.ode.utils.Namespaces;
import org.apache.ode.utils.http.HttpUtils;
import static org.apache.ode.utils.http.HttpUtils.bodyAllowed;
-import static org.apache.ode.utils.http.StatusCode.*;
+import static org.apache.ode.utils.http.StatusCode._202_ACCEPTED;
import org.apache.ode.utils.wsdl.Messages;
import org.apache.ode.utils.wsdl.WsdlUtils;
import org.w3c.dom.Document;
@@ -68,6 +69,8 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
public class HttpMethodConverter {
@@ -220,31 +223,46 @@
throw new IllegalArgumentException("Unsupported HTTP method: " + verb);
}
- // link params together
- method.getParams().setDefaults(params);
method.setPath(completeUri); // assumes that the path is properly encoded (URL safe).
method.setQueryString(queryPath);
// set headers
- setHttpRequestHeaders(method, partValues, headers, opBinding);
+ setHttpRequestHeaders(method, opBinding, partValues, headers, params);
return method;
}
/**
- * Go through the list of message headers and set them if empty.
+ * First go through the list of default headers set in the method params. This param is then remove to avoid interference with HttpClient.
+ * Actually the default headers should be overriden by any headers set from the process.
+ * Not to mention that, for a given header, HttpClient do not overwrite any previous values but simply append the default value.<br/>
+ * See {@link see org.apache.commons.httpclient.params.HostParams.DEFAULT_HEADERS}
* <p/>
- * Then go through the list of {@linkplain Namespaces.ODE_HTTP_EXTENSION_NS}{@code :header} elements included in the input binding.
+ * Then go through the list of message headers and set them if empty.
+ * <p/>
+ * Finally go through the list of {@linkplain Namespaces.ODE_HTTP_EXTENSION_NS}{@code :header} elements included in the input binding.
* For each of them, set the HTTP Request Header with the static value defined by the attribute {@linkplain Namespaces.ODE_HTTP_EXTENSION_NS}{@code :value},
* or the part value mentionned in the attribute {@linkplain Namespaces.ODE_HTTP_EXTENSION_NS}{@code :part}.
* <p/>
* Finally, set the 'Accept' header if the output content type of the operation exists.
* <p/>
* Notice that the last header value overrides any values set previoulsy. Meaning that message headers might get overriden by parts bound to headers.
+ *
*/
- public void setHttpRequestHeaders(HttpMethod method, Map<String, Element> partValues, Map<String, Node> headers, BindingOperation opBinding) {
+ public void setHttpRequestHeaders(HttpMethod method, BindingOperation opBinding, Map<String, Element> partValues, Map<String, Node> headers, HttpParams params) {
BindingInput inputBinding = opBinding.getBindingInput();
Message inputMessage = opBinding.getOperation().getInput().getMessage();
+ // Do not let HttpClient manage the default headers
+ // Actually the default headers should be overriden by any headers set from the process.
+ // (Not to mention that, for a given header, HttpClient do not overwrite any previous values but simply append the default value)
+ Collection defaultHeaders = (Collection) params.getParameter(HostParams.DEFAULT_HEADERS);
+ if (defaultHeaders != null) {
+ Iterator i = defaultHeaders.iterator();
+ while (i.hasNext()) {
+ method.setRequestHeader((Header) i.next());
+ }
+ }
+
// process message headers
for (Iterator<Map.Entry<String, Node>> iterator = headers.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<String, Node> e = iterator.next();
@@ -299,7 +317,9 @@
if (log.isErrorEnabled()) log.error(errMsg);
throw new RuntimeException(errMsg);
}
- method.setRequestHeader(headerName, HttpHelper.replaceCRLFwithLWS(headerValue));
+ // do not set the header isf the value is empty
+ if (StringUtils.isNotEmpty(headerValue))
+ method.setRequestHeader(headerName, HttpHelper.replaceCRLFwithLWS(headerValue));
}
MIMEContent outputContent = WsdlUtils.getMimeContent(opBinding.getBindingOutput().getExtensibilityElements());
@@ -412,12 +432,9 @@
Part part = messageDef.getPart(partName);
if (StringUtils.isNotEmpty(partName)) {
Header responseHeader = method.getResponseHeader(headerName);
+ // if the response header is not set, just skip it. no need to fail.
if (responseHeader != null) {
odeMessage.setPart(partName, createPartElement(part, responseHeader.getValue()));
- } else {
- String errMsg = "Part [" + partName + "] is bound to header [" + headerName + "], but this header is not set in the HTTP response.";
- if (log.isErrorEnabled()) log.error(errMsg);
- throw new RuntimeException(errMsg);
}
} else {
String errMsg = "Invalid binding: missing required attribute! Part name: " + new QName(Namespaces.ODE_HTTP_EXTENSION_NS, "part");
@@ -426,12 +443,10 @@
}
}
- // add all HTTP headers into the messade as header parts
- Header[] reqHeaders = method.getResponseHeaders();
- for (int i = 0; i < reqHeaders.length; i++) {
- Header h = reqHeaders[i];
- odeMessage.setHeaderPart(h.getName(), h.getValue());
- }
+ // add all HTTP response headers (in their condensed form) into the message as header parts
+ Set<String> headerNames = new HashSet<String>();
+ for (Header header : method.getResponseHeaders()) headerNames.add(header.getName());
+ for(String hname:headerNames) odeMessage.setHeaderPart(hname, method.getResponseHeader(hname).getValue());
// make the status line information available as a single element
odeMessage.setHeaderPart("Status-Line", HttpHelper.statusLineToElement(method.getStatusLine()));
Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java Wed Oct 1 16:44:37 2008
@@ -49,15 +49,14 @@
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.Namespaces;
import org.apache.ode.utils.WatchDog;
-import org.apache.ode.utils.wsdl.Messages;
-import org.apache.ode.utils.fs.FileWatchDog;
import org.apache.ode.utils.uuid.UUID;
+import org.apache.ode.utils.wsdl.Messages;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.wsdl.Definition;
-import javax.wsdl.Operation;
import javax.wsdl.Fault;
+import javax.wsdl.Operation;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.InputStream;
@@ -73,9 +72,9 @@
private static final Log __log = LogFactory.getLog(ExternalService.class);
private static final int EXPIRE_SERVICE_CLIENT = 30000;
- private static ThreadLocal<CachedOptions> _cachedOptions = new ThreadLocal<CachedOptions>();
- private static ThreadLocal<CachedServiceClient> _cachedClients = new ThreadLocal<CachedServiceClient>();
-
+ private static ThreadLocal<WatchDog<Map, OptionsObserver>> _cachedOptions = new ThreadLocal<WatchDog<Map, OptionsObserver>>();
+ private static ThreadLocal<WatchDog<Long, ServiceFileObserver>> _cachedClients = new ThreadLocal<WatchDog<Long, ServiceFileObserver>>();
+
private static final org.apache.ode.utils.wsdl.Messages msgs = Messages.getMessages(Messages.class);
private Definition _definition;
@@ -106,7 +105,7 @@
boolean isTwoWay = odeMex.getMessageExchangePattern() == org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE;
try {
// Override options are passed to the axis MessageContext so we can
- // retrieve them in our session out handler.
+ // retrieve them in our session out changeHandler.
MessageContext mctx = new MessageContext();
writeHeader(mctx, odeMex);
@@ -119,7 +118,7 @@
__log.debug("Message: " + soapEnv);
}
- ServiceClient client = getCachedServiceClient().client;
+ ServiceClient client = getServiceClient();
final OperationClient operationClient = client.createClient(isTwoWay ? ServiceClient.ANON_OUT_IN_OP
: ServiceClient.ANON_OUT_ONLY_OP);
operationClient.addMessageContext(mctx);
@@ -160,30 +159,52 @@
}
}
- private CachedServiceClient getCachedServiceClient() throws AxisFault {
- CachedServiceClient cachedServiceClient = _cachedClients.get();
- if (cachedServiceClient == null) {
- cachedServiceClient = new CachedServiceClient(new File(_pconf.getBaseURI().resolve(_serviceName.getLocalPart() + ".axis2")), EXPIRE_SERVICE_CLIENT);
- _cachedClients.set(cachedServiceClient);
+ private ServiceClient getServiceClient() throws AxisFault {
+ WatchDog<Long, ServiceFileObserver> serviceClientWatchDog = _cachedClients.get();
+ if (serviceClientWatchDog == null) {
+ File fileToWatch = new File(_pconf.getBaseURI().resolve(_serviceName.getLocalPart() + ".axis2"));
+ serviceClientWatchDog = WatchDog.watchFile(fileToWatch, new ServiceFileObserver(fileToWatch));
+ serviceClientWatchDog.setDelay(EXPIRE_SERVICE_CLIENT);
+ _cachedClients.set(serviceClientWatchDog);
}
try {
// call manually the check procedure
// we dont want a dedicated thread for that
- cachedServiceClient.check();
+ serviceClientWatchDog.check();
} catch (RuntimeException e) {
throw AxisFault.makeFault(e.getCause() != null ? e.getCause() : e);
}
- SoapExternalService.CachedOptions cachedOptions = _cachedOptions.get();
- if (cachedOptions == null) {
- cachedOptions = new CachedOptions();
- _cachedOptions.set(cachedOptions);
+ WatchDog<Map, OptionsObserver> optionsWatchDog = _cachedOptions.get();
+ if (optionsWatchDog == null) {
+ optionsWatchDog = new WatchDog<Map, OptionsObserver>(new WatchDog.Mutable<Map>() {
+ // ProcessConf#getProperties(String...) cannot return ull (by contract)
+ public boolean exists() {
+ return true;
+ }
+
+ public boolean hasChangedSince(Map since) {
+ Map latest = lastModified(); // cannot be null but better be prepared
+ // check if mappings are equal
+ return !CollectionUtils.equals(latest, since);
+ }
+
+ public Map lastModified() {
+ return _pconf.getEndpointProperties(endpointReference);
+ }
+
+ public String toString() {
+ return "Properties for Endpoint: "+endpointReference;
+ }
+ }, new OptionsObserver());
+ _cachedOptions.set(optionsWatchDog);
}
- cachedOptions.check();
+ optionsWatchDog.check();
// apply the options to the service client
- cachedServiceClient.client.setOptions(cachedOptions.options);
- return cachedServiceClient;
+ ServiceClient serviceClient = serviceClientWatchDog.getObserver().client;
+ serviceClient.setOptions(optionsWatchDog.getObserver().options);
+ return serviceClient;
}
/**
@@ -314,18 +335,19 @@
* The {@link org.apache.axis2.client.ServiceClient} instance is created from the main Axis2 config instance and
* this service-specific config file.
*/
- private class CachedServiceClient extends FileWatchDog {
+ private class ServiceFileObserver extends WatchDog.DefaultObserver {
ServiceClient client;
+ File file;
- protected CachedServiceClient(File file, long delay) {
- super(file, delay);
+ private ServiceFileObserver(File file) {
+ this.file = file;
}
- protected boolean isInitialized() {
+ public boolean isInitialized() {
return client != null;
}
- protected void init() {
+ public void init() {
try {
client = new ServiceClient(new ConfigurationContext(_axisConfig), null);
} catch (AxisFault axisFault) {
@@ -333,7 +355,7 @@
}
}
- protected void doOnUpdate() {
+ public void onUpdate() {
// axis2 service configuration
// if the config file has been modified (i.e added or updated), re-create a ServiceClient
// and load the new config.
@@ -351,42 +373,20 @@
}
}
- private class CachedOptions extends WatchDog<Map> {
+ private class OptionsObserver extends WatchDog.DefaultObserver {
Options options;
- private CachedOptions() {
- super(new WatchDog.Mutable<Map>() {
- // ProcessConf#getProperties(String...) cannot return ull (by contract)
- public boolean exists() {
- return true;
- }
-
- public boolean hasChangedSince(Map since) {
- Map latest = lastModified(); // cannot be null but better be prepared
- // check if mappings are equal
- return !CollectionUtils.equals(latest, since);
- }
-
- public Map lastModified() {
- return _pconf.getEndpointProperties(endpointReference);
- }
-
- public String toString() {
- return "Properties for Endpoint: "+endpointReference;
- }
- });
- }
- protected boolean isInitialized() {
+ public boolean isInitialized() {
return options != null;
}
- protected void init() {
+ public void init() {
options = new Options();
}
- protected void doOnUpdate() {
+ public void doOnUpdate() {
init();
// note: don't make this map an instance attribute, so we always get the latest version
Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java?rev=700972&r1=700971&r2=700972&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java Wed Oct 1 16:44:37 2008
@@ -46,16 +46,18 @@
import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
/**
* Container providing various functions on the deployment directory.
*/
-class DeploymentUnitDir {
+class DeploymentUnitDir {
private static Log __log = LogFactory.getLog(DeploymentUnitDir.class);
@@ -91,6 +93,13 @@
}
};
+ private static final FileFilter _endpointFilter = new FileFilter() {
+ public boolean accept(File path) {
+ // endpoint-configuration.properties is deprecated, keep it for backward compatibility
+ return (path.getName().endsWith(".endpoint") || path.getName().equals("endpoint-configuration.properties")) && path.isFile();
+ }
+ };
+
DeploymentUnitDir(File dir) {
if (!dir.exists())
throw new IllegalArgumentException("Directory " + dir + " does not exist!");
@@ -114,8 +123,8 @@
/**
- * Checking for each BPEL file if we have a corresponding compiled process. If we don't,
- * starts compilation.
+ * Checking for each BPEL file if we have a corresponding compiled process. If we don't,
+ * starts compilation.
*/
void compile() {
ArrayList<File> bpels = listFilesRecursively(_duDirectory, DeploymentUnitDir._bpelFilter);
@@ -149,12 +158,12 @@
private void compile(File bpelFile) {
BpelC bpelc = BpelC.newBpelCompiler();
-
+
// BPEL 1.1 does not suport the <import> element, so "global" WSDL needs to be configured explicitly.
File bpel11wsdl = findBpel11Wsdl(bpelFile);
if (bpel11wsdl != null)
bpelc.setProcessWSDL(bpel11wsdl.toURI());
-
+
bpelc.setCompileProperties(prepareCompileProperties(bpelFile));
bpelc.setExtensionValidators(_extensionValidators);
bpelc.setBaseDirectory(_duDirectory);
@@ -194,15 +203,22 @@
public boolean equals(Object obj) {
if (!(obj instanceof DeploymentUnitDir)) return false;
- return ((DeploymentUnitDir)obj).getDeployDir().getAbsolutePath().equals(getDeployDir().getAbsolutePath());
+ return ((DeploymentUnitDir) obj).getDeployDir().getAbsolutePath().equals(getDeployDir().getAbsolutePath());
}
public File getDeployDir() {
return _duDirectory;
}
- public File getEPRConfigFile(){
- return new File(getDeployDir(), "endpoint-configuration.properties");
+ /**
+ *
+ * @return the list of endpoint configuration files. the list is built on each call to handle changes.
+ */
+ public TreeSet<File> getEndpointConfigFiles() {
+ File[] files = getDeployDir().listFiles(_endpointFilter);
+ TreeSet<File> set = new TreeSet<File>();
+ set.addAll(Arrays.asList(files));
+ return set;
}
public DeployDocument getDeploymentDescriptor() {
@@ -239,7 +255,7 @@
try {
_docRegistry.addDefinition((Definition4BPEL) r.readWSDL(new WSDLLocatorImpl(rf, uri)));
} catch (WSDLException e) {
- throw new ContextException("Couldn't read WSDL document at " + uri, e);
+ throw new ContextException("Couldn't read WSDL document at " + uri, e);
}
}
}
@@ -329,7 +345,7 @@
for (Process process : plist) {
if (process.getFileName() == null || "".equals(process.getFileName()))
continue;
-
+
if (bpelFile.getName().equals(process.getFileName())) {
Map<QName, Node> props = ProcessStoreImpl.calcInitialProperties(process);
Map<String, Object> result = new HashMap<String, Object>();
@@ -340,9 +356,10 @@
return null;
}
-
+
/**
- * Figure out the name of the WSDL file for a BPEL 1.1 process.
+ * Figure out the name of the WSDL file for a BPEL 1.1 process.
+ *
* @param bpelFile BPEL process file name
* @return file name of the WSDL, or null if none specified.
*/
@@ -355,12 +372,12 @@
continue;
if (process.getBpel11WsdlFileName() == null || "".equals(process.getBpel11WsdlFileName()))
return null;
-
+
return new File(bpelFile.getParentFile(), process.getBpel11WsdlFileName());
}
return null;
}
-
+
public long getVersion() {
return _version;
}