[mule-scm] [mule] [15993] branches/mule-3.x-messaging: Merged revisions 15924,15927-15928,15930,15933-15934,15939-15943,15945-15950,15954-15958,15961,15963-15964,15966-15974,15976-15977,15979-15982,15984-15985,15991 via svnmerge from

View: New views
1 Messages — Rating Filter:   Alert me  

[mule-scm] [mule] [15993] branches/mule-3.x-messaging: Merged revisions 15924,15927-15928,15930,15933-15934,15939-15943,15945-15950,15954-15958,15961,15963-15964,15966-15974,15976-15977,15979-15982,15984-15985,15991 via svnmerge from

by dirk.olmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
[mule] [15993] branches/mule-3.x-messaging: Merged revisions 15924,15927-15928,15930,15933-15934,15939-15943,15945-15950,15954-15958,15961,15963-15964,15966-15974,15976-15977,15979-15982,15984-15985,15991 via svnmerge from
Revision
15993
Author
dirk.olmes
Date
2009-11-07 19:58:55 -0600 (Sat, 07 Nov 2009)

Log Message

Merged revisions 15924,15927-15928,15930,15933-15934,15939-15943,15945-15950,15954-15958,15961,15963-15964,15966-15974,15976-15977,15979-15982,15984-15985,15991 via svnmerge from 
https://svn.codehaus.org/mule/branches/mule-3.x

................
  r15924 | dirk.olmes | 2009-11-02 09:17:10 +0100 (Mon, 02 Nov 2009) | 16 lines
  
  Merged revisions 15923 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ................
    r15923 | dirk.olmes | 2009-11-02 09:11:02 +0100 (Mon, 02 Nov 2009) | 9 lines
    
    Merged revisions 15922 via svnmerge from 
    https://svn.codehaus.org/mule/branches/mule-2.1.x
    
    ........
      r15922 | dirk.olmes | 2009-11-02 09:06:40 +0100 (Mon, 02 Nov 2009) | 1 line
      
      MULE-4539 (DefaultMuleEventContext.sendEventAsync() - use injected ExecutorService)
    ........
  ................
................
  r15927 | dfeist | 2009-11-02 21:41:06 +0100 (Mon, 02 Nov 2009) | 1 line
  
  MULE-4555 Do not create connector scheduler in getScheduler method but rather in lifecycle method or dedicated createScheduler method
................
  r15928 | dfeist | 2009-11-02 22:16:46 +0100 (Mon, 02 Nov 2009) | 9 lines
  
  Merged revisions 15560 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15560 | dandiep | 2009-09-01 14:32:05 -0300 (Tue, 01 Sep 2009) | 1 line
    
    Ensure the ReversibleStaxInInterceptor runs after the StreamClosingInterceptor or streams won't get closed. Add a test for proxy stream closing so we never have proxy stream closing issues again.
  ........
................
  r15930 | dfeist | 2009-11-03 01:39:53 +0100 (Tue, 03 Nov 2009) | 31 lines
  
  Merged revisions 15892,15921 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ................
    r15892 | dfeist | 2009-10-27 10:49:02 -0200 (Tue, 27 Oct 2009) | 11 lines
    
    Merged revisions 15886 via svnmerge from 
    https://svn.codehaus.org/mule/branches/mule-2.1.x
    
    ........
      r15886 | dfeist | 2009-10-26 19:20:35 -0200 (Mon, 26 Oct 2009) | 3 lines
      
      MULE-4569 CXF transport depends on CONTEXT_STARTED notification to start protocol endpoints
      MULE-4570 CXFConnector never stops or cleans up the outer (CxfServiceComponent) service it creates when the service that uses it no longer exists
      MULE-4571 When using CXF it is possible that user service is stopped before CxfServiceComponent service and requests fail.
    ........
  ................
    r15921 | dfeist | 2009-10-31 19:02:39 -0200 (Sat, 31 Oct 2009) | 11 lines
    
    Merged revisions 15919 via svnmerge from 
    https://svn.codehaus.org/mule/branches/mule-2.1.x
    
    ........
      r15919 | dfeist | 2009-10-30 18:59:47 -0200 (Fri, 30 Oct 2009) | 3 lines
      
      MULE-4569 CXF transport depends on CONTEXT_STARTED notification to start protocol endpoints
      MULE-4570 CXFConnector never stops or cleans up the outer (CxfServiceComponent) service it creates when the service that uses it no longer exists
      MULE-4571 When using CXF it is possible that user service is stopped before CxfServiceComponent service and requests fail.
    ........
  ................
................
  r15933 | dfeist | 2009-11-03 03:20:58 +0100 (Tue, 03 Nov 2009) | 13 lines
  
  Merged revisions 15697,15753 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15697 | dfeist | 2009-09-15 16:20:43 -0300 (Tue, 15 Sep 2009) | 1 line
    
    Loosen up a bit, allow muleContext usage in subclasses
  ........
    r15753 | dfeist | 2009-09-22 17:50:39 -0300 (Tue, 22 Sep 2009) | 1 line
    
    MULE-4522 When creating a HttpResponse the content length should not be set if the transfer encoding is chunked
  ........
................
  r15934 | dfeist | 2009-11-03 03:34:45 +0100 (Tue, 03 Nov 2009) | 13 lines
  
  Merged revisions 15755-15756 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15755 | dfeist | 2009-09-22 19:10:17 -0300 (Tue, 22 Sep 2009) | 1 line
    
    MULE-4520 Dispatchers doSend() methods should return message with NullPayload rather than null
  ........
    r15756 | dfeist | 2009-09-22 21:35:47 -0300 (Tue, 22 Sep 2009) | 1 line
    
    MULE-4520 Dispatchers doSend() methods should return message with NullPayload rather than null
  ........
................
  r15939 | rossmason | 2009-11-03 12:25:38 +0100 (Tue, 03 Nov 2009) | 1 line
  
  Added support for making jobs stateful.  This has the benefit of making sure one job finishes before the next job starts.  We can revisit exposing the actual state, but I think Mule should handle this
................
  r15940 | rossmason | 2009-11-03 12:27:25 +0100 (Tue, 03 Nov 2009) | 1 line
  
  Added a "wireObject" flag that separates lifecycle from autowiring
................
  r15941 | dfeist | 2009-11-03 12:47:21 +0100 (Tue, 03 Nov 2009) | 12 lines
  
  Merged revisions 15755-15756 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x 
  
  ........ 
   r15755 | dfeist | 2009-09-22 19:10:17 -0300 (Tue, 22 Sep 2009) | 1 line 
     
   MULE-4520 Dispatchers doSend() methods should return message with NullPayload rather than null 
  ........ 
   r15756 | dfeist | 2009-09-22 21:35:47 -0300 (Tue, 22 Sep 2009) | 1 line 
  
   MULE-4520 Dispatchers doSend() methods should return message with NullPayload rather than null 
  ........ 
................
  r15942 | dfeist | 2009-11-03 13:39:34 +0100 (Tue, 03 Nov 2009) | 29 lines
  
  Merged revisions 15762-15763,15777,15863,15871,15884 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15762 | dfeist | 2009-09-23 15:39:04 -0300 (Wed, 23 Sep 2009) | 1 line
    
    MULE-4527 CXF Proxy fails when outbound responseTime>= inbound client->inbound responseTimeout
  ........
    r15763 | dfeist | 2009-09-23 15:40:21 -0300 (Wed, 23 Sep 2009) | 1 line
    
    MULE-4527 CXF Proxy fails when outbound responseTime>= inbound client->inbound responseTimeout
  ........
    r15777 | dfeist | 2009-09-28 16:15:19 -0300 (Mon, 28 Sep 2009) | 1 line
    
    MULE-4504 sxc module throws NullPointerException with namespaces
  ........
    r15863 | dfeist | 2009-10-22 10:38:32 -0200 (Thu, 22 Oct 2009) | 1 line
    
    MULE-4545 Ensure that JCA distribution externalizes serverId, clusterId etc for configuration in deployment descriptor
  ........
    r15871 | dfeist | 2009-10-23 16:48:55 -0200 (Fri, 23 Oct 2009) | 1 line
    
    Reduce polling log message to trace
  ........
    r15884 | dfeist | 2009-10-26 18:51:26 -0200 (Mon, 26 Oct 2009) | 1 line
    
    MULE-4573 Unable to stop or restart a service with Axis endpoints due to use of only one instance of AxisServiceComponent
  ........
................
  r15943 | dfeist | 2009-11-03 13:48:01 +0100 (Tue, 03 Nov 2009) | 49 lines
  
  Blocked revisions 15829,15834,15890-15891 via svnmerge
  
  ................
    r15829 | dfeist | 2009-10-14 17:12:21 -0300 (Wed, 14 Oct 2009) | 12 lines
    
    Blocked revisions 15754,15817 via svnmerge
    
    ........
      r15754 | dfeist | 2009-09-22 17:56:55 -0300 (Tue, 22 Sep 2009) | 1 line
      
      Merged r15753 from mule-2.2.x (MULE-4522 When creating a HttpResponse the content length should not be set if the transfer encoding is chunked)
    ........
      r15817 | dfeist | 2009-10-13 13:36:54 -0300 (Tue, 13 Oct 2009) | 1 line
      
      Manual merge of r15774 from 2.2.x (MULE-4531 Endpoints are reconnected for every message that is sent or dispatched)
    ........
  ................
    r15834 | dfeist | 2009-10-15 11:26:08 -0300 (Thu, 15 Oct 2009) | 8 lines
    
    Blocked revisions 15831 via svnmerge
    
    ........
      r15831 | dfeist | 2009-10-14 17:19:19 -0300 (Wed, 14 Oct 2009) | 1 line
      
      Back merge -r15777,15778 from 2.2.x for MULE-4504 sxc module throws NullPointerException with namespaces
    ........
  ................
    r15890 | dfeist | 2009-10-27 10:24:56 -0200 (Tue, 27 Oct 2009) | 8 lines
    
    Blocked revisions 15852 via svnmerge
    
    ........
      r15852 | dfeist | 2009-10-19 19:19:28 -0200 (Mon, 19 Oct 2009) | 1 line
      
      Uncomment test method commented out in error.
    ........
  ................
    r15891 | dfeist | 2009-10-27 10:44:31 -0200 (Tue, 27 Oct 2009) | 9 lines
    
    Recorded merge of revisions 15885 via svnmerge from 
    https://svn.codehaus.org/mule/branches/mule-2.1.x
    
    ........
      r15885 | dfeist | 2009-10-26 19:00:16 -0200 (Mon, 26 Oct 2009) | 1 line
      
      MULE-4573 Unable to stop or restart a service with Axis endpoints due to use of only one instance of AxisServiceComponent
    ........
  ................
................
  r15945 | dfeist | 2009-11-03 14:17:03 +0100 (Tue, 03 Nov 2009) | 9 lines
  
  Merged revisions 15889 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15889 | dfeist | 2009-10-27 10:18:13 -0200 (Tue, 27 Oct 2009) | 1 line
    
    MULE-4576 Improve RegistryBroker API to not require id's when adding and removing Registries
  ........
................
  r15946 | dfeist | 2009-11-03 14:46:00 +0100 (Tue, 03 Nov 2009) | 1 line
  
  Merged revisions 15889 via svnmerge from https://svn.codehaus.org/mule/branches/mule-2.2.x ........ r15889 | dfeist | 2009-10-27 10:18:13 -0200 (Tue, 27 Oct 2009) | 1 line MULE-4576 Improve RegistryBroker API to not require id's when adding and removing Registries ........
................
  r15947 | dfeist | 2009-11-03 15:10:58 +0100 (Tue, 03 Nov 2009) | 2 lines
  
  Fix for merge made in r15930 (Merged revisions 15892,15921 via svnmerge from https://svn.codehaus.org/mule/branches/mule-2.2.x)
................
  r15948 | dfeist | 2009-11-03 15:21:32 +0100 (Tue, 03 Nov 2009) | 36 lines
  
  Merged revisions 15853 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ................
    r15853 | dfeist | 2009-10-19 21:38:02 -0200 (Mon, 19 Oct 2009) | 29 lines
    
    Merged revisions 15843-15846,15850-15851 via svnmerge from 
    https://svn.codehaus.org/mule/branches/mule-2.1.x
    
    ........
      r15843 | dfeist | 2009-10-19 11:19:12 -0200 (Mon, 19 Oct 2009) | 1 line
      
      MULE-4559 ExceptionHelper apply.to property design is flawed and causes properties not to be found in certain circumstances.
    ........
      r15844 | dfeist | 2009-10-19 11:23:44 -0200 (Mon, 19 Oct 2009) | 1 line
      
      Additional security filter test case for CXF that covers:
    ........
      r15845 | dfeist | 2009-10-19 11:24:54 -0200 (Mon, 19 Oct 2009) | 1 line
      
      MULE-4559 ExceptionHelper apply.to property design is flawed and causes properties not to be found in certain circumstances.
    ........
      r15846 | dfeist | 2009-10-19 12:53:44 -0200 (Mon, 19 Oct 2009) | 1 line
      
      Enable the test method that was hiding MULE-4558 because it was disabled.  Also add keystores so that tests using HttpClient and Https run ok from maven.
    ........
      r15850 | dfeist | 2009-10-19 17:32:15 -0200 (Mon, 19 Oct 2009) | 1 line
      
      MULE-4556 Stream is closed too early when request message fails authorization
    ........
      r15851 | dfeist | 2009-10-19 17:37:23 -0200 (Mon, 19 Oct 2009) | 1 line
      
      MULE-4556 Stream is closed too early when request message fails authorization
    ........
  ................
................
  r15949 | dfeist | 2009-11-03 16:11:08 +0100 (Tue, 03 Nov 2009) | 1 line
  
  MULE-4561 Synchronous transports return request message rather than error when security exceptions occurs
................
  r15950 | dfeist | 2009-11-03 16:18:14 +0100 (Tue, 03 Nov 2009) | 1 line
  
  Fix broken test case broken after work on MULE-4576.  At least for now maintain the 'transient first, then last registry added' precedence rule.
................
  r15954 | dirk.olmes | 2009-11-03 18:56:48 +0100 (Tue, 03 Nov 2009) | 9 lines
  
  Merged revisions 15938 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15938 | dirk.olmes | 2009-11-03 12:05:25 +0100 (Tue, 03 Nov 2009) | 1 line
    
    Add more comments in the XML request document
  ........
................
  r15955 | dirk.olmes | 2009-11-03 19:15:30 +0100 (Tue, 03 Nov 2009) | 17 lines
  
  Merged revisions 15935-15937 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15935 | dirk.olmes | 2009-11-03 10:29:42 +0100 (Tue, 03 Nov 2009) | 1 line
    
    MULE-4549 (ReversibleXMLStreamReader chokes on comments with ClassCastException): another test that fails
  ........
    r15936 | dirk.olmes | 2009-11-03 11:18:14 +0100 (Tue, 03 Nov 2009) | 1 line
    
    MULE-4547 (XmlStreamReader to xml fails when contain comments)
  ........
    r15937 | dirk.olmes | 2009-11-03 11:19:13 +0100 (Tue, 03 Nov 2009) | 1 line
    
    fix the assertion in the test
  ........
................
  r15956 | dfeist | 2009-11-03 19:54:04 +0100 (Tue, 03 Nov 2009) | 1 line
  
  MULE-4561 Synchronous transports return request message rather than error when security exceptions occurs
................
  r15957 | dfeist | 2009-11-03 21:52:43 +0100 (Tue, 03 Nov 2009) | 1 line
  
  MULE-4561 Synchronous transports return request message rather than error when security exceptions occurs
................
  r15958 | dirk.olmes | 2009-11-04 02:51:22 +0100 (Wed, 04 Nov 2009) | 17 lines
  
  Merged revisions 15951-15953 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15951 | dirk.olmes | 2009-11-03 18:23:30 +0100 (Tue, 03 Nov 2009) | 1 line
    
    Cleanup, simplify by using JDK5 for loops
  ........
    r15952 | dirk.olmes | 2009-11-03 18:24:09 +0100 (Tue, 03 Nov 2009) | 1 line
    
    generics
  ........
    r15953 | dirk.olmes | 2009-11-03 18:24:47 +0100 (Tue, 03 Nov 2009) | 1 line
    
    checkstyle
  ........
................
  r15961 | dfeist | 2009-11-04 04:22:21 +0100 (Wed, 04 Nov 2009) | 16 lines
  
  Merged revisions 15960 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ................
    r15960 | dfeist | 2009-11-04 00:48:43 -0200 (Wed, 04 Nov 2009) | 9 lines
    
    Merged revisions 15959 via svnmerge from 
    https://svn.codehaus.org/mule/branches/mule-2.1.x
    
    ........
      r15959 | dfeist | 2009-11-04 00:38:49 -0200 (Wed, 04 Nov 2009) | 1 line
      
      MULE-4589 java.lang.IllegalStateException: Phase 'start' has already been executed
    ........
  ................
................
  r15963 | dirk.olmes | 2009-11-04 12:44:10 +0100 (Wed, 04 Nov 2009) | 13 lines
  
  Merged revisions 15944,15962 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15944 | dirk.olmes | 2009-11-03 13:49:41 +0100 (Tue, 03 Nov 2009) | 1 line
    
    Test case for sending quartz events to a persistent vm queue
  ........
    r15962 | dirk.olmes | 2009-11-04 12:20:52 +0100 (Wed, 04 Nov 2009) | 1 line
    
    EE-1702 (Quartz job and persistent VM queues cause NotSerializableException)
  ........
................
  r15964 | dirk.olmes | 2009-11-04 14:34:48 +0100 (Wed, 04 Nov 2009) | 2 lines
  
  fix the config files for 3.x
................
  r15966 | rossmason | 2009-11-05 00:25:23 +0100 (Thu, 05 Nov 2009) | 1 line
  
  Added a connector lifecycle test to assert that methods are being called correctly in the right order
................
  r15967 | rossmason | 2009-11-05 00:26:15 +0100 (Thu, 05 Nov 2009) | 1 line
  
  Make Http connecotr a little easier to extend
................
  r15968 | rossmason | 2009-11-05 00:26:38 +0100 (Thu, 05 Nov 2009) | 1 line
  
  split out the start method so that start doesn't get called twice, 1) once by the lifecycle manager once by the connect() method.
................
  r15969 | rossmason | 2009-11-05 00:26:57 +0100 (Thu, 05 Nov 2009) | 1 line
  
  extended the API so that parser could pass additional info when creating objects in Mule
................
  r15970 | rossmason | 2009-11-05 00:27:15 +0100 (Thu, 05 Nov 2009) | 1 line
  
  renamed ServiceScopt to ObjectScope since to the user they are creating objects not services
................
  r15971 | rossmason | 2009-11-05 00:27:54 +0100 (Thu, 05 Nov 2009) | 1 line
  
  makes sure transport transformers have a unique id
................
  r15972 | rossmason | 2009-11-05 00:28:41 +0100 (Thu, 05 Nov 2009) | 1 line
  
  Split Object Processor into two pahses ; inject and pre init, wher inject happens first. Inject is used by all object processors that inject values into objects
................
  r15973 | rossmason | 2009-11-05 00:29:04 +0100 (Thu, 05 Nov 2009) | 1 line
  
  upgraded commons-pool to 1.5.3
................
  r15974 | rossmason | 2009-11-05 00:30:38 +0100 (Thu, 05 Nov 2009) | 1 line
  
  update commons-pool to 1.5.3
................
  r15976 | dirk.olmes | 2009-11-05 02:57:25 +0100 (Thu, 05 Nov 2009) | 2 lines
  
  pom indentation fixes
................
  r15977 | dirk.olmes | 2009-11-05 03:00:43 +0100 (Thu, 05 Nov 2009) | 9 lines
  
  Merged revisions 15975 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15975 | dirk.olmes | 2009-11-05 02:24:52 +0100 (Thu, 05 Nov 2009) | 1 line
    
    MULE-4595 (ObjectToRemoteInvocationTransformer thrown NPE when log4j set at debug)
  ........
................
  r15979 | dirk.olmes | 2009-11-05 03:15:42 +0100 (Thu, 05 Nov 2009) | 9 lines
  
  Merged revisions 15978 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15978 | dirk.olmes | 2009-11-05 03:10:25 +0100 (Thu, 05 Nov 2009) | 1 line
    
    MULE-4577 (The logger on DefaultMuleEvent should be transient so that it will work with queue-profile persistent="true" with log4j < 1.2.12)
  ........
................
  r15980 | dirk.olmes | 2009-11-05 10:09:34 +0100 (Thu, 05 Nov 2009) | 2 lines
  
  fix the distribution whitelists
................
  r15981 | dirk.olmes | 2009-11-05 10:12:13 +0100 (Thu, 05 Nov 2009) | 2 lines
  
  we should get rid of the properties for version numbers wherever possible: this was introduced for the osgi bundles we created ourselves. Artifacts that come as osgi bundles per default should be managed without version name variable to reduce confusion
................
  r15982 | rossmason | 2009-11-05 17:10:18 +0100 (Thu, 05 Nov 2009) | 1 line
  
  MULE-4598. moved followRedirects to the endpoint since it only applies to outbound endpoints and wasn't exposed by the connector config
................
  r15984 | rossmason | 2009-11-06 01:12:55 +0100 (Fri, 06 Nov 2009) | 1 line
  
  Added a flag to synchronize calls to the component object, by default it is false
................
  r15985 | dirk.olmes | 2009-11-06 02:59:50 +0100 (Fri, 06 Nov 2009) | 9 lines
  
  Merged revisions 15983 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15983 | jwheeler | 2009-11-05 18:29:56 +0100 (Thu, 05 Nov 2009) | 1 line
    
    Updated annotations.
  ........
................
  r15991 | tcarlson | 2009-11-07 01:59:26 +0100 (Sat, 07 Nov 2009) | 9 lines
  
  Recorded merge of revisions 15990 via svnmerge from 
  https://svn.codehaus.org/mule/branches/mule-2.2.x
  
  ........
    r15990 | tcarlson | 2009-11-06 17:12:14 -0300 (Fri, 06 Nov 2009) | 1 line
    
    Fix for MULE-4104/EE-1605
  ........
................

Modified Paths

Added Paths

Removed Paths

Property Changed

  • branches/mule-3.x-messaging/

Diff

Property changes: branches/mule-3.x-messaging

Name: svnmerge-integrated
   - /branches/mule-3.x:1-15522,15524-15919
   + /branches/mule-3.x:1-15522,15524-15991

Modified: branches/mule-3.x-messaging/core/pom.xml (15992 => 15993)

--- branches/mule-3.x-messaging/core/pom.xml	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/pom.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -12,6 +12,7 @@
     <packaging>bundle</packaging>
     <name>Mule Core</name>
     <description>Mule server and core classes</description>
+
     <build>
         <plugins>
             <plugin>
@@ -28,17 +29,15 @@
         </plugins>
     </build>
 
+    <!--
+        group/artifact id only, version and exclusions are specified
+        via dependency management
+    -->
     <dependencies>
-
         <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils</artifactId>
         </dependency>
-
-        <!--
-            OTHERS. group/artifact id only, version and exclusions are specified
-            via dependency management
-        -->
         <dependency>
             <groupId>backport-util-concurrent</groupId>
             <artifactId>backport-util-concurrent</artifactId>
@@ -64,7 +63,6 @@
             <artifactId>commons-lang</artifactId>
         </dependency>
         <dependency>
-            <!-- OSGi-ready -->
             <groupId>commons-pool</groupId>
             <artifactId>commons-pool</artifactId>
         </dependency>
@@ -80,7 +78,6 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
         </dependency>
-
         <!--
             Bind log4j statically, but preserve the clogging API compatibility.
         -->
@@ -100,13 +97,11 @@
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
         </dependency>
-
         <dependency>
             <groupId>asm</groupId>
             <artifactId>asm</artifactId>
             <version>3.1</version>
         </dependency>
-
         <dependency>
             <groupId>asm</groupId>
             <artifactId>asm-commons</artifactId>

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/AbstractExceptionListener.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/AbstractExceptionListener.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/AbstractExceptionListener.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -81,6 +81,11 @@
 
     protected boolean enableNotifications = true;
 
+    /**
+     * A message to be returned to the caller as a result of this exception handling.
+     */
+    private MuleMessage returnMessage = null;
+    
     public void setMuleContext(MuleContext context)
     {
         this.muleContext = context;
@@ -598,4 +603,24 @@
      */
     public abstract void handleStandardException(Throwable e);
 
+    public MuleMessage getReturnMessage()
+    {
+        return returnMessage;
+    }
+
+    /**
+     * Set a message to be returned to the caller as a result of this exception handling.
+     */
+    public void setReturnMessage(MuleMessage returnMessage)
+    {
+        this.returnMessage = returnMessage;
+    }
+
+    /**
+     * Set a message to be returned to the caller as a result of this exception handling.
+     */
+    public void setReturnMessage(Object returnMessage)
+    {
+        this.returnMessage = new DefaultMuleMessage(returnMessage, RequestContext.getEvent().getMessage(), muleContext);
+    }
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleContext.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleContext.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleContext.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -160,7 +160,7 @@
     
     public synchronized void initialise() throws InitialisationException
     {
-        if (isInitialised())
+        if (lifecycleManager.getCurrentPhase().equals(Initialisable.PHASE_NAME))
         {
             return;
         }
@@ -204,30 +204,33 @@
 
     public synchronized void start() throws MuleException
     {
+        if (isStarted())
+        {
+            return;
+        }
+
         lifecycleManager.checkPhase(Startable.PHASE_NAME);
-        if (!isStarted())
+
+        if (getSecurityManager() == null)
         {
-            if (getSecurityManager() == null)
-            {
-                throw new MuleRuntimeException(CoreMessages.objectIsNull("securityManager"));
-            }
-            if (getQueueManager() == null)
-            {
-                throw new MuleRuntimeException(CoreMessages.objectIsNull("queueManager"));
-            }
+            throw new MuleRuntimeException(CoreMessages.objectIsNull("securityManager"));
+        }
+        if (getQueueManager() == null)
+        {
+            throw new MuleRuntimeException(CoreMessages.objectIsNull("queueManager"));
+        }
 
-            startDate = System.currentTimeMillis();
+        startDate = System.currentTimeMillis();
 
-            fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTING));
+        fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTING));
 
