diff --git a/uk/ac/sanger/ibatis/Cvterm.java b/uk/ac/sanger/ibatis/Cvterm.java new file mode 100644 index 0000000000000000000000000000000000000000..85492e0c4f6408d0b9b0f07a8b2fb2ec2b376552 --- /dev/null +++ b/uk/ac/sanger/ibatis/Cvterm.java @@ -0,0 +1,53 @@ +/* Cvterm.java + * + * created: 2005 + * + * This file is part of Artemis + * + * Copyright (C) 2005 Genome Research Limited + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package uk.ac.sanger.ibatis; + + +public class Cvterm +{ + + private long id; + private String name; + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } +} diff --git a/uk/ac/sanger/ibatis/DbSqlConfig.java b/uk/ac/sanger/ibatis/DbSqlConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..6c6b08e2f0f3eaf26c24631e22d7742202197695 --- /dev/null +++ b/uk/ac/sanger/ibatis/DbSqlConfig.java @@ -0,0 +1,78 @@ +/* DbSqlConfig.java + * + * created: 2005 + * + * This file is part of Artemis + * + * Copyright (C) 2005 Genome Research Limited + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +package uk.ac.sanger.ibatis; + +import com.ibatis.sqlmap.client.SqlMapClient; +import com.ibatis.sqlmap.client.SqlMapClientBuilder; +import com.ibatis.common.resources.Resources; + +import java.util.Properties; +import java.io.Reader; + +public class DbSqlConfig +{ + + private static final SqlMapClient sqlMap; + + static + { + try + { + String resource = "artemis_sqlmap/chado_iBatis_config.xml"; + Reader reader = Resources.getResourceAsReader(resource); + + Properties properties = null; + if(System.getProperty("chado") != null) + { + String url = System.getProperty("chado"); + int index = url.indexOf("?"); + properties = new Properties(); + + properties.put("chado", url.substring(0,index)); + properties.put("username", url.substring(index+1)); + } + + sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader, + properties); + } + catch(Exception e) + { + // If you get an error at this point, it doesnt matter what it was. It is going to be + // unrecoverable and we will want the app to blow up hard so we are aware of the + // problem. You should always log such errors and re-throw them in such a way that + // you can be made immediately aware of the problem. + e.printStackTrace(); + throw new RuntimeException("Error initializing DbSqlConfig class. Cause: " + e); + } + } + + public static SqlMapClient getSqlMapInstance() + { + return sqlMap; + } + +} + diff --git a/uk/ac/sanger/ibatis/Feature.java b/uk/ac/sanger/ibatis/Feature.java new file mode 100644 index 0000000000000000000000000000000000000000..1d3511fb59818dfaa3e917bfdaddb6618104a71a --- /dev/null +++ b/uk/ac/sanger/ibatis/Feature.java @@ -0,0 +1,191 @@ +/* Feature.java + * + * created: 2005 + * + * This file is part of Artemis + * + * Copyright (C) 2005 Genome Research Limited + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +package uk.ac.sanger.ibatis; + +import java.util.Date; + +public class Feature +{ + + /** feature id */ + private int id; + /** id of the parent feature */ + private String object_id; + /** time last changed */ + private Date timelastmodified; + /** +1 or -1 depending if on the forward or reverse */ + private int strand; + /** start position */ + private int fmin; + /** end position */ + private int fmax; + /** features unique name */ + private String uniquename; + /** features name */ + private String name; + /** features residues */ + private byte[] residues; + /** feature type id */ + private long type_id; + /** feature property type id */ + private long prop_type_id; + /** feature description value */ + private String value; + /** feature organism abbreviation */ + private String abbreviation; + + + public int getId() + { + return id; + } + + public void setId(int id) + { + this.id = id; + } + + public String getObject_id() + { + return object_id; + } + + public void setObject_id(String object_id) + { + this.object_id = object_id; + } + + public Date getTimelastmodified() + { + return timelastmodified; + } + + public void setTimelastmodified(Date timelastmodified) + { + this.timelastmodified = timelastmodified; + } + + public int getStrand() + { + return strand; + } + + public void setStrand(int strand) + { + this.strand = strand; + } + + public int getFmin() + { + return fmin; + } + + public void setFmin(int fmin) + { + this.fmin = fmin; + } + + public int getFmax() + { + return fmax; + } + + public void setFmax(int fmax) + { + this.fmax = fmax; + } + + public String getUniquename() + { + return uniquename; + } + + public void setUniquename(String uniquename) + { + this.uniquename = uniquename; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public byte[] getResidues() + { + return residues; + } + + public void setResidues(byte[] residues) + { + this.residues = residues; + } + + public long getType_id() + { + return type_id; + } + + public void setType_id(long type_id) + { + this.type_id = type_id; + } + + public long getProp_type_id() + { + return prop_type_id; + } + + public void setProp_type_id(long prop_type_id) + { + this.prop_type_id = prop_type_id; + } + + public String getValue() + { + return value; + } + + public void setValue(String value) + { + this.value = value; + } + + public String getAbbreviation() + { + return abbreviation; + } + + public void setAbbreviation(String abbreviation) + { + this.abbreviation = abbreviation; + } + +} diff --git a/uk/ac/sanger/ibatis/Organism.java b/uk/ac/sanger/ibatis/Organism.java new file mode 100644 index 0000000000000000000000000000000000000000..8d77b7a68735d1338663a6c577d26b318603ee67 --- /dev/null +++ b/uk/ac/sanger/ibatis/Organism.java @@ -0,0 +1,98 @@ +/* Organism.java + * + * created: 2005 + * + * This file is part of Artemis + * + * Copyright (C) 2005 Genome Research Limited + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +package uk.ac.sanger.ibatis; + + +public class Organism +{ + + private int id; + private String abbreviation; + private String genus; + private String species; + private String common_name; + private String comment; + + public int getId() + { + return id; + } + + public void setId(int id) + { + this.id = id; + } + + public String getAbbreviation() + { + return abbreviation; + } + + public void setAbbreviation(String abbreviation) + { + this.abbreviation = abbreviation; + } + + public String getGenus() + { + return genus; + } + + public void setGenus(String genus) + { + this.genus = genus; + } + + public String getSpecies() + { + return species; + } + + public void setSpecies(String species) + { + this.species = species; + } + + public String getCommon_name() + { + return common_name; + } + + public void setCommon_name(String common_name) + { + this.common_name = common_name; + } + + public String getComment() + { + return comment; + } + + public void setComment() + { + this.comment = comment; + } + +}