View Javadoc

1   /*
2    * $Id: JcaService.java 20064 2010-11-03 17:29:54Z aperepel $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.jca;
12  
13  import org.mule.api.MuleContext;
14  import org.mule.api.MuleEvent;
15  import org.mule.api.MuleException;
16  import org.mule.api.processor.MessageProcessorChainBuilder;
17  import org.mule.module.jca.i18n.JcaMessages;
18  import org.mule.service.AbstractService;
19  
20  /**
21   * <code>JcaService</code> Is the type of service used in Mule when embedded inside
22   * an app server using JCA. In the future we might want to use one of the existing
23   * models.
24   */
25  public class JcaService extends AbstractService
26  {
27  
28      /**
29       * Serial version
30       */
31      private static final long serialVersionUID = -1510441245219710451L;
32  
33      
34      public JcaService(MuleContext muleContext)
35      {
36          super(muleContext);
37      }
38      
39      /**
40       * This is the synchronous call method and not supported by components managed in
41       * a JCA container
42       * 
43       * @param event
44       * @throws MuleException
45       */
46      public MuleEvent sendEvent(MuleEvent event) throws MuleException
47      {
48          throw new UnsupportedOperationException("sendEvent()");
49      }
50  
51      public boolean isPaused()
52      {
53          // JcaService is a wrapper for a hosted service implementation and
54          // therefore cannot be paused by mule
55          return false;
56      }
57  
58      protected void waitIfPaused(MuleEvent event) throws InterruptedException
59      {
60          // JcaService is a wrapper for a hosted service implementation and
61          // therefore cannot be paused by mule
62      }
63  
64      protected void doPause() 
65      {
66          throw new UnsupportedOperationException(JcaMessages.cannotPauseResumeJcaComponent().getMessage());
67      }
68  
69      protected void doResume() 
70      {
71          throw new UnsupportedOperationException(JcaMessages.cannotPauseResumeJcaComponent().getMessage());
72      }
73  
74      @Override
75      protected void addMessageProcessors(MessageProcessorChainBuilder builder)
76      {
77          builder.chain(component);
78      }
79  }