-            lifecycleManager.firePhase(this, Startable.PHASE_NAME);
+        lifecycleManager.firePhase(this, Startable.PHASE_NAME);
 
-            fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTED));
+        fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTED));
 
-            if (logger.isInfoEnabled())
-            {
-                logger.info(startupScreen.toString());
-            }
+        if (logger.isInfoEnabled())
+        {
+            logger.info(startupScreen.toString());
         }
     }
 
@@ -251,9 +254,10 @@
         {
             return;
         }
-             
+
+        lifecycleManager.checkPhase(Disposable.PHASE_NAME);
+        
         ServerNotificationManager notificationManager = getNotificationManager();
-        lifecycleManager.checkPhase(Disposable.PHASE_NAME);
         fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSING));
 
         try
@@ -615,18 +619,6 @@
         return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_THREADING_PROFILE);
     }
 
-    // TODO This should ideally only be available via an Admin interface
-    public void addRegistry(long id, Registry registry)
-    {
-        registryBroker.addRegistry(id, registry);
-    }
-
-    // TODO This should ideally only be available via an Admin interface
-    public void removeRegistry(long id)
-    {
-        registryBroker.removeRegistry(id);
-    }
-
     /**
      * Returns the long date when the server was started
      *
@@ -647,4 +639,14 @@
     {
         return expressionManager;
     }
+
+    public void addRegistry(Registry registry)
+    {
+        registryBroker.addRegistry(registry);
+    }
+
+    public void removeRegistry(Registry registry)
+    {
+        registryBroker.removeRegistry(registry);
+    }
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleEvent.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleEvent.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleEvent.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -63,10 +63,12 @@
      * Serial version
      */
     private static final long serialVersionUID = 1L;
+
     /**
      * logger used by this class
      */
-    protected Log logger = LogFactory.getLog(getClass());
+    protected transient Log logger = LogFactory.getLog(getClass());
+
     /**
      * The endpoint associated with the event
      */
@@ -612,6 +614,8 @@
 
     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException, MuleException
     {
+        logger = LogFactory.getLog(getClass());
+
         in.defaultReadObject();
         serializedData = new HashMap<String, Object>();
         serializedData.put("endpointHashcode", in.readInt());

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleEventContext.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleEventContext.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/DefaultMuleEventContext.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -285,7 +285,6 @@
         };
 
         FutureMessageResult result = new FutureMessageResult(callable, event.getMuleContext());
-        // TODO MULE-732: use injected ExecutorService
         result.execute();
         return result;
     }
@@ -320,7 +319,6 @@
         };
 
         FutureMessageResult result = new FutureMessageResult(callable, event.getMuleContext());
-        // TODO MULE-732: use injected ExecutorService
         result.execute();
         return result;
     }
@@ -357,7 +355,6 @@
         };
 
         FutureMessageResult result = new FutureMessageResult(callable, event.getMuleContext());
-        // TODO MULE-732: use injected ExecutorService
         result.execute();
         return result;
     }
@@ -396,7 +393,6 @@
         };
 
         FutureMessageResult result = new FutureMessageResult(callable, event.getMuleContext());
-        // TODO MULE-732: use injected ExecutorService
         result.execute();
         return result;
     }
@@ -650,6 +646,7 @@
         return event.getSession();
     }
 
+    @Override
     public String toString()
     {
         return event.toString();

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/api/MuleContext.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/api/MuleContext.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/api/MuleContext.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -191,11 +191,11 @@
     ThreadingProfile getDefaultThreadingProfile();
 
     // TODO This should ideally only be available via an Admin interface
-    void addRegistry(long id, Registry registry);
+    void addRegistry(Registry registry);
 
     // TODO This should ideally only be available via an Admin interface
-    void removeRegistry(long id);
-
+    void removeRegistry(Registry registry);
+    
     /**
      * Returns the date when the server was started.
      * @return the date when the server was started.

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/api/object/ObjectFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/api/object/ObjectFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/api/object/ObjectFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -47,6 +47,14 @@
      * instance.
      */
     boolean isExternallyManagedLifecycle();
+
+    /**
+     * Return true if the created object should get its dependencies wired from the registry automatically.  Typically
+     * Mule object factories would return true for this value, objects managed by DI container such as Spring should
+     * set this to false.
+     * @return
+     */
+    boolean isAutoWireObject();
     
     /**
      * Register a custom initialiser

Copied: branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/InjectProcessor.java (from rev 15991, branches/mule-3.x/core/src/main/java/org/mule/api/registry/InjectProcessor.java) (0 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/InjectProcessor.java	                        (rev 0)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/InjectProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,18 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.api.registry;
+
+/**
+ * An object processor that will get called during the inject phase
+ */
+public interface InjectProcessor extends ObjectProcessor
+{
+
+}

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/ObjectProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/ObjectProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/ObjectProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,9 +10,12 @@
 package org.mule.api.registry;
 
 /**
- * TODO
+ * The parent interface for all object processors. Object processors can be registered in the Mule regisrty and fired
+ * at the correct time.
+ *
+ * Developers must not implement this interface directly. Instead use either {@link org.mule.api.registry.InjectProcessor} or
+ * {@link org.mule.api.registry.PreInitProcessor}. 
  */
-
 public interface ObjectProcessor
 {
     Object process(Object object);

Copied: branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/PreInitProcessor.java (from rev 15991, branches/mule-3.x/core/src/main/java/org/mule/api/registry/PreInitProcessor.java) (0 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/PreInitProcessor.java	                        (rev 0)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/PreInitProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,17 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.api.registry;
+
+/**
+ * Fired after the inject phase but before the initialise lifecycle phase
+ */
+public interface PreInitProcessor extends ObjectProcessor
+{
+}

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/RegistryBroker.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/RegistryBroker.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/api/registry/RegistryBroker.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -15,9 +15,9 @@
  */
 public interface RegistryBroker extends Registry
 {
-    void addRegistry(long id, Registry registry);
+    void addRegistry(Registry registry);
 
-    void removeRegistry(long id);
+    void removeRegistry(Registry registry);
 }
 
 

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/component/AbstractJavaComponent.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/component/AbstractJavaComponent.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/component/AbstractJavaComponent.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -126,9 +126,9 @@
                 ((ServiceAware)object).setService(getService());
             }
             
-            if(!objectFactory.isExternallyManagedLifecycle())
+            if(objectFactory.isAutoWireObject())
             {
-                //Apply processors, object lifecycle is handled by this adapter
+                //Apply processors, these will inject dependencies
                 muleContext.getRegistry().applyProcessors(object);
             }
         }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/component/PooledJavaComponent.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/component/PooledJavaComponent.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/component/PooledJavaComponent.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -148,6 +148,11 @@
         {
             return objectFactory.isExternallyManagedLifecycle();
         }
+
+        public boolean isAutoWireObject()
+        {
+            return objectFactory.isAutoWireObject();
+        }
     }
 
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/config/DefaultMuleConfiguration.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/config/DefaultMuleConfiguration.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/config/DefaultMuleConfiguration.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -509,5 +509,79 @@
             this.shutdownTimeout = shutdownTimeout;
         }
     }
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (autoWrapMessageAwareTransform ? 1231 : 1237);
+        result = prime * result + (cacheMessageAsBytes ? 1231 : 1237);
+        result = prime * result + (cacheMessageOriginalPayload ? 1231 : 1237);
+        result = prime * result + (clientMode ? 1231 : 1237);
+        result = prime * result + ((clusterId == null) ? 0 : clusterId.hashCode());
+        result = prime * result + defaultQueueTimeout;
+        result = prime * result + defaultTransactionTimeout;
+        result = prime * result + ((domainId == null) ? 0 : domainId.hashCode());
+        result = prime * result + (enableStreaming ? 1231 : 1237);
+        result = prime * result + ((encoding == null) ? 0 : encoding.hashCode());
+        result = prime * result + ((id == null) ? 0 : id.hashCode());
+        result = prime * result + responseTimeout;
+        result = prime * result + shutdownTimeout;
+        result = prime * result + (synchronous ? 1231 : 1237);
+        result = prime * result + ((systemModelType == null) ? 0 : systemModelType.hashCode());
+        result = prime * result + ((workingDirectory == null) ? 0 : workingDirectory.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj) return true;
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
+        DefaultMuleConfiguration other = (DefaultMuleConfiguration) obj;
+        if (autoWrapMessageAwareTransform != other.autoWrapMessageAwareTransform) return false;
+        if (cacheMessageAsBytes != other.cacheMessageAsBytes) return false;
+        if (cacheMessageOriginalPayload != other.cacheMessageOriginalPayload) return false;
+        if (clientMode != other.clientMode) return false;
+        if (clusterId == null)
+        {
+            if (other.clusterId != null) return false;
+        }
+        else if (!clusterId.equals(other.clusterId)) return false;
+        if (defaultQueueTimeout != other.defaultQueueTimeout) return false;
+        if (defaultTransactionTimeout != other.defaultTransactionTimeout) return false;
+        if (domainId == null)
+        {
+            if (other.domainId != null) return false;
+        }
+        else if (!domainId.equals(other.domainId)) return false;
+        if (enableStreaming != other.enableStreaming) return false;
+        if (encoding == null)
+        {
+            if (other.encoding != null) return false;
+        }
+        else if (!encoding.equals(other.encoding)) return false;
+        if (id == null)
+        {
+            if (other.id != null) return false;
+        }
+        else if (!id.equals(other.id)) return false;
+        if (responseTimeout != other.responseTimeout) return false;
+        if (shutdownTimeout != other.shutdownTimeout) return false;
+        if (synchronous != other.synchronous) return false;
+        if (systemModelType == null)
+        {
+            if (other.systemModelType != null) return false;
+        }
+        else if (!systemModelType.equals(other.systemModelType)) return false;
+        if (workingDirectory == null)
+        {
+            if (other.workingDirectory != null) return false;
+        }
+        else if (!workingDirectory.equals(other.workingDirectory)) return false;
+        return true;
+    }
     
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/config/ExceptionHelper.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/config/ExceptionHelper.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/config/ExceptionHelper.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -17,7 +17,6 @@
 import org.mule.util.ClassUtils;
 import org.mule.util.MapUtils;
 import org.mule.util.SpiUtils;
-import org.mule.util.StringUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -50,12 +49,6 @@
     public static final String ERROR_CODE_PROPERTY = "error.code.property";
 
     /**
-     * a comma-separated list of other protocols the mappings in a file can be
-     * applied to
-     */
-    public static final String APPLY_TO_PROPERTY = "apply.to";
-
-    /**
      * logger used by this class
      */
     protected static final Log logger = LogFactory.getLog(ExceptionHelper.class);
@@ -212,15 +205,6 @@
             }
             
             errorMappings.put(protocol, p);
-            String applyTo = p.getProperty(APPLY_TO_PROPERTY, null);
-            if (applyTo != null)
-            {
-                String[] protocols = StringUtils.splitAndTrim(applyTo, ",");
-                for (int i = 0; i < protocols.length; i++)
-                {
-                    errorMappings.put(protocols[i], p);
-                }
-            }
             return p;
         }
     }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/context/notification/ServiceNotification.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/context/notification/ServiceNotification.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/context/notification/ServiceNotification.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,6 +10,7 @@
 
 package org.mule.context.notification;
 
+import org.mule.api.context.notification.BlockingServerEvent;
 import org.mule.api.context.notification.ServerNotification;
 import org.mule.api.service.Service;
 
@@ -18,7 +19,7 @@
  * starting occurs. The payload of this event will always be a reference to the
  * service.
  */
