View Javadoc

1   /*
2    * $Id: MuleEndpointKey.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 javax.resource.spi.endpoint.MessageEndpointFactory;
14  
15  /**
16   * <code>MuleEndpointKey</code> TODO
17   */
18  public class MuleEndpointKey
19  {
20      final private MessageEndpointFactory messageEndpointFactory;
21      final private MuleActivationSpec activationSpec;
22  
23      /**
24       * @param messageEndpointFactory
25       * @param activationSpec
26       */
27      public MuleEndpointKey(MessageEndpointFactory messageEndpointFactory, MuleActivationSpec activationSpec)
28      {
29          this.messageEndpointFactory = messageEndpointFactory;
30          this.activationSpec = activationSpec;
31      }
32  
33      /**
34       * @return Returns the activationSpec.
35       */
36      public MuleActivationSpec getActivationSpec()
37      {
38          return activationSpec;
39      }
40  
41      /**
42       * @return Returns the messageEndpointFactory.
43       */
44      public MessageEndpointFactory getMessageEndpointFactory()
45      {
46          return messageEndpointFactory;
47      }
48  
49      /**
50       * @see java.lang.Object#hashCode()
51       */
52      public int hashCode()
53      {
54          return messageEndpointFactory.hashCode() ^ activationSpec.hashCode();
55      }
56  
57      /**
58       * @see java.lang.Object#equals(java.lang.Object)
59       */
60      public boolean equals(Object obj)
61      {
62          if (this == obj)
63          {
64              return true;
65          }
66  
67          if (obj == null)
68          {
69              return false;
70          }
71  
72          if (this.getClass() != obj.getClass())
73          {
74              return false;
75          }
76  
77          MuleEndpointKey o = (MuleEndpointKey)obj;
78          return o.activationSpec == activationSpec && o.messageEndpointFactory == messageEndpointFactory;
79      }
80  
81      public String toString()
82      {
83          return "MuleEndpointKey{" + "messageEndpointFactory=" + messageEndpointFactory + ", activationSpec="
84                 + activationSpec + "}";
85      }
86  }