]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.management/src/org/simantics/db/management/discovery/ServerInfo.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.management / src / org / simantics / db / management / discovery / ServerInfo.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.management.discovery;
13
14 import org.simantics.db.service.ServerInformation;
15
16
17 /**
18  * @author Tuukka Lehtonen
19  */
20 public class ServerInfo {
21
22     public static final ServerInfo[] NONE = {};
23
24     private final String             name;
25
26 //    private final ServerAddress  address;
27     
28     private final ServerInformation  info;
29     
30     private final String aux_info;
31
32     /**
33      * @param name
34      * @param address
35      * @throws IllegalArgumentException if the address is not in host:port
36      *         format
37      */
38 //    public ServerInfo(String name, String address) throws IllegalArgumentException {
39 //        this(name, address, null, null);
40 //    }
41     
42 //    public ServerInfo(String name, String address, String aux_info) throws IllegalArgumentException {
43 //        this(name, address, null, aux_info);
44 //    }
45 //
46 //    public ServerInfo(String name) {
47 //        this(name, null);
48 //    }
49 //    
50 //    public ServerInfo(String name, String aux_info) {
51 //        this(name, aux_info, null);
52 //    }
53 //
54 //    public ServerInfo(String name, String address, ServerInformation info) throws IllegalArgumentException {
55 //        this(name, address, info, null);
56 //    }
57 //
58     public ServerInfo(String name, ServerInformation info, String aux_info) throws IllegalArgumentException {
59         this.name = name;
60 //        this.address = address == null ? null : new ServerAddress(address);
61         this.info = info;
62         this.aux_info = aux_info;
63     }
64 //
65 //    public ServerInfo(String name, ServerInformation info) {
66 //        this(name, address, info, null);
67 //    }
68 //    
69 //    public ServerInfo(String name, ServerInformation info, String aux_info) {
70 //        this.name = name;
71 ////        this.address = address;
72 //        this.info = info;
73 //        this.aux_info = aux_info;
74 //    }
75
76     public String getName() {
77         return name;
78     }
79
80 //    public ServerAddress getAddress() {
81 //        return address;
82 //    }
83
84     public ServerInformation getInfo() {
85         return info;
86     }
87     
88     public String getAuxInfo() {
89         return aux_info;
90     }
91
92     @Override
93     public String toString() {
94         String str = name + " "; //+ address;
95         if(aux_info != null)
96                 str += " "+aux_info;
97         return str;
98     }
99
100     @Override
101     public int hashCode() {
102         return ((name == null) ? 0 : name.hashCode());
103     }
104
105     @Override
106     public boolean equals(Object obj) {
107         if (this == obj)
108             return true;
109         if (obj == null || getClass() != obj.getClass())
110             return false;
111         final ServerInfo other = (ServerInfo) obj;
112 //        if (address == null) {
113 //            if (other.address != null)
114 //                return false;
115 //            // The name field is used for equals
116 //            // only when the address is null.
117 //            if (!name.equals(other.name))
118 //                return false;
119 //        } else if (!address.equals(other.address))
120 //            return false;
121         return true;
122     }
123
124 //    public ServerInfo withAddress(ServerAddress address) {
125 //        return new ServerInfo(name, address);
126 //    }
127
128 }