You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/06/05 23:14:10 UTC

svn commit: r663741 [1/2] - in /ode/trunk: ./ axis2-war/src/test/java/org/apache/ode/axis2/ axis2/src/main/java/org/apache/ode/axis2/ axis2/src/main/java/org/apache/ode/axis2/httpbinding/ axis2/src/main/java/org/apache/ode/axis2/soapbinding/ axis2/src/...

Author: mriou
Date: Thu Jun  5 14:14:08 2008
New Revision: 663741

URL: http://svn.apache.org/viewvc?rev=663741&view=rev
Log:
ODE-295 Integration-Layer configuration.

Added:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java
      - copied, changed from r663708, ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/ProxyConf.java
    ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpClientHelperTest.java
      - copied, changed from r663708, ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java
    ode/trunk/bpel-store/src/test/resources/integration-layer.properties
    ode/trunk/utils/src/main/java/org/apache/ode/utils/CollectionUtils.java
    ode/trunk/utils/src/main/java/org/apache/ode/utils/HierarchiedProperties.java
    ode/trunk/utils/src/main/java/org/apache/ode/utils/WatchDog.java
    ode/trunk/utils/src/test/java/org/apache/ode/utils/HierarchiedPropertiesTest.java
    ode/trunk/utils/src/test/resources/hierarchied.properties
Removed:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java
    ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java
    ode/trunk/utils/src/main/java/org/apache/ode/utils/ArrayUtils.java
Modified:
    ode/trunk/Rakefile
    ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/CorrelationKey.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/Filter.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/BpelEvent.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/intercept/ThrottlingInterceptor.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/CorrelatorDaoImpl.java
    ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.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/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
    ode/trunk/jacob/src/main/java/org/apache/ode/jacob/JacobRunnable.java
    ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ChannelFactory.java
    ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
    ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java
    ode/trunk/utils/src/main/java/org/apache/ode/utils/ObjectPrinter.java
    ode/trunk/utils/src/main/java/org/apache/ode/utils/fs/FileWatchDog.java
    ode/trunk/utils/src/test/java/org/apache/ode/utils/wsdl/WsdlUtilsTest.java

Modified: ode/trunk/Rakefile
URL: http://svn.apache.org/viewvc/ode/trunk/Rakefile?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/Rakefile (original)
+++ ode/trunk/Rakefile Thu Jun  5 14:14:08 2008
@@ -133,7 +133,7 @@
   define "axis2" do
     compile.with projects("bpel-api", "bpel-compiler", "bpel-connector", "bpel-dao", "il-common", "bpel-runtime",
       "scheduler-simple", "bpel-schemas", "bpel-store", "utils"),
-      AXIOM, AXIS2_ALL, COMMONS.logging, COMMONS.collections, COMMONS.httpclient, DERBY, GERONIMO.kernel, GERONIMO.transaction,
+      AXIOM, AXIS2_ALL, COMMONS.lang, COMMONS.logging, COMMONS.collections, COMMONS.httpclient, DERBY, GERONIMO.kernel, GERONIMO.transaction,
       JAVAX.activation, JAVAX.servlet, JAVAX.stream, JAVAX.transaction, JENCKS, WSDL4J, WS_COMMONS.xml_schema,
       XMLBEANS
 
@@ -464,7 +464,7 @@
 
   desc "ODE Utils"
   define "utils" do
-    compile.with COMMONS.logging, COMMONS.pool, COMMONS.httpclient, COMMONS.codec, LOG4J, XERCES, JAVAX.stream, WSDL4J
+    compile.with COMMONS.collections, COMMONS.logging, COMMONS.pool, COMMONS.httpclient, COMMONS.codec, LOG4J, XERCES, JAVAX.stream, WSDL4J
 	test.exclude "*TestResources"
     package :jar
   end

Modified: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java (original)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java Thu Jun  5 14:14:08 2008
@@ -3,6 +3,7 @@
 /**
  * Tests that a fault thrown by a called service can be caught and is properly
  * structured so that an assign on a fault sub-element will succeed.
+ *
  * @author Matthieu Riou <mr...@apache.org>
  */
 public class ServiceFaultCatchTest extends Axis2TestBase {

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java Thu Jun  5 14:14:08 2008
@@ -78,7 +78,7 @@
             throw new ContextException("Cannot find definition for service " + initialPartnerEndpoint.serviceName
                                        + " in the context of process "+processId);
         }
-        return _server.createExternalService(wsdl, initialPartnerEndpoint.serviceName, initialPartnerEndpoint.portName, pconf);
+        return _server.createExternalService(pconf, initialPartnerEndpoint.serviceName, initialPartnerEndpoint.portName);
     }
 
 }

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=663741&r1=663740&r2=663741&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 Thu Jun  5 14:14:08 2008
@@ -302,7 +302,7 @@
     public ODEService createService(ProcessConf pconf, QName serviceName, String portName) throws AxisFault {
         destroyService(serviceName, portName);
         AxisService axisService = ODEAxisService.createService(_axisConfig, pconf, serviceName, portName);
-        ODEService odeService = new ODEService(axisService, pconf.getDefinitionForService(serviceName), serviceName, portName, _server);
+        ODEService odeService = new ODEService(axisService, pconf, serviceName, portName, _server);
 
         _services.put(serviceName, portName, odeService);
 
@@ -318,15 +318,16 @@
         return odeService;
     }
 
