| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | |
| | | */ |
| | | public class ConnectionHandlerDescriptor |
| | | { |
| | | private Set<CustomSearchResult> monitoringEntries = Collections.emptySet(); |
| | | |
| | | /** |
| | | * Enumeration used to represent the state of the listener. |
| | | */ |
| | |
| | | * @param protocol the protocol of the listener. |
| | | * @param state the state of the connection handler (enabled, disabled, etc.). |
| | | * @param name the name of the listener. |
| | | * @param monitoringEntries the LDAP entries containing the monitoring |
| | | * information. |
| | | */ |
| | | public ConnectionHandlerDescriptor(Collection<InetAddress> addresses, |
| | | int port, Protocol protocol, State state, String name) |
| | | int port, Protocol protocol, State state, String name, |
| | | Set<CustomSearchResult> monitoringEntries) |
| | | { |
| | | this.addresses.addAll(addresses); |
| | | this.port = port; |
| | | this.protocol = protocol; |
| | | this.state = state; |
| | | this.name = name; |
| | | this.monitoringEntries = Collections.unmodifiableSet(monitoringEntries); |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append(getProtocol() + " " + getState() + " "); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the monitoring entries. |
| | | * @return the monitoring entries. |
| | | */ |
| | | public Set<CustomSearchResult> getMonitoringEntries() |
| | | { |
| | | return monitoringEntries; |
| | | } |
| | | |
| | | /** |
| | | * Sets the monitoring entries. |
| | | * @param monitoringEntries the monitoring entries. |
| | | */ |
| | | public void setMonitoringEntries(Set<CustomSearchResult> monitoringEntries) |
| | | { |
| | | this.monitoringEntries = Collections.unmodifiableSet(monitoringEntries); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | |
| | | else if (o instanceof ConnectionHandlerDescriptor) |
| | | { |
| | | equals = toString.equals(o.toString()); |
| | | if (equals) |
| | | { |
| | | ConnectionHandlerDescriptor ch = |
| | | (ConnectionHandlerDescriptor)o; |
| | | // Compare monitoring entries |
| | | equals = (getMonitoringEntries().equals(ch.getMonitoringEntries())); |
| | | } |
| | | } |
| | | return equals; |
| | | } |