-public class ServiceNotification extends ServerNotification
+public class ServiceNotification extends ServerNotification implements BlockingServerEvent
 {
     /**
      * Serial version

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/lifecycle/GenericLifecycleManager.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/lifecycle/GenericLifecycleManager.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/lifecycle/GenericLifecycleManager.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -197,19 +197,16 @@
 
     public void checkPhase(String name) throws IllegalStateException
     {
-        if (completedPhases.contains(name))
-        {
-            throw new IllegalStateException("Phase '" + name + "' has already been executed");
-        }
-
-        if (name.equalsIgnoreCase(executingPhase))
-        {
-            throw new IllegalStateException("Phase '" + name + "' is already currently being executed");
-        }
-
         if (executingPhase != null)
         {
-            throw new IllegalStateException("Currently executing lifecycle phase: " + executingPhase);
+            if (name.equalsIgnoreCase(executingPhase))
+            {
+                throw new IllegalStateException("Phase '" + name + "' is already currently being executed");
+            }
+            else
+            {
+                throw new IllegalStateException("Currently executing lifecycle phase: " + executingPhase);
+            }
         }
 
         Integer phaseIndex = index.get(name);
@@ -217,13 +214,6 @@
         {
             throw new IllegalStateException("Phase does not exist: " + name);
         }
-        if (NotInLifecyclePhase.PHASE_NAME.equals(currentPhase))
-        {
-            if (phaseIndex > 0)
-            {
-                throw new IllegalStateException("The first lifecycle phase has to be called before the '" + name + "' phase");
-            }
-        }
         else
         {
             LifecyclePhase phase = (LifecyclePhase) lifecycles.get(phaseIndex);

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/lifecycle/phases/MuleContextInitialisePhase.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/lifecycle/phases/MuleContextInitialisePhase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/lifecycle/phases/MuleContextInitialisePhase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -22,5 +22,6 @@
     public MuleContextInitialisePhase()
     {
         super(Initialisable.PHASE_NAME, Initialisable.class, Disposable.PHASE_NAME);
+        registerSupportedPhase(NotInLifecyclePhase.PHASE_NAME);
     }
 }
\ No newline at end of file

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -22,7 +22,6 @@
 import java.lang.reflect.Method;
 
 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -41,6 +40,7 @@
 
     private boolean acceptVoidMethods = false;
 
+    private boolean synchronizeCall = false;
 
     // @GuardedBy(itself)
     protected final ConcurrentHashMap methodCache = new ConcurrentHashMap(4);
@@ -151,7 +151,20 @@
             logger.debug("Invoking " + methodCall);
         }
 
-        Object result = method.invoke(component, arguments);
+        Object result;
+
+        if(isSynchronizeCall())
+        {
+            synchronized (component)
+            {
+                result = method.invoke(component, arguments);
+            }
+        }
+        else
+        {
+            result = method.invoke(component, arguments);
+        }
+
         if (method.getReturnType().equals(Void.TYPE))
         {
             result = VoidResult.getInstance();
@@ -165,7 +178,16 @@
         return new InvocationResult(result, method);
     }
 
+    public boolean isSynchronizeCall()
+    {
+        return synchronizeCall;
+    }
 
+    public void setSynchronizeCall(boolean synchronizeCall)
+    {
+        this.synchronizeCall = synchronizeCall;
+    }
+
     public String toString()
     {
         final StringBuffer sb = new StringBuffer();

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/model/seda/SedaService.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/model/seda/SedaService.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/model/seda/SedaService.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,6 +10,7 @@
 
 package org.mule.model.seda;
 
+import org.mule.AbstractExceptionListener;
 import org.mule.DefaultMuleEvent;
 import org.mule.DefaultMuleMessage;
 import org.mule.FailedToQueueEventException;
@@ -272,10 +273,16 @@
             }
             if (result == null)
             {
-                // important that we pull event from request context here as it may
-                // have been modified
-                // (necessary to avoid scribbling between threads)
-                result = new DefaultMuleMessage(NullPayload.getInstance(), RequestContext.getEvent().getMessage(), muleContext);
+                if (exceptionListener != null 
+                    && exceptionListener instanceof AbstractExceptionListener 
+                    && ((AbstractExceptionListener) exceptionListener).getReturnMessage() != null)
+                {
+                    result = ((AbstractExceptionListener) exceptionListener).getReturnMessage();
+                }
+                else
+                {
+                    result = new DefaultMuleMessage(NullPayload.getInstance(), RequestContext.getEvent().getMessage(), muleContext);
+                }
             }
             ExceptionPayload exceptionPayload = result.getExceptionPayload();
             if (exceptionPayload == null)
@@ -420,9 +427,9 @@
         {
             throw new InitialisationException(MessageFactory.createStaticMessage("Queue not created for service " + name), this);
         }
-        if (logger.isDebugEnabled())
+        if (logger.isTraceEnabled())
         {
-            logger.debug(MessageFormat.format("Service {0} polling queue {1}, timeout = {2}", name, queue.getName(), queueTimeout));
+            logger.trace(MessageFormat.format("Service {0} polling queue {1}, timeout = {2}", name, queue.getName(), queueTimeout));
         }
         if (getQueueTimeout() == null)
         {

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/object/JndiObjectFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/object/JndiObjectFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/object/JndiObjectFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -214,4 +214,9 @@
     {
         return false;
     }
+
+    public boolean isAutoWireObject()
+    {
+        return true;
+    }
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/object/PrototypeObjectFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/object/PrototypeObjectFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/object/PrototypeObjectFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -44,4 +44,9 @@
         super(objectClass, properties);
     }
 
+    public boolean isAutoWireObject()
+    {
+        return true;
+    }
+
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/object/SingletonObjectFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/object/SingletonObjectFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/object/SingletonObjectFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -119,4 +119,8 @@
         return true;
     }
 
+    public boolean isAutoWireObject()
+    {
+        return true;
+    }
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/DefaultRegistryBroker.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/DefaultRegistryBroker.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/DefaultRegistryBroker.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -13,34 +13,19 @@
 import org.mule.api.MuleContext;
 import org.mule.api.registry.Registry;
 
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Comparator;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.List;
 
 public class DefaultRegistryBroker extends AbstractRegistryBroker
 {
     private TransientRegistry transientRegistry;
+    private List<Registry> registries = new ArrayList<Registry>();
 
-    private Map<Long, Registry> registries = new TreeMap<Long, Registry>(new Comparator<Long>(){
-        public int compare(Long o1, Long o2)
-        {
-            if(o1.longValue() < o2.longValue())
-            {
-                return -1;
-            }
-            else if(o1.longValue() > o2.longValue())
-            {
-                return 1;
-            }
-            return 0;
-        }
-    });
-
     public DefaultRegistryBroker(MuleContext context)
     {
         transientRegistry = new TransientRegistry(context);
-        addRegistry(-1, transientRegistry);
+        registries.add(0, new TransientRegistry(context));
     }
 
     TransientRegistry getTransientRegistry()
@@ -48,18 +33,18 @@
         return transientRegistry;
     }
 
-    public void addRegistry(long id, Registry registry)
+    public void addRegistry(Registry registry)
     {
-        registries.put(new Long(id), registry);
+        registries.add(1, registry);
     }
 
-    public void removeRegistry(long id)
+    public void removeRegistry(Registry registry)
     {
-        registries.remove(new Long(id));
+        registries.remove(registry);
     }
 
     protected Collection<Registry> getRegistries()
     {
-        return registries.values();
+        return registries;
     }
 }

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/ExpressionEvaluatorProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/ExpressionEvaluatorProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/ExpressionEvaluatorProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -12,7 +12,7 @@
 import org.mule.api.MuleContext;
 import org.mule.api.expression.ExpressionEvaluator;
 import org.mule.api.lifecycle.Disposable;
-import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.PreInitProcessor;
 
 /** 
  * Registers ExpressionEvaluators with the {@link org.mule.expression.DefaultExpressionManager} so that they will
@@ -20,7 +20,7 @@
  * {@link org.mule.api.expression.ExpressionEvaluator} objects are used to execute property expressions (usually on the
  * current message) at run-time to extract a dynamic value.
  */
-public class ExpressionEvaluatorProcessor implements ObjectProcessor, Disposable
+public class ExpressionEvaluatorProcessor implements PreInitProcessor, Disposable
 {
     private MuleContext context;
 

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/MuleContextProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/MuleContextProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/MuleContextProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -11,13 +11,13 @@
 
 import org.mule.api.MuleContext;
 import org.mule.api.context.MuleContextAware;
-import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.InjectProcessor;
 
 /**
  * Injects the MuleContext object for objects stored in the {@link TransientRegistry} where the object registered
  * implements {@link org.mule.api.context.MuleContextAware}.
  */
-public class MuleContextProcessor implements ObjectProcessor
+public class MuleContextProcessor implements InjectProcessor
 {
     private MuleContext context;
 

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/TransientRegistry.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/TransientRegistry.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/registry/TransientRegistry.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -16,8 +16,10 @@
 import org.mule.api.lifecycle.Disposable;
 import org.mule.api.lifecycle.InitialisationException;
 import org.mule.api.model.Model;
+import org.mule.api.registry.InjectProcessor;
 import org.mule.api.registry.MuleRegistry;
 import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.PreInitProcessor;
 import org.mule.api.registry.RegistrationException;
 import org.mule.api.service.Service;
 import org.mule.api.transformer.Transformer;
@@ -191,11 +193,14 @@
     Object applyProcessors(Object object)
     {
         Object theObject = object;
-        // this may be an incorrect hack.  the problem is that if we try to lookup objects in spring before
-        // it is initialised, we end up triggering object creation.  that causes circular dependencies because
-        // this may have originally been called while creating objects in spring...  so we prevent that by
-        // only doing the full lookup once everything is stable.  ac.
-        Collection<ObjectProcessor> processors = lookupObjects(ObjectProcessor.class);
+        //Process injectors first
+        Collection<InjectProcessor> injectProcessors = lookupObjects(InjectProcessor.class);
+        for (InjectProcessor processor : injectProcessors)
+        {
+            theObject = processor.process(theObject);
+        }
+        //Then any other processors
+        Collection<ObjectProcessor> processors = lookupObjects(PreInitProcessor.class);
         for (ObjectProcessor processor : processors)
         {
             theObject = processor.process(theObject);

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/AbstractConnector.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/AbstractConnector.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/AbstractConnector.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -230,7 +230,7 @@
     /**
      * A generic scheduling service for tasks that need to be performed periodically.
      */
-    private final AtomicReference/*<ScheduledExecutorService>*/ scheduler = new AtomicReference();
+    private ScheduledExecutorService scheduler;
 
     /**
      * Holds the service configuration for this connector
@@ -350,7 +350,6 @@
             ((DefaultExceptionStrategy)exceptionListener).initialise();
         }
 
-
         initialised.set(true);
     }
 
@@ -384,20 +383,24 @@
             {
                 throw new LifecycleException(e, this);
             }
-            return;
         }
+        else
+        {
+            startAfterConnect();
+        }
 
+    }
+
+    protected synchronized void startAfterConnect() throws MuleException
+    {
         if (logger.isInfoEnabled())
         {
             logger.info("Starting: " + this);
         }
 
         // the scheduler is recreated after stop()
-        ScheduledExecutorService currentScheduler = (ScheduledExecutorService) scheduler.get();
-        if (currentScheduler == null || currentScheduler.isShutdown())
-        {
-            scheduler.set(this.getScheduler());
-        }
+        scheduler = createScheduler();
+
         initWorkManagers();
 
         this.doStart();
@@ -463,7 +466,7 @@
     {
         if (!this.isStarted())
         {
-            logger.warn("Attempting to stop a connector which is not started");
+            logger.warn("Attempting to stop a connector which is not started: " + getName());
             return;
         }
         
@@ -507,7 +510,8 @@
         }
         
         // Workaround for MULE-4553
-        dispatchers.clear();
+        this.disposeDispatchers();
+        this.disposeRequesters();
 
         if (this.isConnected())
         {
@@ -523,7 +527,7 @@
         }
 
         // make sure the scheduler is gone
-        scheduler.set(null);
+        scheduler = null;
 
         // we do not need to stop the work managers because they do no harm (will just be idle)
         // and will be reused on restart without problems.
@@ -537,22 +541,21 @@
 
     protected void shutdownScheduler()
     {
-        ScheduledExecutorService schedulerExecutor = ((ScheduledExecutorService) scheduler.get());
-        if (schedulerExecutor != null)
+        if (scheduler != null)
         {
             // Disable new tasks from being submitted
-            schedulerExecutor.shutdown();
+            scheduler.shutdown();
             try
             {
                 // Wait a while for existing tasks to terminate
-                if (!schedulerExecutor.awaitTermination(muleContext.getConfiguration().getShutdownTimeout(),
+                if (!scheduler.awaitTermination(muleContext.getConfiguration().getShutdownTimeout(),
                     TimeUnit.MILLISECONDS))
                 {
                     // Cancel currently executing tasks and return list of pending
                     // tasks
-                    List outstanding = schedulerExecutor.shutdownNow();
+                    List outstanding = scheduler.shutdownNow();
                     // Wait a while for tasks to respond to being cancelled
-                    if (!schedulerExecutor.awaitTermination(SCHEDULER_FORCED_SHUTDOWN_TIMEOUT,
+                    if (!scheduler.awaitTermination(SCHEDULER_FORCED_SHUTDOWN_TIMEOUT,
                         TimeUnit.MILLISECONDS))
                     {
                         logger.warn(MessageFormat.format(
@@ -574,13 +577,13 @@
             catch (InterruptedException ie)
             {
                 // (Re-)Cancel if current thread also interrupted
-                schedulerExecutor.shutdownNow();
+                scheduler.shutdownNow();
                 // Preserve interrupt status
                 Thread.currentThread().interrupt();
             }
             finally
             {
-                schedulerExecutor = null;
+                scheduler = null;
             }
         }
     }
@@ -617,8 +620,6 @@
         }
 
         this.disposeReceivers();
-        this.disposeDispatchers();
-        this.disposeRequesters();
 
         this.doDispose();
         disposed.set(true);
@@ -723,7 +724,10 @@
         if (dispatchers != null)
         {
             logger.debug("Disposing Dispatchers");
-            dispatchers.clear();
+            synchronized (dispatchers)
+            {
+                dispatchers.clear();
+            }
             logger.debug("Dispatchers Disposed");
         }
     }
@@ -1568,7 +1572,7 @@
                     
                     if (startOnConnect)
                     {
-                        start();
+                        startAfterConnect();
                     }                
                 }
     
@@ -1889,23 +1893,17 @@
      */
     public ScheduledExecutorService getScheduler()
     {
-        if (scheduler.get() == null)
-        {
-            ThreadFactory threadFactory = new NamedThreadFactory(this.getName() + ".scheduler");
-            ScheduledThreadPoolExecutor newExecutor = new ScheduledThreadPoolExecutor(4, threadFactory);
-            newExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
-            newExecutor.setKeepAliveTime(this.getReceiverThreadingProfile().getThreadTTL(),
-                TimeUnit.MILLISECONDS);
-            newExecutor.allowCoreThreadTimeOut(true);
+        return scheduler;
+    }
 
-            if (!scheduler.compareAndSet(null, newExecutor))
-            {
-                // someone else was faster, ditch our copy.
-                newExecutor.shutdown();
-            }
-        }
-
-        return (ScheduledExecutorService) scheduler.get();
+    protected ScheduledExecutorService createScheduler()
+    {
+        ThreadFactory threadFactory = new NamedThreadFactory(this.getName() + ".scheduler");
+        ScheduledThreadPoolExecutor newExecutor = new ScheduledThreadPoolExecutor(4, threadFactory);
+        newExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+        newExecutor.setKeepAliveTime(this.getReceiverThreadingProfile().getThreadTTL(), TimeUnit.MILLISECONDS);
+        newExecutor.allowCoreThreadTimeOut(true);
+        return newExecutor;
     }
 
     /**
@@ -2225,22 +2223,7 @@
                 logger.debug("Transport '" + getProtocol() + "' will not support requests: ");
             }
 
-
             sessionHandler = serviceDescriptor.createSessionHandler();
-
-            // TODO Do we still need to support this for 2.x?
-            // Set any manager default properties for the connector. These are set on
-            // the Manager with a protocol e.g. jms.specification=1.1
-            // This provides a really convenient way to set properties on an object
-            // from unit tests
-//            Map props = new HashMap();
-//            PropertiesUtils.getPropertiesWithPrefix(muleContext.getRegistry().lookupProperties(), getProtocol()
-//                .toLowerCase(), props);
-//            if (props.size() > 0)
-//            {
-//                props = PropertiesUtils.removeNamespaces(props);
-//                org.mule.util.BeanUtils.populateWithoutFail(this, props, true);
-//            }
         }
         catch (Exception e)
         {

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/AbstractMessageReceiver.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/AbstractMessageReceiver.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/AbstractMessageReceiver.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -337,6 +337,7 @@
                             SecurityNotification.SECURITY_AUTHENTICATION_FAILED));
                     handleException(e);
                     resultMessage = RequestContext.getEvent().getMessage();
+                    resultMessage.setPayload(e.getLocalizedMessage());
                 }
             }
             else

Modified: branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/service/DefaultTransportServiceDescriptor.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/service/DefaultTransportServiceDescriptor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/main/java/org/mule/transport/service/DefaultTransportServiceDescriptor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -409,6 +409,8 @@
             {
                 inboundTransformer = (Transformer) ClassUtils.instanciateClass(
                         defaultInboundTransformer, ClassUtils.NO_ARGS, classLoader);
+                inboundTransformer.setName(inboundTransformer.getName() + "#" + hashCode());
+
                 registry.registerObject(inboundTransformer.getName(), inboundTransformer);
                 return CollectionUtils.singletonList(inboundTransformer);
             }
@@ -434,6 +436,7 @@
             {
                 outboundTransformer = (Transformer) ClassUtils.instanciateClass(
                         defaultOutboundTransformer, ClassUtils.NO_ARGS, classLoader);
+                outboundTransformer.setName(outboundTransformer.getName() + "#" + hashCode());
                 registry.registerObject(outboundTransformer.getName(), outboundTransformer);
                 return CollectionUtils.singletonList(outboundTransformer);
             }
@@ -459,6 +462,8 @@
             {
                 responseTransformer = (Transformer) ClassUtils.instanciateClass(
                         defaultResponseTransformer, ClassUtils.NO_ARGS, classLoader);
+                responseTransformer.setName(responseTransformer.getName() + "#" + hashCode());
+
                 registry.registerObject(responseTransformer.getName(), responseTransformer);                
                 return CollectionUtils.singletonList(responseTransformer);
             }

Copied: branches/mule-3.x-messaging/core/src/test/java/org/mule/context/MuleContextLifecycleTestCase.java (from rev 15991, branches/mule-3.x/core/src/test/java/org/mule/context/MuleContextLifecycleTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/core/src/test/java/org/mule/context/MuleContextLifecycleTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/core/src/test/java/org/mule/context/MuleContextLifecycleTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,251 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.context;
+
+import org.mule.api.MuleContext;
+import org.mule.api.MuleException;
+import org.mule.api.context.MuleContextBuilder;
+import org.mule.config.builders.DefaultsConfigurationBuilder;
+import org.mule.tck.AbstractMuleTestCase;
+
+public class MuleContextLifecycleTestCase extends AbstractMuleTestCase
+{
+
+    private MuleContextBuilder ctxBuilder = new DefaultMuleContextBuilder();
+
+    @Override
+    protected MuleContext createMuleContext() throws Exception
+    {
+        return null;
+    }
+
+    public void testInitialise() throws MuleException
+    {
+        MuleContext ctx = ctxBuilder.buildMuleContext();
+        assertFalse(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx.initialise();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        // Double initialisation does not fail.
+        // MuleContext state stays the same
+        ctx.initialise();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        new DefaultsConfigurationBuilder().configure(ctx);
+        ctx.start();
+        // Attempt to initialise once started should fail!
+        try
+        {
+            ctx.initialise();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+
+        ctx.stop();
+        // Attempt to initialise once stopped should fail!
+        try
+        {
+            ctx.initialise();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+
+        ctx.dispose();
+        // Attempt to initialise once disposed should fail!
+        try
+        {
+            ctx.initialise();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+    }
+
+    public void testStart() throws MuleException
+    {
+        MuleContext ctx = ctxBuilder.buildMuleContext();
+
+        // Attempt to start before initialise should fail!
+        try
+        {
+            ctx.start();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+
+        ctx.initialise();
+        new DefaultsConfigurationBuilder().configure(ctx);
+        ctx.start();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertTrue(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        // Double start does not fail.
+        // MuleContext state stays the same
+        ctx.start();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertTrue(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx.stop();
+        ctx.start();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertTrue(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx.dispose();
+        // Attempt to start once disposed should fail!
+        try
+        {
+            ctx.start();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+    }
+
+    public void testStop() throws MuleException
+    {
+        MuleContext ctx = ctxBuilder.buildMuleContext();
+
+        // Attempt to stop before initialise should fail!
+        try
+        {
+            ctx.stop();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+
+        ctx.initialise();
+        ctx.stop();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        new DefaultsConfigurationBuilder().configure(ctx);
+        ctx.start();
+        ctx.stop();
+        assertTrue(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertFalse(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx.start();
+        ctx.stop();
+        // Attempt to stop twice should fail!
+        try
+        {
+            ctx.stop();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+
+        ctx.dispose();
+        // Attempt to start once disposed should fail!
+        try
+        {
+            ctx.stop();
+            fail();
+        }
+        catch (Exception e)
+        {
+        }
+    }
+
+    public void testDipose() throws MuleException
+    {
+        MuleContext ctx = ctxBuilder.buildMuleContext();
+
+        ctx.dispose();
+        assertFalse(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertTrue(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx = ctxBuilder.buildMuleContext();
+        ctx.initialise();
+        ctx.dispose();
+        assertFalse(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertTrue(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx = ctxBuilder.buildMuleContext();
+        ctx.initialise();
+        new DefaultsConfigurationBuilder().configure(ctx);
+        ctx.start();
+        ctx.dispose();
+        assertFalse(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertTrue(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx = ctxBuilder.buildMuleContext();
+        ctx.initialise();
+        new DefaultsConfigurationBuilder().configure(ctx);
+        ctx.start();
+        ctx.stop();
+        ctx.dispose();
+        assertFalse(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertTrue(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+        ctx = ctxBuilder.buildMuleContext();
+        ctx.initialise();
+        ctx.dispose();
+        ctx.dispose();
+        assertFalse(ctx.isInitialised());
+        assertFalse(ctx.isInitialising());
+        assertFalse(ctx.isStarted());
+        assertTrue(ctx.isDisposed());
+        assertFalse(ctx.isDisposing());
+
+    }
+}

Modified: branches/mule-3.x-messaging/core/src/test/java/org/mule/tck/testmodels/fruit/BananaFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/test/java/org/mule/tck/testmodels/fruit/BananaFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/test/java/org/mule/tck/testmodels/fruit/BananaFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -53,4 +53,9 @@
     {
         return false;
     }
+
+    public boolean isAutoWireObject()
+    {
+        return false;
+    }
 }

Modified: branches/mule-3.x-messaging/core/src/test/java/org/mule/transport/ConnectorLifecycleTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/core/src/test/java/org/mule/transport/ConnectorLifecycleTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/core/src/test/java/org/mule/transport/ConnectorLifecycleTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -368,27 +368,21 @@
 
     public void testSchedulerLifecycle() throws MuleException, WorkException
     {
-        // Scheduler lifecycle is hard to test because scheduler is created in
-        // getScheduler() method and the field is private. (MULE-4555)
+        assertNull(connector.getScheduler());
 
-        assertFalse(connector.getScheduler().isShutdown());
-        assertFalse(connector.getScheduler().isTerminated());
-
         connector.start();
         assertFalse(connector.getScheduler().isShutdown());
         assertFalse(connector.getScheduler().isTerminated());
 
         connector.stop();
-        assertFalse(connector.getScheduler().isShutdown());
-        assertFalse(connector.getScheduler().isTerminated());
+        assertNull(connector.getScheduler());
 
         connector.start();
         assertFalse(connector.getScheduler().isShutdown());
         assertFalse(connector.getScheduler().isTerminated());
 
         connector.dispose();
-        assertFalse(connector.getScheduler().isShutdown());
-        assertFalse(connector.getScheduler().isTerminated());
+        assertNull(connector.getScheduler());
     }
 
     protected Work createSomeWork()

Modified: branches/mule-3.x-messaging/distributions/jca/jca/assembly-whitelist.txt (15992 => 15993)

--- branches/mule-3.x-messaging/distributions/jca/jca/assembly-whitelist.txt	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/distributions/jca/jca/assembly-whitelist.txt	2009-11-08 01:58:55 UTC (rev 15993)
@@ -24,7 +24,7 @@
 commons-jxpath-1.3-osgi
 commons-lang-2.4
 commons-net-2.0
-commons-pool-1.5.2
+commons-pool-1.5.3
 cryptix-jce-api-20050328-osgi
 cryptix-jce-provider-20050328-osgi
 cryptix-message-api-20050405-osgi

Modified: branches/mule-3.x-messaging/distributions/jca/jca-jboss/assembly-whitelist.txt (15992 => 15993)

--- branches/mule-3.x-messaging/distributions/jca/jca-jboss/assembly-whitelist.txt	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/distributions/jca/jca-jboss/assembly-whitelist.txt	2009-11-08 01:58:55 UTC (rev 15993)
@@ -23,7 +23,7 @@
 commons-jxpath-1.3-osgi
 commons-lang-2.4
 commons-net-2.0
-commons-pool-1.5.2
+commons-pool-1.5.3
 cryptix-jce-api-20050328-osgi
 cryptix-jce-provider-20050328-osgi
 cryptix-message-api-20050405-osgi

Modified: branches/mule-3.x-messaging/distributions/standalone/assembly-whitelist.txt (15992 => 15993)

--- branches/mule-3.x-messaging/distributions/standalone/assembly-whitelist.txt	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/distributions/standalone/assembly-whitelist.txt	2009-11-08 01:58:55 UTC (rev 15993)
@@ -24,7 +24,7 @@
 commons-jxpath-1.3-osgi
 commons-lang-2.4
 commons-net-2.0
-commons-pool-1.5.2
+commons-pool-1.5.3
 cryptix-jce-api-20050328-osgi
 cryptix-jce-provider-20050328-osgi
 cryptix-message-api-20050405-osgi

Modified: branches/mule-3.x-messaging/modules/acegi/src/test/java/org/mule/module/acegi/HttpFilterFunctionalTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/acegi/src/test/java/org/mule/module/acegi/HttpFilterFunctionalTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/acegi/src/test/java/org/mule/module/acegi/HttpFilterFunctionalTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -38,7 +38,11 @@
         {
             int status = client.executeMethod(get);
             assertEquals(HttpConstants.SC_UNAUTHORIZED, status);
-            assertEquals("/index.html", get.getResponseBodyAsString());
+            assertEquals(
+                "Registered authentication is set to org.mule.module.acegi.filters.http.HttpBasicAuthenticationFilter "
+                                + "but there was no security context on the session. Authentication denied on endpoint "
+                                + "http://localhost:4567. Message payload is of type: String",
+                get.getResponseBodyAsString());
         }
         finally
         {

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/api/EndpointAnnotationParser.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/api/EndpointAnnotationParser.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/api/EndpointAnnotationParser.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -14,6 +14,7 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Member;
+import java.util.Map;
 
 /**
  * An SPI interface that will process an Endpoint annotation. Note that the Annotation must be annotated with the {@link @Endpoint }
@@ -25,19 +26,23 @@
      * Creates an outbound endpoint from the annotation.
      *
      * @param annotation the annotation to process
+     * @param metaInfo   any additional info that can be used to construct the endpoint.  Typically a connector name might be
+     *                   in this map so that all endpoints for the current object can share the same connector
      * @return a new {@link org.mule.api.endpoint.OutboundEndpoint} object configured according to the annotation
      * @throws MuleException if the outbound endpoint cannot be created. A Mule-specific error will be thrown.
      */
-    public OutboundEndpoint parseOutboundEndpoint(Annotation annotation) throws MuleException;
+    public OutboundEndpoint parseOutboundEndpoint(Annotation annotation, Map metaInfo) throws MuleException;
 
     /**
      * Creates an inbound endpoint from the annotation.
      *
      * @param annotation the annotation to process
+     * @param metaInfo any additional info that can be used to construct the endpoint.  Typically a connector name might be
+     *                   in this map so that all endpoints for the current object can share the same connector
      * @return a new {@link org.mule.api.endpoint.InboundEndpoint} object configured according to the annotation
      * @throws MuleException if the inbound endpoint cannot be created. A Mule-specific error will be thrown.
      */
-    public InboundEndpoint parseInboundEndpoint(Annotation annotation) throws MuleException;
+    public InboundEndpoint parseInboundEndpoint(Annotation annotation, Map metaInfo) throws MuleException;
 
     /**
      * Determines whether this parser can process the current annotation.  The clazz and member params are passed in

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/config/annotations/Service.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/config/annotations/Service.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/config/annotations/Service.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -9,7 +9,7 @@
  */
 package org.mule.config.annotations;
 
-import org.mule.impl.annotations.ServiceScope;
+import org.mule.impl.annotations.ObjectScope;
 
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
@@ -31,7 +31,7 @@
      * The name of this service
      * @return the name of this service. This value is required
      */
-    String name();
+    String name() default "";
 
     /**
      * Determines if this service will be a singleton or prototype.
@@ -41,7 +41,7 @@
      * services possible by default. Note that any operations on field variables will need to be thread-safe.
      * @return true if the service is a singleton
      */
-    ServiceScope scope() default ServiceScope.SINGLETON;
+    ObjectScope scope() default ObjectScope.SINGLETON;
 
     /**
      * The service builder is used to add configuration to this service.  A builder is used when the service has more
@@ -56,5 +56,12 @@
      * service or an empty String if there is no {@link ServiceBuilder} for this service.
      */
     //TODO Implement
-    String builder() default "";
+    //String builder() default "";
+
+    /**
+     * If the channel that triggered a call on this object is not expecting a response, how many threads can process the inbound
+     * emessages simultaneously
+     * @return the number of concurrent threads to be used for async processing
+     */
+    int maxAsyncThreads() default 8;
 }

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/config/spring/factories/ScopedObjectFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/config/spring/factories/ScopedObjectFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/config/spring/factories/ScopedObjectFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -12,7 +12,7 @@
 import org.mule.api.lifecycle.InitialisationException;
 import org.mule.config.PoolingProfile;
 import org.mule.config.i18n.CoreMessages;
-import org.mule.impl.annotations.ServiceScope;
+import org.mule.impl.annotations.ObjectScope;
 import org.mule.object.AbstractObjectFactory;
 import org.mule.object.PrototypeObjectFactory;
 import org.mule.object.SingletonObjectFactory;
@@ -21,7 +21,7 @@
   */
 public class ScopedObjectFactory extends AbstractObjectFactory
 {
-    private ServiceScope scope = ServiceScope.SINGLETON;
+    private ObjectScope scope = ObjectScope.SINGLETON;
 
     private PoolingProfile poolingProfile;
 
@@ -29,12 +29,12 @@
 
     private Object objectInstance;
 
-    public ServiceScope getScope()
+    public ObjectScope getScope()
     {
         return scope;
     }
 
-    public void setScope(ServiceScope scope)
+    public void setScope(ObjectScope scope)
     {
         this.scope = scope;
     }
@@ -84,15 +84,15 @@
      */
     public void initialise() throws InitialisationException
     {
-        if(scope == ServiceScope.PROTOTYPE)
+        if(scope == ObjectScope.REQUEST)
         {
             delegate = new PrototypeObjectFactory();
         }
-        else if(scope == ServiceScope.SINGLETON)
+        else if(scope == ObjectScope.SINGLETON)
         {
             delegate = new SingletonObjectFactory();
         }
-        else if(scope == ServiceScope.POOLED)
+        else if(scope == ObjectScope.POOLED)
         {
             delegate = new PrototypeObjectFactory();
 //            delegate = new PooledObjectFactory();
@@ -126,7 +126,7 @@
     @Override
     public boolean isSingleton()
     {
-        return scope == ServiceScope.SINGLETON;
+        return scope == ObjectScope.SINGLETON;
     }
 
     public Object getObjectInstance()
@@ -153,4 +153,9 @@
         }
         return super.getInstance();
     }
+
+    public boolean isAutoWireObject()
+    {
+        return true;
+    }
 }

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/AnnotatedServiceBuilder.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/AnnotatedServiceBuilder.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/AnnotatedServiceBuilder.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -53,6 +53,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -90,7 +91,7 @@
     protected ObjectFactory createObjectFactory(Object object)
     {
         Service serv = object.getClass().getAnnotation(Service.class);
-        if (serv.scope().equals(ServiceScope.SINGLETON))
+        if (serv.scope().equals(ObjectScope.SINGLETON))
         {
             return new SingletonObjectFactory(object);
         }
@@ -130,7 +131,7 @@
 
         serviceDescriptor.setName(getValue(service.name()));
         componentFactory.initialise();
-        if (service.scope().equals(ServiceScope.POOLED))
+        if (service.scope().equals(ObjectScope.POOLED))
         {
             serviceDescriptor.setComponent(new PooledJavaComponent(componentFactory));
         }
@@ -299,7 +300,7 @@
                 EndpointAnnotationParser parser = (EndpointAnnotationParser) iterator.next();
                 if (parser.supports(metaData.getAnnotation(), metaData.getClazz(), metaData.getMember()))
                 {
-                    return parser.parseInboundEndpoint(metaData.getAnnotation());
+                    return parser.parseInboundEndpoint(metaData.getAnnotation(), Collections.EMPTY_MAP);
                 }
             }
             //TODO i18n
@@ -319,7 +320,7 @@
                 EndpointAnnotationParser parser = (EndpointAnnotationParser) iterator.next();
                 if (parser.supports(metaData.getAnnotation(), metaData.getClazz(), metaData.getMember()))
                 {
-                    return parser.parseOutboundEndpoint(metaData.getAnnotation());
+                    return parser.parseOutboundEndpoint(metaData.getAnnotation(), Collections.EMPTY_MAP);
                 }
             }
         }

Copied: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/ObjectScope.java (from rev 15991, branches/mule-3.x/modules/annotations/src/main/java/org/mule/impl/annotations/ObjectScope.java) (0 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/ObjectScope.java	                        (rev 0)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/ObjectScope.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,21 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.impl.annotations;
+
+/**
+ * Object component scopes
+ */
+public enum ObjectScope
+{
+   REQUEST,
+   SINGLETON,
+   SINGLETON_THREADSAFE,
+   POOLED
+}

Deleted: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/ServiceScope.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/ServiceScope.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/ServiceScope.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -1,20 +0,0 @@
-/*
- * $Id$
- * --------------------------------------------------------------------------------------
- * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
- *
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.impl.annotations;
-
-/**
- * Service component scopes
- */
-public enum ServiceScope
-{
-   PROTOTYPE,
-   SINGLETON,
-   POOLED
-}

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/AbstractAnnotationProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/AbstractAnnotationProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/AbstractAnnotationProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -13,7 +13,7 @@
 import org.mule.api.MuleException;
 import org.mule.api.MuleRuntimeException;
 import org.mule.api.context.MuleContextAware;
-import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.PreInitProcessor;
 import org.mule.impl.endpoint.AnnotatedEndpointBuilder;
 import org.mule.impl.registry.RegistryMap;
 import org.mule.util.TemplateParser;
@@ -21,7 +21,7 @@
 /**
  * TODO
  */
-public abstract class AbstractAnnotationProcessor implements ObjectProcessor, MuleContextAware
+public abstract class AbstractAnnotationProcessor implements PreInitProcessor, MuleContextAware
 {
     protected MuleContext context;
     protected AnnotatedEndpointBuilder builder;

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/AnnotatedServiceObjectProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/AnnotatedServiceObjectProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/AnnotatedServiceObjectProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -14,7 +14,7 @@
 import org.mule.api.config.MuleProperties;
 import org.mule.api.context.MuleContextAware;
 import org.mule.api.model.Model;
-import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.PreInitProcessor;
 import org.mule.config.annotations.Service;
 import org.mule.impl.annotations.AnnotatedServiceBuilder;
 import org.mule.impl.model.resolvers.AnnotatedEntryPointResolver;
@@ -31,7 +31,7 @@
  * If one is not found a default  SEDA Model will be created
  * Finally, the processor will register the service with the Registry and return null.
  */
-public class AnnotatedServiceObjectProcessor implements ObjectProcessor, MuleContextAware
+public class AnnotatedServiceObjectProcessor implements PreInitProcessor, MuleContextAware
 {
     protected MuleContext context;
 

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/InjectAnnotationProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/InjectAnnotationProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/InjectAnnotationProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -11,7 +11,7 @@
 
 import org.mule.api.MuleContext;
 import org.mule.api.context.MuleContextAware;
-import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.InjectProcessor;
 
 import java.lang.reflect.Field;
 
@@ -24,7 +24,7 @@
  * Processes the JSR-330 {@link javax.inject.Inject} annotation. This can be used for injecting objects in the registry into
  * user object/beans. THis annotation injects by type. To inject by key use the {@link javax.inject.Named} annotation.
  */
-public class InjectAnnotationProcessor implements ObjectProcessor, MuleContextAware
+public class InjectAnnotationProcessor implements InjectProcessor, MuleContextAware
 {
     /**
      * logger used by this class

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/NamedAnnotationProcessor.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/NamedAnnotationProcessor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/annotations/processors/NamedAnnotationProcessor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -11,7 +11,7 @@
 
 import org.mule.api.MuleContext;
 import org.mule.api.context.MuleContextAware;
-import org.mule.api.registry.ObjectProcessor;
+import org.mule.api.registry.InjectProcessor;
 import org.mule.util.StringUtils;
 
 import java.lang.reflect.Field;
@@ -25,7 +25,7 @@
  * Processes the JSR-330 {@link javax.inject.Named} annotation. This can be used for injecting objects in the registry into
  * user object/beans.
  */
-public class NamedAnnotationProcessor implements ObjectProcessor, MuleContextAware
+public class NamedAnnotationProcessor implements InjectProcessor, MuleContextAware
 {
     /**
      * logger used by this class

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/endpoint/AbstractEndpointAnnotationParser.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/endpoint/AbstractEndpointAnnotationParser.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/endpoint/AbstractEndpointAnnotationParser.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -45,12 +45,12 @@
         return new AnnotatedEndpointBuilder(muleContext);
     }
 
-    public OutboundEndpoint parseOutboundEndpoint(Annotation annotation) throws MuleException
+    public OutboundEndpoint parseOutboundEndpoint(Annotation annotation, Map metaInfo) throws MuleException
     {
         return (OutboundEndpoint) getEndpointBuilder().processEndpoint(createEndpointData(annotation));
     }
 
-    public InboundEndpoint parseInboundEndpoint(Annotation annotation) throws MuleException
+    public InboundEndpoint parseInboundEndpoint(Annotation annotation, Map metaInfo) throws MuleException
     {
         return (InboundEndpoint) getEndpointBuilder().processEndpoint(createEndpointData(annotation));
     }

Modified: branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/endpoint/AnnotatedEndpointBuilder.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/endpoint/AnnotatedEndpointBuilder.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/annotations/src/main/java/org/mule/impl/endpoint/AnnotatedEndpointBuilder.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -16,12 +16,12 @@
 import org.mule.api.expression.PropertyConverter;
 import org.mule.api.routing.filter.Filter;
 import org.mule.api.transformer.Transformer;
-import org.mule.api.transport.Connector;
 import org.mule.config.annotations.endpoints.ChannelType;
 import org.mule.config.annotations.i18n.AnnotationsMessages;
 import org.mule.endpoint.MuleEndpointURI;
 import org.mule.impl.registry.ConfigurableTransportFactory;
 import org.mule.impl.registry.RegistryMap;
+import org.mule.transport.AbstractConnector;
 import org.mule.transport.service.TransportFactory;
 import org.mule.util.TemplateParser;
 
@@ -101,27 +101,39 @@
             endpointBuilder.setEncoding(getPropertyValue(epData.getEncoding()));
         }
 
+        AbstractConnector connector;
         if (epData.getConnectorName() != null)
         {
-            endpointBuilder.setConnector(muleContext.getRegistry().lookupConnector(getPropertyValue(epData.getConnectorName())));
+            connector = (AbstractConnector)muleContext.getRegistry().lookupConnector(getPropertyValue(epData.getConnectorName()));
         }
         else if (epData.getConnector() != null)
         {
-            endpointBuilder.setConnector(epData.getConnector());
+            connector = (AbstractConnector)epData.getConnector();
         }
         else
         {
             //We always create a new connecotr for annotations when one has not been configured
             MuleEndpointURI uri = new MuleEndpointURI(getPropertyValue(epData.getAddress()), muleContext);
 
-            Connector connector = transportFactory.createConnector(uri);
+            connector = (AbstractConnector)transportFactory.createConnector(uri);
             //The ibeans transport factory will not always create a new connector, check before registering
             if (muleContext.getRegistry().lookupConnector(connector.getName()) == null)
             {
                 muleContext.getRegistry().registerConnector(connector);
             }
-            endpointBuilder.setConnector(connector);
+        }
+        endpointBuilder.setConnector(connector);
 
+        //Set threading for this connector. Note we simplify by setting all profiles with a single value 'threads'
+        //that can be set by the user
+        String threadsString = (String)epData.getProperties().get("threads");
+        if(threadsString!=null)
+        {
+            int threads = Integer.valueOf(threadsString);
+            connector.setMaxDispatchersActive(threads);
+            connector.setMaxRequestersActive(threads);
+            connector.getReceiverThreadingProfile().setMaxThreadsActive(threads);
+            connector.getReceiverThreadingProfile().setMaxThreadsIdle(threads);
         }
 
         if (epData.getName() != null)

Modified: branches/mule-3.x-messaging/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextListener.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextListener.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextListener.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -54,7 +54,7 @@
      */
     public static final String INIT_PARAMETER_MULE_CONFIG = "org.mule.config";
 
-    private MuleContext muleContext;
+    protected MuleContext muleContext;
 
     protected transient final Log logger = LogFactory.getLog(MuleXmlBuilderContextListener.class);
 

Modified: branches/mule-3.x-messaging/modules/guice/src/main/java/org/mule/module/guice/GuiceConfigurationBuilder.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/guice/src/main/java/org/mule/module/guice/GuiceConfigurationBuilder.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/guice/src/main/java/org/mule/module/guice/GuiceConfigurationBuilder.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -145,7 +145,7 @@
             injector = Guice.createInjector(modules);
         }
         GuiceRegistry registry = new GuiceRegistry(injector);
-        muleContext.addRegistry(2, registry);
+        muleContext.addRegistry(registry);
 
         for (Iterator<Key<?>> iterator = injector.getBindings().keySet().iterator(); iterator.hasNext();)
         {

Modified: branches/mule-3.x-messaging/modules/guice/src/main/java/org/mule/module/guice/config/GuiceLookupObjectFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/guice/src/main/java/org/mule/module/guice/config/GuiceLookupObjectFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/guice/src/main/java/org/mule/module/guice/config/GuiceLookupObjectFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -91,4 +91,10 @@
         //Guice doesn't provide lifecycle hooks
         return false;
     }
+
+    public boolean isAutoWireObject()
+    {
+        //Guice does the wiring
+        return false;
+    }
 }

Modified: branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleConnectionRequestInfo.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleConnectionRequestInfo.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleConnectionRequestInfo.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,13 +10,6 @@
 
 package org.mule.module.jca;
 
-import org.mule.api.MuleContext;
-import org.mule.api.context.MuleContextAware;
-import org.mule.config.spring.SpringXmlConfigurationBuilder;
-import org.mule.util.StringUtils;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.io.Serializable;
 
 import javax.resource.spi.ConnectionRequestInfo;
@@ -24,56 +17,16 @@
 /**
  * <code>MuleConnectionRequestInfo</code> TODO
  */
-public class MuleConnectionRequestInfo implements ConnectionRequestInfo, Cloneable, Serializable, MuleContextAware
+public class MuleConnectionRequestInfo implements ConnectionRequestInfo, Cloneable, Serializable
 {
     /**
      * Serial version
      */
     private static final long serialVersionUID = 910828075890304726L;
 
-
-    private String configurationBuilder = SpringXmlConfigurationBuilder.class.getName();
-    private String configurations;
     private String username;
     private String password;
 
-    private MuleContext muleContext;
-
-    public MuleConnectionRequestInfo()
-    {
-        super();
-    }
-
-    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
-    {
-        ois.defaultReadObject();
-    }
-
-    public String getConfigurationBuilder()
-    {
-        return configurationBuilder;
-    }
-
-    public void setConfigurationBuilder(String configurationBuilder)
-    {
-        this.configurationBuilder = configurationBuilder;
-    }
-
-    public String getConfigurations()
-    {
-        return configurations;
-    }
-
-    public String[] getConfigurationsAsArray()
-    {
-        return StringUtils.splitAndTrim(configurations, ",");
-    }
-
-    public void setConfigurations(String configurations)
-    {
-        this.configurations = configurations;
-    }
-
     public String getUserName()
     {
         return username;
@@ -94,74 +47,36 @@
         this.password = password;
     }
 
-    public MuleContext getMuleContext()
+    @Override
+    public int hashCode()
     {
-        return muleContext;
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((password == null) ? 0 : password.hashCode());
+        result = prime * result + ((username == null) ? 0 : username.hashCode());
+        return result;
     }
 
-    public void setMuleContext(MuleContext context)
-    {
-        this.muleContext = context;
-    }
-
+    @Override
     public boolean equals(Object obj)
     {
-        if (this == obj)
+        if (this == obj) return true;
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
+        MuleConnectionRequestInfo other = (MuleConnectionRequestInfo) obj;
+        if (password == null)
         {
-            return true;
+            if (other.password != null) return false;
         }
-
-        if (obj == null)
+        else if (!password.equals(other.password)) return false;
+        if (username == null)
         {
-            return false;
+            if (other.username != null) return false;
         }
-
-        if (this.getClass() != obj.getClass())
-        {
-            return false;
-        }
-
-        final MuleConnectionRequestInfo muleConnectionRequestInfo = (MuleConnectionRequestInfo)obj;
-
-        if (configurationBuilder != null
-                        ? !configurationBuilder.equals(muleConnectionRequestInfo.configurationBuilder)
-                        : muleConnectionRequestInfo.configurationBuilder != null)
-        {
-            return false;
-        }
-
-        if (configurations != null
-                        ? !configurations.equals(muleConnectionRequestInfo.configurations)
-                        : muleConnectionRequestInfo.configurations != null)
-        {
-            return false;
-        }
-
-        if (password != null
-                        ? !password.equals(muleConnectionRequestInfo.password)
-                        : muleConnectionRequestInfo.password != null)
-        {
-            return false;
-        }
-
-        if (username != null
-                        ? !username.equals(muleConnectionRequestInfo.username)
-                        : muleConnectionRequestInfo.username != null)
-        {
-            return false;
-        }
-
+        else if (!username.equals(other.username)) return false;
         return true;
     }
 
-    public int hashCode()
-    {
-        int result = (configurationBuilder != null ? configurationBuilder.hashCode() : 0);
-        result = 29 * result + (configurations != null ? configurations.hashCode() : 0);
-        result = 29 * result + (username != null ? username.hashCode() : 0);
-        return 29 * result + (password != null ? password.hashCode() : 0);
-    }
-
     protected Object clone() throws CloneNotSupportedException
     {
         return super.clone();

Modified: branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnection.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnection.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnection.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -114,7 +114,9 @@
             creds = new MuleCredentials(user, password.toCharArray());
         }
 
-        MuleConnection connection = new DefaultMuleConnection(this, info.getMuleContext(), creds);
+        // TODO Get muleContext from ResourceAdaptor somehow 
+        // (MULE-2916 MuleContext should not be a static singleton instance)
+        MuleConnection connection = new DefaultMuleConnection(this, null, creds);
         addConnection(connection);
         return connection;
     }

Modified: branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleResourceAdapter.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleResourceAdapter.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleResourceAdapter.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -19,6 +19,7 @@
 import org.mule.api.model.Model;
 import org.mule.api.service.Service;
 import org.mule.config.DefaultMuleConfiguration;
+import org.mule.config.spring.SpringXmlConfigurationBuilder;
 import org.mule.context.DefaultMuleContextBuilder;
 import org.mule.context.DefaultMuleContextFactory;
 import org.mule.endpoint.EndpointURIEndpointBuilder;
@@ -61,16 +62,16 @@
     protected transient MuleContext muleContext;
 
     protected transient BootstrapContext bootstrapContext;
-    protected MuleConnectionRequestInfo info = new MuleConnectionRequestInfo();
-    protected final Map endpoints = new HashMap();
+    protected final Map<MuleEndpointKey, Service> endpoints = new HashMap<MuleEndpointKey, Service>();
     protected String defaultJcaModelName;
 
-    public MuleResourceAdapter()
-    {
-        // TODO Make this work for OSGi
-        //muleContext.getOrCreateRegistry();
-    }
+    private String configurationBuilder = SpringXmlConfigurationBuilder.class.getName();
+    private String configurations;
+    private String username;
+    private String password;
 
+    private DefaultMuleConfiguration muleConfiguration = new DefaultMuleConfiguration();
+
     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
     {
         ois.defaultReadObject();
@@ -84,18 +85,18 @@
     {
         this.bootstrapContext = bootstrapContext;
 
-        if (info.getConfigurations() != null)
+        if (configurations != null)
         {
             ConfigurationBuilder configBuilder = null;
             try
             {
-                configBuilder = (ConfigurationBuilder) ClassUtils.instanciateClass(info.getConfigurationBuilder(),
-                                                                                   info.getConfigurations());
+                configBuilder = (ConfigurationBuilder) ClassUtils.instanciateClass(configurationBuilder,
+                    configurations);
             }
             catch (Exception e)
             {
-                throw new ResourceAdapterInternalException("Failed to instanciate configurationBuilder class: "
-                                                           + info.getConfigurationBuilder(), e);
+                throw new ResourceAdapterInternalException(
+                    "Failed to instanciate configurationBuilder class: " + configurationBuilder, e);
             }
 
             try
@@ -103,16 +104,15 @@
                 logger.info("Initializing Mule...");
 
                 MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
-                DefaultMuleConfiguration config = new DefaultMuleConfiguration();
-                config.setSystemModelType(JcaModel.JCA_MODEL_TYPE);
-                contextBuilder.setMuleConfiguration(config);
+                muleConfiguration.setSystemModelType(JcaModel.JCA_MODEL_TYPE);
+                contextBuilder.setMuleConfiguration(muleConfiguration);
                 muleContext = new DefaultMuleContextFactory().createMuleContext(configBuilder, contextBuilder);
             }
             catch (MuleException e)
             {
                 logger.error(e);
                 throw new ResourceAdapterInternalException(
-                    "Failed to load configurations: " + info.getConfigurations(), e);
+                    "Failed to load configurations: " + configurations, e);
             }
             try
             {
@@ -186,7 +186,8 @@
         }
         else
         {
-            throw new NotSupportedException("That type of ActicationSpec not supported: " + activationSpec.getClass());
+            throw new NotSupportedException("That type of ActicationSpec not supported: "
+                                            + activationSpec.getClass());
         }
 
     }
@@ -272,8 +273,8 @@
     }
 
     protected Service createJcaService(MessageEndpointFactory endpointFactory,
-                                              JcaModel model,
-                                              InboundEndpoint endpoint) throws MuleException
+                                       JcaModel model,
+                                       InboundEndpoint endpoint) throws MuleException
     {
         String name = "JcaService#" + endpointFactory.hashCode();
         Service service = new JcaService();
@@ -304,8 +305,8 @@
     }
 
     /**
-     * We only connect to one resource manager per ResourceAdapter instance, so any ActivationSpec will return
-     * the same XAResource.
+     * We only connect to one resource manager per ResourceAdapter instance, so any
+     * ActivationSpec will return the same XAResource.
      * 
      * @see javax.resource.spi.ResourceAdapter#getXAResources(javax.resource.spi.ActivationSpec[])
      */
@@ -314,87 +315,192 @@
         return new XAResource[]{};
     }
 
-    public String getPassword()
+    /**
+     * @param password
+     */
+    public void setPassword(String password)
     {
-        return info.getPassword();
+        this.password = password;
     }
 
-    public String getConfigurations()
+    /**
+     * @param configurations
+     */
+    public void setConfigurations(String configurations)
     {
-        return info.getConfigurations();
+        this.configurations = configurations;
     }
 
-    public String getUserName()
+    /**
+     * @param userid
+     */
+    public void setUserName(String userid)
     {
-        return info.getUserName();
+        this.username = userid;
     }
 
-    public void setPassword(String password)
+    public void setConfigurationBuilder(String configbuilder)
     {
-        info.setPassword(password);
+        this.configurationBuilder = configbuilder;
     }
 
-    public void setConfigurations(String configurations)
+    public String getModelName()
     {
-        info.setConfigurations(configurations);
+        return defaultJcaModelName;
     }
 
-    public void setUserName(String userid)
+    public void setModelName(String modelName)
     {
-        info.setUserName(userid);
+        this.defaultJcaModelName = modelName;
     }
 
-    public String getConfigurationBuilder()
+    public void setAutoWrapMessageAwareTransform(Boolean autoWrapMessageAwareTransform)
     {
-        return info.getConfigurationBuilder();
+        if (autoWrapMessageAwareTransform != null)
+        {
+            muleConfiguration.setAutoWrapMessageAwareTransform(autoWrapMessageAwareTransform);
+        }
     }
 
-    public void setConfigurationBuilder(String configbuilder)
+    public void setCacheMessageAsBytes(Boolean cacheMessageAsBytes)
     {
-        info.setConfigurationBuilder(configbuilder);
+        if (cacheMessageAsBytes != null)
+        {
+            muleConfiguration.setCacheMessageAsBytes(cacheMessageAsBytes);
+        }
     }
 
-    public MuleConnectionRequestInfo getInfo()
+    public void setCacheMessageOriginalPayload(Boolean cacheMessageOriginalPayload)
     {
-        return info;
+        if (cacheMessageOriginalPayload != null)
+        {
+            muleConfiguration.setCacheMessageOriginalPayload(cacheMessageOriginalPayload);
+        }
     }
 
-    @Override
-    public boolean equals(Object o)
+    public void setClusterId(String clusterId)
     {
-        if (this == o)
+        muleConfiguration.setClusterId(clusterId);
+    }
+
+    public void setDefaultEncoding(String encoding)
+    {
+        muleConfiguration.setDefaultEncoding(encoding);
+    }
+
+    public void setDefaultQueueTimeout(Integer defaultQueueTimeout)
+    {
+        if (defaultQueueTimeout != null)
         {
-            return true;
+            muleConfiguration.setDefaultQueueTimeout(defaultQueueTimeout);
         }
-        if (!(o instanceof MuleResourceAdapter))
+    }
+
+    public void setDefaultResponseTimeout(Integer responseTimeout)
+    {
+        if (responseTimeout != null)
         {
-            return false;
+            muleConfiguration.setDefaultResponseTimeout(responseTimeout);
         }
+    }
 
-        final MuleResourceAdapter muleResourceAdapter = (MuleResourceAdapter) o;
+    public void setDefaultSynchronousEndpoints(Boolean synchronous)
+    {
+        if (synchronous != null)
+        {
+            muleConfiguration.setDefaultSynchronousEndpoints(synchronous);
+        }
+    }
 
-        if (info != null ? !info.equals(muleResourceAdapter.info) : muleResourceAdapter.info != null)
+    public void setDefaultTransactionTimeout(Integer defaultTransactionTimeout)
+    {
+        if (defaultTransactionTimeout != null)
         {
-            return false;
+            muleConfiguration.setDefaultTransactionTimeout(defaultTransactionTimeout);
         }
+    }
 
-        return true;
+    public void setDomainId(String domainId)
+    {
+        muleConfiguration.setDomainId(domainId);
     }
 
-    @Override
-    public int hashCode()
+    public void setServerId(String serverId)
     {
-        return (info != null ? info.hashCode() : 0);
+        muleConfiguration.setId(serverId);
     }
 
-    public String getModelName()
+    public void setShutdownTimeout(Integer shutdownTimeout)
     {
-        return defaultJcaModelName;
+        if (shutdownTimeout != null)
+        {
+            muleConfiguration.setShutdownTimeout(shutdownTimeout);
+        }
     }
 
-    public void setModelName(String modelName)
+    public void setWorkingDirectory(String workingDirectory)
     {
-        this.defaultJcaModelName = modelName;
+        muleConfiguration.setWorkingDirectory(workingDirectory);
     }
 
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((configurationBuilder == null) ? 0 : configurationBuilder.hashCode());
+        result = prime * result + ((configurations == null) ? 0 : configurations.hashCode());
+        result = prime * result + ((defaultJcaModelName == null) ? 0 : defaultJcaModelName.hashCode());
+        result = prime * result + ((endpoints == null) ? 0 : endpoints.hashCode());
+        result = prime * result + ((muleConfiguration == null) ? 0 : muleConfiguration.hashCode());
+        result = prime * result + ((password == null) ? 0 : password.hashCode());
+        result = prime * result + ((username == null) ? 0 : username.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj) return true;
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
+        MuleResourceAdapter other = (MuleResourceAdapter) obj;
+        if (configurationBuilder == null)
+        {
+            if (other.configurationBuilder != null) return false;
+        }
+        else if (!configurationBuilder.equals(other.configurationBuilder)) return false;
+        if (configurations == null)
+        {
+            if (other.configurations != null) return false;
+        }
+        else if (!configurations.equals(other.configurations)) return false;
+        if (defaultJcaModelName == null)
+        {
+            if (other.defaultJcaModelName != null) return false;
+        }
+        else if (!defaultJcaModelName.equals(other.defaultJcaModelName)) return false;
+        if (endpoints == null)
+        {
+            if (other.endpoints != null) return false;
+        }
+        else if (!endpoints.equals(other.endpoints)) return false;
+        if (muleConfiguration == null)
+        {
+            if (other.muleConfiguration != null) return false;
+        }
+        else if (!muleConfiguration.equals(other.muleConfiguration)) return false;
+        if (password == null)
+        {
+            if (other.password != null) return false;
+        }
+        else if (!password.equals(other.password)) return false;
+        if (username == null)
+        {
+            if (other.username != null) return false;
+        }
+        else if (!username.equals(other.username)) return false;
+        return true;
+    }
+
 }

