View Javadoc

1   /*
2    * $Id: MuleManagedConnectionMetaData.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.jca;
12  
13  import org.mule.config.MuleManifest;
14  import org.mule.module.jca.i18n.JcaMessages;
15  
16  import javax.resource.ResourceException;
17  import javax.resource.spi.ManagedConnectionMetaData;
18  
19  /**
20   * <code>MuleManagedConnectionMetaData</code> TODO
21   */
22  public class MuleManagedConnectionMetaData implements ManagedConnectionMetaData
23  {
24      private final MuleManagedConnection managedConnection;
25  
26      public MuleManagedConnectionMetaData(MuleManagedConnection mc)
27      {
28          this.managedConnection = mc;
29      }
30  
31      public String getEISProductName() throws ResourceException
32      {
33          return MuleManifest.getVendorName();
34      }
35  
36      public String getEISProductVersion() throws ResourceException
37      {
38          return MuleManifest.getProductVersion();
39      }
40  
41      // TODO
42      public int getMaxConnections() throws ResourceException
43      {
44          return 0;
45      }
46  
47      public String getUserName() throws ResourceException
48      {
49          if (managedConnection.isDestroyed())
50          {
51              throw new IllegalStateException(
52                  JcaMessages.objectIsDisposed(managedConnection).toString());
53          }
54          return managedConnection.getUsername();
55      }
56  }