View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.jca;
8   
9   import org.mule.config.MuleManifest;
10  import org.mule.module.jca.i18n.JcaMessages;
11  
12  import javax.resource.ResourceException;
13  import javax.resource.spi.ManagedConnectionMetaData;
14  
15  /**
16   * <code>MuleManagedConnectionMetaData</code> TODO
17   */
18  public class MuleManagedConnectionMetaData implements ManagedConnectionMetaData
19  {
20      private final MuleManagedConnection managedConnection;
21  
22      public MuleManagedConnectionMetaData(MuleManagedConnection mc)
23      {
24          this.managedConnection = mc;
25      }
26  
27      public String getEISProductName() throws ResourceException
28      {
29          return MuleManifest.getVendorName();
30      }
31  
32      public String getEISProductVersion() throws ResourceException
33      {
34          return MuleManifest.getProductVersion();
35      }
36  
37      // TODO
38      public int getMaxConnections() throws ResourceException
39      {
40          return 0;
41      }
42  
43      public String getUserName() throws ResourceException
44      {
45          if (managedConnection.isDestroyed())
46          {
47              throw new IllegalStateException(
48                  JcaMessages.objectIsDisposed(managedConnection).toString());
49          }
50          return managedConnection.getUsername();
51      }
52  }