Modified: branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/SpringConfigurationBuilder.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/SpringConfigurationBuilder.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/SpringConfigurationBuilder.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -61,7 +61,7 @@
 
         // Note: The SpringRegistry must be created before applicationContext.refresh() gets called because
         // some beans may try to look up other beans via the Registry during preInstantiateSingletons().
-        muleContext.addRegistry(1, registry);
+        muleContext.addRegistry(registry);
         registry.initialise();
     }
 

Modified: branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/SpringXmlConfigurationBuilder.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/SpringXmlConfigurationBuilder.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/SpringXmlConfigurationBuilder.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -94,7 +94,7 @@
 
         // Note: The SpringRegistry must be created before applicationContext.refresh() gets called because
         // some beans may try to look up other beans via the Registry during preInstantiateSingletons().
-        muleContext.addRegistry(1, registry);
+        muleContext.addRegistry(registry);
         registry.initialise();
     }
     

Modified: branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/util/SpringBeanLookup.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/util/SpringBeanLookup.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/spring-config/src/main/java/org/mule/config/spring/util/SpringBeanLookup.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -113,4 +113,10 @@
     {
         return true;
     }
+
+    public boolean isAutoWireObject()
+    {
+        //Spring does the wiring
+        return false;
+    }
 }

Modified: branches/mule-3.x-messaging/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocationTransformer.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocationTransformer.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocationTransformer.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -22,7 +22,6 @@
 /**
  * Transforms a byte[] into an ObjectInputStream and then into a Spring RemoteInvocation instance.
  */
-
 public class ObjectToRemoteInvocationTransformer extends AbstractTransformer
 {
 
@@ -76,12 +75,17 @@
             logger.debug("request to execute " + ri.getMethodName());
             for (int i = 0; i < ri.getArguments().length; i++)
             {
-                Object a = ri.getArguments()[i];
-                logger.debug("with argument (" + a.toString() + ")");
+                Object currentArgument = ri.getArguments()[i];
+                
+                StringBuilder buf = new StringBuilder(64);
+                buf.append("with argument (");
+                buf.append(currentArgument == null ? "<null>" : currentArgument.toString());
+                buf.append(")");
+                
+                logger.debug(buf);
             }
         }
         return ri;
-
     }
 
 }

Modified: branches/mule-3.x-messaging/modules/spring-security/src/test/java/org/mule/module/spring/security/HttpFilterFunctionalTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/spring-security/src/test/java/org/mule/module/spring/security/HttpFilterFunctionalTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/spring-security/src/test/java/org/mule/module/spring/security/HttpFilterFunctionalTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -38,7 +38,7 @@
         {
             int status = client.executeMethod(get);
             assertEquals(HttpConstants.SC_UNAUTHORIZED, status);
-            assertTrue(get.getResponseBodyAsString().contains("/index.html"));
+            assertEquals(getNoContextErrorResponse(), get.getResponseBodyAsString());
         }
         finally
         {
@@ -46,6 +46,13 @@
         }
     }
 
