View Javadoc

1   /*
2    * $Id: MuleManagedConnectionMetaData.java 7976 2007-08-21 14:26:13Z dirk.olmes $
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.ra;
12  
13  import org.mule.MuleManager;
14  import org.mule.ra.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 MuleManager.getConfiguration().getVendorName();
34      }
35  
36      public String getEISProductVersion() throws ResourceException
37      {
38          return MuleManager.getConfiguration().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  }