-    public ExternalService createExternalService(Definition def, QName serviceName, String portName, ProcessConf pconf) throws ContextException {
+    public ExternalService createExternalService(ProcessConf pconf, QName serviceName, String portName) throws ContextException {
         ExternalService extService = (ExternalService) _externalServices.get(serviceName);
         if (extService != null)
             return extService;
 
+	Definition def = pconf.getDefinitionForService(serviceName);
         try {
              if (WsdlUtils.useHTTPBinding(def, serviceName, portName)) {
                  if(__log.isDebugEnabled())__log.debug("Creating HTTP-bound external service " + serviceName);
-                 extService = new HttpExternalService(def, serviceName, portName, _server);
+                 extService = new HttpExternalService(pconf, serviceName, portName, _server);
              } else if (WsdlUtils.useSOAPBinding(def, serviceName, portName)) {
                  if(__log.isDebugEnabled())__log.debug("Creating SOAP-bound external service " + serviceName);
                  extService = new SoapExternalService(def, serviceName, portName, _axisConfig, pconf);

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java Thu Jun  5 14:14:08 2008
@@ -45,6 +45,7 @@
 import org.apache.ode.bpel.iapi.Message;
 import org.apache.ode.bpel.iapi.MessageExchange;
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.GUID;
 import org.apache.ode.utils.Namespaces;
@@ -59,24 +60,25 @@
 public class ODEService {
 
     private static final Log __log = LogFactory.getLog(ODEService.class);
-    public static final int TIMEOUT = 2 * 60 * 1000;
 
     private AxisService _axisService;
     private BpelServer _server;
+    private ProcessConf _pconf;
     private Definition _wsdlDef;
     private QName _serviceName;
     private String _portName;
     private WSAEndpoint _serviceRef;
     private SoapMessageConverter _converter;
 
-    public ODEService(AxisService axisService, Definition def, QName serviceName, String portName, BpelServer server) throws AxisFault {
+    public ODEService(AxisService axisService, ProcessConf pconf, QName serviceName, String portName, BpelServer server) throws AxisFault {
         _axisService = axisService;
         _server = server;
-        _wsdlDef = def;
         _serviceName = serviceName;
+	_pconf = pconf;
+	_wsdlDef = pconf.getDefinitionForService(serviceName);
         _portName = portName;
         _serviceRef = EndpointFactory.convertToWSA(createServiceRef(genEPRfromWSDL(_wsdlDef, serviceName, portName)));
-        _converter = new SoapMessageConverter(def, serviceName, portName);
+        _converter = new SoapMessageConverter(_wsdlDef, serviceName, portName);
     }
 
     public void onAxisMessageExchange(MessageContext msgContext, MessageContext outMsgContext, SOAPFactory soapFactory)
@@ -107,7 +109,7 @@
             }
 
             odeMex.setRequest(odeRequest);
-            // odeMex.setTimeout(TIMEOUT);
+            odeMex.setTimeout(resolveTimeout());
             try {
                 odeMex.invokeBlocking();
             } catch (java.util.concurrent.TimeoutException te) {
@@ -146,6 +148,21 @@
         return result;
     }
 
+    /**
+     * do not store the value so it can be dynamically updated
+     */
+    private long resolveTimeout() {
+        String timeout = _pconf.getProperties(_serviceName.getLocalPart(), _portName).get(Properties.PROP_MEX_TIMEOUT);
+        if (timeout != null) {
+            try {
+                return Long.parseLong(timeout);
+            } catch (NumberFormatException e) {
+                if(__log.isWarnEnabled()) __log.warn("Mal-formatted Property: ["+ Properties.PROP_MEX_TIMEOUT+"="+timeout+"] Default value ("+Properties.DEFAULT_MEX_TIMEOUT+") will be used");
+            }
+        }
+        return Properties.DEFAULT_MEX_TIMEOUT;
+    }
+
     private void onResponse(MyRoleMessageExchange mex, MessageContext msgContext) throws AxisFault {
         switch (mex.getAckType()) {
             case FAULT:
@@ -209,7 +226,7 @@
         // The callback endpoint is going to be the same as the target
         // endpoint in this case, except that it is updated with session
         // information (if available).
-        if (odeMex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID)!= null) {
+        if (odeMex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID) != null) {
             _serviceRef.setSessionId(odeMex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID));
             msgContext.setProperty("callbackSessionEndpoint", _serviceRef);
         }

Added: 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=663741&view=auto
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java (added)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Properties.java Thu Jun  5 14:14:08 2008
@@ -0,0 +1,247 @@
+/*
+ * 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 org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.commons.httpclient.Header;
+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.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;
+
+/**
+ * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
+ */
+public class Properties {
+
+    /**
+     * Property used to define how long (in miiliseconds) the message will wait for a response. Default value is {@link #DEFAULT_MEX_TIMEOUT}
+     */
+    public static final String PROP_MEX_TIMEOUT = "mex.timeout";
+    // its default value
+    public static final int DEFAULT_MEX_TIMEOUT = 2 * 60 * 1000;
+
+
+    public static final String PROP_HTTP_CONNECTION_TIMEOUT = HttpConnectionParams.CONNECTION_TIMEOUT;
+    public static final String PROP_HTTP_SOCKET_TIMEOUT = HttpMethodParams.SO_TIMEOUT;
+    public static final String PROP_HTTP_PROTOCOL_VERSION = HttpMethodParams.PROTOCOL_VERSION;
+    public static final String PROP_HTTP_HEADER_PREFIX = "http.default-headers.";
+    public static final String PROP_HTTP_PROXY_PREFIX = "http.proxy.";
+    public static final String PROP_HTTP_PROXY_HOST = PROP_HTTP_PROXY_PREFIX + "host";
+    public static final String PROP_HTTP_PROXY_PORT = PROP_HTTP_PROXY_PREFIX + "port";
+    public static final String PROP_HTTP_PROXY_DOMAIN = PROP_HTTP_PROXY_PREFIX + "domain";
+    public static final String PROP_HTTP_PROXY_USER = PROP_HTTP_PROXY_PREFIX + "user";
+    public static final String PROP_HTTP_PROXY_PASSWORD = PROP_HTTP_PROXY_PREFIX + "password";
+
+    // Httpclient specific
+    public static final String PROP_HTTP_MAX_REDIRECTS = HttpClientParams.MAX_REDIRECTS;
+
+    // Axis2-specific
+    public static final String PROP_HTTP_PROTOCOL_ENCODING = "http.protocol.encoding";
+    public static final String PROP_HTTP_REQUEST_CHUNK = "http.request.chunk";
+    public static final String PROP_HTTP_REQUEST_GZIP = "http.request.gzip";
+    public static final String PROP_HTTP_ACCEPT_GZIP = "http.accept.gzip";
+
+
+    protected static final Log log = LogFactory.getLog(Properties.class);
+
+    public static Object[] getProxyAndHeaders(Map<String, String> properties) {
+        ArrayList<Header> headers = null; // /!\ Axis2 requires an ArrayList (not a List implementation)
+        HttpTransportProperties.ProxyProperties proxy = null;
+        for (Map.Entry<String, String> e : properties.entrySet()) {
+            final String k = e.getKey();
+            final String v = e.getValue();
+            if (k.startsWith(PROP_HTTP_HEADER_PREFIX)) {
+                if (headers == null) headers = new ArrayList<Header>();
+                // extract the header name
+                String name = k.substring(PROP_HTTP_HEADER_PREFIX.length());
+                headers.add(new Header(name, v));
+            } else if (k.startsWith(PROP_HTTP_PROXY_PREFIX)) {
+                if (proxy == null) proxy = new HttpTransportProperties.ProxyProperties();
+
+                if (PROP_HTTP_PROXY_HOST.equals(k)) proxy.setProxyName(v);
+                else if (PROP_HTTP_PROXY_PORT.equals(k)) proxy.setProxyPort(Integer.parseInt(v));
+                else if (PROP_HTTP_PROXY_DOMAIN.equals(k)) proxy.setDomain(v);
+                else if (PROP_HTTP_PROXY_USER.equals(k)) proxy.setUserName(v);
+                else if (PROP_HTTP_PROXY_PASSWORD.equals(k)) proxy.setPassWord(v);
+                else if (log.isWarnEnabled())
+                    log.warn("Unknown proxy properties [" + k + "]. " + PROP_HTTP_PROXY_PREFIX + " is a refix reserved for proxy properties.");
+            }
+        }
+        if (proxy != null) {
+            String host = proxy.getProxyHostName();
+            if (host == null || host.length() == 0) {
+                // disable proxy if the host is not null
+                proxy=null;
+                if(log.isDebugEnabled()) log.debug("Proxy host is null. Proxy will not be taken into account.");
+            }
+        }
+
+        return new Object[]{proxy, headers};
+    }
+
+    public static class Axis2 {
+
+        public static Options translate(Map<String, String> properties) {
+            return translate(properties, new Options());
+        }
+
+        public static Options translate(Map<String, String> properties, Options options) {
+            if (log.isDebugEnabled()) log.debug("Translating IL Properties for Axis2");
+            if (properties.isEmpty()) return options;
+            if (properties.containsKey(PROP_HTTP_CONNECTION_TIMEOUT)) {
+                final String value = properties.get(PROP_HTTP_CONNECTION_TIMEOUT);
+                try {
+                    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, Integer.valueOf(value));
+                } catch (NumberFormatException e) {
+                    if (log.isWarnEnabled())
+                        log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_CONNECTION_TIMEOUT + "=" + value + "] Property will be skipped.");
+                }
+            }
+            if (properties.containsKey(PROP_HTTP_SOCKET_TIMEOUT)) {
+                final String value = properties.get(PROP_HTTP_SOCKET_TIMEOUT);
+                try {
+                    options.setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf(value));
+                } catch (NumberFormatException e) {
+                    if (log.isWarnEnabled())
+                        log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_SOCKET_TIMEOUT + "=" + value + "] Property will be skipped.");
+                }
+            }
+            if (properties.containsKey(PROP_HTTP_PROTOCOL_ENCODING)) {
+                options.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, properties.get(PROP_HTTP_PROTOCOL_ENCODING));
+            }
+            if (properties.containsKey(PROP_HTTP_PROTOCOL_VERSION)) {
+                options.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, properties.get(PROP_HTTP_PROTOCOL_VERSION));
+            }
+            if (properties.containsKey(PROP_HTTP_REQUEST_CHUNK)) {
+                options.setProperty(HTTPConstants.CHUNKED, properties.get(PROP_HTTP_REQUEST_CHUNK));
+            }
+            if (properties.containsKey(PROP_HTTP_REQUEST_GZIP)) {
+                options.setProperty(HTTPConstants.MC_GZIP_REQUEST, properties.get(PROP_HTTP_REQUEST_GZIP));
+            }
+            if (properties.containsKey(PROP_HTTP_ACCEPT_GZIP)) {
+                options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, properties.get(PROP_HTTP_ACCEPT_GZIP));
+            }
+            if (properties.containsKey(PROP_HTTP_MAX_REDIRECTS)) {
+                if (log.isWarnEnabled()) log.warn("Property Not Supported: " + PROP_HTTP_MAX_REDIRECTS);
+            }
+
+            // iterate through the properties to get Headers & Proxy information
+            Object[] o = getProxyAndHeaders(properties);
+            HttpTransportProperties.ProxyProperties proxy = (HttpTransportProperties.ProxyProperties) o[0];
+            ArrayList<Header> headers = (ArrayList<Header>) o[1]; // /!\ Axis2 requires an ArrayList (not a List implementation)
+            if (headers != null && !headers.isEmpty()) options.setProperty(HTTPConstants.HTTP_HEADERS, headers);
+            if (proxy != null) options.setProperty(HTTPConstants.PROXY, proxy);
+
+            return options;
+        }
+    }
+
+
+    public static class HttpClient {
+        public static HttpParams translate(Map<String, String> properties) {
+            return translate(properties, new DefaultHttpParams());
+        }
+
+        public static HttpParams translate(Map<String, String> properties, HttpParams p) {
+            if (log.isDebugEnabled()) log.debug("Translating IL Properties for HttpClient. Properties size="+properties.size());
+            if (properties.isEmpty()) return p;
+
+            // initialize the collection of headers
+            p.setParameter(HostParams.DEFAULT_HEADERS, new ArrayList());
+
+            if (properties.containsKey(PROP_HTTP_CONNECTION_TIMEOUT)) {
+                final String value = properties.get(PROP_HTTP_CONNECTION_TIMEOUT);
+                try {
+                    p.setParameter(HttpConnectionParams.CONNECTION_TIMEOUT, Integer.valueOf(value));
+                } catch (NumberFormatException e) {
+                    if (log.isWarnEnabled())
+                        log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_CONNECTION_TIMEOUT + "=" + value + "] Property will be skipped.");
+                }
+            }
+            if (properties.containsKey(PROP_HTTP_SOCKET_TIMEOUT)) {
+                final String value = properties.get(PROP_HTTP_SOCKET_TIMEOUT);
+                try {
+                    p.setParameter(HttpMethodParams.SO_TIMEOUT, Integer.valueOf(value));
+                } catch (NumberFormatException e) {
+                    if (log.isWarnEnabled())
+                        log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_SOCKET_TIMEOUT + "=" + value + "] Property will be skipped.");
+                }
+            }
+            if (properties.containsKey(PROP_HTTP_PROTOCOL_ENCODING)) {
+                p.setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, properties.get(PROP_HTTP_PROTOCOL_ENCODING));
+            }
+            if (properties.containsKey(PROP_HTTP_PROTOCOL_VERSION)) {
+                try {
+                    p.setParameter(HttpMethodParams.PROTOCOL_VERSION, HttpVersion.parse(properties.get(PROP_HTTP_PROTOCOL_VERSION)));
+                } catch (ProtocolException e) {
+                    if (log.isWarnEnabled())
+                        log.warn("Mal-formatted Property: [" + PROP_HTTP_PROTOCOL_VERSION + "]", e);
+                }
+            }
+            if (properties.containsKey(PROP_HTTP_REQUEST_CHUNK)) {
+                // see org.apache.commons.httpclient.methods.EntityEnclosingMethod.setContentChunked()
+                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: " + PROP_HTTP_REQUEST_GZIP);
+            }
+
+            if (Boolean.parseBoolean(properties.get(PROP_HTTP_ACCEPT_GZIP))) {
+                // append gzip to the list of accepted encoding
+                ((Collection) p.getParameter(HostParams.DEFAULT_HEADERS)).add(new Header("Accept-Encoding", "gzip"));
+            }
+
+            if (properties.containsKey(PROP_HTTP_MAX_REDIRECTS)) {
+                final String value = properties.get(PROP_HTTP_MAX_REDIRECTS);
+                try {
+                    p.setParameter(HttpClientParams.MAX_REDIRECTS, Integer.valueOf(value));
+                } catch (NumberFormatException e) {
+                    if (log.isWarnEnabled())
+                        log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_MAX_REDIRECTS + "=" + value + "] Property will be skipped.");
+                }
+            }
+
+            Object[] o = getProxyAndHeaders(properties);
+            HttpTransportProperties.ProxyProperties proxy = (HttpTransportProperties.ProxyProperties) o[0];
+            Collection headers = (Collection) o[1];
+            if (headers != null && !headers.isEmpty())
+                ((Collection) p.getParameter(HostParams.DEFAULT_HEADERS)).addAll(headers);
+            if (proxy != null) p.setParameter(PROP_HTTP_PROXY_PREFIX, proxy);
+
+            return p;
+        }
+
+    }
+}