+    protected String getNoContextErrorResponse()
+    {
+        return "Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter "
+               + "but there was no security context on the session. Authentication denied on endpoint "
+               + "http://localhost:4567. Message payload is of type: String";
+    }
+
     public void testAuthenticationFailureBadCredentials() throws Exception
     {
         doRequest(null, "localhost", "anonX", "anonX", getUrl(), true, false, 401);
@@ -73,8 +80,7 @@
 
     public void testAuthenticationAuthorisedWithHandshakeAndRealm() throws Exception
     {
-        doRequest("mule-realm", "localhost", "ross", "ross", getUrl(), true, false,
-            200);
+        doRequest("mule-realm", "localhost", "ross", "ross", getUrl(), true, false, 200);
     }
 
     private void doRequest(String realm,

Modified: branches/mule-3.x-messaging/modules/sxc/src/main/java/org/mule/module/sxc/SxcFilteringOutboundRouter.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/sxc/src/main/java/org/mule/module/sxc/SxcFilteringOutboundRouter.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/sxc/src/main/java/org/mule/module/sxc/SxcFilteringOutboundRouter.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -139,7 +139,7 @@
         if (evaluator == null)
         {
             builder = new XPathBuilder();
-
+            builder.setNamespaceContext(namespaces);
             addEventHandlers(builder, getFilter());
 
             evaluator = builder.compile();

Modified: branches/mule-3.x-messaging/modules/xml/src/main/java/org/mule/module/xml/stax/XMLStreamReaderToContentHandler.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/xml/src/main/java/org/mule/module/xml/stax/XMLStreamReaderToContentHandler.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/xml/src/main/java/org/mule/module/xml/stax/XMLStreamReaderToContentHandler.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -80,12 +80,8 @@
         this.filter = filter;
     }
 
-    /*
-     * @see StAXReaderToContentHandler#bridge()
-     */
     public void bridge() throws XMLStreamException
     {
-
         try
         {
             // remembers the nest level of elements to know when we are done.
@@ -422,15 +418,11 @@
 
     protected void handleComment() throws XMLStreamException
     {
-        int textLength = staxStreamReader.getTextLength();
-        int textStart = staxStreamReader.getTextStart();
-        char[] chars = new char[textLength];
-
-        staxStreamReader.getTextCharacters(textStart, chars, 0, textLength);
-
+        char[] chars = staxStreamReader.getText().toCharArray();
+        
         try
         {
-            filter.comment(chars, 0, textLength);
+            filter.comment(chars, 0, chars.length);
         }
         catch (SAXException e)
         {

Modified: branches/mule-3.x-messaging/modules/xml/src/main/java/org/mule/module/xml/util/XMLUtils.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/xml/src/main/java/org/mule/module/xml/util/XMLUtils.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/xml/src/main/java/org/mule/module/xml/util/XMLUtils.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -214,8 +214,9 @@
             final InputStream is = (java.io.InputStream) obj;
             
             XMLStreamReader xsr = factory.createXMLStreamReader(is);
-            return new DelegateXMLStreamReader(xsr) {
-
+            return new DelegateXMLStreamReader(xsr) 
+            {
+                @Override
                 public void close() throws XMLStreamException
                 {
                     super.close();

Modified: branches/mule-3.x-messaging/modules/xml/src/test/java/org/mule/module/xml/util/XMLTestUtils.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/xml/src/test/java/org/mule/module/xml/util/XMLTestUtils.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/xml/src/test/java/org/mule/module/xml/util/XMLTestUtils.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -26,11 +26,11 @@
 
 public class XMLTestUtils
 {
-    public static List getXmlMessageVariants(String resource) throws Exception
+    public static List<?> getXmlMessageVariants(String resource) throws Exception
     {
         XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
         
-        List list = new ArrayList();
+        List<Object> list = new ArrayList<Object>();
         InputStream is;
 
         // java.io.InputStream
@@ -64,5 +64,3 @@
         return list;
     }
 }
-
-

Modified: branches/mule-3.x-messaging/modules/xml/src/test/java/org/mule/routing/filters/xml/IsXmlFilterTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/modules/xml/src/test/java/org/mule/routing/filters/xml/IsXmlFilterTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/modules/xml/src/test/java/org/mule/routing/filters/xml/IsXmlFilterTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -17,14 +17,13 @@
 import org.mule.util.IOUtils;
 
 import java.io.InputStream;
-import java.util.Iterator;
 import java.util.List;
 
 public class IsXmlFilterTestCase extends AbstractMuleTestCase
 {
-
     private IsXmlFilter filter;
 
+    @Override
     protected void doSetUp() throws Exception
     {
         filter = new IsXmlFilter();
@@ -75,14 +74,10 @@
 
     public void testFilterXmlMessageVariants() throws Exception
     {
-        List list = XMLTestUtils.getXmlMessageVariants("cdcatalog.xml");
-        Iterator it = list.iterator();
-        
-        Object msg;
-        while (it.hasNext())
+        List<?> list = XMLTestUtils.getXmlMessageVariants("cdcatalog.xml");
+        for (Object message : list)
         {
-            msg = it.next();
-            assertTrue(filter.accept(new DefaultMuleMessage(msg, muleContext)));
+            assertTrue(filter.accept(new DefaultMuleMessage(message, muleContext)));
         }
     }
 }

Modified: branches/mule-3.x-messaging/pom.xml (15992 => 15993)

--- branches/mule-3.x-messaging/pom.xml	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/pom.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -1,6 +1,4 @@
-
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
     <!-- Version -->
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.mule</groupId>
@@ -99,7 +97,6 @@
         <commonsLangVersion>2.4</commonsLangVersion>
         <commonsLoggingVersion>1.1.1</commonsLoggingVersion>
         <commonsNetVersion>2.0</commonsNetVersion>
-        <commonsPoolVersion>1.5.2</commonsPoolVersion>
         <!-- TODO There is a more modern version of cryptix available: 
         http://mirrors.ibiblio.org/pub/mirrors/maven2/cryptix/cryptix/3.2.0/cryptix-3.2.0.jar
         but the PGP module would need some work in order to use it -->
@@ -248,8 +245,7 @@
                 <artifactId>mule-transport-stdio</artifactId>
                 <version>${version}</version>
             </dependency>
-
-             <dependency>
+            <dependency>
                 <!-- OSGi-ready -->
                 <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-annotation_1.0_spec</artifactId>
@@ -267,8 +263,6 @@
                 <artifactId>geronimo-stax-api_1.0_spec</artifactId>
                 <version>${geronimoSpecsStaxVersion}</version>
             </dependency>
-            
-            
             <dependency>
                 <groupId>org.springframework</groupId>
                 <artifactId>spring-beans</artifactId>
@@ -428,16 +422,12 @@
                     </exclusion>
                 </exclusions>
             </dependency>
-            
             <dependency>
                 <!-- OSGi-ready -->
                 <groupId>commons-pool</groupId>
                 <artifactId>commons-pool</artifactId>
-                <version>${commonsPoolVersion}</version>
+                <version>1.5.3</version>
             </dependency>
-            
-            
-            
             <!-- OSGi Specification -->
             <dependency>
                 <groupId>org.osgi</groupId>
@@ -467,7 +457,6 @@
                 <version>${springOsgiVersion}</version>
             </dependency>
             -->
-            
             <dependency>
                 <!-- OSGi-ready -->
                 <groupId>org.mortbay.jetty</groupId>
@@ -498,7 +487,6 @@
                 <artifactId>servlet-api-2.5</artifactId>
                 <version>${jettyVersion}</version>
             </dependency>
-
             <!-- For unit tests only -->
             <dependency>
                 <groupId>org.apache.derby</groupId>
@@ -647,191 +635,178 @@
                 <artifactId>log4j</artifactId>
                 <version>${log4jVersion}</version>
             </dependency>
-
             <dependency>
                 <groupId>mockobjects</groupId>
                 <artifactId>mockobjects-core</artifactId>
                 <version>0.09</version>
             </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-ejb_2.1_spec</artifactId>
-            <version>${geronimoSpecsVersion}-osgi</version>
-            
-        </dependency>
-         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
-            <version>${geronimoSpecsVersion}-osgi</version>
-            
-        </dependency>
-         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
-            <version>${geronimoSpecsVersion}-osgi</version>
-            
-        </dependency>
-         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jaxrpc_1.1_spec</artifactId>
-            <version>${geronimoSpecsVersion}-osgi</version>
-            
-        </dependency>
-         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jms_1.1_spec</artifactId>
-            <version>${geronimoSpecsVersion}-osgi</version>
-            
-        </dependency>
-         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
-            <version>${geronimoSpecsVersion}-osgi</version>
-            
-        </dependency>
-         <dependency>
-            <groupId>javax.activation</groupId>
-            <artifactId>activation</artifactId>
-            <version>${javaActivationVersion}-osgi</version>
-         </dependency>
-        <dependency>
-            <groupId>javax.mail</groupId>
-            <artifactId>mail</artifactId>
-            <version>${javaMailVersion}-osgi</version>
-        </dependency>
-         <dependency>
-            <groupId>javax.xml.ws</groupId>
-            <artifactId>jaxws-api</artifactId>
-            <version>${javaXmlWsVersion}-osgi</version>
-            <exclusions>
-                <exclusion> 
-                    <groupId>javax.jws</groupId>
-                    <artifactId>jsr181</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>         
-        <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
-            <version>${jaxbApiVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>javax.xml.stream</groupId>
-                    <artifactId>stax-api</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-xjc</artifactId>
-            <version>${javaXmlBindVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>${javaXmlBindVersion}-osgi</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>javax.xml.soap</groupId>
-            <artifactId>saaj-api</artifactId>
-            <version>${saajVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.messaging.saaj</groupId>
-            <artifactId>saaj-impl</artifactId>
-            <version>${saajVersion}-osgi</version>
-        </dependency>
-        
-         <dependency>
-            <groupId>net.java.dev.stax-utils</groupId>
-            <artifactId>stax-utils</artifactId>
-            <version>${staxUtilsVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.bea.xml</groupId>
-                    <artifactId>jsr173-ri</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-         <dependency>
-            <groupId>wsdl4j</groupId>
-            <artifactId>wsdl4j</artifactId>
-            <version>${javaWsdlVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils</artifactId>
-            <version>${commonsBeanUtilsVersion}</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>commons-logging</artifactId>
-                    <groupId>commons-logging</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>commons-collections</groupId>
-            <artifactId>commons-collections</artifactId>
-            <version>${commonsCollectionsVersion}</version>
-        </dependency>
-         <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>${commonsCodecVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>commons-logging</artifactId>
-                    <groupId>commons-logging</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-         <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>${commonsIoVersion}</version>
-        </dependency>
-         <dependency>
-            <groupId>commons-httpclient</groupId>
-            <artifactId>commons-httpclient</artifactId>
-            <version>${commonsHttpClientVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>commons-logging</artifactId>
-                    <groupId>commons-logging</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>${commonsLangVersion}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-cli</groupId>
-            <artifactId>commons-cli</artifactId>
-            <version>${commonsCliVersion}</version>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-ejb_2.1_spec</artifactId>
+                <version>${geronimoSpecsVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+                <version>${geronimoSpecsVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+                <version>${geronimoSpecsVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-jaxrpc_1.1_spec</artifactId>
+                <version>${geronimoSpecsVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-jms_1.1_spec</artifactId>
+                <version>${geronimoSpecsVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
+                <version>${geronimoSpecsVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.activation</groupId>
+                <artifactId>activation</artifactId>
+                <version>${javaActivationVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+                <version>${javaMailVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.xml.ws</groupId>
+                <artifactId>jaxws-api</artifactId>
+                <version>${javaXmlWsVersion}-osgi</version>
                 <exclusions>
-                    <!-- we like slf4j -->
                     <exclusion>
+                        <groupId>javax.jws</groupId>
+                        <artifactId>jsr181</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>javax.xml.bind</groupId>
+                <artifactId>jaxb-api</artifactId>
+                <version>${jaxbApiVersion}-osgi</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.xml.stream</groupId>
+                        <artifactId>stax-api</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-xjc</artifactId>
+                <version>${javaXmlBindVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.xml.bind</groupId>
+                <artifactId>jaxb-impl</artifactId>
+                <version>${javaXmlBindVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.xml.soap</groupId>
+                <artifactId>saaj-api</artifactId>
+                <version>${saajVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>com.sun.xml.messaging.saaj</groupId>
+                <artifactId>saaj-impl</artifactId>
+                <version>${saajVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>net.java.dev.stax-utils</groupId>
+                <artifactId>stax-utils</artifactId>
+                <version>${staxUtilsVersion}-osgi</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>com.bea.xml</groupId>
+                        <artifactId>jsr173-ri</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>wsdl4j</groupId>
+                <artifactId>wsdl4j</artifactId>
+                <version>${javaWsdlVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-beanutils</groupId>
+                <artifactId>commons-beanutils</artifactId>
+                <version>${commonsBeanUtilsVersion}</version>
+                <exclusions>
+                    <exclusion>
+                        <artifactId>commons-logging</artifactId>
                         <groupId>commons-logging</groupId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>commons-collections</groupId>
+                <artifactId>commons-collections</artifactId>
+                <version>${commonsCollectionsVersion}</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-codec</groupId>
+                <artifactId>commons-codec</artifactId>
+                <version>${commonsCodecVersion}-osgi</version>
+                <exclusions>
+                    <exclusion>
                         <artifactId>commons-logging</artifactId>
+                        <groupId>commons-logging</groupId>
                     </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>commons-io</groupId>
+                <artifactId>commons-io</artifactId>
+                <version>${commonsIoVersion}</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-httpclient</groupId>
+                <artifactId>commons-httpclient</artifactId>
+                <version>${commonsHttpClientVersion}-osgi</version>
+                <exclusions>
                     <exclusion>
-                        <groupId>commons-lang</groupId>
-                        <artifactId>commons-lang</artifactId>
+                        <artifactId>commons-logging</artifactId>
+                        <groupId>commons-logging</groupId>
                     </exclusion>
                 </exclusions>
-         </dependency>
-
-        <dependency>
-            <groupId>commons-jxpath</groupId>
-            <artifactId>commons-jxpath</artifactId>
-            <version>${commonsJxpathVersion}-osgi</version>
-            
+            </dependency>
+            <dependency>
+                <groupId>commons-lang</groupId>
+                <artifactId>commons-lang</artifactId>
+                <version>${commonsLangVersion}</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-cli</groupId>
+                <artifactId>commons-cli</artifactId>
+                <version>${commonsCliVersion}</version>
+                    <exclusions>
+                        <!-- we like slf4j -->
+                        <exclusion>
+                            <groupId>commons-logging</groupId>
+                            <artifactId>commons-logging</artifactId>
+                        </exclusion>
+                        <exclusion>
+                            <groupId>commons-lang</groupId>
+                            <artifactId>commons-lang</artifactId>
+                        </exclusion>
+                    </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>commons-jxpath</groupId>
+                <artifactId>commons-jxpath</artifactId>
+                <version>${commonsJxpathVersion}-osgi</version>
                 <exclusions>
-
                     <!-- we want newer beanutils via core -->
                     <exclusion>
                         <groupId>commons-beanutils</groupId>
@@ -878,331 +853,329 @@
                         <artifactId>junit</artifactId>
                     </exclusion>
                 </exclusions>
-        </dependency>
-         <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate</artifactId>
-            <version>${hibernateVersion}-osgi</version>
-            
-            <exclusions>
-                <!-- we like slf4j -->
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-                <!-- We've already got the geronimo-jta spec -->
-                <exclusion>
-                    <groupId>javax.transaction</groupId>
-                    <artifactId>jta</artifactId>
-                </exclusion>
-                <!-- Use the combined cglib-nodep instead of separate cglib and asm dependencies -->
-                <exclusion>
-                    <groupId>cglib</groupId>
-                    <artifactId>cglib</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>asm</groupId>
-                    <artifactId>asm</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>asm</groupId>
-                    <artifactId>asm-attrs</artifactId>
-                </exclusion>
-                <!-- EhCache is no longer the default cache provider for Hibernate -->
-                <exclusion>
-                    <groupId>net.sf.ehcache</groupId>
-                    <artifactId>ehcache</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>msv</groupId>
-                    <artifactId>msv</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>relaxngDatatype</groupId>
-                    <artifactId>relaxngDatatype</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>isorelax</groupId>
-                    <artifactId>isorelax</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.groovy</groupId>
-            <artifactId>groovy-all</artifactId>
-            <version>1.5.6-osgi</version>
-            <exclusions>
-                <!--  Exclude openejb-loader as it is not needed and there are currently version inconsistancies in openejb-core pom-->
-                <exclusion>
-                    <groupId>openejb</groupId>
-                    <artifactId>openejb-loader</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.ant</groupId>
-                    <artifactId>ant</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.ant</groupId>
-                    <artifactId>ant-junit</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.ant</groupId>
-                    <artifactId>ant-launcher</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>jline</groupId>
-                    <artifactId>jline</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>axion</groupId>
-                    <artifactId>axion</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>bsf</groupId>
-                    <artifactId>bsf</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.tonicsystems</groupId>
-                    <artifactId>jarjar</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>commons-lang</groupId>
-                    <artifactId>commons-lang</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>commons-primitives</groupId>
-                    <artifactId>commons-primitives</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>jmock</groupId>
-                    <artifactId>jmock</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>jmock</groupId>
-                    <artifactId>jmock-cglib</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>jsp-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>servlet-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>mx4j</groupId>
-                    <artifactId>mx4j</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>nekohtml</groupId>
-                    <artifactId>nekohtml</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>qdox</groupId>
-                    <artifactId>qdox</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>qdox</groupId>
-                    <artifactId>qdox</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>radeox</groupId>
-                    <artifactId>radeox</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>radeox</groupId>
-                    <artifactId>radeox-oro</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>regexp</groupId>
-                    <artifactId>regexp</artifactId>
-                </exclusion>
-                <!-- no XML -->
-                <exclusion>
-                    <groupId>xml-apis</groupId>
-                    <artifactId>xml-apis</artifactId>
-                </exclusion>
-                <!-- totally outdated and wrong too -->
-                <exclusion>
-                    <groupId>xerces</groupId>
-                    <artifactId>xerces</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>xpp3</groupId>
-                    <artifactId>xpp3</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>xstream</groupId>
-                    <artifactId>xstream</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-         <dependency>
-            <groupId>net.sf.retrotranslator</groupId>
-            <artifactId>retrotranslator-runtime</artifactId>
-            <version>1.2.1</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.script</groupId>
-            <artifactId>script-api</artifactId>
-            <version>1.0-osgi</version>
-            <!-- we use our own retrotranslated version -->
-            <classifier>jdk14</classifier>
-        </dependency>
-         <dependency>
-            <groupId>javax.script</groupId>
-            <artifactId>groovy-engine</artifactId>
-            <version>1.1-osgi</version>
-            <!-- we use our own retrotranslated version -->
-            <classifier>jdk14</classifier>
-        </dependency>
-        <dependency>
-            <groupId>tanukisoft</groupId>
-            <artifactId>wrapper</artifactId>
-            <version>${wrapperVersion}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.woodstox</groupId>
-            <artifactId>wstx-asl</artifactId>
-            <version>${woodstoxVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>stax</groupId>
-                    <artifactId>stax-api</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>backport-util-concurrent</groupId>
-            <artifactId>backport-util-concurrent</artifactId>
-            <version>${backportUtilConcurrentVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>ant</groupId>
-            <artifactId>ant</artifactId>
-            <version>${antVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>jdom</groupId>
-            <artifactId>jdom</artifactId>
-            <version>${jdomVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>dom4j</groupId>
-            <artifactId>dom4j</artifactId>
-            <version>${dom4jVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>cgilib</groupId>
-            <artifactId>cgilib-nodep</artifactId>
-            <version>${cgilibVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>jaxen</groupId>
-            <artifactId>jaxen</artifactId>
-            <version>${jaxenVersion}-osgi</version>
-        </dependency>
-                
-        <dependency>
-            <groupId>org.apache.ws.security</groupId>
-            <artifactId>wss4j</artifactId>
-            <version>${wss4jVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>axis</groupId>
-                    <artifactId>axis</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>axis</groupId>
-                    <artifactId>axis-ant</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>bouncycastle</groupId>
-                    <artifactId>bcprov-jdk15</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>bouncycastle</groupId>
-                    <artifactId>bcprov-jdk13</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>bouncycastle</groupId>
-                    <artifactId>bcprov-jdk14</artifactId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>commons-logging</artifactId>
-                    <groupId>commons-logging</groupId>
-                </exclusion>
-                <exclusion>
-                    <groupId>xerces</groupId>
-                    <artifactId>xercesImpl</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>xml-apis</groupId>
-                    <artifactId>xml-apis</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-         <dependency>
-            <groupId>org.apache.santuario</groupId>
-            <artifactId>xmlsec</artifactId>
-            <version>${xmlSecurityVersion}-osgi</version>
-        </dependency>
-         <dependency>
-            <groupId>opensaml</groupId>
-            <artifactId>opensaml</artifactId>
-            <version>${openSamlVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>xml-resolver</groupId>
-            <artifactId>xml-resolver</artifactId>
-            <version>${xmlResolverVersion}-osgi</version>
-        </dependency>
-        <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-jmx</artifactId>
-            <version>${mx4jVersion}-osgi</version>
-        </dependency>
-         <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-impl</artifactId>
-            <version>${mx4jVersion}-osgi</version>
-        </dependency>
-         <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-tools</artifactId>
-            <version>${mx4jVersion}-osgi</version>
-        </dependency>
-         <dependency>
-            <groupId>mx4j</groupId>
-            <artifactId>mx4j-remote</artifactId>
-            <version>${mx4jVersion}-osgi</version>
-        </dependency>
-         <dependency>
-            <groupId>asm</groupId>
-            <artifactId>asm</artifactId>
-            <version>${asmVersion}-osgi</version>
-        </dependency>        
-        <dependency>
-            <groupId>org.jbpm</groupId>
-            <artifactId>jbpm-jpdl</artifactId>
-            <version>${jbpmVersion}-osgi</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>commons-logging</artifactId>
-                    <groupId>commons-logging</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.beanshell</groupId>
-            <artifactId>bsh</artifactId>
-            <version>${bshVersion}-osgi</version>
-        </dependency>
-      </dependencies>
+            </dependency>
+            <dependency>
+                <groupId>org.hibernate</groupId>
+                <artifactId>hibernate</artifactId>
+                <version>${hibernateVersion}-osgi</version>
+                <exclusions>
+                    <!-- we like slf4j -->
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                    <!-- We've already got the geronimo-jta spec -->
+                    <exclusion>
+                        <groupId>javax.transaction</groupId>
+                        <artifactId>jta</artifactId>
+                    </exclusion>
+                    <!-- Use the combined cglib-nodep instead of separate cglib and asm dependencies -->
+                    <exclusion>
+                        <groupId>cglib</groupId>
+                        <artifactId>cglib</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>asm</groupId>
+                        <artifactId>asm</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>asm</groupId>
+                        <artifactId>asm-attrs</artifactId>
+                    </exclusion>
+                    <!-- EhCache is no longer the default cache provider for Hibernate -->
+                    <exclusion>
+                        <groupId>net.sf.ehcache</groupId>
+                        <artifactId>ehcache</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>msv</groupId>
+                        <artifactId>msv</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>relaxngDatatype</groupId>
+                        <artifactId>relaxngDatatype</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>isorelax</groupId>
+                        <artifactId>isorelax</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy-all</artifactId>
+                <version>1.5.6-osgi</version>
+                <exclusions>
+                    <!--  Exclude openejb-loader as it is not needed and there are currently version inconsistancies in openejb-core pom-->
+                    <exclusion>
+                        <groupId>openejb</groupId>
+                        <artifactId>openejb-loader</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.apache.ant</groupId>
+                        <artifactId>ant</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.apache.ant</groupId>
+                        <artifactId>ant-junit</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.apache.ant</groupId>
+                        <artifactId>ant-launcher</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>jline</groupId>
+                        <artifactId>jline</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>axion</groupId>
+                        <artifactId>axion</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>bsf</groupId>
+                        <artifactId>bsf</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>com.tonicsystems</groupId>
+                        <artifactId>jarjar</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>commons-lang</groupId>
+                        <artifactId>commons-lang</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>commons-primitives</groupId>
+                        <artifactId>commons-primitives</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>jmock</groupId>
+                        <artifactId>jmock</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>jmock</groupId>
+                        <artifactId>jmock-cglib</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.servlet</groupId>
+                        <artifactId>jsp-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.servlet</groupId>
+                        <artifactId>servlet-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>mx4j</groupId>
+                        <artifactId>mx4j</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>nekohtml</groupId>
+                        <artifactId>nekohtml</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>qdox</groupId>
+                        <artifactId>qdox</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>qdox</groupId>
+                        <artifactId>qdox</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>radeox</groupId>
+                        <artifactId>radeox</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>radeox</groupId>
+                        <artifactId>radeox-oro</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>regexp</groupId>
+                        <artifactId>regexp</artifactId>
+                    </exclusion>
+                    <!-- no XML -->
+                    <exclusion>
+                        <groupId>xml-apis</groupId>
+                        <artifactId>xml-apis</artifactId>
+                    </exclusion>
+                    <!-- totally outdated and wrong too -->
+                    <exclusion>
+                        <groupId>xerces</groupId>
+                        <artifactId>xerces</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>xpp3</groupId>
+                        <artifactId>xpp3</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>xstream</groupId>
+                        <artifactId>xstream</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>net.sf.retrotranslator</groupId>
+                <artifactId>retrotranslator-runtime</artifactId>
+                <version>1.2.1</version>
+            </dependency>
+            <dependency>
+                <groupId>javax.script</groupId>
+                <artifactId>script-api</artifactId>
+                <version>1.0-osgi</version>
+                <!-- we use our own retrotranslated version -->
+                <classifier>jdk14</classifier>
+            </dependency>
+            <dependency>
+                <groupId>javax.script</groupId>
+                <artifactId>groovy-engine</artifactId>
+                <version>1.1-osgi</version>
+                <!-- we use our own retrotranslated version -->
+                <classifier>jdk14</classifier>
+            </dependency>
+            <dependency>
+                <groupId>tanukisoft</groupId>
+                <artifactId>wrapper</artifactId>
+                <version>${wrapperVersion}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.woodstox</groupId>
+                <artifactId>wstx-asl</artifactId>
+                <version>${woodstoxVersion}-osgi</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>stax</groupId>
+                        <artifactId>stax-api</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>backport-util-concurrent</groupId>
+                <artifactId>backport-util-concurrent</artifactId>
+                <version>${backportUtilConcurrentVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>ant</groupId>
+                <artifactId>ant</artifactId>
+                <version>${antVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>jdom</groupId>
+                <artifactId>jdom</artifactId>
+                <version>${jdomVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>dom4j</groupId>
+                <artifactId>dom4j</artifactId>
+                <version>${dom4jVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>cgilib</groupId>
+                <artifactId>cgilib-nodep</artifactId>
+                <version>${cgilibVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>jaxen</groupId>
+                <artifactId>jaxen</artifactId>
+                <version>${jaxenVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ws.security</groupId>
+                <artifactId>wss4j</artifactId>
+                <version>${wss4jVersion}-osgi</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>axis</groupId>
+                        <artifactId>axis</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>axis</groupId>
+                        <artifactId>axis-ant</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>bouncycastle</groupId>
+                        <artifactId>bcprov-jdk15</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>bouncycastle</groupId>
+                        <artifactId>bcprov-jdk13</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>bouncycastle</groupId>
+                        <artifactId>bcprov-jdk14</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <artifactId>commons-logging</artifactId>
+                        <groupId>commons-logging</groupId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>xerces</groupId>
+                        <artifactId>xercesImpl</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>xml-apis</groupId>
+                        <artifactId>xml-apis</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.santuario</groupId>
+                <artifactId>xmlsec</artifactId>
+                <version>${xmlSecurityVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>opensaml</groupId>
+                <artifactId>opensaml</artifactId>
+                <version>${openSamlVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>xml-resolver</groupId>
+                <artifactId>xml-resolver</artifactId>
+                <version>${xmlResolverVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>mx4j</groupId>
+                <artifactId>mx4j-jmx</artifactId>
+                <version>${mx4jVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>mx4j</groupId>
+                <artifactId>mx4j-impl</artifactId>
+                <version>${mx4jVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>mx4j</groupId>
+                <artifactId>mx4j-tools</artifactId>
+                <version>${mx4jVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>mx4j</groupId>
+                <artifactId>mx4j-remote</artifactId>
+                <version>${mx4jVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>asm</groupId>
+                <artifactId>asm</artifactId>
+                <version>${asmVersion}-osgi</version>
+            </dependency>
+            <dependency>
+                <groupId>org.jbpm</groupId>
+                <artifactId>jbpm-jpdl</artifactId>
+                <version>${jbpmVersion}-osgi</version>
+                <exclusions>
+                    <exclusion>
+                        <artifactId>commons-logging</artifactId>
+                        <groupId>commons-logging</groupId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.beanshell</groupId>
+                <artifactId>bsh</artifactId>
+                <version>${bshVersion}-osgi</version>
+            </dependency>
+        </dependencies>
     </dependencyManagement>
 
     <ciManagement>

Modified: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/components/AbstractLifecycleTracker.java (15992 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/components/AbstractLifecycleTracker.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/components/AbstractLifecycleTracker.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -15,8 +15,6 @@
 import org.mule.api.context.MuleContextAware;
 import org.mule.api.lifecycle.InitialisationException;
 import org.mule.api.lifecycle.Lifecycle;
-import org.mule.api.service.Service;
-import org.mule.api.service.ServiceAware;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -25,7 +23,7 @@
  * @author David Dossot (david@...)
  */
 public abstract class AbstractLifecycleTracker implements Lifecycle,
-        MuleContextAware, ServiceAware {
+        MuleContextAware {
 
     private final List<String> tracker = new ArrayList<String>();
 
@@ -41,11 +39,6 @@
         tracker.add("setMuleContext");
     }
 
-    public void setService(final Service service)
-    {
-        tracker.add("setService");
-    }
-
     public void initialise() throws InitialisationException {
         tracker.add("initialise");
     }

Modified: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/components/LifecycleTrackerComponent.java (15992 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/components/LifecycleTrackerComponent.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/components/LifecycleTrackerComponent.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -12,12 +12,14 @@
 
 import org.mule.api.MuleEventContext;
 import org.mule.api.lifecycle.Callable;
+import org.mule.api.service.Service;
+import org.mule.api.service.ServiceAware;
 
 /**
  * @author David Dossot (david@...)
  */
 public class LifecycleTrackerComponent extends AbstractLifecycleTracker
-        implements Callable {
+        implements ServiceAware, Callable {
 
     public void springInitialize() {
         getTracker().add("springInitialize");
@@ -27,6 +29,11 @@
         getTracker().add("springDestroy");
     }
 
+     public void setService(final Service service)
+    {
+        getTracker().add("setService");
+    }
+
     public Object onCall(final MuleEventContext eventContext) throws Exception {
         // dirty trick to get the component instance that was used for the
         // request

Modified: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/config/DummyInitialContextFactory.java (15992 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/config/DummyInitialContextFactory.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/config/DummyInitialContextFactory.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -80,4 +80,9 @@
     {
         return false;
     }
+
+    public boolean isAutoWireObject()
+    {
+        return false;
+    }
 }

Copied: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java (from rev 15991, branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyReturnMessageTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,37 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.exceptions;
+
+import org.mule.api.MuleMessage;
+import org.mule.module.client.MuleClient;
+import org.mule.tck.FunctionalTestCase;
+
+public class ExceptionStrategyReturnMessageTestCase extends FunctionalTestCase
+{
+    @Override
+    protected String getConfigResources()
+    {
+        return "org/mule/test/integration/exceptions/exception-strategy-return-message.xml";
+    }
+
+    public void testExceptionMessage() throws Exception
+    {
+        MuleClient client = new MuleClient();
+        MuleMessage msg = client.send("vm://in", "Test Message", null);
+
+        assertNotNull(msg);
+        assertNotNull(msg.getExceptionPayload());
+        assertEquals("Functional Test Service Exception", msg.getExceptionPayload().getMessage());
+
+        assertNotNull(msg.getPayload());
+        assertEquals("Ka-boom!", msg.getPayload());
+    }
+}

Copied: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java (from rev 15991, branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java) (0 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java	                        (rev 0)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/exceptions/TestExceptionStrategy.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,28 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.exceptions;
+
+import org.mule.DefaultExceptionStrategy;
+import org.mule.RequestContext;
+import org.mule.message.DefaultExceptionPayload;
+
+public class TestExceptionStrategy extends DefaultExceptionStrategy
+{
+    @Override
+    protected void defaultHandler(Throwable t)
+    {
+        if (RequestContext.getEvent() != null)
+        {
+            RequestContext.setExceptionPayload(new DefaultExceptionPayload(t));
+            setReturnMessage("Ka-boom!");
+        }
+    }
+}

Modified: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/security/ServletHttpFilterFunctionalTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/security/ServletHttpFilterFunctionalTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/security/ServletHttpFilterFunctionalTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -51,5 +51,12 @@
 
         super.doTearDown();
     }
+    
+    protected String getNoContextErrorResponse()
+    {
+        return "Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter "
+               + "but there was no security context on the session. Authentication denied on endpoint "
+               + "servlet://test. Message payload is of type: String";
+    }
 
 }

Copied: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/transport/ConnectorLifecycleTracker.java (from rev 15991, branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/transport/ConnectorLifecycleTracker.java) (0 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/transport/ConnectorLifecycleTracker.java	                        (rev 0)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/transport/ConnectorLifecycleTracker.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,91 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.test.integration.transport;
+
+import org.mule.api.MuleContext;
+import org.mule.api.MuleException;
+import org.mule.api.lifecycle.InitialisationException;
+import org.mule.transport.AbstractConnector;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO
+ */
+public class ConnectorLifecycleTracker extends AbstractConnector
+{
+    private final List<String> tracker = new ArrayList<String>();
+
+    private String property1;
+
+    boolean connected = false;
+    public List<String> getTracker() {
+        return tracker;
+    }
+
+    public String getProtocol()
+    {
+        return "test";
+    }
+
+    public void doConnect() throws Exception
+    {
+        connected = true;
+        getTracker().add("connect");
+    }
+
+    public void doDisconnect() throws Exception
+    {
+        connected = false;
+        getTracker().add("disconnect");
+    }
+
+
+
+    public void setProperty(final String value) {
+        tracker.add("setProperty");
+    }
+
+    public void setMuleContext(final MuleContext context) {
+        tracker.add("setMuleContext");
+        super.setMuleContext(context);
+    }
+
+    public void doInitialise() throws InitialisationException
+    {
+        tracker.add("initialise");
+    }
+
+    public void doStart() throws MuleException
+    {
+        tracker.add("start");
+    }
+
+    public void doStop() throws MuleException {
+        tracker.add("stop");
+    }
+
+    public void doDispose() {
+        tracker.add("dispose");
+    }
+
+
+    public String getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(String property1)
+    {
+        tracker.add("setProperty");
+        this.property1 = property1;
+    }
+}

Copied: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/transport/LifecycleTrackerConnectorFunctionalTestCase.java (from rev 15991, branches/mule-3.x/tests/integration/src/test/java/org/mule/test/integration/transport/LifecycleTrackerConnectorFunctionalTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/transport/LifecycleTrackerConnectorFunctionalTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/integration/transport/LifecycleTrackerConnectorFunctionalTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.test.integration.transport;
+
+import org.mule.tck.FunctionalTestCase;
+
+public class LifecycleTrackerConnectorFunctionalTestCase extends FunctionalTestCase
+{
+
+    @Override
+    protected String getConfigResources()
+    {
+        return "org/mule/test/integration/transport/connector-lifecycle-config.xml";
+    }
+
+    /**
+     * ASSERT:
+     * - Mule stop/start lifecycle methods invoked
+     * - Mule initialize/dipose lifecycle methods NOT invoked
+     * - Spring lifecycle methods invoked
+     * - Service and muleContext injected (Component implements ServiceAware/MuleContextAware)
+     * NOTE: muleContext is injected twice, once by registry and once by lifecycleAdaptor
+     * @throws Exception
+     */
+    public void testConnectorLifecycle() throws Exception
+    {
+        testComponentLifecycle(
+            "test1",
+            "[setProperty, setMuleContext, initialise, connect, start, stop, disconnect, dispose]");
+    }
+
+    private void testComponentLifecycle(final String connectorName, final String expectedLifeCycle)
+        throws Exception
+    {
+
+        final ConnectorLifecycleTracker tracker = getConnector(connectorName);
+
+        muleContext.dispose();
+
+        assertEquals(connectorName, expectedLifeCycle, tracker.getTracker().toString());
+    }
+
+    private ConnectorLifecycleTracker getConnector(final String connectorName) throws Exception
+    {
+        ConnectorLifecycleTracker t = (ConnectorLifecycleTracker)muleContext.getRegistry().lookupConnector(connectorName);
+        assertNotNull(t);
+
+        return t;
+    }
+}
\ No newline at end of file

Modified: branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/usecases/http/HttpResponseTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/usecases/http/HttpResponseTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/tests/integration/src/test/java/org/mule/test/usecases/http/HttpResponseTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -16,6 +16,7 @@
 import org.mule.tck.FunctionalTestCase;
 import org.mule.transport.NullPayload;
 import org.mule.transport.http.HttpConnector;
+import org.mule.transport.http.HttpConstants;
 
 public class HttpResponseTestCase extends FunctionalTestCase
 {
@@ -52,4 +53,29 @@
         assertFalse(reply.getPayload() instanceof NullPayload);
         assertEquals("test", reply.getPayloadAsString());
     }
+    
+    /**
+     * See MULE-4522
+     * @throws Exception
+     */
+    public void testChunkingContentLength() throws Exception
+    {
+        MuleClient client = new MuleClient();
+        MuleMessage reply = client.send("http://localhost:8988", new DefaultMuleMessage("test", muleContext));
+        assertNotNull(reply.getPayload());
+        assertFalse(reply.getPayload() instanceof NullPayload);
+        assertEquals("chunked", reply.getStringProperty(HttpConstants.HEADER_TRANSFER_ENCODING, null));
+        assertNull(reply.getStringProperty(HttpConstants.HEADER_CONTENT_LENGTH, null));
+    }
+
+    public void testNoChunkingContentLength() throws Exception
+    {
+        MuleClient client = new MuleClient();
+        MuleMessage reply = client.send("http://localhost:8987", new DefaultMuleMessage("test", muleContext));
+        assertNotNull(reply.getPayload());
+        assertFalse(reply.getPayload() instanceof NullPayload);
+        assertNotSame("chunked", reply.getStringProperty(HttpConstants.HEADER_TRANSFER_ENCODING, null));
+        assertNotNull(reply.getStringProperty(HttpConstants.HEADER_CONTENT_LENGTH, null));
+    }
+    
 }

Copied: branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml (from rev 15991, branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml) (0 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml	                        (rev 0)
+++ branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-return-message.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xmlns:test="http://www.mulesource.org/schema/mule/test/2.2"
+      xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"	  
+      xsi:schemaLocation="
+            http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
+            http://www.mulesource.org/schema/mule/test/2.2 http://www.mulesource.org/schema/mule/test/2.2/mule-test.xsd
+			http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd">
+
+    <model>
+        <service name="InputService">
+            <inbound>
+                <vm:inbound-endpoint path="in" synchronous="true" />
+            </inbound>
+            <outbound>
+                <pass-through-router>
+                    <vm:outbound-endpoint path="badService" synchronous="true"/>
+                </pass-through-router>
+            </outbound>
+        </service>
+        
+        <service name="ExceptionService">
+            <inbound>
+		        <vm:inbound-endpoint path="badService" />
+            </inbound>
+            <test:component throwException="true" />
+            <custom-exception-strategy class="org.mule.test.integration.exceptions.TestExceptionStrategy" /> 
+        </service>
+    </model>
+</mule>

Copied: branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/integration/transport/connector-lifecycle-config.xml (from rev 15991, branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/transport/connector-lifecycle-config.xml) (0 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/integration/transport/connector-lifecycle-config.xml	                        (rev 0)
+++ branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/integration/transport/connector-lifecycle-config.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+    xsi:schemaLocation="
+       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
+       http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+    <custom-connector name="test1" class="org.mule.test.integration.transport.ConnectorLifecycleTracker" validateConnections="false">
+        <spring:property name="property1" value="foo"/>
+    </custom-connector>
+
+</mule>

Modified: branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/usecases/http/http-response.xml (15992 => 15993)

--- branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/usecases/http/http-response.xml	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/tests/integration/src/test/resources/org/mule/test/usecases/http/http-response.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -33,5 +33,25 @@
             </inbound>
             <echo-component/>
         </service>
+        
+        <service name="HttpWithChunking">
+            <inbound>
+                <inbound-endpoint address="http://localhost:8988" synchronous="true">
+                    <response-transformers>
+                        <message-properties-transformer>
+                            <add-message-property key="Transfer-Encoding" value="chunked"/>
+                        </message-properties-transformer>
+                    </response-transformers>
+                </inbound-endpoint>
+            </inbound>
+            <echo-component/>
+        </service>
+        
+        <service name="HttpWithNoChunking">
+            <inbound>
+                <inbound-endpoint address="http://localhost:8987" synchronous="true"/>
+            </inbound>
+            <echo-component/>
+        </service>
     </model>
 </mule>

Modified: branches/mule-3.x-messaging/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -143,7 +143,7 @@
         result = call.invoke(args);
         if (result == null)
         {
-            return null;
+            return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
         }
         else
         {

Copied: branches/mule-3.x-messaging/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorLifecycleTestCase.java (from rev 15991, branches/mule-3.x/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorLifecycleTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorLifecycleTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorLifecycleTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,70 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.transport.soap.axis;
+
+import org.mule.api.MuleException;
+import org.mule.tck.FunctionalTestCase;
+
+public class AxisConnectorLifecycleTestCase extends FunctionalTestCase
+{
+
+    private static String SERVICE_NAME = "mycomponent";
+    private static String PROTOCOL_SERVICE_NAME = AxisConnector.AXIS_SERVICE_PROPERTY + "connector.axis.0";
+
+    @Override
+    protected String getConfigResources()
+    {
+        return "axis-http-mule-config.xml";
+    }
+
+    /**
+     * MULE-4570, MULE-4573
+     * 
+     * @throws MuleException
+     */
+    public void testStopService() throws MuleException
+    {
+        muleContext.getRegistry().lookupService(SERVICE_NAME).stop();
+        assertFalse(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
+        assertFalse(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME).isStarted());
+
+    }
+
+    /**
+     * MULE-4570, MULE-4573
+     * 
+     * @throws MuleException
+     */
+    public void testDisposeService() throws MuleException
+    {
+        muleContext.getRegistry().lookupService(SERVICE_NAME).dispose();
+        assertFalse(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
+        assertNull(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME));
+
+    }
+
+    /**
+     * MULE-4569, MULE-4573
+     * 
+     * @throws MuleException
+     */
+    public void testRestartService() throws MuleException
+    {
+        muleContext.getRegistry().lookupService(SERVICE_NAME).stop();
+        assertFalse(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
+        assertFalse(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME).isStarted());
+        muleContext.getRegistry().lookupService(SERVICE_NAME).start();
+        assertTrue(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
+        assertTrue(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME).isStarted());
+
+    }
+
+}

Modified: branches/mule-3.x-messaging/transports/axis/src/test/resources/mule-test-exclusions.txt (15992 => 15993)

--- branches/mule-3.x-messaging/transports/axis/src/test/resources/mule-test-exclusions.txt	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/axis/src/test/resources/mule-test-exclusions.txt	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,4 +10,7 @@
 org.mule.transport.soap.axis.AxisEndpointMule2164TestCase
 
 # This works, but it requires tools.jar on the classpath which not everyone has
-org.mule.transport.soap.axis.AxisServiceUsingCxfEndpointTestCase
\ No newline at end of file
+org.mule.transport.soap.axis.AxisServiceUsingCxfEndpointTestCase
+
+# MULE-4573
+org.mule.transport.soap.axis.AxisConnectorLifecycleTestCase
\ No newline at end of file

Modified: branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/CxfConnector.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/CxfConnector.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/CxfConnector.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -11,7 +11,7 @@
 package org.mule.transport.cxf;
 
 import org.mule.api.MuleException;
-import org.mule.api.context.notification.MuleContextNotificationListener;
+import org.mule.api.context.notification.ServiceNotificationListener;
 import org.mule.api.endpoint.EndpointBuilder;
 import org.mule.api.endpoint.EndpointURI;
 import org.mule.api.endpoint.InboundEndpoint;
@@ -21,7 +21,7 @@
 import org.mule.api.transport.MessageReceiver;
 import org.mule.component.DefaultJavaComponent;
 import org.mule.config.spring.SpringRegistry;
-import org.mule.context.notification.MuleContextNotification;
+import org.mule.context.notification.ServiceNotification;
 import org.mule.endpoint.EndpointURIEndpointBuilder;
 import org.mule.model.seda.SedaService;
 import org.mule.object.SingletonObjectFactory;
@@ -31,11 +31,11 @@
 import org.mule.transport.http.HttpConnector;
 import org.mule.transport.http.HttpConstants;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.namespace.QName;
 
@@ -52,7 +52,7 @@
 /**
  * Connects Mule to a CXF bus instance.
  */
-public class CxfConnector extends AbstractConnector implements MuleContextNotificationListener<MuleContextNotification>
+public class CxfConnector extends AbstractConnector implements ServiceNotificationListener<ServiceNotification>
 {
 
     public static final String CXF = "cxf";
@@ -65,7 +65,7 @@
     private Bus bus;
     private String configurationLocation;
     private String defaultFrontend = CxfConstants.JAX_WS_FRONTEND;
-    private List<SedaService> services = Collections.synchronizedList(new ArrayList<SedaService>());
+    private Map<String, Set<Service>> serviceToProtocolServices = Collections.synchronizedMap(new HashMap<String, Set<Service>>());
     private Map<String, Server> uriToServer = new HashMap<String, Server>();
     private boolean initializeStaticBusInstance = true;
     
@@ -218,20 +218,20 @@
         uriToServer.put(server.getEndpoint().getEndpointInfo().getAddress(), server);
         
         // TODO MULE-2228 Simplify this API
-        SedaService service = new SedaService();
-        service.setMuleContext(muleContext);
+        SedaService outerProtocolService = new SedaService();
+        outerProtocolService.setMuleContext(muleContext);
 
         String uniqueServiceName = createServiceName(server.getEndpoint());
-        service.setName(uniqueServiceName);
+        outerProtocolService.setName(uniqueServiceName);
+        
+        outerProtocolService.setModel(muleContext.getRegistry().lookupSystemModel());
 
-        service.setModel(muleContext.getRegistry().lookupSystemModel());
-
         CxfServiceComponent svcComponent = new CxfServiceComponent(this, (CxfMessageReceiver) receiver);
         svcComponent.setBus(bus);
 
         final DefaultJavaComponent component = new DefaultJavaComponent(new SingletonObjectFactory(svcComponent));
         component.setMuleContext(muleContext);
-        service.setComponent(component);
+        outerProtocolService.setComponent(component);
 
         // No determine if the endpointUri requires a new connector to be
         // registed in the case of http we only need to register the new
@@ -329,9 +329,17 @@
 
         receiver.setEndpoint(receiverEndpoint);
         
-        service.setInboundRouter(new DefaultInboundRouterCollection());
-        service.getInboundRouter().addEndpoint(protocolEndpoint);
-        services.add(service);
+        outerProtocolService.setInboundRouter(new DefaultInboundRouterCollection());
+        outerProtocolService.getInboundRouter().addEndpoint(protocolEndpoint);
+
+        // Add outer services to map so that we can easily look them on on user
+        // service lifecycle notifications
+        if (!serviceToProtocolServices.containsKey(receiver.getService().getName()))
+        {
+            serviceToProtocolServices.put(receiver.getService().getName(), new HashSet());
+        }
+        serviceToProtocolServices.get(receiver.getService().getName()).add(outerProtocolService);
+
     }
     
     /**
@@ -371,30 +379,42 @@
         }
     }
 
-    public void onNotification(MuleContextNotification event)
+    public void onNotification(ServiceNotification event)
     {
-        // We need to register the CXF service service once the model
-        // starts because
-        // when the model starts listeners on components are started, thus
-        // all listener
-        // need to be registered for this connector before the CXF service
-        // service is registered. The implication of this is that to add a
-        // new service and a
-        // different http port the model needs to be restarted before the
-        // listener is available
-        if (event.getAction() == MuleContextNotification.CONTEXT_STARTED)
+        // Only register/start the outer (CxfServiceComponent/protocol) services once
+        // the inner (user) service is started
+        if (event.getAction() == ServiceNotification.SERVICE_STARTED
+            && serviceToProtocolServices.get(event.getSource()) != null)
         {
-            for (Service service : services)
+            try
             {
-                try
+                for (Service outerService : serviceToProtocolServices.get(event.getSource()))
                 {
-                    muleContext.getRegistry().registerService(service);
+                    muleContext.getRegistry().registerService(outerService);
                 }
-                catch (MuleException e)
+            }
+            catch (MuleException e)
+            {
+                handleException(e);
+            }
+        }
+        // We need to stop the outer services first if they are not already stopped
+        // to avoid request failures.
+        else if (event.getAction() == ServiceNotification.SERVICE_STOPPING
+                 && serviceToProtocolServices.get(event.getSource()) != null)
+        {
+            try
+            {
+                for (Service outerService : serviceToProtocolServices.get(event.getSource()))
                 {
-                    handleException(e);
+                    muleContext.getRegistry().unregisterService(outerService.getName());
+                    serviceToProtocolServices.remove(event.getSource());
                 }
             }
+            catch (MuleException e)
+            {
+                handleException(e);;
+            }
         }
     }
     

Modified: branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -18,6 +18,7 @@
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.api.transformer.TransformerException;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 import org.mule.transport.soap.SoapConstants;
 import org.mule.util.TemplateParser;
 
@@ -239,7 +240,7 @@
         // One way dispatches over an async transport result in this
         if (transportResponse == null) 
         {
-            return null;
+            return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
         }
         
         // Otherwise we may have a response!

Modified: branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/support/ReversibleStaxInInterceptor.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/support/ReversibleStaxInInterceptor.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/cxf/src/main/java/org/mule/transport/cxf/support/ReversibleStaxInInterceptor.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -30,6 +30,7 @@
     public ReversibleStaxInInterceptor()
     {
         super(Phase.POST_STREAM);
+        getAfter().add(StreamClosingInterceptor.class.getName());
         getAfter().add(StaxInInterceptor.class.getName());
     }
 

Copied: branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorLifecycleTestCase.java (from rev 15991, branches/mule-3.x/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorLifecycleTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorLifecycleTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorLifecycleTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,72 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.transport.cxf;
+
+import org.mule.api.MuleException;
+import org.mule.api.service.Service;
+import org.mule.tck.FunctionalTestCase;
+
+public class CxfConnectorLifecycleTestCase extends FunctionalTestCase
+{
+
+    private static String SERVICE_NAME = "echoService";
+    private static String PROTOCOL_SERVICE_NAME = "_cxfServiceComponent{http|//localhost|63081/services/Echo}EchoComponent";
+
+    @Override
+    protected String getConfigResources()
+    {
+        return "basic-conf.xml";
+    }
+
+    /**
+     * MULE-4570
+     * 
+     * @throws MuleException
+     */
+    public void testStopService() throws MuleException
+    {
+        Service service = muleContext.getRegistry().lookupService(SERVICE_NAME);
+        Service protocolService = muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME);
+        assertNotNull(service);
+        assertTrue(service.isStarted());
+        assertNotNull(protocolService);
+        assertTrue(protocolService.isStarted());
+
+        service.stop();
+
+        assertFalse(service.isStarted());
+        assertFalse(protocolService.isStarted());
+        assertNull(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME));
+    }
+
+    /**
+     * MULE-4569
+     * 
+     * @throws MuleException
+     */
+    public void testRestartService() throws MuleException
+    {
+        Service service = muleContext.getRegistry().lookupService(SERVICE_NAME);
+        Service protocolService = muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME);
+
+        service.stop();
+        service.start();
+
+        // protocolService is recreated when service is restarted
+        protocolService = muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME);
+
+        assertTrue(service.isStarted());
+        assertTrue(protocolService.isStarted());
+        assertNotNull(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME));
+
+    }
+
+}

Copied: branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityFilterFunctionalTestCase.java (from rev 15991, branches/mule-3.x/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityFilterFunctionalTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityFilterFunctionalTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityFilterFunctionalTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,225 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.transport.cxf;
+
+import org.mule.tck.FunctionalTestCase;
+import org.mule.transport.http.HttpConstants;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+
+public class HttpSecurityFilterFunctionalTestCase extends FunctionalTestCase
+{
+    
+    private static String soapRequest = 
+        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:unk=\"http://unknown.namespace/\">" +
+           "<soapenv:Header/>" +
+           "<soapenv:Body>" +
+              "<unk:echo>" +         
+                 "<arg0>asdf</arg0>" +
+              "</unk:echo>" +
+           "</soapenv:Body>" +
+        "</soapenv:Envelope>";
+
+    protected String getConfigResources()
+    {
+        return "http-security-filter-test.xml";
+    }
+
+    /**
+     * By putting this test method that uses https first we can test MULE-4558
+     * 
+     * @throws Exception
+     */
+    public void testAuthenticationFailureBadCredentialsGetHttps() throws Exception
+    {
+        doGet(null, "localhost", "anonX", "anonX", "https://localhost:60444/services/Echo", true, true, 401);
+    }
+
+    public void testAuthenticationFailureNoContextGet() throws Exception
+    {
+        HttpClient client = new HttpClient();
+        client.getParams().setAuthenticationPreemptive(true);
+        GetMethod get = new GetMethod("http://localhost:60443/services/Echo");
+
+        get.setDoAuthentication(false);
+
+        try
+        {
+            int status = client.executeMethod(get);
+            assertEquals(HttpConstants.SC_UNAUTHORIZED, status);
+            assertEquals(
+                "Registered authentication is set to org.mule.module.acegi.filters.http.HttpBasicAuthenticationFilter "
+                                + "but there was no security context on the session. Authentication denied on "
+                                + "endpoint http://localhost:60443/services/Echo. Message payload is of type: "
+                                + "String", get.getResponseBodyAsString());
+        }
+        finally
+        {
+            get.releaseConnection();
+        }
+    }
+
+    public void testAuthenticationFailureNoContextPost() throws Exception
+    {
+        HttpClient client = new HttpClient();
+        client.getParams().setAuthenticationPreemptive(true);
+        PostMethod post = new PostMethod("http://localhost:60443/services/Echo");
+
+        post.setDoAuthentication(false);
+
+        StringRequestEntity requestEntity = new StringRequestEntity(soapRequest, "text/xml", "UTF-8");
+        post.setRequestEntity(requestEntity);
+
+        try
+        {
+            int status = client.executeMethod(post);
+            assertEquals(HttpConstants.SC_UNAUTHORIZED, status);
+            assertEquals(
+                "Registered authentication is set to org.mule.module.acegi.filters.http.HttpBasicAuthenticationFilter "
+                                + "but there was no security context on the session. Authentication denied on "
+                                + "endpoint http://localhost:60443/services/Echo. Message payload is of type: "
+                                + "ContentLengthInputStream",   post.getResponseBodyAsString());
+        }
+        finally
+        {
+            post.releaseConnection();
+        }
+    }
+
+    public void testAuthenticationFailureBadCredentialsGet() throws Exception
+    {
+        doGet(null, "localhost", "anonX", "anonX", "http://localhost:60443/services/Echo/echo/echo/hello", true, true, 401);
+    }
+
+    public void testAuthenticationFailureBadCredentialsPost() throws Exception
+    {
+        doPost(null, "localhost", "anonX", "anonX", "http://localhost:60443/services/Echo", true, true, 401);
+    }
+
+    public void testAuthenticationFailureBadCredentialsPostHttps() throws Exception
+    {
+        doPost(null, "localhost", "anonX", "anonX", "https://localhost:60444/services/Echo", true, true, 401);
+    }
+
+    public void testAuthenticationAuthorisedGet() throws Exception
+    {
+        doGet(null, "localhost", "anon", "anon", "http://localhost:60443/services/Echo/echo/echo/hello", false, true, 200);
+    }
+
+    public void testAuthenticationAuthorisedGetHttps() throws Exception
+    {
+        doGet(null, "localhost", "anon", "anon", "https://localhost:60444/services/Echo/echo/echo/hello", false, true, 200);
+    }
+
+    public void testAuthenticationAuthorisedPost() throws Exception
+    {
+        doPost(null, "localhost", "anon", "anon", "http://localhost:60443/services/Echo", false, true, 200);
+    }
+
+    public void testAuthenticationAuthorisedPostHttps() throws Exception
+    {
+        doPost(null, "localhost", "anon", "anon", "https://localhost:60444/services/Echo", false, true, 200);
+    }
+
+    public void testAuthenticationAuthorisedWithHandshakeGet() throws Exception
+    {
+        doGet(null, "localhost", "anon", "anon", "http://localhost:60443/services/Echo/echo/echo/hello", true, false, 200);
+    }
+
+    public void testAuthenticationAuthorisedWithHandshakePost() throws Exception
+    {
+        doPost(null, "localhost", "anon", "anon", "http://localhost:60443/services/Echo", true, false, 200);
+    }
+
+    public void testAuthenticationAuthorisedWithHandshakeAndBadRealmGet() throws Exception
+    {
+        doGet("blah", "localhost", "anon", "anon", "http://localhost:60443/services/Echo/echo/echo/hello", true, false, 401);
+    }
+
+    public void testAuthenticationAuthorisedWithHandshakeAndBadRealmPost() throws Exception
+    {
+        doPost("blah", "localhost", "anon", "anon", "http://localhost:60443/services/Echo", true, false, 401);
+    }
+
+    public void testAuthenticationAuthorisedWithHandshakeAndRealmGet() throws Exception
+    {
+        doGet("mule-realm", "localhost", "ross", "ross", "http://localhost:60443/services/Echo/echo/echo/hello", true, false,
+            200);
+    }
+
+    public void testAuthenticationAuthorisedWithHandshakeAndRealmPost() throws Exception
+    {
+        doPost("mule-realm", "localhost", "ross", "ross", "http://localhost:60443/services/Echo", true,
+            false, 200);
+    }
+
+    private void doGet(String realm,
+                       String host,
+                       String user,
+                       String pass,
+                       String url,
+                       boolean handshake,
+                       boolean preemtive,
+                       int result) throws Exception
+    {
+        HttpClient client = new HttpClient();
+        client.getParams().setAuthenticationPreemptive(preemtive);
+        client.getState().setCredentials(new AuthScope(host, -1, realm),
+            new UsernamePasswordCredentials(user, pass));
+        GetMethod get = new GetMethod(url);
+        get.setDoAuthentication(handshake);
+
+        try
+        {
+            int status = client.executeMethod(get);
+            assertEquals(result, status);
+        }
+        finally
+        {
+            get.releaseConnection();
+        }
+    }
+
+    private void doPost(String realm,
+                        String host,
+                        String user,
+                        String pass,
+                        String url,
+                        boolean handshake,
+                        boolean preemtive,
+                        int result) throws Exception
+    {
+        HttpClient client = new HttpClient();
+        client.getParams().setAuthenticationPreemptive(preemtive);
+        client.getState().setCredentials(new AuthScope(host, -1, realm),
+            new UsernamePasswordCredentials(user, pass));
+        PostMethod post = new PostMethod(url);
+        post.setDoAuthentication(handshake);
+        StringRequestEntity requestEntity = new StringRequestEntity(soapRequest, "text/xml", "UTF-8");
+        post.setRequestEntity(requestEntity);
+        try
+        {
+            int status = client.executeMethod(post);
+            assertEquals(result, status);
+            assertNotNull(post.getResponseBodyAsString());
+        }
+        finally
+        {
+            post.releaseConnection();
+        }
+    }
+
+}

Modified: branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/HttpSecurityTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -39,11 +39,12 @@
      * This test doesn't work in Maven because Mule can't load the keystores from the jars
      * @throws Exception
      */
-    public void xtestBasicAuth() throws Exception
+    public void testBasicAuth() throws Exception
     {
         HttpClient client = new HttpClient();
         Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
         client.getState().setCredentials(AuthScope.ANY, credentials);
+        client.getState().setAuthenticationPreemptive(true);
 
         PostMethod method = new PostMethod("https://localhost:60443/services/Echo");
         method.setDoAuthentication(true);
@@ -57,11 +58,11 @@
 
         credentials = new UsernamePasswordCredentials("admin", "adminasd");
         client.getState().setCredentials(AuthScope.ANY, credentials);
+        client.getState().setAuthenticationPreemptive(true);
+
         result = client.executeMethod(method);
 
-//        // this causes an error because mule tries to return the request as the response
-//        // and its already been read. Need to figure out how to configure Acegi differently...
-//        assertEquals(401, result);
+        assertEquals(401, result);
     }
 
     public void testBasicAuthWithCxfClient() throws Exception

Modified: branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/ProxyTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/ProxyTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/cxf/src/test/java/org/mule/transport/cxf/ProxyTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -30,10 +30,35 @@
     String msg = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
         + "<soap:Body><test xmlns=\"http://foo\"> foo </test>" + "</soap:Body>" + "</soap:Envelope>";
 
-    String msgWithComment = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><!-- This is a comment -->"
-                            + "<soap:Body><!-- This is a comment --><test xmlns=\"http://foo\"> foo </test>"
-                            + "</soap:Body>" + "</soap:Envelope>";
-    
+    String doGoogleSearch = "<urn:doGoogleSearch xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:urn=\"urn:GoogleSearch\">";
+
+    String msgWithComment = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+        + "<!-- comment 1 -->"
+        + "<soap:Header>"
+        + "<!-- comment 2 -->"
+        + "</soap:Header>"
+        + "<!-- comment 3 -->"
+        + "<soap:Body>"
+        + "<!-- comment 4 -->"
+        + doGoogleSearch
+        + "<!-- this comment breaks it -->"
+        + "<key>1</key>"
+        + "<!-- comment 5 -->"
+        + "<q>a</q>"
+        + "<start>0</start>"
+        + "<maxResults>1</maxResults>"
+        + "<filter>false</filter>"
+        + "<restrict>a</restrict>"
+        + "<safeSearch>true</safeSearch>"
+        + "<lr>a</lr>"
+        + "<ie>b</ie>"
+        + "<oe>c</oe>"
+        + "</urn:doGoogleSearch>"
+        + "<!-- comment 6 -->"
+        + "</soap:Body>"
+        + "<!-- comment 7 -->"
+        + "</soap:Envelope>";
+
     public void testServerWithEcho() throws Exception
     {
         MuleClient client = new MuleClient();
@@ -42,7 +67,7 @@
 //        System.out.println(resString);
         assertTrue(resString.indexOf("<test xmlns=\"http://foo\"> foo </test>") != -1);
     }
-    
+
     public void testServerClientProxy() throws Exception
     {
         String msg = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
@@ -195,7 +220,7 @@
         MuleClient client = new MuleClient();
         MuleMessage result = client.send("http://localhost:63081/services/envelope-proxy", msgWithComment, null);
         String resString = result.getPayloadAsString();
-        assertTrue(resString.indexOf("<test xmlns=\"http://foo\"> foo </test>") != -1);
+        assertTrue(resString.contains(doGoogleSearch));
     }
     
     protected String prepareOneWayTestMessage()
@@ -213,7 +238,7 @@
         props.put(HttpConnector.HTTP_CUSTOM_HEADERS_MAP_PROPERTY, httpHeaders);
         props.put("SOAPAction", "http://acme.com/oneway");
         return props;
-    }   
+    }
     
     protected String getConfigResources()
     {

Copied: branches/mule-3.x-messaging/transports/cxf/src/test/resources/clientKeystore (from rev 15991, branches/mule-3.x/transports/cxf/src/test/resources/clientKeystore)

(Binary files differ)

Copied: branches/mule-3.x-messaging/transports/cxf/src/test/resources/http-security-filter-test.xml (from rev 15991, branches/mule-3.x/transports/cxf/src/test/resources/http-security-filter-test.xml) (0 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/test/resources/http-security-filter-test.xml	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/cxf/src/test/resources/http-security-filter-test.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:spring="http://www.springframework.org/schema/beans"
+       xmlns:http="http://www.mulesoft.org/schema/mule/http"
+       xmlns:https="http://www.mulesoft.org/schema/mule/https"
+       xmlns:acegi="http://www.mulesoft.org/schema/mule/acegi"
+       xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
+    xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
+       http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.0/mule-http.xsd
+       http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/3.0/mule-https.xsd
+       http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.0/mule-cxf.xsd       
+       http://www.mulesoft.org/schema/mule/acegi http://www.mulesoft.org/schema/mule/acegi/3.0/mule-acegi.xsd">
+
+    <https:connector name="httpConnector">
+        <https:tls-client path="clientKeystore" storePassword="mulepassword"/>
+        <https:tls-key-store path="serverKeystore" keyPassword="mulepassword" storePassword="mulepassword"/>
+        <https:tls-server path="trustStore" storePassword="mulepassword"/>
+    </https:connector>
+
+    <spring:bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
+        <spring:property name="userDetailsService" ref="inMemoryDaoImpl"/>
+    </spring:bean>
+
+    <spring:bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
+        <spring:property name="userMap">
+            <spring:value>
+                ross=ross,ROLE_ADMIN
+                anon=anon,ROLE_ANONYMOUS
+            </spring:value>
+        </spring:property>
+    </spring:bean>
+
+    <acegi:security-manager>
+        <acegi:delegate-security-provider name="memory-dao" delegate-ref="daoAuthenticationProvider"/>
+    </acegi:security-manager>
+
+    <model name="http secured test model">
+        <service name="SecureUMO">
+            <inbound>
+                <cxf:inbound-endpoint 
+                    address="http://localhost:60443/services/Echo"
+                    frontend="simple"
+                    applySecurityToProtocol="true">
+                    <acegi:http-security-filter realm="mule-realm"/>
+                </cxf:inbound-endpoint>
+                <cxf:inbound-endpoint 
+                    address="https://localhost:60444/services/Echo"
+                    frontend="simple"
+                    applySecurityToProtocol="true">
+                    <acegi:http-security-filter realm="mule-realm"/>
+                </cxf:inbound-endpoint>
+            </inbound>
+            <echo-component/>
+        </service>
+    </model>
+
+</mule>

Modified: branches/mule-3.x-messaging/transports/cxf/src/test/resources/proxy-conf.xml (15992 => 15993)

--- branches/mule-3.x-messaging/transports/cxf/src/test/resources/proxy-conf.xml	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/cxf/src/test/resources/proxy-conf.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -203,6 +203,11 @@
                         <cxf-core:logging/>
                     </cxf:features>
                 </cxf:inbound-endpoint>
+                <cxf:inbound-endpoint address="http://localhost:63081/services/routeBasedOnSoapActionAsync" proxy="true" synchronous="false">
+                    <cxf:features>
+                        <cxf-core:logging/>
+                    </cxf:features>
+                </cxf:inbound-endpoint>
             </inbound>
             <outbound>
                 <filtering-router>
@@ -224,7 +229,7 @@
                 <filtering-router>
                     <cxf:outbound-endpoint address="http://localhost:63081/services/oneway" 
                         proxy="true"
-                        synchronous="true"/>
+                        synchronous="true" responseTimeout="2000"/>
                     <message-property-filter pattern="SOAPAction=http://acme.com/oneway"/>
                 </filtering-router>
             </outbound>

Copied: branches/mule-3.x-messaging/transports/cxf/src/test/resources/trustStore (from rev 15991, branches/mule-3.x/transports/cxf/src/test/resources/trustStore)

(Binary files differ)

Modified: branches/mule-3.x-messaging/transports/email/src/main/java/org/mule/transport/email/SmtpMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/email/src/main/java/org/mule/transport/email/SmtpMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/email/src/main/java/org/mule/transport/email/SmtpMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,6 +10,7 @@
 
 package org.mule.transport.email;
 
+import org.mule.DefaultMuleMessage;
 import org.mule.api.MuleEvent;
 import org.mule.api.MuleMessage;
 import org.mule.api.endpoint.EndpointException;
@@ -19,6 +20,7 @@
 import org.mule.config.i18n.CoreMessages;
 import org.mule.config.i18n.MessageFactory;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 
 import java.net.URLDecoder;
 import java.util.Calendar;
@@ -104,7 +106,7 @@
     protected MuleMessage doSend(MuleEvent event) throws Exception
     {
         doDispatch(event);
-        return null;
+        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
     }
 
     protected void sendMailMessage(Message message) throws MessagingException

Modified: branches/mule-3.x-messaging/transports/file/src/main/java/org/mule/transport/file/FileMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/file/src/main/java/org/mule/transport/file/FileMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/file/src/main/java/org/mule/transport/file/FileMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -18,6 +18,7 @@
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.api.transport.OutputHandler;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 import org.mule.transport.file.i18n.FileMessages;
 import org.mule.util.FileUtils;
 import org.mule.util.IOUtils;
@@ -148,7 +149,7 @@
     protected MuleMessage doSend(MuleEvent event) throws Exception
     {
         doDispatch(event);
-        return null;
+        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
     }
 
     protected void doDispose()

Modified: branches/mule-3.x-messaging/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,12 +10,14 @@
 
 package org.mule.transport.ftp;
 
+import org.mule.DefaultMuleMessage;
 import org.mule.api.MuleEvent;
 import org.mule.api.MuleMessage;
 import org.mule.api.endpoint.EndpointURI;
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.api.retry.RetryContext;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -74,7 +76,7 @@
     protected MuleMessage doSend(MuleEvent event) throws Exception
     {
         doDispatch(event);
-        return null;
+        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
     }
 
     protected void doConnect() throws Exception

Modified: branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -230,7 +230,7 @@
             httpMethod = (HttpMethod) sendTransformer.transform(msg);
         }
 
-        httpMethod.setFollowRedirects(connector.isFollowRedirects());
+        httpMethod.setFollowRedirects("true".equalsIgnoreCase((String)endpoint.getProperty("followRedirects")));
         return httpMethod;
     }
 
@@ -329,7 +329,8 @@
 
     protected MuleMessage handleRedirect(HttpMethod method, MuleEvent event) throws HttpResponseException, MuleException, IOException
     {
-        if (!connector.isFollowRedirects())
+        String followRedirects = (String)endpoint.getProperty("followRedirects");
+        if (followRedirects==null || "false".equalsIgnoreCase(followRedirects))
         {
             if (logger.isInfoEnabled())
             {
@@ -337,7 +338,7 @@
             }
             return getResponseFromMethod(method, null);
         }
-        Header locationHeader = method.getRequestHeader(HttpConstants.HEADER_LOCATION);
+        Header locationHeader = method.getResponseHeader(HttpConstants.HEADER_LOCATION);
         if (locationHeader == null)
         {
             throw new HttpResponseException(method.getStatusText(), method.getStatusCode());

Modified: branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpConnector.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpConnector.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpConnector.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -137,8 +137,6 @@
 
     protected HttpConnectionManager clientConnectionManager;
 
-    private boolean followRedirects = false;
-
     @Override
     protected void doInitialise() throws InitialisationException
     {
@@ -315,18 +313,8 @@
         this.clientConnectionManager = clientConnectionManager;
     }
 
-    public boolean isFollowRedirects()
+    HttpClient doClientConnect() throws Exception
     {
-        return followRedirects;
-    }
-    
-    public void setFollowRedirects(boolean followRedirects)
-    {
-        this.followRedirects = followRedirects;
-    }
-    
-    protected HttpClient doClientConnect() throws Exception
-    {
         HttpState state = new HttpState();
 
         if (getProxyUsername() != null)
@@ -343,7 +331,7 @@
         return client;
     }
 
-    protected void setupClientAuthorization(MuleEvent event, HttpMethod httpMethod,
+    void setupClientAuthorization(MuleEvent event, HttpMethod httpMethod,
                                             HttpClient client, ImmutableEndpoint endpoint)
             throws UnsupportedEncodingException
     {

Modified: branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpMessageAdapter.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpMessageAdapter.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpMessageAdapter.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -36,9 +36,9 @@
      */
     private static final long serialVersionUID = -1544495479333000422L;
 
-    private boolean http11 = true;
+    protected boolean http11 = true;
 
-    private Object message;
+    protected Object message;
 
     public HttpMessageAdapter(Object message)
     {

Modified: branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpResponse.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpResponse.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/HttpResponse.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -314,7 +314,10 @@
         {
             setHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE));
         }
-        setHeader(new Header(HttpConstants.HEADER_CONTENT_LENGTH, Long.toString(raw.length)));
+        if (!containsHeader(HttpConstants.HEADER_TRANSFER_ENCODING))
+        {
+            setHeader(new Header(HttpConstants.HEADER_CONTENT_LENGTH, Long.toString(raw.length)));
+        }        
         
         this.outputHandler = new OutputHandler() {
 

Modified: branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/transformers/MuleMessageToHttpResponse.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/transformers/MuleMessageToHttpResponse.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/java/org/mule/transport/http/transformers/MuleMessageToHttpResponse.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -72,11 +72,6 @@
     public Object transform(MuleMessage msg, String outputEncoding) throws TransformerException
     {
         Object src = msg.getPayload();
-        // Send back the exception payload if one has been set
-        if (msg.getExceptionPayload() != null)
-        {
-            // src = context.getMessage().getExceptionPayload();
-        }
 
         // Note this transformer excepts Null as we must always return a result
         // from the Http

Modified: branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/mule-http.xsd (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/mule-http.xsd	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/mule-http.xsd	2009-11-08 01:58:55 UTC (rev 15993)
@@ -258,6 +258,15 @@
             <xsd:extension base="mule:outboundEndpointType">
                 <xsd:attributeGroup ref="addressAttributes"/>
                 <xsd:attributeGroup ref="propertyAttributes"/>
+                <xsd:attribute name="followRedirects" type="xsd:boolean">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            If a request if made using GET that responds with a redirectLocation header, setting this to true will
+                            make the request on the redirect URL.  This only works when using GET since you cannot automatically follow
+                            redirects when perfroming a POST (a restriction according to RFC 2616).
+                        </xsd:documentation>
+                    </xsd:annotation>
+                    </xsd:attribute>
             </xsd:extension>
         </xsd:complexContent>
     </xsd:complexType>
@@ -275,6 +284,15 @@
             <xsd:extension base="mule:globalEndpointType">
                 <xsd:attributeGroup ref="addressAttributes"/>
                 <xsd:attributeGroup ref="propertyAttributes"/>
+                <xsd:attribute name="followRedirects" type="xsd:boolean">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            If a request if made using GET that responds with a redirectLocation header, setting this to true will
+                            make the request on the redirect URL.  This only works when using GET since you cannot automatically follow
+                            redirects when perfroming a POST (a restriction according to RFC 2616).
+                        </xsd:documentation>
+                    </xsd:annotation>
+                    </xsd:attribute>
             </xsd:extension>
         </xsd:complexContent>
     </xsd:complexType>

Modified: branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/services/org/mule/config/http-exception-mappings.properties (15992 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/services/org/mule/config/http-exception-mappings.properties	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/services/org/mule/config/http-exception-mappings.properties	2009-11-08 01:58:55 UTC (rev 15993)
@@ -5,10 +5,6 @@
 #set the error code on the underlying message
 error.code.property=http.status
 
-#a comma-separated list of other protocols these mappings can
-#be applied to
-apply.to=https,http
-
 #Exception to http status mappings
 java.lang.Exception=500
 org.mule.api.security.SecurityException=403

Copied: branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/services/org/mule/config/https-exception-mappings.properties (from rev 15991, branches/mule-3.x/transports/http/src/main/resources/META-INF/services/org/mule/config/https-exception-mappings.properties) (0 => 15993)

--- branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/services/org/mule/config/https-exception-mappings.properties	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/http/src/main/resources/META-INF/services/org/mule/config/https-exception-mappings.properties	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,12 @@
+#Http Error code mappings
+
+#This is the property to set the error code to no the message
+#it is the property name the Transport provider uses set the
+#set the error code on the underlying message
+error.code.property=http.status
+
+#Exception to http status mappings
+java.lang.Exception=500
+org.mule.api.security.SecurityException=403
+org.mule.api.security.UnauthorisedException=401
+org.mule.api.transport.NoReceiverForEndpointException=404

Modified: branches/mule-3.x-messaging/transports/jdbc/src/main/resources/META-INF/mule-jdbc.xsd (15992 => 15993)

--- branches/mule-3.x-messaging/transports/jdbc/src/main/resources/META-INF/mule-jdbc.xsd	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/jdbc/src/main/resources/META-INF/mule-jdbc.xsd	2009-11-08 01:58:55 UTC (rev 15993)
@@ -38,7 +38,12 @@
         <xsd:complexContent>
             <xsd:extension base="mule:connectorType">
                 <xsd:sequence>
-                    <xsd:element ref="abstract-sqlStatementStrategyFactory" minOccurs="0" maxOccurs="1"/>
+                    <xsd:element ref="abstract-sqlStatementStrategyFactory" minOccurs="0" maxOccurs="1">
+                        <xsd:annotation>
+                            <xsd:documentation>The factory that determines the
+                execution strategy based on the SQL provided.</xsd:documentation>
+                        </xsd:annotation>
+                    </xsd:element>
                     <xsd:element ref="abstract-query" minOccurs="0" maxOccurs="unbounded">
                         <xsd:annotation>
                             <xsd:documentation>Defines a set of queries. Each query has a key
@@ -51,7 +56,7 @@
                     type="mule:substitutableLong">
                     <xsd:annotation>
                         <xsd:documentation>
-                                                    The delay in milliseconds that will be used during two subsequent polls to the database. This is only applied to queries configured on inbound endpoints.
+                        The delay in milliseconds that will be used during two subsequent polls to the database. This is only applied to queries configured on inbound endpoints.
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
@@ -59,21 +64,21 @@
                     use="required">
                     <xsd:annotation>
                         <xsd:documentation>
-                                                    Reference to the JDBC DataSource object. This object is typically created using Spring. When using XA transactions, an XADataSource object must be provided.
+                        Reference to the JDBC DataSource object. This object is typically created using Spring. When using XA transactions, an XADataSource object must be provided.
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
                 <xsd:attribute name="queryRunner-ref" type="xsd:NMTOKEN">
                     <xsd:annotation>
                         <xsd:documentation>
-                                                    Reference to the QueryRunner object, which is the object that actually runs the Query. This object is typically created using Spring. Default is org.apache.commons.dbutils.QueryRunner.
+                        Reference to the QueryRunner object, which is the object that actually runs the Query. This object is typically created using Spring. Default is org.apache.commons.dbutils.QueryRunner.
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
                 <xsd:attribute name="resultSetHandler-ref" type="xsd:NMTOKEN">
                     <xsd:annotation>
                         <xsd:documentation>
-                                                    Reference to the ResultSetHandler object, which is the object that determines which java.sql.ResultSet gets handled. This object is typically created using Spring. Default is org.apache.commons.dbutils.handlers.MapListHandler, which steps through the ResultSet and stores records as Map objects on a List.
+                        Reference to the ResultSetHandler object, which is the object that determines which java.sql.ResultSet gets handled. This object is typically created using Spring. Default is org.apache.commons.dbutils.handlers.MapListHandler, which steps through the ResultSet and stores records as Map objects on a List.
                                                 </xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
@@ -93,7 +98,7 @@
         substitutionGroup="mule:abstract-inbound-endpoint">
         <xsd:annotation>
             <xsd:documentation>
-                            Receives or fetches data from a database. You can reference SQL select statements or call stored procedures on inbound endpoints. Statements on the inbound endpoint get invoked periodically according to the pollingInterval. Statements that contain an insert, update, or delete are not allowed.
+                Receives or fetches data from a database. You can reference SQL select statements or call stored procedures on inbound endpoints. Statements on the inbound endpoint get invoked periodically according to the pollingInterval. Statements that contain an insert, update, or delete are not allowed.
             </xsd:documentation>
         </xsd:annotation>
     </xsd:element>
@@ -112,7 +117,7 @@
         substitutionGroup="mule:abstract-outbound-endpoint">
         <xsd:annotation>
             <xsd:documentation>
-                            You can reference any SQL statement or call a stored procedure on outbound endpoints. Statements on the outbound endpoint get invoked synchronously. SQL select statements or stored procedures may return output that is handled by the ResultSetHandler and then attached to the message as the payload.
+                You can reference any SQL statement or call a stored procedure on outbound endpoints. Statements on the outbound endpoint get invoked synchronously. SQL select statements or stored procedures may return output that is handled by the ResultSetHandler and then attached to the message as the payload.
             </xsd:documentation>
         </xsd:annotation>
     </xsd:element>
@@ -150,7 +155,8 @@
     
     <xsd:element name="query" type="queryType" substitutionGroup="abstract-query">
         <xsd:annotation>
-            <xsd:documentation>Assigns a name (key) to a query (value). Queries
+            <xsd:documentation>
+                Assigns a name (key) to a query (value). Queries
                 are then referenced by key, such as jdbc://myQuery for
                 <![CDATA[<jdbc:query key="myQuery" value="select * from table"/>]]>
                 </xsd:documentation>
@@ -163,8 +169,16 @@
     </xsd:complexType>
     
     <xsd:attributeGroup name="addressAttributes">
-        <xsd:attribute name="queryKey" type="xsd:string"/>
-        <xsd:attribute name="pollingFrequency" type="mule:substitutableLong"/>
+        <xsd:attribute name="queryKey" type="xsd:string">
+                <xsd:annotation>
+                        <xsd:documentation>The key of the query to use.</xsd:documentation>
+                </xsd:annotation>
+        </xsd:attribute>
+        <xsd:attribute name="pollingFrequency" type="mule:substitutableLong">
+                <xsd:annotation>
+                        <xsd:documentation>The delay in milliseconds that will be used during two subsequent polls to the database.</xsd:documentation>
+                </xsd:annotation>
+        </xsd:attribute>
     </xsd:attributeGroup>
 
     <xsd:element name="transaction" type="transactionType" substitutionGroup="mule:abstract-transaction">
@@ -189,7 +203,8 @@
 
     <xsd:element name="sqlStatementStrategyFactory" type="sqlStatementStrategyFactoryType" substitutionGroup="abstract-sqlStatementStrategyFactory">
         <xsd:annotation>
-            <xsd:documentation>Override the default SqlStatementStrategyFactory. Determines the
+            <xsd:documentation>
+                Override the default SqlStatementStrategyFactory. Determines the
                 execution strategy based on the SQL provided.</xsd:documentation>
         </xsd:annotation>
     </xsd:element>

Modified: branches/mule-3.x-messaging/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -260,7 +260,7 @@
                     if (result == null)
                     {
                         logger.debug("No message was returned via replyTo destination");
-                        return null;
+                        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
                     }
                     else
                     {
@@ -282,7 +282,7 @@
                     if (result == null)
                     {
                         logger.debug("No message was returned via replyTo destination " + replyTo);
-                        return null;
+                        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
                     }
                     else
                     {

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzConnector.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzConnector.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzConnector.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -39,6 +39,7 @@
     public static final String PROPERTY_PAYLOAD = "payload";
 
     public static final String PROPERTY_JOB_CONFIG = "jobConfig";
+    public static final String PROPERTY_JOB_DATA = "jobData";
 
     public static final String PROPERTY_JOB_REF = "jobRef";
     public static final String PROPERTY_JOB_OBJECT = "jobObject";

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -10,11 +10,13 @@
 
 package org.mule.transport.quartz;
 
+import org.mule.DefaultMuleMessage;
 import org.mule.api.MuleEvent;
 import org.mule.api.MuleMessage;
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.config.i18n.CoreMessages;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 import org.mule.transport.quartz.config.JobConfig;
 import org.mule.transport.quartz.i18n.QuartzMessages;
 import org.mule.transport.quartz.jobs.CustomJob;
@@ -175,7 +177,7 @@
     protected MuleMessage doSend(MuleEvent event) throws Exception
     {
         doDispatch(event);
-        return null;
+        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
     }
 
     @Override

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/config/AbstractJobConfig.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/config/AbstractJobConfig.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/config/AbstractJobConfig.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -18,11 +18,13 @@
  */
 public abstract class AbstractJobConfig implements JobConfig, MuleContextAware
 {
+    private boolean stateful = false;
+
     private String groupName = QuartzConnector.DEFAULT_GROUP_NAME;
 
     private String jobGroupName = QuartzConnector.DEFAULT_GROUP_NAME;
 
-    private MuleContext muleContext;
+    private transient MuleContext muleContext;
 
     public void setMuleContext(MuleContext context)
     {
@@ -53,4 +55,24 @@
     {
         this.jobGroupName = jobGroupName;
     }
+
+    public boolean isStateful()
+    {
+        return stateful;
+    }
+
+    public void setStateful(boolean stateful)
+    {
+        this.stateful = stateful;
+    }
+
+    public final Class getJobClass()
+    {
+
+        return (isStateful() ? getStatefulJobClass() : getStatelessJobClass());
+    }
+
+    protected abstract Class getStatefulJobClass();
+    
+    protected abstract Class getStatelessJobClass();
 }

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobConfig.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobConfig.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobConfig.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -30,9 +30,13 @@
         this.job = job;
     }
 
-    public Class getJobClass()
+    protected Class getStatefulJobClass()
     {
+        return StatefulCustomJob.class;
+    }
+
+    protected Class getStatelessJobClass()
+    {
         return CustomJob.class;
     }
-
 }
\ No newline at end of file

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobFromMessageConfig.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobFromMessageConfig.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobFromMessageConfig.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -109,8 +109,13 @@
         this.expression = expression;
     }
 
-    public Class getJobClass()
+    protected Class getStatefulJobClass()
     {
+        return StatefulCustomJob.class;
+    }
+
+    protected Class getStatelessJobClass()
+    {
         return CustomJob.class;
     }
 

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EndpointPollingJobConfig.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EndpointPollingJobConfig.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EndpointPollingJobConfig.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -41,8 +41,13 @@
         this.timeout = timeout;
     }
 
-    public Class getJobClass()
+    protected Class getStatefulJobClass()
     {
+        return StatefulEndpointPollingJob.class;
+    }
+
+    protected Class getStatelessJobClass()
+    {
         return EndpointPollingJob.class;
     }
 }
\ No newline at end of file

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJob.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJob.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJob.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -12,7 +12,9 @@
 
 import org.mule.DefaultMuleMessage;
 import org.mule.api.MuleContext;
+import org.mule.api.MuleMessage;
 import org.mule.api.config.MuleProperties;
+import org.mule.api.transport.PropertyScope;
 import org.mule.transport.AbstractConnector;
 import org.mule.transport.AbstractMessageReceiver;
 import org.mule.transport.NullPayload;
@@ -99,7 +101,10 @@
                     payload = NullPayload.getInstance();
                 }
             }
-            receiver.routeMessage(new DefaultMuleMessage(receiver.getConnector().getMessageAdapter(payload), muleContext));
+            MuleMessage msg = new DefaultMuleMessage(receiver.getConnector().getMessageAdapter(payload), muleContext);
+            //If the job is stateful users cna store state in this map and have it available for the next job trigger
+            msg.setProperty(QuartzConnector.PROPERTY_JOB_DATA, jobExecutionContext.getJobDetail().getJobDataMap(), PropertyScope.INVOCATION);
+            receiver.routeMessage(msg);
         }
         catch (Exception e)
         {

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJobConfig.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJobConfig.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJobConfig.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -9,8 +9,8 @@
  */
 package org.mule.transport.quartz.jobs;
 
+import org.mule.transport.NullPayload;
 import org.mule.transport.quartz.config.AbstractJobConfig;
-import org.mule.transport.NullPayload;
 
 
 /**
@@ -30,9 +30,13 @@
         this.payload = payload;
     }
 
-    public Class getJobClass()
+    protected Class getStatefulJobClass()
     {
+        return StatefulEventGeneratorJob.class;
+    }
+
+    protected Class getStatelessJobClass()
+    {
         return EventGeneratorJob.class;
     }
-
 }

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJob.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJob.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJob.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -16,6 +16,8 @@
 import org.mule.transport.quartz.QuartzConnector;
 import org.mule.transport.quartz.i18n.QuartzMessages;
 
+import java.io.Serializable;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.quartz.Job;
@@ -24,10 +26,10 @@
 import org.quartz.JobExecutionException;
 
 /**
- * Will dispatch the current message to a Mule endpoint at a leter time.
- * This job can be used to fire timebased events.
+ * Will dispatch the current message to a Mule endpoint at a later time.
+ * This job can be used to fire time based events.
  */
-public class ScheduledDispatchJob implements Job
+public class ScheduledDispatchJob implements Job, Serializable
 {
     /**
      * The logger used for this class

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJobConfig.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJobConfig.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJobConfig.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -30,8 +30,13 @@
         this.endpointRef = endpointRef;
     }
 
-    public Class getJobClass()
+    protected Class getStatefulJobClass()
     {
+        return StatefulScheduledDispatchJob.class;
+    }
+
+    protected Class getStatelessJobClass()
+    {
         return ScheduledDispatchJob.class;
     }
 }
\ No newline at end of file

Copied: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulCustomJob.java (from rev 15991, branches/mule-3.x/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulCustomJob.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulCustomJob.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulCustomJob.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,21 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.transport.quartz.jobs;
+
+import org.quartz.StatefulJob;
+
+/**
+ * Same as {@link org.mule.transport.quartz.jobs.CustomJob} except the JobDetail state is persistent
+ * for each request and only one instance of the job will fire  at any given trigger. If the job does not
+ * complete before the next trigger the second execution is blocked until the job completes
+ */
+public class StatefulCustomJob extends CustomJob implements StatefulJob
+{
+}

Copied: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEndpointPollingJob.java (from rev 15991, branches/mule-3.x/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEndpointPollingJob.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEndpointPollingJob.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEndpointPollingJob.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,21 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.transport.quartz.jobs;
+
+import org.quartz.StatefulJob;
+
+/**
+ * Same as {@link org.mule.transport.quartz.jobs.EndpointPollingJob} except the JobDetail state is persistent
+ * for each request and only one instance of the job will fire  at any given trigger. If the job does not
+ * complete before the next trigger the second execution is blocked until the job completes
+ */
+public class StatefulEndpointPollingJob extends EndpointPollingJob implements StatefulJob
+{
+}

Copied: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEventGeneratorJob.java (from rev 15991, branches/mule-3.x/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEventGeneratorJob.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEventGeneratorJob.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulEventGeneratorJob.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,21 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.transport.quartz.jobs;
+
+import org.quartz.StatefulJob;
+
+/**
+ * Same as {@link org.mule.transport.quartz.jobs.EventGeneratorJob} except the JobDetail state is persistent
+ * for each request and only one instance of the job will fire  at any given trigger. If the job does not
+ * complete before the next trigger the second execution is blocked until the job completes
+ */
+public class StatefulEventGeneratorJob extends EventGeneratorJob implements StatefulJob
+{
+}

Copied: branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulScheduledDispatchJob.java (from rev 15991, branches/mule-3.x/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulScheduledDispatchJob.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulScheduledDispatchJob.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/StatefulScheduledDispatchJob.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,21 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+package org.mule.transport.quartz.jobs;
+
+import org.quartz.StatefulJob;
+
+/**
+ * Same as {@link org.mule.transport.quartz.jobs.ScheduledDispatchJob} except the JobDetail state is persistent
+ * for each request and only one instance of the job will fire  at any given trigger. If the job does not
+ * complete before the next trigger the second execution is blocked until the job completes
+ */
+public class StatefulScheduledDispatchJob extends ScheduledDispatchJob implements StatefulJob
+{
+}

Modified: branches/mule-3.x-messaging/transports/quartz/src/main/resources/META-INF/mule-quartz.xsd (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/main/resources/META-INF/mule-quartz.xsd	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/main/resources/META-INF/mule-quartz.xsd	2009-11-08 01:58:55 UTC (rev 15993)
@@ -122,6 +122,15 @@
                     <xsd:element ref="abstract-job" minOccurs="0" maxOccurs="1"/>
                 </xsd:sequence>
                 <xsd:attributeGroup ref="addressAttributes"/>
+                <xsd:attribute name="stateful" type="xsd:boolean">
+                <xsd:annotation>
+                    <xsd:documentation>
+                        Determines if the job is persistent. If so, the job detail state will be persisted for each
+                        request.  More importantly, each job triggered will execute sequentially. If the Job takes longer
+                        than the next trigger the next job will wait for the current job to execute.
+                    </xsd:documentation>
+                </xsd:annotation>
+            </xsd:attribute>
             </xsd:extension>
 
         </xsd:complexContent>

Modified: branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzCustomJobFromMessageTestCase.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzCustomJobFromMessageTestCase.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzCustomJobFromMessageTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -36,7 +36,7 @@
 
         MuleClient client = new MuleClient();
 
-        Map props = new HashMap();
+        Map<String, Object> props = new HashMap<String, Object>();
         ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig();
         jobConfig.setEndpointRef("vm://quartz.in");
         props.put(QuartzConnector.PROPERTY_JOB_CONFIG, jobConfig);
@@ -68,5 +68,4 @@
         // report more messages than requested during shutdown of the test/Mule server
         component.setEventCallback(null);
     }
-
 }

Copied: branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentCustomJobFromMessageTestCase.java (from rev 15991, branches/mule-3.x/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentCustomJobFromMessageTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentCustomJobFromMessageTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentCustomJobFromMessageTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.transport.quartz;
+
+import org.mule.api.MuleMessage;
+import org.mule.module.client.MuleClient;
+import org.mule.tck.FunctionalTestCase;
+import org.mule.transport.quartz.jobs.ScheduledDispatchJobConfig;
+
+public class QuartzPersistentCustomJobFromMessageTestCase extends FunctionalTestCase
+{
+//    private static final long TIMEOUT = 30000;
+    private static final long TIMEOUT = 3000000;
+
+    @Override
+    protected String getConfigResources()
+    {
+        return "quartz-persistent-custom-job-generator.xml";
+    }
+
+    public void testSendToCustomEventScheduler() throws Exception
+    {
+        MuleClient client = new MuleClient();
+
+        ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig();
+        jobConfig.setEndpointRef("vm://resultQueue");
+        client.send("vm://customJobQueue", jobConfig, null);
+        
+        MuleMessage result = client.request("vm://resultQueue", TIMEOUT);
+        assertNotNull(result);
+        assertTrue(result.getPayload() instanceof ScheduledDispatchJobConfig);
+    }
+}

Copied: branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentQueueEventGeneratorTestCase.java (from rev 15991, branches/mule-3.x/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentQueueEventGeneratorTestCase.java) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentQueueEventGeneratorTestCase.java	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzPersistentQueueEventGeneratorTestCase.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ * --------------------------------------------------------------------------------------
+ * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
+ *
+ * The software in this package is published under the terms of the CPAL v1.0
+ * license, a copy of which has been included with this distribution in the
+ * LICENSE.txt file.
+ */
+
+package org.mule.transport.quartz;
+
+import org.mule.api.MuleMessage;
+import org.mule.module.client.MuleClient;
+import org.mule.tck.FunctionalTestCase;
+import org.mule.transport.NullPayload;
+
+public class QuartzPersistentQueueEventGeneratorTestCase extends FunctionalTestCase
+{
+    private static final long TIMEOUT = 30000;
+
+    @Override
+    protected String getConfigResources()
+    {
+        return "quartz-persistent-event-generator.xml";
+    }
+    
+    public void testReceiveEvent() throws Exception
+    {
+        MuleClient client = new MuleClient();
+        
+        MuleMessage result = client.request("vm://resultQueue", TIMEOUT);
+        assertNotNull(result);
+        assertFalse(result.getPayload() instanceof NullPayload);
+        assertEquals(TEST_MESSAGE, result.getPayload());
+    }    
+}
+
+

Copied: branches/mule-3.x-messaging/transports/quartz/src/test/resources/quartz-persistent-custom-job-generator.xml (from rev 15991, branches/mule-3.x/transports/quartz/src/test/resources/quartz-persistent-custom-job-generator.xml) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/test/resources/quartz-persistent-custom-job-generator.xml	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/test/resources/quartz-persistent-custom-job-generator.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:spring="http://www.springframework.org/schema/beans"
+    xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
+    xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+    xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
+       http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd
+       http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/3.0/mule-quartz.xsd">
+
+    <vm:connector name="persistentVmConnector">
+        <vm:queue-profile persistent="true"/>
+    </vm:connector>
+
+    <!--
+        Messages are sent from the test case to the customJobQueue endpoint. This has to be used to
+        ensure that a message has been serialized and deserialized before it hits the quartz
+        endpoint in the CustomJobScheduler service.
+
+        Sending messages to the "customJobInput" endpoint only are routed sync, no matter what's
+        specified on the endpoint.
+    -->
+    <model>
+        <service name="VmTrampoline">
+            <inbound>
+                <vm:inbound-endpoint path="customJobQueue"/>
+            </inbound>
+            <outbound>
+                <pass-through-router>
+                    <vm:outbound-endpoint path="customJobInput"/>
+                </pass-through-router>
+            </outbound>
+        </service>
+
+        <service name="CustomJobScheduler">
+            <inbound>
+                <vm:inbound-endpoint path="customJobInput"/>
+            </inbound>
+            <outbound>
+                <pass-through-router>
+                    <quartz:outbound-endpoint jobName="myService2" repeatInterval="1000" repeatCount="1">
+                        <quartz:custom-job-from-message evaluator="payload" expression=""/>
+                    </quartz:outbound-endpoint>
+                </pass-through-router>
+            </outbound>
+            <queue-profile persistent="true"/>
+        </service>
+    </model>
+</mule>

Copied: branches/mule-3.x-messaging/transports/quartz/src/test/resources/quartz-persistent-event-generator.xml (from rev 15991, branches/mule-3.x/transports/quartz/src/test/resources/quartz-persistent-event-generator.xml) (0 => 15993)

--- branches/mule-3.x-messaging/transports/quartz/src/test/resources/quartz-persistent-event-generator.xml	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/quartz/src/test/resources/quartz-persistent-event-generator.xml	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mule xmlns="http://www.mulesoft.org/schema/mule/core"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:spring="http://www.springframework.org/schema/beans"
+    xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
+    xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+    xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
+       http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd
+       http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/3.0/mule-quartz.xsd">
+
+    <vm:connector name="vmConnector"/>
+
+    <model>
+        <service name="QuartzEventGenerator">
+            <inbound>
+                <quartz:inbound-endpoint jobName="eventTimer" repeatInterval="1000" repeatCount="1">
+                    <quartz:event-generator-job>
+                        <quartz:payload>Test Message</quartz:payload>
+                    </quartz:event-generator-job>
+                </quartz:inbound-endpoint>
+            </inbound>
+            <outbound>
+                <pass-through-router>
+                    <vm:outbound-endpoint path="resultQueue"/>
+                </pass-through-router>
+            </outbound>
+            <queue-profile persistent="true"/>
+        </service>
+    </model>
+</mule>

Modified: branches/mule-3.x-messaging/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -16,6 +16,7 @@
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.api.transformer.TransformerException;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 
 import java.lang.reflect.Method;
 import java.rmi.RMISecurityManager;
@@ -97,7 +98,7 @@
 
         if (result == null)
         {
-            return null;
+            return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
         }
         else
         {

Copied: branches/mule-3.x-messaging/transports/servlet/src/main/resources/META-INF/services/org/mule/config/jetty-exception-mappings.properties (from rev 15991, branches/mule-3.x/transports/servlet/src/main/resources/META-INF/services/org/mule/config/jetty-exception-mappings.properties) (0 => 15993)

--- branches/mule-3.x-messaging/transports/servlet/src/main/resources/META-INF/services/org/mule/config/jetty-exception-mappings.properties	                        (rev 0)
+++ branches/mule-3.x-messaging/transports/servlet/src/main/resources/META-INF/services/org/mule/config/jetty-exception-mappings.properties	2009-11-08 01:58:55 UTC (rev 15993)
@@ -0,0 +1,12 @@
+#Http Error code mappings
+
+#This is the property to set the error code to no the message
+#it is the property name the Transport provider uses set the
+#set the error code on the underlying message
+error.code.property=http.status
+
+#Exception to http status mappings
+java.lang.Exception=500
+org.mule.api.security.SecurityException=403
+org.mule.api.security.UnauthorisedException=401
+org.mule.api.transport.NoReceiverForEndpointException=404

Modified: branches/mule-3.x-messaging/transports/servlet/src/main/resources/META-INF/services/org/mule/config/servlet-exception-mappings.properties (15992 => 15993)

--- branches/mule-3.x-messaging/transports/servlet/src/main/resources/META-INF/services/org/mule/config/servlet-exception-mappings.properties	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/servlet/src/main/resources/META-INF/services/org/mule/config/servlet-exception-mappings.properties	2009-11-08 01:58:55 UTC (rev 15993)
@@ -5,10 +5,6 @@
 #set the error code on the underlying message
 error.code.property=http.status
 
-#a comma-separated list of other protocols these mappings can
-#be applied to
-apply.to=servlet,jetty
-
 #Exception to http status mappings
 java.lang.Exception=500
 org.mule.api.security.SecurityException=403

Modified: branches/mule-3.x-messaging/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -17,6 +17,7 @@
 import org.mule.api.retry.RetryContext;
 import org.mule.api.transformer.TransformerException;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
@@ -66,7 +67,7 @@
                     Object result = receiveFromSocket(socket, event.getTimeout(), endpoint);
                     if (result == null)
                     {
-                        return null;
+                        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
                     }
                     
                     if (result instanceof MuleMessage)
@@ -81,12 +82,12 @@
                     // we don't necessarily expect to receive a response here
                     logger.info("Socket timed out normally while doing a synchronous receive on endpointUri: "
                         + event.getEndpoint().getEndpointURI());
-                    return null;
+                    return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
                 }
             }
             else
             {
-                return null;
+                return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
             }
         }
         finally

Modified: branches/mule-3.x-messaging/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -17,6 +17,7 @@
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.api.retry.RetryContext;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 
 import java.io.IOException;
 import java.net.DatagramPacket;
@@ -136,13 +137,13 @@
             DatagramPacket result = receive(socket, event.getTimeout());
             if (result == null)
             {
-                return null;
+                return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
             }
             return new DefaultMuleMessage(connector.getMessageAdapter(result), event.getMessage(), connector.getMuleContext());
         }
         else
         {
-            return null;
+            return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
         }
     }
 

Modified: branches/mule-3.x-messaging/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageDispatcher.java (15992 => 15993)

--- branches/mule-3.x-messaging/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageDispatcher.java	2009-11-08 01:57:03 UTC (rev 15992)
+++ branches/mule-3.x-messaging/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageDispatcher.java	2009-11-08 01:58:55 UTC (rev 15993)
@@ -16,6 +16,7 @@
 import org.mule.api.endpoint.EndpointURI;
 import org.mule.api.endpoint.OutboundEndpoint;
 import org.mule.transport.AbstractMessageDispatcher;
+import org.mule.transport.NullPayload;
 
 import org.jivesoftware.smack.Chat;
 import org.jivesoftware.smack.GroupChat;
@@ -103,7 +104,7 @@
                 return new DefaultMuleMessage(connector.getMessageAdapter(response), connector.getMuleContext());
             }
         }
-        return null;
+        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
     }
 
     protected void sendMessage(MuleEvent event) throws Exception


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email