-
Notifications
You must be signed in to change notification settings - Fork 0
Move files from main app to api project #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2d98de7
Create pom.xml
akshay-ap bb954dd
Move files from parent app project
akshay-ap 701da91
Add license header
akshay-ap 3d7f2ad
Add version 1.0.0
akshay-ap e0ffa2b
Add github deploy in pom.xml
akshay-ap 2293d0e
Improvement: Update license header
akshay-ap 61dfd3b
Improvement: Remove ConnectionProfileListener interface from api
akshay-ap 7695327
Improvement: Remove Permissions.java file from api
akshay-ap ed9da8d
Improvement: Remove unused properties
akshay-ap 1181c3a
Improvement: Remove AbstractAdapter.java file
akshay-ap 20645da
Update version to 1.0.1-SNAPSHOT
akshay-ap 3c9f8c7
Improvement: Update pom.xml
akshay-ap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>blockchains.iaas.uni.stuttgart.de</groupId> | ||
<artifactId>blockchain-access-layer-api</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<jsonrpc.version>0.10</jsonrpc.version> | ||
<org.slf4j>1.7.25</org.slf4j> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.pf4j</groupId> | ||
<artifactId>pf4j</artifactId> | ||
<version>3.6.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.arteam</groupId> | ||
<artifactId>simple-json-rpc-server</artifactId> | ||
<version>${jsonrpc.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.arteam</groupId> | ||
<artifactId>simple-json-rpc-client</artifactId> | ||
<version>${jsonrpc.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.8</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>26.0-android</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/javax.json/javax.json-api --> | ||
<dependency> | ||
<groupId>javax.json</groupId> | ||
<artifactId>javax.json-api</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.reactivex.rxjava2</groupId> | ||
<artifactId>rxjava</artifactId> | ||
<version>2.2.21</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
23 changes: 23 additions & 0 deletions
23
src/main/java/blockchains/iaas/uni/stuttgart/de/api/IAdapterExtenstion.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Institute for the Architecture of Application System - University of Stuttgart | ||
* Author: Akshay Patel | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*******************************************************************************/ | ||
|
||
package blockchains.iaas.uni.stuttgart.de.api; | ||
|
||
import blockchains.iaas.uni.stuttgart.de.api.interfaces.BlockchainAdapter; | ||
import org.pf4j.ExtensionPoint; | ||
|
||
import java.util.Map; | ||
|
||
public interface IAdapterExtenstion extends ExtensionPoint { | ||
BlockchainAdapter getAdapter(Map<String, String> parameters); | ||
|
||
String getBlockChainId(); | ||
} |
59 changes: 59 additions & 0 deletions
59
...a/blockchains/iaas/uni/stuttgart/de/api/connectionprofiles/AbstractConnectionProfile.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2019 Institute for the Architecture of Application System - | ||
* University of Stuttgart | ||
* Author: Ghareeb Falazi | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
|
||
package blockchains.iaas.uni.stuttgart.de.api.connectionprofiles; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
||
import java.util.Properties; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME) | ||
public abstract class AbstractConnectionProfile { | ||
ghareeb-falazi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private static final String PREFIX = "common."; | ||
private static final String ADVERSARY_VOTING_RATIO = PREFIX + "adversaryVotingRatio"; | ||
private double adversaryVotingRatio; | ||
|
||
public double getAdversaryVotingRatio() { | ||
return adversaryVotingRatio; | ||
} | ||
|
||
public void setAdversaryVotingRatio(double adversaryVotingRatio) { | ||
if (adversaryVotingRatio < 0 || adversaryVotingRatio > 1.0) { | ||
throw new IllegalArgumentException("Voting power of adversary should be between 0.0 and 1.0, but (" + | ||
adversaryVotingRatio + ") is passed!"); | ||
} | ||
|
||
this.adversaryVotingRatio = adversaryVotingRatio; | ||
} | ||
|
||
public Properties getAsProperties() { | ||
Properties result = new Properties(); | ||
result.put(ADVERSARY_VOTING_RATIO, String.valueOf(adversaryVotingRatio)); | ||
|
||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
AbstractConnectionProfile that = (AbstractConnectionProfile) o; | ||
return this.getAsProperties().equals(that.getAsProperties()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return this.getAsProperties().hashCode(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/BalException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Institute for the Architecture of Application System - University of Stuttgart | ||
* Author: Ghareeb Falazi | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*******************************************************************************/ | ||
package blockchains.iaas.uni.stuttgart.de.api.exceptions; | ||
|
||
public abstract class BalException extends RuntimeException { | ||
|
||
public BalException() { | ||
} | ||
|
||
public BalException(String message) { | ||
super(message); | ||
} | ||
|
||
public BalException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public BalException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public abstract int getCode(); | ||
} |
31 changes: 31 additions & 0 deletions
31
.../java/blockchains/iaas/uni/stuttgart/de/api/exceptions/BlockchainIdNotFoundException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2018-2019 Institute for the Architecture of Application System - | ||
* University of Stuttgart | ||
* Author: Ghareeb Falazi | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
package blockchains.iaas.uni.stuttgart.de.api.exceptions; | ||
|
||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; | ||
|
||
@JsonRpcError(code = ExceptionCode.NotFound, message = "The specified blockchain-id cannot be found") | ||
public class BlockchainIdNotFoundException extends BalException { | ||
|
||
public BlockchainIdNotFoundException() { | ||
super(); | ||
} | ||
|
||
public BlockchainIdNotFoundException(String message) { | ||
super(message); | ||
} | ||
|
||
@Override | ||
public int getCode() { | ||
return ExceptionCode.NotFound; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
.../blockchains/iaas/uni/stuttgart/de/api/exceptions/BlockchainNodeUnreachableException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2018-2019 Institute for the Architecture of Application System - | ||
* University of Stuttgart | ||
* Author: Ghareeb Falazi | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
********************************************************************************/ | ||
package blockchains.iaas.uni.stuttgart.de.api.exceptions; | ||
|
||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; | ||
|
||
@JsonRpcError(code = ExceptionCode.ConnectionException, message = "The blockchain node cannot be reached.") | ||
public class BlockchainNodeUnreachableException extends BalException { | ||
|
||
public BlockchainNodeUnreachableException() { | ||
} | ||
|
||
public BlockchainNodeUnreachableException(String message) { | ||
super(message); | ||
} | ||
|
||
@Override | ||
public int getCode() { | ||
return ExceptionCode.ConnectionException; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/blockchains/iaas/uni/stuttgart/de/api/exceptions/ExceptionCode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Institute for the Architecture of Application System - University of Stuttgart | ||
* Author: Ghareeb Falazi | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*******************************************************************************/ | ||
|
||
package blockchains.iaas.uni.stuttgart.de.api.exceptions; | ||
|
||
public class ExceptionCode { | ||
public static final int UnknownError = 0; | ||
|
||
/** | ||
* The blockchain instance, smart contract, event or function are not found | ||
*/ | ||
public static final int NotFound = -32000; | ||
/** | ||
* Input parameter types, names, or order mismatch the designated function or event. | ||
* This also indicates inability to map a parameter's abstract type to a native type. | ||
*/ | ||
public static final int InvalidParameters = -32001; | ||
/** | ||
* Client certificate is missing | ||
*/ | ||
public static final int MissingCertificate = -32002; | ||
/** | ||
* The client application is not authorized to perform the requested task. | ||
* Gateway-side authorization. | ||
*/ | ||
public static final int NotAuthorized = -32003; | ||
/** | ||
* The specified blockchain instance does not support the requested operation. | ||
*/ | ||
public static final int NotSupported = -32004; | ||
/** | ||
* Connection to the underlying blockchain node is not possible. | ||
*/ | ||
public static final int ConnectionException = -32005; | ||
/** | ||
* The transaction associated with an function invocation is invalidated after it was mined. | ||
*/ | ||
public static final int TransactionInvalidatedException = -32006; | ||
|
||
/** | ||
* A scip method parameter has an invalid value | ||
*/ | ||
public static final int InvalidScipParam = -32007; | ||
|
||
/** | ||
* A general error occurred when trying to invoke a smart contract function | ||
* This error is used when the specific cause of the error cannot be deteremined. | ||
*/ | ||
public static final int InvocationError = -32100; | ||
/** | ||
* The smart contract function threw an exception | ||
*/ | ||
public static final int ExecutionError = -32101; | ||
/** | ||
* Not enough funds to invoke the state-changing smart contract funciton. | ||
*/ | ||
public static final int InsufficientFunds = -32102; | ||
/** | ||
* The BAL instance is not authorized to performed the requested operation on the underlying blockchain. | ||
*/ | ||
public static final int BalNotAuthorized = -32103; | ||
|
||
/** | ||
* Timeout is reached before fulfilling the desired degree of confidence. | ||
* This is an asynchronous error. | ||
*/ | ||
public static final int Timeout = -32201; | ||
} |
29 changes: 29 additions & 0 deletions
29
.../java/blockchains/iaas/uni/stuttgart/de/api/exceptions/InvalidScipParameterException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Institute for the Architecture of Application System - University of Stuttgart | ||
* Author: Ghareeb Falazi | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*******************************************************************************/ | ||
|
||
package blockchains.iaas.uni.stuttgart.de.api.exceptions; | ||
|
||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcError; | ||
|
||
@JsonRpcError(code = ExceptionCode.InvalidScipParam, message = "A scip method parameter has an invalid value.") | ||
public class InvalidScipParameterException extends BalException { | ||
@Override | ||
public int getCode() { | ||
return ExceptionCode.InvalidScipParam; | ||
} | ||
|
||
public InvalidScipParameterException() { | ||
} | ||
|
||
public InvalidScipParameterException(String message) { | ||
super(message); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.