*/
package org.biojava.dasobert.dasregistry;
-import java.util.Date ;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
+import java.util.*;
//import org.biojava.dasobert.das2.io.DasSourceWriter;
//import org.biojava.dasobert.das2.io.DasSourceWriterImpl;
* @author Andreas Prlic
*/
-public class Das1Source implements DasSource {
- String url ;
- protected String nickname ;
- String adminemail ;
- String description ;
- DasCoordinateSystem[] coordinateSystem ;
- String[] capabilities ;
- String[] labels ;
- String helperurl ;
- Date registerDate ;
- Date leaseDate ;
- String id ;
- boolean local;
-
- boolean alertAdmin;
-
- public static String EMPTY_ID = "UNK:-1" ;
-
- public Das1Source () {
- id = EMPTY_ID;
- url = "";
- adminemail = "" ;
- description = "" ;
- //String empty = "" ;
- nickname = "" ;
- coordinateSystem = new DasCoordinateSystem[0];
- //coordinateSystem[0] = new DasCoordinateSystem();
- capabilities = new String[0];
- labels = new String[0];
- //capabilities[0] = empty ;
- registerDate = new Date() ;
- leaseDate = new Date() ;
- helperurl = "";
- local=true;
- }
-
-
- public boolean equals(DasSource other){
- System.out.println("Das1Source equals, comparing with other DasSource");
- if (! (other instanceof Das1Source))
- return false;
-
- Das1Source ods = (Das1Source) other;
-
- if ( ods.getUrl().equals(url))
- return true;
- if ( ods.getNickname().equals(nickname))
- return true;
- return false;
- }
-
- public int hashCode() {
- int h = 7;
-
- h = 31 * h + ( null == nickname ? 0 : nickname.hashCode());
- h = 31 * h + ( null == url ? 0 : url.hashCode());
-
- return h;
- }
-
- /** the DAS2 string representation of this DAS source
- *
- public String toString() {
-
- StringWriter writer = new StringWriter();
-
- PrintWriter pw = new PrintWriter(writer);
- PrettyXMLWriter xw = new PrettyXMLWriter(pw);
-
- DasSourceWriter dswriter = new DasSourceWriterImpl();
- try {
- dswriter.writeDasSource(xw,this);
- } catch (IOException e){
- e.printStackTrace();
- }
-
- return writer.toString();
-
- }
- */
- public void setLocal(boolean flag){ local = flag;}
- public boolean isLocal(){return local;}
-
- public void setId(String i) { id = i; }
-
- /** get a the Id of the DasSource. The Id is a unique db
- * identifier. The public DAS-Registry has Auto_Ids that look like
- * DASSOURCE:12345; public look like XYZ:12345, where the XYZ
- * prefix can be configured in the config file.
- */
- public String getId() { return id;}
-
- public void setNickname(String name) {
- nickname = name ;
- }
- public String getNickname(){
- return nickname;
- }
- public void setUrl(String u) {
- char lastChar = u.charAt(u.length()-1);
- if ( lastChar != '/')
- u += "/";
-
- url = u ;
- }
-
- public void setAdminemail (String u) {
- adminemail = u ;
- }
-
- public void setDescription (String u) {
- description = u;
- }
-
- public void setCoordinateSystem (DasCoordinateSystem[] u){
- coordinateSystem=u ;
- }
-
- public void setCapabilities (String[] u){
- capabilities = u ;
- }
-
- public String getUrl(){return url;}
- public String getAdminemail(){return adminemail;}
- public String getDescription(){return description;}
- public String[] getCapabilities(){return capabilities;}
- public DasCoordinateSystem[] getCoordinateSystem(){return coordinateSystem;}
-
- public void setRegisterDate(Date d) {
- registerDate = d;
- }
- public Date getRegisterDate() {
- return registerDate ;
- }
- public void setLeaseDate(Date d) {
- leaseDate =d ;
- }
- public Date getLeaseDate() {
- return leaseDate ;
+public class Das1Source
+ implements DasSource
+{
+ String url;
+ protected String nickname;
+ String adminemail;
+ String description;
+ DasCoordinateSystem[] coordinateSystem;
+ String[] capabilities;
+ String[] labels;
+ String helperurl;
+ Date registerDate;
+ Date leaseDate;
+ String id;
+ boolean local;
+
+ boolean alertAdmin;
+
+ public static String EMPTY_ID = "UNK:-1";
+
+ public Das1Source()
+ {
+ id = EMPTY_ID;
+ url = "";
+ adminemail = "";
+ description = "";
+ //String empty = "" ;
+ nickname = "";
+ coordinateSystem = new DasCoordinateSystem[0];
+ //coordinateSystem[0] = new DasCoordinateSystem();
+ capabilities = new String[0];
+ labels = new String[0];
+ //capabilities[0] = empty ;
+ registerDate = new Date();
+ leaseDate = new Date();
+ helperurl = "";
+ local = true;
+ }
+
+ public boolean equals(DasSource other)
+ {
+ System.out.println("Das1Source equals, comparing with other DasSource");
+ if (! (other instanceof Das1Source))
+ {
+ return false;
}
- public void setLabels(String[] ls) {
- labels = ls ;
- }
+ Das1Source ods = (Das1Source) other;
- public String[] getLabels() {
- return labels;
+ if (ods.getUrl().equals(url))
+ {
+ return true;
}
-
- public void setHelperurl(String url) {
- helperurl = url;
+ if (ods.getNickname().equals(nickname))
+ {
+ return true;
}
-
- public String getHelperurl() {
- return helperurl;
+ return false;
+ }
+
+ public int hashCode()
+ {
+ int h = 7;
+
+ h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
+ h = 31 * h + (null == url ? 0 : url.hashCode());
+
+ return h;
+ }
+
+ /** the DAS2 string representation of this DAS source
+ *
+ public String toString() {
+
+ StringWriter writer = new StringWriter();
+
+ PrintWriter pw = new PrintWriter(writer);
+ PrettyXMLWriter xw = new PrettyXMLWriter(pw);
+
+ DasSourceWriter dswriter = new DasSourceWriterImpl();
+ try {
+ dswriter.writeDasSource(xw,this);
+ } catch (IOException e){
+ e.printStackTrace();
+ }
+
+ return writer.toString();
+
+ }
+ */
+ public void setLocal(boolean flag)
+ {
+ local = flag;
+ }
+
+ public boolean isLocal()
+ {
+ return local;
+ }
+
+ public void setId(String i)
+ {
+ id = i;
+ }
+
+ /** get a the Id of the DasSource. The Id is a unique db
+ * identifier. The public DAS-Registry has Auto_Ids that look like
+ * DASSOURCE:12345; public look like XYZ:12345, where the XYZ
+ * prefix can be configured in the config file.
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setNickname(String name)
+ {
+ nickname = name;
+ }
+
+ public String getNickname()
+ {
+ return nickname;
+ }
+
+ public void setUrl(String u)
+ {
+ char lastChar = u.charAt(u.length() - 1);
+ if (lastChar != '/')
+ {
+ u += "/";
}
- public void setAlertAdmin(boolean flag) {
- alertAdmin = flag;
- }
-
- public boolean getAlertAdmin() {
- return alertAdmin;
- }
+ url = u;
+ }
+
+ public void setAdminemail(String u)
+ {
+ adminemail = u;
+ }
+
+ public void setDescription(String u)
+ {
+ description = u;
+ }
+
+ public void setCoordinateSystem(DasCoordinateSystem[] u)
+ {
+ coordinateSystem = u;
+ }
+
+ public void setCapabilities(String[] u)
+ {
+ capabilities = u;
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public String getAdminemail()
+ {
+ return adminemail;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String[] getCapabilities()
+ {
+ return capabilities;
+ }
+
+ public DasCoordinateSystem[] getCoordinateSystem()
+ {
+ return coordinateSystem;
+ }
+
+ public void setRegisterDate(Date d)
+ {
+ registerDate = d;
+ }
+
+ public Date getRegisterDate()
+ {
+ return registerDate;
+ }
+
+ public void setLeaseDate(Date d)
+ {
+ leaseDate = d;
+ }
+
+ public Date getLeaseDate()
+ {
+ return leaseDate;
+ }
+
+ public void setLabels(String[] ls)
+ {
+ labels = ls;
+ }
+
+ public String[] getLabels()
+ {
+ return labels;
+ }
+
+ public void setHelperurl(String url)
+ {
+ helperurl = url;
+ }
+
+ public String getHelperurl()
+ {
+ return helperurl;
+ }
+
+ public void setAlertAdmin(boolean flag)
+ {
+ alertAdmin = flag;
+ }
+
+ public boolean getAlertAdmin()
+ {
+ return alertAdmin;
+ }
}