Das client files
[jalview.git] / src / org / biojava / dasobert / dasregistry / Das1Source.java
1 /*
2  *                    BioJava development code
3  *
4  * This code may be freely distributed and modified under the
5  * terms of the GNU Lesser General Public Licence.  This should
6  * be distributed with the code.  If you do not have a copy,
7  * see:
8  *
9  *      http://www.gnu.org/copyleft/lesser.html
10  *
11  * Copyright for this code is held jointly by the individual
12  * authors.  These should be listed in @author doc comments.
13  *
14  * For more information on the BioJava project and its aims,
15  * or to join the biojava-l mailing list, visit the home page
16  * at:
17  *
18  *      http://www.biojava.org/
19  *
20  * Created on 15.04.2004
21  * @author Andreas Prlic
22  *
23  */
24 package org.biojava.dasobert.dasregistry;
25
26 import java.util.Date ;
27 import java.io.IOException;
28 import java.io.PrintWriter;
29 import java.io.StringWriter;
30
31
32
33 /** a simple Bean class to be returned via SOAP
34  * @author Andreas Prlic
35  */
36
37 public class Das1Source implements DasSource {
38     String url                ;
39     protected String nickname           ;
40     String adminemail         ;
41     String description        ;
42     DasCoordinateSystem[] coordinateSystem ;
43     String[] capabilities     ;
44     String[] labels           ;
45     String helperurl          ;
46     Date   registerDate       ;
47     Date   leaseDate          ;
48     String id                 ;
49     boolean local;
50
51     boolean alertAdmin;
52
53     public static String EMPTY_ID = "UNK:-1" ;
54
55     public Das1Source () {
56         id               = EMPTY_ID;
57         url              = "";
58         adminemail       = "" ;
59         description      = "" ;
60         //String empty     = "" ;
61         nickname         = "" ;
62         coordinateSystem = new DasCoordinateSystem[0];
63         //coordinateSystem[0] = new DasCoordinateSystem();
64         capabilities     =  new String[0];
65         labels           = new String[0];
66         //capabilities[0]  = empty ;
67         registerDate     = new Date() ;
68         leaseDate        = new Date() ;
69         helperurl        = "";
70         local=true;
71     }
72
73
74     public boolean equals(DasSource other){
75         System.out.println("Das1Source equals, comparing with other DasSource");
76         if (! (other instanceof Das1Source))
77             return false;
78
79         Das1Source ods = (Das1Source) other;
80
81         if ( ods.getUrl().equals(url))
82             return true;
83         if ( ods.getNickname().equals(nickname))
84             return true;
85         return false;
86     }
87
88     public int hashCode() {
89         int h = 7;
90
91         h = 31 * h + ( null == nickname ? 0 : nickname.hashCode());
92         h = 31 * h + ( null == url ? 0 : url.hashCode());
93
94         return h;
95     }
96
97     public void setLocal(boolean flag){ local = flag;}
98     public boolean isLocal(){return local;}
99
100     public void setId(String i) { id = i; }
101
102     /** get a the Id of the DasSource. The Id is a unique db
103      * identifier. The public DAS-Registry has Auto_Ids that look like
104      * DASSOURCE:12345; public look like XYZ:12345, where the XYZ
105      * prefix can be configured in the config file.
106      */
107     public String getId() { return id;}
108
109     public void setNickname(String name) {
110         nickname = name ;
111     }
112     public String getNickname(){
113         return nickname;
114     }
115     public void setUrl(String u) {
116         char lastChar = u.charAt(u.length()-1);
117         if ( lastChar  != '/')
118             u += "/";
119
120         url = u ;
121     }
122
123     public void setAdminemail (String u) {
124         adminemail = u ;
125     }
126
127     public void setDescription (String u) {
128         description = u;
129     }
130
131     public void setCoordinateSystem (DasCoordinateSystem[] u){
132         coordinateSystem=u ;
133     }
134
135     public void setCapabilities (String[] u){
136         capabilities = u ;
137     }
138
139     public String getUrl(){return url;}
140     public String getAdminemail(){return adminemail;}
141     public String getDescription(){return description;}
142     public String[] getCapabilities(){return capabilities;}
143     public DasCoordinateSystem[] getCoordinateSystem(){return coordinateSystem;}
144
145     public void setRegisterDate(Date d) {
146         registerDate = d;
147     }
148     public Date getRegisterDate() {
149         return registerDate ;
150     }
151     public void setLeaseDate(Date d) {
152         leaseDate =d ;
153     }
154     public Date getLeaseDate() {
155         return leaseDate ;
156     }
157
158     public void setLabels(String[] ls) {
159         labels = ls ;
160     }
161
162     public String[] getLabels() {
163         return labels;
164     }
165
166     public void setHelperurl(String url) {
167         helperurl = url;
168     }
169
170     public String getHelperurl() {
171         return helperurl;
172     }
173
174     public void setAlertAdmin(boolean flag) {
175         alertAdmin = flag;
176     }
177
178     public boolean getAlertAdmin() {
179         return alertAdmin;
180     }
181
182 }