1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.management.discovery;
14 import org.simantics.db.service.ServerInformation;
18 * @author Tuukka Lehtonen
20 public class ServerInfo {
22 public static final ServerInfo[] NONE = {};
24 private final String name;
26 // private final ServerAddress address;
28 private final ServerInformation info;
30 private final String aux_info;
35 * @throws IllegalArgumentException if the address is not in host:port
38 // public ServerInfo(String name, String address) throws IllegalArgumentException {
39 // this(name, address, null, null);
42 // public ServerInfo(String name, String address, String aux_info) throws IllegalArgumentException {
43 // this(name, address, null, aux_info);
46 // public ServerInfo(String name) {
50 // public ServerInfo(String name, String aux_info) {
51 // this(name, aux_info, null);
54 // public ServerInfo(String name, String address, ServerInformation info) throws IllegalArgumentException {
55 // this(name, address, info, null);
58 public ServerInfo(String name, ServerInformation info, String aux_info) throws IllegalArgumentException {
60 // this.address = address == null ? null : new ServerAddress(address);
62 this.aux_info = aux_info;
65 // public ServerInfo(String name, ServerInformation info) {
66 // this(name, address, info, null);
69 // public ServerInfo(String name, ServerInformation info, String aux_info) {
71 //// this.address = address;
73 // this.aux_info = aux_info;
76 public String getName() {
80 // public ServerAddress getAddress() {
84 public ServerInformation getInfo() {
88 public String getAuxInfo() {
93 public String toString() {
94 String str = name + " "; //+ address;
101 public int hashCode() {
102 return ((name == null) ? 0 : name.hashCode());
106 public boolean equals(Object obj) {
109 if (obj == null || getClass() != obj.getClass())
111 final ServerInfo other = (ServerInfo) obj;
112 // if (address == null) {
113 // if (other.address != null)
115 // // The name field is used for equals
116 // // only when the address is null.
117 // if (!name.equals(other.name))
119 // } else if (!address.equals(other.address))
124 // public ServerInfo withAddress(ServerAddress address) {
125 // return new ServerInfo(name, address);