Copied: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java (from r663708, ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java)
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java?p2=ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java&p1=ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java&r1=663708&r2=663741&rev=663741&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilder.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpClientHelper.java Thu Jun  5 14:14:08 2008
@@ -19,65 +19,72 @@
 
 package org.apache.ode.axis2.httpbinding;
 
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
 import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
 import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
 import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+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.HttpParams;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ode.axis2.Properties;
+import org.apache.ode.axis2.util.URLEncodedTransformer;
+import org.apache.ode.axis2.util.UrlReplacementTransformer;
 import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
-import org.apache.ode.il.epr.MutableEndpoint;
 import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.Namespaces;
-import org.apache.ode.utils.stl.CollectionsX;
-import org.apache.ode.utils.wsdl.*;
 import org.apache.ode.utils.wsdl.Messages;
-import org.apache.ode.axis2.util.UrlReplacementTransformer;
-import org.apache.ode.axis2.util.URLEncodedTransformer;
+import org.apache.ode.utils.wsdl.WsdlUtils;
+import org.apache.ode.il.epr.MutableEndpoint;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
-import javax.wsdl.Operation;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
 import javax.wsdl.BindingOperation;
 import javax.wsdl.Message;
+import javax.wsdl.Operation;
 import javax.wsdl.Part;
-import javax.wsdl.BindingInput;
-import javax.wsdl.Binding;
 import javax.wsdl.extensions.http.HTTPOperation;
-import javax.wsdl.extensions.http.HTTPBinding;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
 import javax.xml.namespace.QName;
 import java.io.UnsupportedEncodingException;
-import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Collection;
-
-import com.ibm.wsdl.PartImpl;
-import com.ibm.wsdl.util.StringUtils;
+import java.util.Map;
 
