View Javadoc

1   /*
2    * $Id: ConnectorService.java 19191 2010-08-25 21:05:23Z tcarlson $
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.management.mbean;
12  
13  import org.mule.api.MuleException;
14  import org.mule.api.lifecycle.InitialisationException;
15  import org.mule.api.transport.Connector;
16  import org.mule.util.ObjectNameHelper;
17  
18  public class ConnectorService implements ConnectorServiceMBean
19  {
20      private final Connector connector;
21      private final String name;
22  
23      public ConnectorService(final Connector connector)
24      {
25          this.connector = connector;
26          name = new ObjectNameHelper(connector.getMuleContext()).getConnectorName(connector);
27      }
28  
29      public boolean isStarted()
30      {
31          return connector.isStarted();
32      }
33  
34      public boolean isDisposed()
35      {
36          return connector.isDisposed();
37      }
38  
39      public String getName()
40      {
41          return name;
42      }
43  
44      public String getProtocol()
45      {
46          return connector.getProtocol();
47      }
48  
49      public void startConnector() throws MuleException
50      {
51          connector.start();
52      }
53  
54      public void stopConnector() throws MuleException
55      {
56          connector.stop();
57      }
58  
59      public void dispose()
60      {
61          connector.dispose();
62      }
63  
64      public void initialise() throws InitialisationException
65      {
66          connector.initialise();
67      }
68  
69  }