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/09/30 01:34:53 UTC

svn commit: r700306 [1/2] - in /ode/branches/APACHE_ODE_1.X: axis2-war/src/main/webapp/WEB-INF/conf/ axis2-war/src/test/java/org/apache/ode/axis2/ axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ axis2-war/src/test/resources/TestEndpointProper...

Author: midon
Date: Mon Sep 29 16:34:52 2008
New Revision: 700306

URL: http://svn.apache.org/viewvc?rev=700306&view=rev
Log:
Support multiple property file for endpoint configuration.
For a given process these files could be created in two different locations:
 . the global conf dir: $BPNS_HOME/var/config
 . the deployment unit dir: $BPNS_HOME/var/processes/$my_process

Added:
    ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf.endpoint
    ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_1.endpoint
    ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_2.endpoint
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java
      - copied, changed from r700303, ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap
    ode/branches/APACHE_ODE_1.X/utils/src/test/resources/hierarchical-1.properties
      - copied, changed from r700303, ode/branches/APACHE_ODE_1.X/utils/src/test/resources/hierarchical.properties
    ode/branches/APACHE_ODE_1.X/utils/src/test/resources/hierarchical-2.properties
Removed:
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java
    ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/fs/FileWatchDog.java
    ode/branches/APACHE_ODE_1.X/utils/src/test/resources/hierarchical.properties
