Skip to content

Commit

Permalink
Merge pull request #33 from reTHINK-project/3.3
Browse files Browse the repository at this point in the history
3.3
  • Loading branch information
sgoendoer authored Mar 29, 2017
2 parents d7c6500 + ac6d738 commit 8dcbc7f
Show file tree
Hide file tree
Showing 17 changed files with 945 additions and 888 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WORKDIR /build
#ADD *.private.der /build/
#ADD rethink-ca /build/rethink-ca
#ADD docker-entrypoint.sh /
ADD target/ReThinkGlobalRegistry-0.3.2.jar app.jar
ADD target/ReThinkGlobalRegistry-0.3.3.jar app.jar
#RUN ["mvn", "dependency:resolve"]
#RUN ["mvn", "verify"]

Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

<groupId>eu.rethink.globalregistry</groupId>
<artifactId>ReThinkGlobalRegistry</artifactId>
<version>0.3.2</version>
<version>0.3.3</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
<version>1.5.2.RELEASE</version>
</parent>

<dependencies>
Expand Down Expand Up @@ -65,16 +65,16 @@
<artifactId>commons-daemon</artifactId>
<version>1.0.15</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public ResponseEntity<String> index() throws URISyntaxException
response.put("connectedNodes", connectedNodes);

return new ResponseEntity<String>(response.toString(), HttpStatus.OK);

}

//STATUS: Index Function is working absolutely fine.
Expand Down Expand Up @@ -553,10 +552,11 @@ public ResponseEntity<String> putdata(@RequestBody String jwt, @PathVariable("GU

/**
* DELETE
* @throws JSONException
*
*/
@RequestMapping(value = "guid/{GUID}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deletedata(@PathVariable("GUID") String GUID) throws URISyntaxException
public ResponseEntity<String> deleteData(@PathVariable("GUID") String GUID) throws URISyntaxException
{
LOGGER.error("Incoming request: DELETE /guid/" + GUID);

Expand Down Expand Up @@ -589,6 +589,7 @@ public ResponseEntity<String> deletedata(@PathVariable("GUID") String GUID) thro

/**
* Easteregg. Just returning "I'm a teapot" as of RFC #2324
* @throws JSONException
*
*/
@RequestMapping(value = "teapot", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
* Configuration class of the GlobalRegistry. Using singleton pattern.
*
* @author Sebastian Göndör
* @version 3
* @date 13.02.2017
* @version 4
* @date 29.03.2017
*/
public class Config
{
private static Config _singleton = null;

private static final String versionName = "0.3.2";
private static final int versionNumber = 1569;
private static final String versionName = "0.3.3";
private static final int versionNumber = 1578;
private static final String versionCode = "springified";
private static final String versionDate = "2017-02-14";
private static final String versionDate = "2017-03-29";
private static final String productName = "reTHINK Global Registry";
private static final String productNameShort = "gReg";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public DHTManager initDHT() throws IOException
peer = new PeerBuilderDHT(new PeerBuilder(new Number160(rand)).ports(Config.getInstance().getPortDHT()).start()).start();

new IndirectReplication(peer).start();

InetAddress address = Inet4Address.getByName(Config.getInstance().getConnectNode());
FutureDiscover futureDiscover = peer.peer().discover().inetAddress(address).ports(Config.getInstance().getPortDHT()).start();
futureDiscover.awaitUninterruptibly();
Expand Down
242 changes: 127 additions & 115 deletions src/main/java/eu/rethink/globalregistry/model/AbstractDataset.java
Original file line number Diff line number Diff line change
@@ -1,120 +1,132 @@
package eu.rethink.globalregistry.model;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class AbstractDataset {

protected String guid;
protected String salt;
protected JSONArray userIDs;
protected String lastUpdate;
protected String timeout;
protected String publicKey;
protected int active;
protected int revoked;
protected JSONObject defaults;
protected int schemaVersion;
protected JSONArray legacyIDs;


public String getGUID() {
return guid;
}


public void setGUID(String guid) {
this.guid = guid;
}


public int getSchemaVersion() {
return schemaVersion;
}


public void setSchemaVersion(int schemaVersion) {
this.schemaVersion = schemaVersion;
}


public String getSalt() {
return salt;
}

public void setSalt(String salt) {
this.salt = salt;
}


public JSONArray getUserIDs() {
return userIDs;
}

public JSONObject getUserIDs(int index) {
return userIDs.getJSONObject(index);
}


public void setUserIDs(JSONArray userIDs) {
this.userIDs = userIDs;
}


public String getLastUpdate() {
return lastUpdate;
}


public void setLastUpdate(String lastUpdate) {
this.lastUpdate = lastUpdate;
}

public String getTimeout() {
return timeout;
}


public void setTimeout(String timeout) {
this.timeout = timeout;
}


public String getPublicKey() {
return publicKey;
}


public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}


public int getActive() {
return active;
}


public void setActive(int active) {
this.active = active;
}

public int getRevoked() {
return revoked;
}

public void setRevoked(int revoked) {
this.revoked = revoked;
}


public JSONObject getDefaults() {
return defaults;
}


public void setDefaults(JSONObject defaults) {
this.defaults = defaults;
}

}
public abstract class AbstractDataset
{
protected String guid;
protected String salt;
protected JSONArray userIDs;
protected String lastUpdate;
protected String timeout;
protected String publicKey;
protected int active;
protected int revoked;
protected JSONObject defaults;
protected int schemaVersion;
protected JSONArray legacyIDs;

public String getGUID()
{
return guid;
}

public void setGUID(String guid)
{
this.guid = guid;
}

public int getSchemaVersion()
{
return schemaVersion;
}

public void setSchemaVersion(int schemaVersion)
{
this.schemaVersion = schemaVersion;
}

public String getSalt()
{
return salt;
}

public void setSalt(String salt)
{
this.salt = salt;
}

public JSONArray getUserIDs()
{
return userIDs;
}

public JSONObject getUserIDs(int index)
{
try
{
return userIDs.getJSONObject(index);
}
catch(JSONException e)
{
return new JSONObject();
}
}

public void setUserIDs(JSONArray userIDs)
{
this.userIDs = userIDs;
}

public String getLastUpdate()
{
return lastUpdate;
}

public void setLastUpdate(String lastUpdate)
{
this.lastUpdate = lastUpdate;
}

public String getTimeout()
{
return timeout;
}

public void setTimeout(String timeout)
{
this.timeout = timeout;
}

public String getPublicKey()
{
return publicKey;
}

public void setPublicKey(String publicKey)
{
this.publicKey = publicKey;
}

public int getActive()
{
return active;
}

public void setActive(int active)
{
this.active = active;
}

public int getRevoked()
{
return revoked;
}

public void setRevoked(int revoked)
{
this.revoked = revoked;
}

public JSONObject getDefaults()
{
return defaults;
}

public void setDefaults(JSONObject defaults)
{
this.defaults = defaults;
}
}
3 changes: 1 addition & 2 deletions src/main/java/eu/rethink/globalregistry/model/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ public void setLegacyIDs(JSONArray legacyIDs)
{
this.legacyIDs = legacyIDs;
}



//validate schema is for checking the given datset against its schema format and structure.
public boolean validateSchema() throws DatasetIntegrityException {
int version = this.schemaVersion;
Expand Down
Loading

0 comments on commit 8dcbc7f

Please sign in to comment.