Skip to content

Commit

Permalink
Merge pull request #67 from rohankatyal29/master
Browse files Browse the repository at this point in the history
[ FIX #51, #52 & #53 ] Update Python, NodeJS & Java BDK to API 0.2
  • Loading branch information
mcupak committed Mar 17, 2015
2 parents 0ef6724 + 148dd14 commit 8ab733f
Show file tree
Hide file tree
Showing 24 changed files with 939 additions and 69 deletions.
8 changes: 4 additions & 4 deletions beacon-adapters/beacon-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ All you need to build this project is Java 7.0 (Java SDK 1.7) or later, Maven 3.
##How to run it
Start the JBoss server:

For Linux: JBOSS_HOME/bin/standalone.sh
For Windows: JBOSS_HOME\bin\standalone.bat
For Linux/Unix: JBOSS_HOME/bin/standalone.sh
For Windows: JBOSS_HOME\bin\standalone.bat

Build and deploy the archive:

Expand All @@ -45,8 +45,8 @@ In order to create your own beacon, we suggest you do the following:

The API takes care of the rest and provides the following endpoints upon deployment of your beacon:

http://localhost:8080/beacon-java/rest/info - information about your beacon
http://localhost:8080/beacon-java/rest/query - access to query service
http://localhost:8080/beacon-java/info - information about your beacon
http://localhost:8080/beacon-java/query - access to query service

##Technologies
Java EE. CDI, JAX-RS, JAXB. Tested with Arquillian/ShrinkWrap.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@
package com.dnastack.beacon.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import javax.xml.bind.annotation.XmlRootElement;

import com.dnastack.beacon.entity.resources.DataSetResource;
import com.dnastack.beacon.entity.resources.QueryResource;

/**
* Beacon.
*
Expand All @@ -42,18 +49,79 @@ public class Beacon implements Serializable {
private String name;
private String organization;
private String description;
private String api;
private String homepage;
private String email;
private String auth = null;

private List<DataSetResource> queries;
private List<QueryResource> datasets;

public Beacon() {
// needed for JAXB
}

public Beacon(String id, String name, String organization, String description) {
this.id = id;
public Beacon(String id, String name, String organization, String description, String api, String homepage, String email, String auth, List<DataSetResource> queries, List<QueryResource> datasets) {
this.id = id;
this.name = name;
this.organization = organization;
this.description = description;
this.api = api;
this.homepage = homepage;
this.email = email;
this.auth = auth;
this.queries = queries;
this.datasets = datasets;
}

public String getApi() {
return api;
}

public void setApi(String api) {
this.api = api;
}

public String getHomepage() {
return homepage;
}

public void setHomepage(String homepage) {
this.homepage = homepage;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getAuth() {
return auth;
}

public void setAuth(String auth) {
this.auth = auth;
}

public List<DataSetResource> getQueries() {
return queries;
}

public void setQueries(List<DataSetResource> queries) {
this.queries = queries;
}

public List<QueryResource> getDatasets() {
return datasets;
}

public void setDatasets(List<QueryResource> datasets) {
this.datasets = datasets;
}

public String getId() {
return id;
}
Expand Down Expand Up @@ -93,6 +161,12 @@ public int hashCode() {
hash = 61 * hash + Objects.hashCode(this.name);
hash = 61 * hash + Objects.hashCode(this.organization);
hash = 61 * hash + Objects.hashCode(this.description);
hash = 61 * hash + Objects.hashCode(this.api);
hash = 61 * hash + Objects.hashCode(this.homepage);
hash = 61 * hash + Objects.hashCode(this.email);
hash = 61 * hash + Objects.hashCode(this.auth);
hash = 61 * hash + Objects.hashCode(this.queries);
hash = 61 * hash + Objects.hashCode(this.datasets);
return hash;
}

Expand All @@ -117,12 +191,30 @@ public boolean equals(Object obj) {
if (!Objects.equals(this.description, other.description)) {
return false;
}
if (!Objects.equals(this.api, other.api)) {
return false;
}
if (!Objects.equals(this.homepage, other.homepage)) {
return false;
}
if (!Objects.equals(this.email, other.email)) {
return false;
}
if (!Objects.equals(this.auth, other.auth)) {
return false;
}
if (!Objects.equals(this.queries, other.queries)) {
return false;
}
if (!Objects.equals(this.datasets, other.datasets)) {
return false;
}
return true;
}

@Override
public String toString() {
return "Beacon{" + "id=" + id + ", name=" + name + ", organization=" + organization + ", description=" + description + '}';
return "Beacon{" + "id=" + id + ", name=" + name + ", organization=" + organization + ", description=" + description + ", api=" + api + ", homepage=" + ", email=" + email + ", auth=" + auth + " + " + ", queries=" + queries + ", datasets=" + datasets + "}";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
package com.dnastack.beacon.entity;

import java.io.Serializable;
import java.util.Objects;

import javax.xml.bind.annotation.XmlRootElement;

import com.dnastack.beacon.entity.resources.ResponseResource;

/**
* Beacon response.
*
Expand All @@ -37,48 +41,48 @@ public class BeaconResponse implements Serializable {

private static final long serialVersionUID = 54L;

private Beacon beacon;
private String beacon_id;
private Query query;
private Boolean response = null;
private ResponseResource response = null;

public BeaconResponse() {
// needed for JAXB
}

public BeaconResponse(Beacon beacon, Query query, Boolean response) {
this.beacon = beacon;
public BeaconResponse(String beacon_id, Query query, ResponseResource response) {
this.beacon_id = beacon_id;
this.query = query;
this.response = response;
}

public Beacon getBeacon() {
return beacon;
}
public String getBeacon_id() {
return beacon_id;
}

public void setBeacon(Beacon beacon) {
this.beacon = beacon;
}
public void setBeacon_id(String beacon_id) {
this.beacon_id = beacon_id;
}

public Query getQuery() {
public Query getQuery() {
return query;
}

public void setQuery(Query query) {
this.query = query;
}

public Boolean getResponse() {
public ResponseResource getResponse() {
return response;
}

public void setResponse(Boolean response) {
public void setResponse(ResponseResource response) {
this.response = response;
}

@Override
public int hashCode() {
int hash = 7;
hash = 41 * hash + (this.beacon != null ? this.beacon.hashCode() : 0);
hash = 41 * hash + Objects.hashCode(this.beacon_id);
hash = 41 * hash + (this.query != null ? this.query.hashCode() : 0);
hash = 41 * hash + (this.response != null ? this.response.hashCode() : 0);
return hash;
Expand All @@ -93,7 +97,7 @@ public boolean equals(Object obj) {
return false;
}
final BeaconResponse other = (BeaconResponse) obj;
if (this.beacon != other.beacon && (this.beacon == null || !this.beacon.equals(other.beacon))) {
if (this.beacon_id != other.beacon_id && (this.beacon_id == null || !this.beacon_id.equals(other.beacon_id))) {
return false;
}
if (this.query != other.query && (this.query == null || !this.query.equals(other.query))) {
Expand All @@ -107,7 +111,7 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "Response of '" + beacon + "' to '" + query + "': '" + response + "'";
return "Response of '" + beacon_id + "' to '" + query + "': '" + response + "'";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ public class Query implements Serializable {
private Long position;
private String allele;
private Reference reference;
private String dataset;

public Query() {
// needed for JAXB
}

public Query(Chromosome chromosome, Long position, String allele, Reference reference) {
public Query(Chromosome chromosome, Long position, String allele, Reference reference, String dataset) {
this.chromosome = chromosome;
this.position = position;
this.allele = allele;
this.reference = reference;
this.dataset = dataset;
}

public Chromosome getChromosome() {
Expand Down Expand Up @@ -86,13 +88,22 @@ public void setReference(Reference reference) {
this.reference = reference;
}

@Override
public String getDataset() {
return dataset;
}

public void setDataset(String dataset) {
this.dataset = dataset;
}

@Override
public int hashCode() {
int hash = 3;
hash = 89 * hash + Objects.hashCode(this.chromosome);
hash = 89 * hash + Objects.hashCode(this.position);
hash = 89 * hash + Objects.hashCode(this.allele);
hash = 89 * hash + Objects.hashCode(this.reference);
hash = 89 * hash + Objects.hashCode(this.dataset);
return hash;
}

Expand All @@ -117,12 +128,15 @@ public boolean equals(Object obj) {
if (this.reference != other.reference) {
return false;
}
if (this.dataset != other.dataset) {
return false;
}
return true;
}

@Override
public String toString() {
return "Query{" + "chromosome=" + chromosome + ", position=" + position + ", allele=" + allele + ", reference=" + reference + '}';
return "Query{" + "chromosome=" + chromosome + ", position=" + position + ", allele=" + allele + ", reference=" + reference + ", dataset=" + dataset + '}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.dnastack.beacon.entity.resources;

public class AlleleResource {

private String allele;
private Double frequency;

public AlleleResource() {
// needed for JAXB
}

/*
* Required field(s): allele
* frequency is a double between 0 & 1
*/
public AlleleResource(String allele, Double frequency) {
this.allele = allele;
this.frequency = frequency;
}

public String getAllele() {
return allele;
}

public void setAllele(String allele) {
this.allele = allele;
}

public Double getFrequency() {
return frequency;
}

public void setFrequency(Double frequency) {
this.frequency = frequency;
}
}
Loading

0 comments on commit 8ab733f

Please sign in to comment.