Modified:
    ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
    ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/Properties.java
    ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
    ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
    ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java
    ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java
    ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
    ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
    ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
    ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java
    ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/jpa/DbConfStoreConnectionFactory.java
    ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/HierarchicalProperties.java
    ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/WatchDog.java
    ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/HierarchicalPropertiesTest.java

Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf.endpoint
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf.endpoint?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf.endpoint (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf.endpoint Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_1.endpoint
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_1.endpoint?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_1.endpoint (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_1.endpoint Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_2.endpoint
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_2.endpoint?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_2.endpoint (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/main/webapp/WEB-INF/conf/test-endpoint-properties_global_conf_headerAA_2.endpoint Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointPropertiesTest.java Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java (from r700303, ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java)
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java?p2=ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java&p1=ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java&r1=700303&r2=700306&rev=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/JettyWrapper.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/JettyWrapper.java Mon Sep 29 16:34:52 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;
@@ -36,12 +38,21 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletInputStream;
 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;
 
@@ -51,23 +62,72 @@
 
     public JettyWrapper(int port) throws Exception {
         server = new Server(port);
-        // Adding the buildr handler to control our server lifecycle
         ContextHandler arithmeticsContext = new ContextHandler();
         arithmeticsContext.setContextPath("/HttpBindingTest/ArithmeticsService");
         arithmeticsContext.setHandler(new ArithmeticsServiceHandler());
 
-
         ContextHandler blogContext = new ContextHandler();
         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();
+    }
+
+    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);
+        }
+    }
+
     private class ArithmeticsServiceHandler extends AbstractHandler {
         /*
         8 urls to handle:
@@ -376,7 +436,6 @@
         }
     }
 
-
     public static void main(String[] args) {
         try {
             new JettyWrapper().server.start();
@@ -384,4 +443,5 @@
             e.printStackTrace();
         }
     }
+
 }

Modified: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java Mon Sep 29 16:34:52 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;
 
@@ -33,7 +34,7 @@
         new Thread("HttpBindingJetty") {
             public void run() {
                 try {
-                    jettyWrapper.server.start();
+                    jettyWrapper.start();
                     latch.countDown();
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -45,7 +46,7 @@
     }
 
     protected void tearDown() throws Exception {
-        jettyWrapper.server.stop();
+        jettyWrapper.stop();
         super.tearDown();
     }
 

Added: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/deploy.xml Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit.endpoint Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_1.endpoint Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties-deploy-unit_headerBB_2.endpoint Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.wsdl Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap?rev=700306&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap (added)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/resources/TestEndpointProperties/testRequest.soap Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Mon Sep 29 16:34:52 2008
@@ -94,6 +94,8 @@
 
     protected File _workRoot;
 
+    protected File _configRoot;
+
     protected BpelServerImpl _server;
 
     protected ProcessStoreImpl _store;
@@ -138,8 +140,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();
@@ -462,6 +464,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/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/Properties.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/Properties.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/Properties.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/Properties.java Mon Sep 29 16:34:52 2008
@@ -27,19 +27,17 @@
 import org.apache.commons.httpclient.HttpVersion;
 import org.apache.commons.httpclient.ProtocolException;
 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.httpclient.params.HttpConnectionParams;
 import org.apache.commons.httpclient.params.HttpMethodParams;
 import org.apache.commons.httpclient.params.HttpParams;
-import org.apache.commons.httpclient.params.HttpClientParams;
-import org.apache.commons.httpclient.params.HostParams;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.util.ArrayList;
-import java.util.Map;
-import java.util.List;
 import java.util.Collection;
-import java.util.Iterator;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
@@ -182,7 +180,8 @@
         }
 
         public static HttpParams translate(Map<String, String> properties, HttpParams p) {
-            if (log.isDebugEnabled()) log.debug("Translating Properties for HttpClient. Properties size=" + properties.size());
+            if (log.isDebugEnabled())
+                log.debug("Translating Properties for HttpClient. Properties size=" + properties.size());
             if (properties.isEmpty()) return p;
 
             /*first add all property pairs so that new properties (with string value)
@@ -231,7 +230,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 +239,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 +260,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/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java Mon Sep 29 16:34:52 2008
@@ -22,7 +22,6 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.Map;
-import java.util.HashMap;
 import java.io.File;
 import java.io.InputStream;
 
@@ -48,7 +47,6 @@
 import org.apache.ode.bpel.epr.EndpointFactory;
 import org.apache.ode.bpel.epr.MutableEndpoint;
 import org.apache.ode.bpel.epr.WSAEndpoint;
-import org.apache.ode.bpel.epr.WSDL11Endpoint;
 import org.apache.ode.bpel.iapi.BpelServer;
 import org.apache.ode.bpel.iapi.Message;
 import org.apache.ode.bpel.iapi.MessageExchange;
@@ -61,7 +59,6 @@
 import org.apache.ode.utils.Namespaces;
 import org.apache.ode.utils.WatchDog;
 import org.apache.ode.utils.CollectionUtils;
-import org.apache.ode.utils.fs.FileWatchDog;
 import org.apache.ode.utils.wsdl.Messages;
 import org.apache.ode.utils.uuid.UUID;
 import org.w3c.dom.Document;
@@ -82,8 +79,8 @@
 
     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 ExecutorService _executorService;
     private Definition _definition;
@@ -119,7 +116,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);
 
@@ -134,7 +131,7 @@
             }
 
 
-            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);
@@ -205,30 +202,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;
     }
 
     /**
@@ -387,18 +406,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) {
@@ -406,7 +426,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.
@@ -424,42 +444,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/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Mon Sep 29 16:34:52 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;
@@ -53,6 +56,7 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
+import java.util.Collections;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 
@@ -144,11 +148,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;
@@ -300,7 +302,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/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpHelper.java Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodConverter.java Mon Sep 29 16:34:52 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/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/DeploymentUnitDir.java Mon Sep 29 16:34:52 2008
@@ -46,11 +46,13 @@
 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.
@@ -58,7 +60,7 @@
  * @author mriou
  * @author Maciej Szefler <mszefler at gmail dot com>
  */
-class DeploymentUnitDir  {
+class DeploymentUnitDir {
 
 
     private static Log __log = LogFactory.getLog(DeploymentUnitDir.class);
@@ -67,8 +69,8 @@
     private File _duDirectory;
     private File _descriptorFile;
 
-    private HashMap<QName, CBPInfo> _processes = new HashMap<QName,CBPInfo>();
-    private HashMap<QName, TDeployment.Process> _processInfo = new HashMap<QName,TDeployment.Process>();
+    private HashMap<QName, CBPInfo> _processes = new HashMap<QName, CBPInfo>();
+    private HashMap<QName, TDeployment.Process> _processInfo = new HashMap<QName, TDeployment.Process>();
 
     private volatile DeployDocument _dd;
     private volatile DocumentRegistry _docRegistry;
@@ -93,6 +95,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!");
@@ -116,8 +125,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 = FileUtils.listFilesRecursively(_duDirectory, DeploymentUnitDir._bpelFilter);
@@ -151,12 +160,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.setBaseDirectory(_duDirectory);
         try {
@@ -174,7 +183,7 @@
         try {
             is = new FileInputStream(f);
             Serializer ofh = new Serializer(is);
-            CBPInfo info = new CBPInfo(ofh.type,ofh.guid,f);
+            CBPInfo info = new CBPInfo(ofh.type, ofh.guid, f);
             return info;
         } catch (Exception e) {
             throw new ContextException("Couldn't read compiled BPEL process " + f.getAbsolutePath(), e);
@@ -195,15 +204,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() {
@@ -240,7 +256,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);
                 }
             }
         }
@@ -313,7 +329,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>();
@@ -324,9 +340,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.
      */
@@ -339,12 +356,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;
     }

Modified: ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Mon Sep 29 16:34:52 2008
@@ -23,6 +23,7 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.FileFilter;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -32,6 +33,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Arrays;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
@@ -57,8 +59,8 @@
 import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.HierarchicalProperties;
-import org.apache.ode.utils.fs.FileWatchDog;
-import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.WatchDog;
+import org.apache.ode.utils.CollectionUtils;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -71,9 +73,9 @@
  */
 public class ProcessConfImpl implements ProcessConf {
     private static final Log __log = LogFactory.getLog(ProcessConfImpl.class);
-    private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
 
     private final Date _deployDate;
+    private File _configDir;
     private final Map<QName, Node> _props;
     private final HashMap<String, Endpoint> _partnerRoleInitialValues = new HashMap<String, Endpoint>();
 
@@ -94,30 +96,50 @@
     // provide the IL properties
     private HierarchicalProperties ilProperties;
     // monitor the IL property file and reload it if necessary
-    private PropertiesWatchDog propertiesWatchDog;
+    private WatchDog<Map<File, Long>, PropertiesObserver> propertiesWatchDog;
     private final ReadWriteLock ilPropertiesLock = new ReentrantReadWriteLock();
 
     private EndpointReferenceContext eprContext;
 
     ProcessConfImpl(QName pid, QName type, long version, DeploymentUnitDir du, TDeployment.Process pinfo, Date deployDate,
-                    Map<QName, Node> props, ProcessState pstate, EndpointReferenceContext eprContext) {
+                    Map<QName, Node> props, ProcessState pstate, EndpointReferenceContext eprContext, File configDir) {
         _pid = pid;
         _version = version;
         _du = du;
         _pinfo = pinfo;
         _deployDate = deployDate;
+        _configDir = configDir;
         _props = Collections.unmodifiableMap(props);
         _state = pstate;
         _type = type;
         _inMemory = _pinfo.isSetInMemory() && _pinfo.getInMemory();
         this.eprContext = eprContext;
-        propertiesWatchDog = new PropertiesWatchDog();
+
+        propertiesWatchDog = new WatchDog<Map<File, Long>, PropertiesObserver>(new PropertiesMutable(), new PropertiesObserver());
 
         initLinks();
         initMexInterceptors();
         initEventList();
     }
 
+    private List<File> collectEndpointConfigFiles() {
+        // please mind the order: process-level files must be before system-level files
+        List<File> propFiles = new ArrayList<File>();
+
+        propFiles.addAll(_du.getEndpointConfigFiles());
+        if (_configDir != null) {
+            // list and sort endpoint config files
+            File[] files = _configDir.listFiles(new FileFilter() {
+                public boolean accept(File path) {
+                    return path.getName().endsWith(".endpoint") && path.isFile();
+                }
+            });
+            Arrays.sort(files);
+            propFiles.addAll(Arrays.asList(files));
+        }
+        return propFiles;
+    }
+
     private void initMexInterceptors() {
         if (_pinfo.getMexInterceptors() != null) {
             for (TMexInterceptor mexInterceptor : _pinfo.getMexInterceptors().getMexInterceptorList()) {
@@ -155,7 +177,7 @@
                 _myRoleEndpoints.put(plinkName, new Endpoint(service.getName(), service.getPort()));
 
                 if (provide.isSetEnableSharing()) {
-                	_sharedServices.add(service.getName());
+                    _sharedServices.add(service.getName());
                 }
             }
         }
@@ -254,9 +276,9 @@
     }
 
     public boolean isSharedService(QName serviceName) {
-    	return _sharedServices.contains(serviceName);
+        return _sharedServices.contains(serviceName);
     }
-    
+
     private void handleEndpoints() {
         // for (TProvide provide : _pinfo.getProvideList()) {
         // OPartnerLink pLink = _oprocess.getPartnerLink(provide.getPartnerLink());
@@ -404,42 +426,51 @@
         }
     }
 
-    /**
-     * Manage the reloading of the propery file every {@link org.apache.ode.utils.fs.FileWatchDog#DEFAULT_DELAY}.
-     * The check is done manually, meaning that {@link #check()} must be invoked each time _ilProperties is accessed.
-     */
-    private class PropertiesWatchDog extends FileWatchDog {
-        public PropertiesWatchDog() {
-            super(_du.getEPRConfigFile());
+    private class PropertiesMutable implements WatchDog.Mutable<Map<File, Long>> {
+
+        public boolean exists() {
+            return true;
+        }
+
+        public boolean hasChangedSince(Map<File, Long> since) {
+            return !CollectionUtils.equals(lastModified(), since);
         }
 
-        protected void init() {
+        public Map<File, Long> lastModified() {
+            List<File> files = collectEndpointConfigFiles();
+            Map<File, Long> m = new HashMap<File, Long>(files.size() * 15 / 10);
+            for (File f : files) m.put(f, Long.valueOf(f.lastModified()));
+            return m;
+        }
+    }
+
+    private class PropertiesObserver implements WatchDog.Observer {
+
+        public void init() {
             ilPropertiesLock.writeLock().lock();
             try {
-                if (ilProperties == null) {
-                    try {
-                        ilProperties = new HierarchicalProperties(super.file);
-                    } catch (IOException e) {
-                        throw new ContextException("Integration-Layer Properties cannot be loaded!", e);
-                    }
-                } else {
-                    ilProperties.clear();
+                try {
+                    // do not hold a reference on the file list, so that changes are handled
+                    // and always create a new instance of the HierarchicalProperties
+                    ilProperties = new HierarchicalProperties(collectEndpointConfigFiles());
+                } catch (IOException e) {
+                    throw new ContextException("Integration-Layer Properties cannot be loaded!", e);
                 }
             } finally {
                 ilPropertiesLock.writeLock().unlock();
             }
         }
 
-        protected boolean isInitialized() {
+        public boolean isInitialized() {
             return ilProperties != null;
         }
 
-        protected void doOnUpdate() {
+        public void onUpdate() {
             ilPropertiesLock.writeLock().lock();
             try {
                 init();
                 try {
-                    ilProperties.loadFile();
+                    ilProperties.loadFiles();
                 } catch (IOException e) {
                     throw new ContextException("Integration-Layer Properties cannot be loaded!", e);
                 }
@@ -447,6 +478,10 @@
                 ilPropertiesLock.writeLock().unlock();
             }
         }
+
+        public void onDelete() {
+            init();
+        }
     }
 
 

Modified: ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Mon Sep 29 16:34:52 2008
@@ -95,6 +95,8 @@
 
     protected File _deployDir;
 
+    protected File _configDir;
+
     /**
      * Executor used to process DB transactions. Allows us to isolate the TX context, and to ensure that only one TX gets executed a
      * time. We don't really care to parallelize these operations because: i) HSQL does not isolate transactions and we don't want
@@ -112,22 +114,22 @@
         this(null, null, "", new OdeConfigProperties(new Properties(), ""), true);
     }
 
-    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource ds, String persistenceType, OdeConfigProperties props, boolean auto) {
+    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource ds, String persistenceType, OdeConfigProperties props, boolean createDatamodel) {
         this.eprContext = eprContext;
         if (ds != null) {
             // ugly hack
             if (persistenceType.toLowerCase().indexOf("hib") != -1)
-                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), auto);
+                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), createDatamodel);
             else
-                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, auto);
+                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel);
         } else {
             // If the datasource is not provided, then we create a HSQL-based in-memory
             // database. Makes testing a bit simpler.
             DataSource hsqlds = createInternalDS(_guid);
             if ("hibernate".equalsIgnoreCase(persistenceType))
-                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), auto);
+                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), createDatamodel);
             else
-                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, auto);
+                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel);
             _inMemDs = hsqlds;
         }
 
@@ -214,9 +216,8 @@
                     throw new ContextException(errmsg);
                 }
 
-                // final OProcess oprocess = loadCBP(cbpInfo.cbp);
                 ProcessConfImpl pconf = new ProcessConfImpl(pid, processDD.getName(), version, du, processDD, deployDate,
-                        calcInitialProperties(processDD), calcInitialState(processDD), eprContext);
+                        calcInitialProperties(processDD), calcInitialState(processDD), eprContext, _configDir);
                 processes.add(pconf);
             }
 
@@ -625,7 +626,7 @@
                 // TODO: update the props based on the values in the DB.
 
                 ProcessConfImpl pconf = new ProcessConfImpl(p.getPID(), p.getType(), p.getVersion(), dud, pinfo, dudao
-                        .getDeployDate(), props, p.getState(), eprContext);
+                        .getDeployDate(), props, p.getState(), eprContext, _configDir);
                 version = p.getVersion();
 
                 _processes.put(pconf.getProcessId(), pconf);
@@ -729,6 +730,14 @@
         return _deployDir;
     }
 
+    public File getConfigDir() {
+        return _configDir;
+    }
+
+    public void setConfigDir(File configDir) {
+        this._configDir = configDir;
+    }
+
     public static DataSource createInternalDS(String guid) {
         jdbcDataSource hsqlds = new jdbcDataSource();
         hsqlds.setDatabase("jdbc:hsqldb:mem:" + guid);

Modified: ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java?rev=700306&r1=700305&r2=700306&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-store/src/main/java/org/apache/ode/store/hib/DbConfStoreConnectionFactory.java Mon Sep 29 16:34:52 2008
@@ -78,7 +78,7 @@
 
     final SessionFactory _sessionFactory;
 
-    public DbConfStoreConnectionFactory(DataSource ds, Properties initialProps, boolean auto) {
+    public DbConfStoreConnectionFactory(DataSource ds, Properties initialProps, boolean createDatamodel) {
         _ds = ds;
 
         // Don't want to pollute original properties
@@ -102,7 +102,7 @@
             }
         }
 
-        if (auto) {
+        if (createDatamodel) {
             properties.put(Environment.HBM2DDL_AUTO, "create-drop");
         }