1 /*
2 * $Id: JcaService.java 11414 2008-03-18 03:16:19Z dfeist $
3 * --------------------------------------------------------------------------------------
4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.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.MuleEvent;
14 import org.mule.api.MuleException;
15 import org.mule.api.MuleMessage;
16 import org.mule.api.service.ServiceException;
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 * This is the synchronous call method and not supported by components managed in
35 * a JCA container
36 *
37 * @param event
38 * @return
39 * @throws MuleException
40 */
41 public MuleMessage sendEvent(MuleEvent event) throws MuleException
42 {
43 throw new UnsupportedOperationException("sendEvent()");
44 }
45
46 public boolean isPaused()
47 {
48 // JcaService is a wrapper for a hosted service implementation and
49 // therefore cannot be paused by mule
50 return false;
51 }
52
53 protected void waitIfPaused(MuleEvent event) throws InterruptedException
54 {
55 // JcaService is a wrapper for a hosted service implementation and
56 // therefore cannot be paused by mule
57 }
58
59 protected void doPause() throws MuleException
60 {
61 throw new ServiceException(JcaMessages.cannotPauseResumeJcaComponent(), null, this);
62 }
63
64 protected void doResume() throws MuleException
65 {
66 throw new ServiceException(JcaMessages.cannotPauseResumeJcaComponent(), null, this);
67 }
68
69 protected void doDispatch(MuleEvent event) throws MuleException
70 {
71 component.onCall(event);
72 }
73
74 /**
75 * Implementation of template method which is never call because send() is
76 * overwritten
77 */
78 protected MuleMessage doSend(MuleEvent event) throws MuleException
79 {
80 return null;
81 }
82
83 }