2 * BioJava development code
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,
9 * http://www.gnu.org/copyleft/lesser.html
11 * Copyright for this code is held jointly by the individual
12 * authors. These should be listed in @author doc comments.
14 * For more information on the BioJava project and its aims,
15 * or to join the biojava-l mailing list, visit the home page
18 * http://www.biojava.org/
20 * Created on 15.04.2004
21 * @author Andreas Prlic
24 package org.biojava.dasobert.dasregistry;
28 // import org.biojava.dasobert.das2.io.DasSourceWriter;
29 // import org.biojava.dasobert.das2.io.DasSourceWriterImpl;
30 // import org.biojava.utils.xml.PrettyXMLWriter;
33 * a simple Bean class to be returned via SOAP
35 * @author Andreas Prlic
38 public class Das1Source implements DasSource
42 protected String nickname;
48 DasCoordinateSystem[] coordinateSystem;
50 String[] capabilities;
68 public static String EMPTY_ID = "UNK:-1";
76 // String empty = "" ;
78 coordinateSystem = new DasCoordinateSystem[0];
79 // coordinateSystem[0] = new DasCoordinateSystem();
80 capabilities = new String[0];
81 labels = new String[0];
82 // capabilities[0] = empty ;
83 registerDate = new Date();
84 leaseDate = new Date();
89 public boolean equals(DasSource other)
91 System.out.println("Das1Source equals, comparing with other DasSource");
92 if (!(other instanceof Das1Source))
97 Das1Source ods = (Das1Source) other;
99 if (ods.getUrl().equals(url))
103 if (ods.getNickname().equals(nickname))
110 public int hashCode()
114 h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
115 h = 31 * h + (null == url ? 0 : url.hashCode());
121 * the DAS2 string representation of this DAS source
123 * public String toString() {
125 * StringWriter writer = new StringWriter();
127 * PrintWriter pw = new PrintWriter(writer); PrettyXMLWriter xw = new
128 * PrettyXMLWriter(pw);
130 * DasSourceWriter dswriter = new DasSourceWriterImpl(); try {
131 * dswriter.writeDasSource(xw,this); } catch (IOException e){
132 * e.printStackTrace(); }
134 * return writer.toString();
137 public void setLocal(boolean flag)
142 public boolean isLocal()
147 public void setId(String i)
153 * get a the Id of the DasSource. The Id is a unique db identifier. The public
154 * DAS-Registry has Auto_Ids that look like DASSOURCE:12345; public look like
155 * XYZ:12345, where the XYZ prefix can be configured in the config file.
157 public String getId()
162 public void setNickname(String name)
167 public String getNickname()
172 public void setUrl(String u)
174 char lastChar = u.charAt(u.length() - 1);
183 public void setAdminemail(String u)
188 public void setDescription(String u)
193 public void setCoordinateSystem(DasCoordinateSystem[] u)
195 coordinateSystem = u;
198 public void setCapabilities(String[] u)
203 public String getUrl()
208 public String getAdminemail()
213 public String getDescription()
218 public String[] getCapabilities()
224 * test if a this source has a particular capability
226 * @param testCapability
227 * @return <code>true</code> if the server has this capability.
229 public boolean hasCapability(String testCapability)
231 for (int i = 0; i < capabilities.length; i++)
233 String cap = capabilities[i];
234 if (cap.equals(testCapability))
240 public DasCoordinateSystem[] getCoordinateSystem()
242 return coordinateSystem;
245 public void setRegisterDate(Date d)
250 public Date getRegisterDate()
255 public void setLeaseDate(Date d)
260 public Date getLeaseDate()
265 public void setLabels(String[] ls)
270 public String[] getLabels()
275 public void setHelperurl(String url)
280 public String getHelperurl()
285 public void setAlertAdmin(boolean flag)
290 public boolean getAlertAdmin()
295 public Map getProperties()
300 public void setProperties(Map properties)
302 this.properties = properties;