1. /*
  2. * @(#)EndPointInfoImpl.java 1.35 04/06/21
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.legacy.connection;
  8. import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
  9. import com.sun.corba.se.spi.transport.SocketInfo;
  10. public class EndPointInfoImpl
  11. implements
  12. SocketInfo,
  13. LegacyServerSocketEndPointInfo
  14. {
  15. protected String type;
  16. protected String hostname;
  17. protected int port;
  18. protected int locatorPort;
  19. protected String name;
  20. public EndPointInfoImpl(String type, int port, String hostname) {
  21. this.type = type;
  22. this.port = port;
  23. this.hostname = hostname;
  24. this.locatorPort = -1;
  25. this.name = LegacyServerSocketEndPointInfo.NO_NAME;
  26. }
  27. public String getType() {
  28. return type;
  29. }
  30. public String getHost() {
  31. return hostname;
  32. }
  33. public String getHostName() {
  34. return hostname;
  35. }
  36. public int getPort() {
  37. return port;
  38. }
  39. public int getLocatorPort ()
  40. {
  41. return locatorPort;
  42. }
  43. public void setLocatorPort (int port)
  44. {
  45. locatorPort = port;
  46. }
  47. public String getName()
  48. {
  49. return name;
  50. }
  51. public int hashCode() {
  52. return type.hashCode() ^ hostname.hashCode() ^ port;
  53. }
  54. public boolean equals(Object obj) {
  55. if (!(obj instanceof EndPointInfoImpl)) {
  56. return false;
  57. }
  58. EndPointInfoImpl other = (EndPointInfoImpl)obj;
  59. if (type == null) {
  60. if (other.type != null) {
  61. return false;
  62. }
  63. } else if (!type.equals(other.type)) {
  64. return false;
  65. }
  66. if (port != other.port) {
  67. return false;
  68. }
  69. if (!hostname.equals(other.hostname)) {
  70. return false;
  71. }
  72. return true;
  73. }
  74. public String toString ()
  75. {
  76. return
  77. type + " " +
  78. name + " " +
  79. hostname + " " +
  80. port;
  81. }
  82. }
  83. // End of file.