01: /*
02: * $Id: ConnectorService.java 11234 2008-03-06 23:44:34Z tcarlson $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.module.management.mbean;
12:
13: import org.mule.api.MuleException;
14: import org.mule.api.lifecycle.InitialisationException;
15: import org.mule.api.lifecycle.LifecycleTransitionResult;
16: import org.mule.api.transport.Connector;
17: import org.mule.util.ObjectNameHelper;
18:
19: import java.beans.ExceptionListener;
20:
21: public class ConnectorService implements ConnectorServiceMBean {
22: private final Connector connector;
23: private final String name;
24:
25: public ConnectorService(final Connector connector) {
26: this .connector = connector;
27: name = ObjectNameHelper.getConnectorName(connector);
28: }
29:
30: public boolean isStarted() {
31: return connector.isStarted();
32: }
33:
34: public boolean isDisposed() {
35: return connector.isDisposed();
36: }
37:
38: public boolean isDisposing() {
39: return connector.isDisposing();
40: }
41:
42: public String getName() {
43: return name;
44: }
45:
46: public String getProtocol() {
47: return connector.getProtocol();
48: }
49:
50: public ExceptionListener getExceptionListener() {
51: return connector.getExceptionListener();
52: }
53:
54: public void startConnector() throws MuleException {
55: connector.start();
56: }
57:
58: public void stopConnector() throws MuleException {
59: connector.stop();
60: }
61:
62: public void dispose() {
63: connector.dispose();
64: }
65:
66: public LifecycleTransitionResult initialise()
67: throws InitialisationException {
68: return connector.initialise();
69: }
70:
71: }
|