-/**
- * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
- */
-public class HttpMethodBuilder {
+public class HttpClientHelper {
 
     private static final String CONTENT_TYPE_TEXT_XML = "text/xml";
-    private static final Log log = LogFactory.getLog(HttpMethodBuilder.class);
+    private static final Log log = LogFactory.getLog(HttpClientHelper.class);
 
     protected static final org.apache.ode.utils.wsdl.Messages msgs = Messages.getMessages(Messages.class);
     protected Binding binding;
 
-    public HttpMethodBuilder(Binding binding) {
+    public HttpClientHelper(Binding binding) {
         this.binding = binding;
     }
 
+    public void configure(HostConfiguration hostConfig, HttpState state, URI targetURI, HttpParams params) throws URIException {
+        if (log.isDebugEnabled()) log.debug("Configuring http client...");
+        // 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));
+        }
+
+        // security
+        // ...
 
-    public HttpMethod buildHttpMethod(PartnerRoleMessageExchange odeMex) throws UnsupportedEncodingException {
+    }
+
+    public HttpMethod buildHttpMethod(PartnerRoleMessageExchange odeMex, HttpParams params) throws UnsupportedEncodingException {
         Operation operation = odeMex.getOperation();
         BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(), operation.getInput().getName(), operation.getOutput().getName());
 
@@ -96,7 +103,7 @@
         String verb = WsdlUtils.resolveVerb(binding, bindingOperation);
 
         // build the http method itself
-        HttpMethod method = prepareHttpMethod(bindingOperation, verb, partElements, url);
+        HttpMethod method = prepareHttpMethod(bindingOperation, verb, partElements, url, params);
         return method;
     }
 
@@ -112,7 +119,15 @@
         return partValues;
     }
 
-    protected HttpMethod prepareHttpMethod(BindingOperation bindingOperation, String verb, Map<String, Element> partValues, final String rootUri) throws UnsupportedEncodingException {
+    /**
+     * create and initialize the http method.
+     * Http Headers that may been passed in the params are not set in this method.
+     * Headers will be automatically set by HttpClient.
+     * See usages of HostParams.DEFAULT_HEADERS
+     * See org.apache.commons.httpclient.HttpMethodDirector#executeMethod(org.apache.commons.httpclient.HttpMethod)
+     */
+    protected HttpMethod prepareHttpMethod(BindingOperation bindingOperation, String verb, Map<String, Element> partValues,
+                                           final String rootUri, HttpParams params) throws UnsupportedEncodingException {
         if (log.isDebugEnabled()) log.debug("Preparing http request...");
         // convenience variables...
         BindingInput bindingInput = bindingOperation.getBindingInput();
@@ -154,7 +169,6 @@
             } else if ("DELETE".equalsIgnoreCase(verb)) {
                 method = new DeleteMethod();
             }
-
             if (useUrlEncoded) {
                 queryPath = encodedParams;
             }
@@ -173,7 +187,7 @@
 
             // some body-building...
             if (useUrlEncoded) {
-                requestEntity = new StringRequestEntity(encodedParams, PostMethod.FORM_URL_ENCODED_CONTENT_TYPE, "UTF-8");
+                requestEntity = new StringRequestEntity(encodedParams, PostMethod.FORM_URL_ENCODED_CONTENT_TYPE, method.getParams().getContentCharset());
             } else if (contentType.endsWith(CONTENT_TYPE_TEXT_XML)) {
                 // assumption is made that there is a single part
                 // validation steps in the constructor must warranty that
@@ -191,14 +205,18 @@
             }
 
             // cast safely, PUT and POST are subclasses of EntityEnclosingMethod
-            ((EntityEnclosingMethod) method).setRequestEntity(requestEntity);
+            final EntityEnclosingMethod enclosingMethod = (EntityEnclosingMethod) method;
+            enclosingMethod.setRequestEntity(requestEntity);
+            enclosingMethod.setContentChunked(params.getBooleanParameter(Properties.PROP_HTTP_REQUEST_CHUNK, false));
 
         } else {
             // should not happen because of HttpBindingValidator, but never say never
             throw new IllegalArgumentException("Unsupported HTTP method: " + verb);
         }
 
-        // Settings common to all methods
+        // link params together
+        method.getParams().setDefaults(params);
+
         String completeUri = rootUri + (rootUri.endsWith("/") || relativeUri.startsWith("/") ? "" : "/") + relativeUri;
         method.setPath(completeUri); // assumes that the path is properly encoded (URL safe).
         method.setQueryString(queryPath);

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=663741&r1=663740&r2=663741&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 Thu Jun  5 14:14:08 2008
@@ -23,10 +23,12 @@
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.params.HttpParams;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.axis2.ExternalService;
 import org.apache.ode.axis2.ODEService;
+import org.apache.ode.axis2.Properties;
 import org.apache.ode.il.epr.EndpointFactory;
 import org.apache.ode.il.epr.WSAEndpoint;
 import org.apache.ode.bpel.iapi.BpelServer;
@@ -34,6 +36,7 @@
 import org.apache.ode.bpel.iapi.MessageExchange;
 import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
 import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.Namespaces;
 import org.apache.ode.utils.wsdl.Messages;
@@ -52,6 +55,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 
@@ -64,20 +68,23 @@
     private static final Log log = LogFactory.getLog(HttpExternalService.class);
     private static final Messages msgs = Messages.getMessages(Messages.class);
 
-    private MultiThreadedHttpConnectionManager connections = new MultiThreadedHttpConnectionManager();
+    private MultiThreadedHttpConnectionManager connections;
 
     protected BpelServer server;
+    protected ProcessConf pconf;
     protected QName serviceName;
     protected String portName;
 
-    protected HttpMethodBuilder methodBuilder;
+    protected HttpClientHelper clientHelper;    
     protected WSAEndpoint endpointReference;
 
-    public HttpExternalService(Definition definition, QName serviceName, String portName, BpelServer server) {
+    public HttpExternalService(ProcessConf pconf, QName serviceName, String portName, BpelServer server) {
         this.portName = portName;
         this.serviceName = serviceName;
         this.server = server;
 
+	this.pconf= pconf;
+	Definition definition = pconf.getDefinitionForService(serviceName);
         Service serviceDef = definition.getService(serviceName);
         if (serviceDef == null)
             throw new IllegalArgumentException(msgs.msgServiceDefinitionNotFound(serviceName));
@@ -101,7 +108,8 @@
             throw new IllegalArgumentException(msgs.msgPortDefinitionNotFound(serviceName, portName));
         endpointReference = EndpointFactory.convertToWSA(ODEService.createServiceRef(eprElmt));
 
-        methodBuilder = new HttpMethodBuilder(binding);
+        clientHelper = new HttpClientHelper(binding);
+        connections = new MultiThreadedHttpConnectionManager();
     }
 
     public String getPortName() {
@@ -123,20 +131,32 @@
     public void invoke(PartnerRoleMessageExchange odeMex) {
         if (log.isDebugEnabled()) log.debug("Preparing " + getClass().getSimpleName() + " invocation...");
         try {
+            // don't make this map a class attribute, so we always get the latest version
+            final Map<String, String> properties = pconf.getProperties(serviceName.getLocalPart(), portName);
+            final HttpParams params = Properties.HttpClient.translate(properties);
+
             // build the http method
-            final HttpMethod method = methodBuilder.buildHttpMethod(odeMex);
-            // this callable encapsulate the http method execution and the process of the response
+final HttpMethod method = clientHelper.buildHttpMethod(odeMex, params);
+
+            // create a client
+            HttpClient client = new HttpClient(connections);
+            // don't forget to wire params so that IL properties are passed around
+            client.getParams().setDefaults(params);
+
+            clientHelper.configure(client.getHostConfiguration(),client.getState(), method.getURI(),params);
+
+            // this callable encapsulates the http method execution and the process of the response 
             final Callable executionCallable;
 
             // execute it
             boolean isTwoWay = odeMex.getMessageExchangePattern() == org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE;
             if (isTwoWay) {
                 // two way
-                executionCallable = new HttpExternalService.TwoWayCallable(method, odeMex, odeMex.getOperation());
+                executionCallable = new HttpExternalService.TwoWayCallable(client, method, odeMex, odeMex.getOperation());
                 executionCallable.call();
             } else {
                 // one way, just execute and forget
-                executionCallable = new HttpExternalService.OneWayCallable(method, odeMex, odeMex.getOperation());
+                executionCallable = new HttpExternalService.OneWayCallable(client, method, odeMex, odeMex.getOperation());
                 executionCallable.call();
                 odeMex.replyOneWayOk();
             }
@@ -144,6 +164,10 @@
             String errmsg = "The HTTP encoding returned isn't supported " + odeMex;
             log.error(errmsg, e);
             odeMex.replyWithFailure(MessageExchange.FailureType.FORMAT_ERROR, errmsg, null);
+        } catch (URIException e) {
+            String errmsg = "Invalid URI " + odeMex;
+            log.error(errmsg, e);
+            odeMex.replyWithFailure(MessageExchange.FailureType.FORMAT_ERROR, errmsg, null);
         } catch (Exception e) {
             String errmsg = "Unknown HTTP call error for ODE mex " + odeMex;
             log.error(errmsg, e);
@@ -157,11 +181,13 @@
         HttpMethod method;
         PartnerRoleMessageExchange odeMex;
         Operation operation;
+	HttpClient client;
 
-        public OneWayCallable(HttpMethod method, PartnerRoleMessageExchange odeMex, Operation operation) {
+        public OneWayCallable(HttpClient client, HttpMethod method, PartnerRoleMessageExchange odeMex, Operation operation) {
             this.method = method;
             this.odeMex = odeMex;
             this.operation = operation;
+            this.client = client;
         }
 
         public Void call() {
@@ -213,8 +239,8 @@
     }
 
     private class TwoWayCallable extends OneWayCallable {
-        public TwoWayCallable(HttpMethod method, PartnerRoleMessageExchange odeMex, Operation operation) {
-            super(method, odeMex, operation);
+        public TwoWayCallable(HttpClient client, HttpMethod method, PartnerRoleMessageExchange odeMex, Operation operation) {
+            super(client, method, odeMex, operation);
         }
 
         public void processResponse(final int statusCode) {

Added: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/ProxyConf.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/ProxyConf.java?rev=663741&view=auto
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/ProxyConf.java (added)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/ProxyConf.java Thu Jun  5 14:14:08 2008
@@ -0,0 +1,109 @@
+/*
+ * 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.httpbinding;
+
+import org.apache.axis2.transport.http.HttpTransportProperties;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.NTCredentials;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.params.HttpParams;
+import org.apache.ode.axis2.Properties;
+
+
+/**
+ * The purpose of this class is to configure proxy for HttpClient.
+ */
+public class ProxyConf {
+
+
+    // these properties are java system properties
+    // see http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html
+    public static final String HTTP_PROXY_HOST = "http.proxyHost";
+    public static final String HTTP_PROXY_PORT = "http.proxyPort";
+    public static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
+
+    public static void configure(HostConfiguration hostConfig, HttpState state, HttpTransportProperties.ProxyProperties proxyProperties) {
+        String proxyHost = proxyProperties.getProxyHostName();
+        int proxyPort = proxyProperties.getProxyPort();
+
+        //Setting credentials
+        String userName = proxyProperties.getUserName();
+        String password = proxyProperties.getPassWord();
+        String domain = proxyProperties.getDomain();
+
+        Credentials proxyCred;
+        if (userName != null && password != null && domain != null) {
+            proxyCred = new NTCredentials(userName, password, proxyHost, domain);
+        } else if (userName != null) {
+            proxyCred = new UsernamePasswordCredentials(userName, password);
+        } else {
+            proxyCred = new UsernamePasswordCredentials("", "");
+        }
+
+        //Using Java Networking Properties
+        String host = System.getProperty(HTTP_PROXY_HOST);
+        if (host != null) {
+            proxyHost = host;
+            proxyCred = new UsernamePasswordCredentials("", "");
+        }
+        String port = System.getProperty(HTTP_PROXY_PORT);
+        if (port != null) {
+            proxyPort = Integer.parseInt(port);
+        }
+        state.setProxyCredentials(AuthScope.ANY, proxyCred);
+        hostConfig.setProxy(proxyHost, proxyPort);
+    }
+
+    /**
+     * @return true if a proxy is set in the params, or in the system property "http.proxyHost"
+     * and the host is not mentionnned in the system property "http.nonProxyHosts"  
+     * @see Properties#PROP_HTTP_PROXY_PREFIX
+     */
+    public static boolean isProxyEnabled(HttpParams params, String targetHost) throws URIException {
+        // from IL properties
+        boolean isSet = params.isParameterSet(Properties.PROP_HTTP_PROXY_PREFIX);
+        // from Java Networking Properties
+        isSet |= System.getProperty(HTTP_PROXY_HOST) != null;
+
+        boolean isNonProxyHost = isNonProxyHost(targetHost);
+        return isSet && !isNonProxyHost;
+    }
+
+    /**
+     *
+     * @return true if the targetHost is mentionned in the system properties "http.nonProxyHosts"
+     * @see http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html
+     */
+    public static boolean isNonProxyHost(String targetHost) {
+        String nonProxyHosts = System.getProperty(HTTP_NON_PROXY_HOSTS);
+        if (nonProxyHosts != null) {
+            String[] splitted = nonProxyHosts.split("\\|");
+            for (int i = 0; i < splitted.length; i++) {
+                if (targetHost.matches(splitted[i])) return true;
+            }
+        }
+        return false;
+    }
+}
+

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=663741&r1=663740&r2=663741&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 Thu Jun  5 14:14:08 2008
@@ -19,41 +19,48 @@
 
 package org.apache.ode.axis2.soapbinding;
 
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Operation;
-import javax.xml.namespace.QName;
-
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.deployment.ServiceBuilder;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.deployment.ServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.axis2.ExternalService;
 import org.apache.ode.axis2.ODEService;
-import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.axis2.Properties;
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MessageExchange;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
+import org.apache.ode.bpel.iapi.PartnerRoleChannel;
+import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
+import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.il.OMUtils;
 import org.apache.ode.il.epr.EndpointFactory;
 import org.apache.ode.il.epr.MutableEndpoint;
 import org.apache.ode.il.epr.WSAEndpoint;
+import org.apache.ode.utils.CollectionUtils;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.Namespaces;
+import org.apache.ode.utils.WatchDog;
 import org.apache.ode.utils.fs.FileWatchDog;
 import org.apache.ode.utils.uuid.UUID;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Operation;
+import javax.xml.namespace.QName;
 import java.io.File;
 import java.io.InputStream;
+import java.util.Map;
 
 /**
  * Acts as a service not provided by ODE. Used mainly for invocation as a way to maintain the WSDL decription of used services.
@@ -64,7 +71,10 @@
 
     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 Definition _definition;
     private QName _serviceName;
@@ -108,7 +118,7 @@
 
             CachedServiceClient cached = getCachedServiceClient();
 
-            final OperationClient operationClient = cached._client.createClient(isTwoWay ? ServiceClient.ANON_OUT_IN_OP
+            final OperationClient operationClient = cached.client.createClient(isTwoWay ? ServiceClient.ANON_OUT_IN_OP
                     : ServiceClient.ANON_OUT_ONLY_OP);
             operationClient.setOptions(options);
             operationClient.addMessageContext(mctx);
@@ -142,19 +152,29 @@
     }
 
     private CachedServiceClient getCachedServiceClient() throws AxisFault {
-        CachedServiceClient cached = _cachedClients.get();
-        if (cached == null) {
-            cached = new CachedServiceClient(new File(_pconf.getBaseURI().resolve(_serviceName.getLocalPart() + ".axis2")), EXPIRE_SERVICE_CLIENT);
-            _cachedClients.set(cached);
+        CachedServiceClient cachedServiceClient = _cachedClients.get();
+        if (cachedServiceClient == null) {
+            cachedServiceClient = new CachedServiceClient(new File(_pconf.getBaseURI().resolve(_serviceName.getLocalPart() + ".axis2")), EXPIRE_SERVICE_CLIENT);
+            _cachedClients.set(cachedServiceClient);
         }
         try {
             // call manually the check procedure
             // we dont want a dedicated thread for that
-            cached.checkAndConfigure();
-        } catch (Exception e) {
-            throw AxisFault.makeFault(e);
+            cachedServiceClient.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);
         }
-        return cached;
+        cachedOptions.check();
+
+        // apply the options to the service client
+        cachedServiceClient.client.setOptions(cachedOptions.options);
+        return cachedServiceClient;
     }
 
     /**
@@ -289,35 +309,39 @@
 
     /**
      * This class wraps a {@link org.apache.axis2.client.ServiceClient} and watches changes (deletions,creations,updates)
-     *  on a  Axis2 service config file named {service-name}.axis2.<p/>
+     * on a  Axis2 service config file named {service-name}.axis2.<p/>
      * The {@link org.apache.axis2.client.ServiceClient} instance is created from the main Axis2 config instance and
      * this service-specific config file.
      */
-    class CachedServiceClient extends FileWatchDog {
-        ServiceClient _client;
+    private class CachedServiceClient extends FileWatchDog {
+        ServiceClient client;
 
         protected CachedServiceClient(File file, long delay) {
             super(file, delay);
         }
 
-        protected boolean isInitialized() throws Exception {
-            return _client != null;
+        protected boolean isInitialized() {
+            return client != null;
         }
 
-        protected void init() throws Exception {
-            _client = new ServiceClient(new ConfigurationContext(_axisConfig), null);
+        protected void init() {
+            try {
+                client = new ServiceClient(new ConfigurationContext(_axisConfig), null);
+            } catch (AxisFault axisFault) {
+                throw new RuntimeException(axisFault);
+            }
         }
 
-        protected void doOnUpdate() throws Exception {
+        protected void doOnUpdate() {
             // axis2 service configuration
             // if the config file has been modified (i.e added or updated), re-create a ServiceClient
             // and load the new config.
-            init(); //reset the ServiceClient instance
+            init(); // create a new ServiceClient instance
             try {
                 InputStream ais = file.toURI().toURL().openStream();
                 if (ais != null) {
                     if (__log.isDebugEnabled()) __log.debug("Configuring service " + _serviceName + " using: " + file);
-                    ServiceBuilder builder = new ServiceBuilder(ais, new ConfigurationContext(_client.getAxisConfiguration()), _client.getAxisService());
+                    ServiceBuilder builder = new ServiceBuilder(ais, new ConfigurationContext(client.getAxisConfiguration()), client.getAxisService());
                     builder.populateService(builder.buildOM());
                 }
             } catch (Exception e) {
@@ -326,4 +350,51 @@
         }
     }
 
+    private class CachedOptions extends WatchDog<Map> {
+
+        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.getProperties(_serviceName.getLocalPart(), _portName);
+                }
+            });
+        }
+
+        protected boolean isInitialized() {
+            return options != null;
+        }
+
+        protected void init() {
+            options = new Options();
+        }
+
+        protected void doOnUpdate() {
+            init();
+            Map properties = _pconf.getProperties(_serviceName.getLocalPart(), _portName);
+            Properties.Axis2.translate(properties, options);
+
+            // set defaults values
+            options.setExceptionToBeThrownOnSOAPFault(false);
+
+            // this value does NOT override Properties.PROP_HTTP_CONNECTION_TIMEOUT
+            // nor Properties.PROP_HTTP_SOCKET_TIMEOUT.
+            // it will be applied only if the laters are not set.
+            options.setTimeOutInMilliSeconds(60000);
+        }
+    }
+
+
 }

Copied: ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpClientHelperTest.java (from r663708, ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java)
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpClientHelperTest.java?p2=ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpClientHelperTest.java&p1=ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java&r1=663708&r2=663741&rev=663741&view=diff
==============================================================================
--- ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpMethodBuilderTest.java (original)
+++ ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpClientHelperTest.java Thu Jun  5 14:14:08 2008
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.params.DefaultHttpParams;
 import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.ode.il.epr.MutableEndpoint;
@@ -48,15 +49,15 @@
 /**
  * @author <a href="mailto:midon@intalio.com">Alexis Midon</a>
  */
-public class HttpMethodBuilderTest extends TestCase {
+public class HttpClientHelperTest extends TestCase {
 
     protected Definition definition;
 
-    protected HttpMethodBuilder deliciousBuilder;
+    protected HttpClientHelper deliciousBuilder;
     protected Binding deliciousBinding;
     protected Port deliciousPort;
 
-    protected HttpMethodBuilder dummyBuilder;
+    protected HttpClientHelper dummyBuilder;
     protected Port dummyPort;
     protected Binding dummyBinding;
 
@@ -71,12 +72,12 @@
         Service deliciousService = definition.getService(new QName("http://ode/bpel/unit-test.wsdl", "DeliciousService"));
         deliciousPort = deliciousService.getPort("TagHttpPort");
         deliciousBinding = deliciousPort.getBinding();
-        deliciousBuilder = new HttpMethodBuilder(deliciousBinding);
+        deliciousBuilder = new HttpClientHelper(deliciousBinding);
 
         Service dummyService = definition.getService(new QName("http://ode/bpel/unit-test.wsdl", "DummyService"));
         dummyPort = dummyService.getPort("DummyServiceHttpport");
         dummyBinding = dummyPort.getBinding();
-        dummyBuilder = new HttpMethodBuilder(dummyBinding);
+        dummyBuilder = new HttpClientHelper(dummyBinding);
 
     }
 
@@ -97,7 +98,7 @@
         odeMex.op = deliciousBinding.getBindingOperation("getTag", null, null).getOperation();
         odeMex.req = new MockMessage(msgEl);
         odeMex.epr = new MockEPR(uri);
-        HttpMethod httpMethod = deliciousBuilder.buildHttpMethod(odeMex);
+        HttpMethod httpMethod = deliciousBuilder.buildHttpMethod(odeMex, new DefaultHttpParams());
 
 
         assertTrue("GET".equalsIgnoreCase(httpMethod.getName()));
@@ -118,7 +119,7 @@
         odeMex.req = new MockMessage(msgEl);
         odeMex.epr = new MockEPR(uri);
         try {
-            HttpMethod httpMethod = deliciousBuilder.buildHttpMethod(odeMex);
+            HttpMethod httpMethod = deliciousBuilder.buildHttpMethod(odeMex, new DefaultHttpParams());
             fail("IllegalArgumentException expected because message element is empty.");
         } catch (IllegalArgumentException e) {
             // expected behavior
@@ -144,7 +145,7 @@
         odeMex.op = dummyBinding.getBindingOperation("hello", null, null).getOperation();
         odeMex.req = new MockMessage(msgEl);
         odeMex.epr = new MockEPR(uri);
-        HttpMethod httpMethod = dummyBuilder.buildHttpMethod(odeMex);
+        HttpMethod httpMethod = dummyBuilder.buildHttpMethod(odeMex, new DefaultHttpParams());
         assertTrue("POST".equalsIgnoreCase(httpMethod.getName()));
         assertEquals("Generated URI does not match", expectedUri, httpMethod.getURI().toString());
 
@@ -345,6 +346,10 @@
             return 0;
         }
 
+        public void setTimeout(long timeout) {
+
+        }
+
         public AckType getAckType() {
             return null;
         }

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/CorrelationKey.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/CorrelationKey.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/CorrelationKey.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/CorrelationKey.java Thu Jun  5 14:14:08 2008
@@ -23,7 +23,7 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.apache.ode.utils.ArrayUtils;
+import org.apache.ode.utils.CollectionUtils;
 
 /**
  * <p>
@@ -173,7 +173,7 @@
         buf.append("setId=");
         buf.append(_csetId);
         buf.append(", values=");
-        buf.append(ArrayUtils.makeCollection(ArrayList.class, _keyValues));
+        buf.append(CollectionUtils.makeCollection(ArrayList.class, _keyValues));
         buf.append('}');
 
         return buf.toString();

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/Filter.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/Filter.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/Filter.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/Filter.java Thu Jun  5 14:14:08 2008
@@ -19,7 +19,7 @@
 
 package org.apache.ode.bpel.common;
 
-import org.apache.ode.utils.ArrayUtils;
+import org.apache.ode.utils.CollectionUtils;
 import org.apache.ode.utils.msg.MessageBundle;
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.UnaryFunction;
@@ -133,7 +133,7 @@
 
   private Collection<String> getFilterKeysStr() {
     return CollectionsX.transform(new ArrayList<String>(),
-        ArrayUtils.makeCollection(ArrayList.class , getFilterKeys()),
+        CollectionUtils.makeCollection(ArrayList.class , getFilterKeys()),
         new UnaryFunction<FKEY,String>() {
           public String apply(FKEY x) {
             return x.name();

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/BpelEvent.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/BpelEvent.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/BpelEvent.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/BpelEvent.java Thu Jun  5 14:14:08 2008
@@ -18,7 +18,7 @@
  */
 package org.apache.ode.bpel.evt;
 
-import org.apache.ode.utils.ArrayUtils;
+import org.apache.ode.utils.CollectionUtils;
 
 import java.io.Serializable;
 import java.lang.reflect.Method;
@@ -66,7 +66,7 @@
             if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) {
                 try {
                     String field = method.getName().substring(3);
-                    Object value = method.invoke(this, ArrayUtils.EMPTY_OBJECT_ARRAY);
+                    Object value = method.invoke(this, CollectionUtils.EMPTY_OBJECT_ARRAY);
                     if (value == null) {
                         continue;
                     }

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java Thu Jun  5 14:14:08 2008
@@ -118,6 +118,12 @@
      * @return
      */
     long getTimeout();
+
+    /**
+     * Set the time-out in ms
+     * @param timeout
+     */
+    void setTimeout(long timeout);
     
     /**
      * Get the name of the operation (WSDL 1.1) / message exchange (WSDL 1.2?).

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Thu Jun  5 14:14:08 2008
@@ -24,6 +24,7 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
@@ -103,7 +104,7 @@
      * Get the deployment properties. 
      * @return
      */
-    Map<QName, Node> getProperties();
+    Map<QName, Node> getDeploymentProperties();
 
     /**
      * Gets the name of the package into which the process is deployed.
@@ -141,5 +142,11 @@
     List<Element> getExtensionElement(QName qname);
 
     boolean isEventEnabled(List<String> scopeNames, BpelEvent.TYPE type);
-    
+
+    /**
+     * Must not return null values.
+     * @param path
+     * @return
+     */
+    public Map<String, String> getProperties(String... path);
 }

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java Thu Jun  5 14:14:08 2008
@@ -37,7 +37,7 @@
 import org.apache.ode.bpel.pmapi.ManagementException;
 import org.apache.ode.bpel.pmapi.ProcessingException;
 import org.apache.ode.bpel.runtime.breaks.BreakpointImpl;
-import org.apache.ode.utils.ArrayUtils;
+import org.apache.ode.utils.CollectionUtils;
 import org.apache.ode.utils.msg.MessageBundle;
 
 import javax.xml.namespace.QName;
@@ -102,7 +102,7 @@
     }
 
     void addGlobalBreakpoint(Breakpoint breakpoint) {
-        Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, _globalBreakPoints);
+        Collection<Breakpoint> c = CollectionUtils.makeCollection(ArrayList.class, _globalBreakPoints);
         c.add(breakpoint);
         _globalBreakPoints = c.toArray(new Breakpoint[c.size()]);
     }
@@ -112,7 +112,7 @@
         if (bpArr == null) {
             bpArr = new Breakpoint[] { breakpoint };
         } else {
-            Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, bpArr);
+            Collection<Breakpoint> c = CollectionUtils.makeCollection(ArrayList.class, bpArr);
             c.add(breakpoint);
             bpArr = c.toArray(new Breakpoint[c.size()]);
         }
@@ -120,7 +120,7 @@
     }
 
     void removeGlobalBreakpoint(Breakpoint breakpoint) {
-        Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, _globalBreakPoints);
+        Collection<Breakpoint> c = CollectionUtils.makeCollection(ArrayList.class, _globalBreakPoints);
         c.remove(breakpoint);
         _globalBreakPoints = c.toArray(new Breakpoint[c.size()]);
     }
@@ -128,7 +128,7 @@
     void removeBreakpoint(Long pid, Breakpoint breakpoint) {
         Breakpoint[] bpArr = _instanceBreakPoints.get(pid);
         if (bpArr != null) {
-            Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, bpArr);
+            Collection<Breakpoint> c = CollectionUtils.makeCollection(ArrayList.class, bpArr);
             c.remove(breakpoint);
             bpArr = c.toArray(new Breakpoint[c.size()]);
             if (bpArr.length == 0) {

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MessageExchangeImpl.java Thu Jun  5 14:14:08 2008
@@ -356,6 +356,10 @@
         return _timeout;
     }
 
+    public void setTimeout(long timeout) {
+        _timeout = timeout;
+    }
+
     public void release() {
         __log.debug("Releasing mex " + getMessageExchangeId());
         _changes.add(Change.RELEASE);

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java Thu Jun  5 14:14:08 2008
@@ -51,7 +51,7 @@
 import org.apache.ode.bpel.o.OProcess;
 import org.apache.ode.bpel.o.OScope;
 import org.apache.ode.bpel.runtime.InvalidProcessException;
-import org.apache.ode.utils.ArrayUtils;
+import org.apache.ode.utils.CollectionUtils;
 import org.apache.ode.utils.ObjectPrinter;
 import org.apache.ode.utils.msg.MessageBundle;
 import org.w3c.dom.Element;
@@ -145,7 +145,7 @@
             String mySessionId = mex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID);
             String partnerSessionId = mex.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
             if (__log.isDebugEnabled()) {
-                __log.debug("INPUTMSG: " + correlatorId + ": MSG RCVD keys=" + ArrayUtils.makeCollection(HashSet.class, keys)
+                __log.debug("INPUTMSG: " + correlatorId + ": MSG RCVD keys=" + CollectionUtils.makeCollection(HashSet.class, keys)
                         + " mySessionId=" + mySessionId + " partnerSessionId=" + partnerSessionId);
             }
 

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java Thu Jun  5 14:14:08 2008
@@ -739,7 +739,7 @@
 
         TProcessProperties properties = info.addNewProperties();
         if (custom.includeProcessProperties()) {
-            for (Map.Entry<QName, Node> propEntry : pconf.getProperties().entrySet()) {
+            for (Map.Entry<QName, Node> propEntry : pconf.getDeploymentProperties().entrySet()) {
                 TProcessProperties.Property tprocProp = properties.addNewProperty();
                 tprocProp.setName(new QName(propEntry.getKey().getNamespaceURI(), propEntry.getKey().getLocalPart()));
                 Node propNode = tprocProp.getDomNode();

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/intercept/ThrottlingInterceptor.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/intercept/ThrottlingInterceptor.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/intercept/ThrottlingInterceptor.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/intercept/ThrottlingInterceptor.java Thu Jun  5 14:14:08 2008
@@ -56,7 +56,7 @@
      * @return value of the property, or <code>null</code> if not set
      */
     private String getSimpleProperty(QName propertyName, InterceptorEvent ic) {
-        Map<QName, Node> props =  ic.getProcessConf().getProperties();
+        Map<QName, Node> props =  ic.getProcessConf().getDeploymentProperties();
         for (Map.Entry<QName, Node> prop : props.entrySet()) {
             if (prop.getKey().equals(propertyName))
                 return ((Text)prop.getValue()).getWholeText();

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/CorrelatorDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/CorrelatorDaoImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/CorrelatorDaoImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/CorrelatorDaoImpl.java Thu Jun  5 14:14:08 2008
@@ -25,7 +25,7 @@
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.MessageRouteDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
-import org.apache.ode.utils.ArrayUtils;
+import org.apache.ode.utils.CollectionUtils;
 
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -58,7 +58,7 @@
         }
         for (Iterator i = _messages.iterator(); i.hasNext();) {
             MsgQueueEntry mqe = (MsgQueueEntry)i.next();
-            Set<CorrelationKey> keyset = (Set<CorrelationKey>)ArrayUtils.makeCollection(HashSet.class, mqe.keys);
+            Set<CorrelationKey> keyset = (Set<CorrelationKey>) CollectionUtils.makeCollection(HashSet.class, mqe.keys);
             if ((key == null) || keyset.contains(key)) {
                 i.remove();
                 return mqe.message;
@@ -93,7 +93,7 @@
     public void enqueueMessage(MessageExchangeDAO mex, CorrelationKey[] keys) {
         if (__log.isDebugEnabled()) {
             __log.debug("enqueueProcessInvocation: data=" + mex + " keys="
-                    + ArrayUtils.makeCollection(ArrayList.class, keys));
+                    + CollectionUtils.makeCollection(ArrayList.class, keys));
         }
 
         MsgQueueEntry mqe = new MsgQueueEntry(mex, keys);

Modified: ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java (original)
+++ ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntimeTest.java Thu Jun  5 14:14:08 2008
@@ -154,7 +154,6 @@
         Expression exp = new Expression(e);
         return (OXPath20ExpressionBPEL20)_compiler.compileLValue(exp);
     }
-    
     public URI getBaseResourceURI() {
     	return null;
     }

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=663741&r1=663740&r2=663741&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 Thu Jun  5 14:14:08 2008
@@ -60,6 +60,8 @@
  */
 class DeploymentUnitDir  {
 
+    static final String IL_PROPERTIES_FILE = "integration-layer.properties";
+
     private static Log __log = LogFactory.getLog(DeploymentUnitDir.class);
 
     private String _name;
@@ -203,6 +205,10 @@
         return _duDirectory;
     }
 
+    public File getILPropertyFile(){
+        return new File(getDeployDir(), IL_PROPERTIES_FILE);
+    }
+
     public DeployDocument getDeploymentDescriptor() {
         if (_dd == null) {
             File ddLocation = new File(_duDirectory, "deploy.xml");

Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Thu Jun  5 14:14:08 2008
@@ -32,6 +32,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
@@ -52,6 +54,8 @@
 import org.apache.ode.bpel.iapi.ProcessState;
 import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
 import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.HierarchiedProperties;
+import org.apache.ode.utils.fs.FileWatchDog;
 import org.apache.ode.utils.msg.MessageBundle;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -69,7 +73,8 @@
 
     private final Date _deployDate;
     private final Map<QName, Node> _props;
-    private final HashMap<String, Endpoint> _partnerRoleInitialValues = new HashMap<String, Endpoint>();;
+    private final HashMap<String, Endpoint> _partnerRoleInitialValues = new HashMap<String, Endpoint>();
+
     private final HashMap<String, Endpoint> _myRoleEndpoints = new HashMap<String, Endpoint>();
     private final Map<String, Set<BpelEvent.TYPE>> _events = new HashMap<String, Set<BpelEvent.TYPE>>();
     private final ArrayList<String> _mexi = new ArrayList<String>();
@@ -83,6 +88,13 @@
     // cache the inMemory flag because XMLBeans objects are heavily synchronized (guarded by a coarse-grained lock)
     private volatile boolean _inMemory = false;
 
+    // provide the IL properties
+    private HierarchiedProperties _ilProperties;
+    // monitor the IL property file and reload it if necessary
+    private ILWatchDog _ilWatchDog;
+    private final ReadWriteLock ilPropertiesLock = new ReentrantReadWriteLock();
+
+
     ProcessConfImpl(QName pid, QName type, long version, DeploymentUnitDir du, TDeployment.Process pinfo, Date deployDate,
                     Map<QName, Node> props, ProcessState pstate) {
         _pid = pid;
@@ -94,7 +106,8 @@
         _state = pstate;
         _type = type;
         _inMemory = _pinfo.isSetInMemory() && _pinfo.getInMemory();
-
+        _ilWatchDog = new ILWatchDog();
+        
         initLinks();
         initMexInterceptors();
         initEventList();
@@ -159,7 +172,7 @@
         return _du.getName();
     }
 
-    public Map<QName, Node> getProperties() {
+    public Map<QName, Node> getDeploymentProperties() {
         return _props;
     }
 
@@ -184,7 +197,8 @@
             throw new ContextException("CBP record not found for type " + getType());
         try {
             String relative = getRelativePath(_du.getDeployDir(), cbpInfo.cbp).replaceAll("\\\\", "/");
-            if (!relative.endsWith(".cbp")) throw new ContextException("CBP file must end with .cbp suffix: " + cbpInfo.cbp);
+            if (!relative.endsWith(".cbp"))
+                throw new ContextException("CBP file must end with .cbp suffix: " + cbpInfo.cbp);
             relative = relative.replace(".cbp", ".bpel");
             File bpelFile = new File(_du.getDeployDir(), relative);
             if (!bpelFile.exists()) __log.warn("BPEL file does not exist: " + bpelFile);
@@ -193,9 +207,9 @@
             throw new ContextException("IOException in getBpelRelativePath: " + cbpInfo.cbp, e);
         }
     }
-    
+
     public URI getBaseURI() {
-    	return _du.getDeployDir().toURI();
+        return _du.getDeployDir().toURI();
     }
 
     public ProcessState getState() {
@@ -264,6 +278,7 @@
     public boolean isTransient() {
         return _inMemory;
     }
+
     public void setTransient(boolean t) {
         _pinfo.setInMemory(t);
         _inMemory = t;
@@ -271,13 +286,13 @@
 
     public boolean isEventEnabled(List<String> scopeNames, BpelEvent.TYPE type) {
         if (scopeNames != null) {
-        for (String scopeName : scopeNames) {
-            Set<BpelEvent.TYPE> evtSet = _events.get(scopeName);
-            if (evtSet != null) {
-                if (evtSet.contains(type)) return true;
+            for (String scopeName : scopeNames) {
+                Set<BpelEvent.TYPE> evtSet = _events.get(scopeName);
+                if (evtSet != null) {
+                    if (evtSet.contains(type)) return true;
+                }
             }
         }
-        }
         Set<BpelEvent.TYPE> evtSet = _events.get(null);
         if (evtSet != null) {
             // Default filtering at the process level for some event types
@@ -294,7 +309,7 @@
             for (BpelEvent.TYPE t : BpelEvent.TYPE.values()) {
                 if (!t.equals(BpelEvent.TYPE.scopeHandling)) all.add(t);
             }
-            _events.put(null,all);
+            _events.put(null, all);
             return;
         }
 
@@ -303,7 +318,7 @@
             HashSet<BpelEvent.TYPE> all = new HashSet<BpelEvent.TYPE>();
             for (BpelEvent.TYPE t : BpelEvent.TYPE.values())
                 all.add(t);
-            _events.put(null,all);
+            _events.put(null, all);
             return;
         }
 
@@ -332,7 +347,8 @@
     private String getRelativePath(File base, File path) throws IOException {
         String basePath = base.getCanonicalPath();
         String cbpPath = path.getCanonicalPath();
-        if (!cbpPath.startsWith(basePath)) throw new IOException("Invalid relative path: base="+base+" path="+path);
+        if (!cbpPath.startsWith(basePath))
+            throw new IOException("Invalid relative path: base=" + base + " path=" + path);
         String relative = cbpPath.substring(basePath.length());
         if (relative.startsWith(File.separator)) relative = relative.substring(1);
         return relative;
@@ -346,4 +362,77 @@
         }
     }
 
+    /**
+     *
+     * @param path only the 2 first elements would be interpreted as the service local name and port name. all others would be ignored.
+     * @return a map of properties.
+     */
+    public Map<String, String> getProperties(String... path) {
+        String service=null, port=null;
+        if(path.length>=1) service = path[0];
+        if(path.length>=2) port = path[1];
+        if(path.length>2) if(__log.isWarnEnabled()) __log.debug("Arguments with index>2 ignored!");
+
+        // update properties if necessary
+        // do it manually to save resources (instead of using a thread)
+        _ilWatchDog.check();
+        if (_ilProperties == null) {
+            return Collections.EMPTY_MAP;
+        } else {
+            // take a lock so we can have a consistent snapshot of the properties
+            ilPropertiesLock.readLock().lock();
+            try {
+                return _ilProperties.getProperties(service, port);
+            } finally {
+                ilPropertiesLock.readLock().unlock();
+            }
+        }
+    }
+
+    /**
+     * 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 ILWatchDog extends FileWatchDog {
+        public ILWatchDog() {
+            super(_du.getILPropertyFile());
+        }
+
+        protected void init() {
+            ilPropertiesLock.writeLock().lock();
+            try {
+                if (_ilProperties == null) {
+                    try {
+                        _ilProperties = new HierarchiedProperties(super.file);
+                    } catch (IOException e) {
+                        throw new ContextException("Integration-Layer Properties cannot be loaded!", e);
+                    }
+                } else {
+                    _ilProperties.clear();
+                }
+            } finally {
+                ilPropertiesLock.writeLock().unlock();
+            }
+        }
+
+        protected boolean isInitialized() {
+            return _ilProperties != null;
+        }
+
+        protected void doOnUpdate() {
+            ilPropertiesLock.writeLock().lock();
+            try {
+                init();
+                try {
+                    _ilProperties.loadFile();
+                } catch (IOException e) {
+                    throw new ContextException("Integration-Layer Properties cannot be loaded!", e);
+                }
+            } finally {
+                ilPropertiesLock.writeLock().unlock();
+            }
+        }
+    }
+
+
 }

Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?rev=663741&r1=663740&r2=663741&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Thu Jun  5 14:14:08 2008
@@ -261,7 +261,7 @@
                     try {
                         ProcessConfDAO newDao = dudao.createProcess(pc.getProcessId(), pc.getType(), pc.getVersion());
                         newDao.setState(pc.getState());
-                        for (Map.Entry<QName, Node> prop : pc.getProperties().entrySet()) {
+                        for (Map.Entry<QName, Node> prop : pc.getDeploymentProperties().entrySet()) {
                             newDao.setProperty(prop.getKey(), DOMUtils.domToString(prop.getValue()));
                         }
                         deployed.add(pc.getProcessId());

Added: ode/trunk/bpel-store/src/test/resources/integration-layer.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/resources/integration-layer.properties?rev=663741&view=auto
==============================================================================
--- ode/trunk/bpel-store/src/test/resources/integration-layer.properties (added)
+++ ode/trunk/bpel-store/src/test/resources/integration-layer.properties Thu Jun  5 14:14:08 2008
@@ -0,0 +1,55 @@
+# All properties follow this pattern:
+#  [servicename[.portname].ode.]property
+#
+# If service name is mentioned but port name omitted, the value will apply to all ports of the service.
+# If service name and port name are omitted, the value will apply to all services.
+
+# For instance:
+# Service-specific values
+# my-soap-service1.ode.http.connection.timeout=50000
+# my-http-service1.ode.http.protocol.max-redirects=40
+#
+# Port-specific values
+# my-http-service1.portA.ode.http.protocol.max-redirects=60
+
+
+# 3 minutes
+mex.timeout=180000
+
+# true/false
+http.request.chunk=true
+
+# HTTP/1.1 / HTTP/1.0
+http.protocol.version=HTTP/1.1
+
+# true/false
+# will not apply to http-bound services TBD
+http.request.gzip=false
+
+# true/false
+# Append gzip to the Accept-Encoding header
+http.accept.gzip=false
+
+http.protocol.encoding=UTF-8
+
+
+# You must define one property per header, prefixed with 'http.default-headers'
+# These values will override any values already set for a given header.
+http.default-headers.User-Agent=your-agent
+http.default-headers.foo=bar
+
+# timeout in milliseconds until a connection is etablished
+http.connection.timeout=40000
+# timeout in milliseconds for waiting for data
+http.socket.timeout=40000
+
+http.protocol.max-redirects=10
+
+# To disable proxy set the host to null
+http.proxy.host=myproxy.org
+http.proxy.port=8080
+http.proxy.domain=mydomain
+http.proxy.user=johndoe
+http.proxy.password=topsecret
+
+