Skip to content

Commit

Permalink
Merge pull request #135 from rwth-acis/release/1.2.2
Browse files Browse the repository at this point in the history
Release/1.2.2
  • Loading branch information
AlexanderNeumann authored Mar 14, 2022
2 parents a768be2 + 189729e commit f9ba175
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 15,268 deletions.
4 changes: 2 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies {
type = "jar"
}
}
api "org.web3j:core:4.5.5"
api "org.web3j:core:4.5.18"
api "org.slf4j:slf4j-simple:1.7.25"
}

Expand Down Expand Up @@ -372,4 +372,4 @@ eclipse {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package i5.las2peer.api.security;

/**
* Thrown if an agent cannot be found.
*
*/
public class AgentNotFoundInRegistryException extends AgentException {

private static final long serialVersionUID = 1L;

public AgentNotFoundInRegistryException(String message) {
super(message);
}

public AgentNotFoundInRegistryException(Throwable cause) {
super(cause);
}

public AgentNotFoundInRegistryException(String message, Throwable cause) {
super(message, cause);
}

}
23 changes: 20 additions & 3 deletions core/src/main/java/i5/las2peer/p2p/EthereumNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import i5.las2peer.api.security.AgentException;
import i5.las2peer.api.security.AgentLockedException;
import i5.las2peer.api.security.AgentNotFoundException;
import i5.las2peer.api.security.AgentNotFoundInRegistryException;
import i5.las2peer.api.security.ServiceAgent;
import i5.las2peer.classLoaders.ClassManager;
import i5.las2peer.classLoaders.libraries.BlockchainRepository;
Expand Down Expand Up @@ -167,7 +168,7 @@ public Boolean isLocalAdmin(String agentEmail) throws EthereumException {
}

@Override
public AgentImpl getAgent(String id) throws AgentException {
public AgentImpl getAgent(String id) throws AgentException, AgentNotFoundInRegistryException {
AgentImpl agent = super.getAgent(id);
if (agent instanceof EthereumAgent) {
try {
Expand Down Expand Up @@ -286,8 +287,24 @@ public float getAgentReputation(String adminName, String adminEmail) {
return 0f;
}

public AgentImpl getAgentWithoutCheckInRegistry(String agentId) throws AgentException {
return super.getAgent(agentId);
}

public void storeAgentInRegistry(AgentImpl agent) throws AgentException {
if (agent instanceof EthereumAgent) {
try {
registerAgentInBlockchain((EthereumAgent) agent);
logger.info("[ETH] Stored agent seecreet " + agent.getIdentifier());
} catch (AgentException|EthereumException|SerializationException e) {
logger.warning("Failed to register EthereumAgent seecreet; error: " + e);
throw new AgentException("Problem storing Ethereum agent seecreet", e);
}
}
}

/** compares agent login name and public key */
private boolean agentMatchesUserRegistryData(EthereumAgent agent) throws EthereumException {
private boolean agentMatchesUserRegistryData(EthereumAgent agent) throws EthereumException, AgentNotFoundInRegistryException {
try {
logger.fine("[ETH] matching agent ("+ agent.getLoginName() +") to registry");

Expand All @@ -303,7 +320,7 @@ private boolean agentMatchesUserRegistryData(EthereumAgent agent) throws Ethereu
&& userInBlockchain.getPublicKey().equals(agent.getPublicKey());
} catch (NotFoundException e) {
logger.warning("User not found in registry");
return false;
throw new AgentNotFoundInRegistryException("User agent not found in registry ");
} catch (SerializationException e) {
throw new EthereumException("Public key in user registry can't be deserialized.", e);
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
las2peer.revision=1.2
las2peer.build.number=1
las2peer.build.number=2
java.version=17
junit.version=4.13.1
jersey.version=2.35
dbis.archiva.url=https://archiva.dbis.rwth-aachen.de:9911/repository/internal
dbis.archiva.url.snapshots=https://archiva.dbis.rwth-aachen.de:9911/repository/snapshots
dbis.archiva.url.snapshots=https://archiva.dbis.rwth-aachen.de:9911/repository/snapshots
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions webconnector/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/junit*.properties
/frontend/node_modules/
/build
/resources
Loading

0 comments on commit f9ba175

Please sign in to comment.