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;
26 import java.util.Date ;
27 import java.io.IOException;
28 import java.io.PrintWriter;
29 import java.io.StringWriter;
32 //import org.biojava.dasobert.das2.io.DasSourceWriter;
33 //import org.biojava.dasobert.das2.io.DasSourceWriterImpl;
34 //import org.biojava.utils.xml.PrettyXMLWriter;
37 /** a simple Bean class to be returned via SOAP
38 * @author Andreas Prlic
41 public class Das1Source implements DasSource {
43 protected String nickname ;
46 DasCoordinateSystem[] coordinateSystem ;
47 String[] capabilities ;
57 public static String EMPTY_ID = "UNK:-1" ;
59 public Das1Source () {
66 coordinateSystem = new DasCoordinateSystem[0];
67 //coordinateSystem[0] = new DasCoordinateSystem();
68 capabilities = new String[0];
69 labels = new String[0];
70 //capabilities[0] = empty ;
71 registerDate = new Date() ;
72 leaseDate = new Date() ;
78 public boolean equals(DasSource other){
79 System.out.println("Das1Source equals, comparing with other DasSource");
80 if (! (other instanceof Das1Source))
83 Das1Source ods = (Das1Source) other;
85 if ( ods.getUrl().equals(url))
87 if ( ods.getNickname().equals(nickname))
92 public int hashCode() {
95 h = 31 * h + ( null == nickname ? 0 : nickname.hashCode());
96 h = 31 * h + ( null == url ? 0 : url.hashCode());
101 /** the DAS2 string representation of this DAS source
103 public String toString() {
105 StringWriter writer = new StringWriter();
107 PrintWriter pw = new PrintWriter(writer);
108 PrettyXMLWriter xw = new PrettyXMLWriter(pw);
110 DasSourceWriter dswriter = new DasSourceWriterImpl();
112 dswriter.writeDasSource(xw,this);
113 } catch (IOException e){
117 return writer.toString();
121 public void setLocal(boolean flag){ local = flag;}
122 public boolean isLocal(){return local;}
124 public void setId(String i) { id = i; }
126 /** get a the Id of the DasSource. The Id is a unique db
127 * identifier. The public DAS-Registry has Auto_Ids that look like
128 * DASSOURCE:12345; public look like XYZ:12345, where the XYZ
129 * prefix can be configured in the config file.
131 public String getId() { return id;}
133 public void setNickname(String name) {
136 public String getNickname(){
139 public void setUrl(String u) {
140 char lastChar = u.charAt(u.length()-1);
141 if ( lastChar != '/')
147 public void setAdminemail (String u) {
151 public void setDescription (String u) {
155 public void setCoordinateSystem (DasCoordinateSystem[] u){
159 public void setCapabilities (String[] u){
163 public String getUrl(){return url;}
164 public String getAdminemail(){return adminemail;}
165 public String getDescription(){return description;}
166 public String[] getCapabilities(){return capabilities;}
167 public DasCoordinateSystem[] getCoordinateSystem(){return coordinateSystem;}
169 public void setRegisterDate(Date d) {
172 public Date getRegisterDate() {
173 return registerDate ;
175 public void setLeaseDate(Date d) {
178 public Date getLeaseDate() {
182 public void setLabels(String[] ls) {
186 public String[] getLabels() {
190 public void setHelperurl(String url) {
194 public String getHelperurl() {
198 public void setAlertAdmin(boolean flag) {
202 public boolean getAlertAdmin() {