Skip to content
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

Feature/allow binding selection #26

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.2</version>
<version>3.3.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>blockchains.iaas.uni.stuttgart.de</groupId>
Expand Down Expand Up @@ -75,6 +75,9 @@
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver -->


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
Expand All @@ -97,6 +100,12 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.12.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import blockchains.iaas.uni.stuttgart.de.connectionprofiles.ConnectionProfilesManager;
import blockchains.iaas.uni.stuttgart.de.api.exceptions.BlockchainIdNotFoundException;
import blockchains.iaas.uni.stuttgart.de.api.exceptions.BlockchainNodeUnreachableException;
import blockchains.iaas.uni.stuttgart.de.management.BlockchainPluginManager;
import blockchains.iaas.uni.stuttgart.de.plugin.PluginManager;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
Expand All @@ -30,7 +30,7 @@ public class AdapterManager {
private final Map<String, Pair<BlockchainAdapter, AbstractConnectionProfile>> map = Collections.synchronizedMap(new HashMap<>());
private final BlockchainAdapterFactory factory;

private AdapterManager(BlockchainPluginManager pluginManager) {
private AdapterManager(PluginManager pluginManager) {
this.factory = new BlockchainAdapterFactory(pluginManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
import blockchains.iaas.uni.stuttgart.de.api.IAdapterExtension;
import blockchains.iaas.uni.stuttgart.de.api.connectionprofiles.AbstractConnectionProfile;
import blockchains.iaas.uni.stuttgart.de.api.interfaces.BlockchainAdapter;
import blockchains.iaas.uni.stuttgart.de.management.BlockchainPluginManager;
import blockchains.iaas.uni.stuttgart.de.plugin.PluginManager;
import lombok.extern.log4j.Log4j2;

import java.util.List;

@Log4j2
public class BlockchainAdapterFactory {
private final BlockchainPluginManager manager;
private final PluginManager manager;

public BlockchainAdapterFactory(BlockchainPluginManager manager) {
public BlockchainAdapterFactory(PluginManager manager) {
this.manager = manager;
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
package blockchains.iaas.uni.stuttgart.de.management;
package blockchains.iaas.uni.stuttgart.de.plugin;

import blockchains.iaas.uni.stuttgart.de.Constants;
import blockchains.iaas.uni.stuttgart.de.api.IAdapterExtension;
Expand All @@ -28,12 +28,12 @@

@Log4j2
@Component
public class BlockchainPluginManager {
private PluginManager pluginManager = null;
public class PluginManager {
private org.pf4j.PluginManager pluginManager = null;
private final String pluginDirStr;
private static final String DEFAULT_PLUGIN_DIR = Paths.get(System.getProperty("user.home"), ".bal").toString();
private static final String DEFAULT_PLUGIN_DIR = Paths.get(System.getProperty("user.home"), ".bal", "plugins").toString();

private BlockchainPluginManager(@Value("${" + Constants.PF4J_PLUGIN_DIR_PROPERTY + ":}")
private PluginManager(@Value("${" + Constants.PF4J_PLUGIN_DIR_PROPERTY + ":}")
String pluginDir, @Value("${" + PF4J_AUTOLOAD_PROPERTY + ":false}") String strConf) {
log.info("Initializing Blockchain Plugin Manager: pluginDir={}, autoLoadPlugins={}.", pluginDir, strConf);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
package blockchains.iaas.uni.stuttgart.de.management.callback;
package blockchains.iaas.uni.stuttgart.de.restapi.callback;

import java.util.Map;

Expand All @@ -32,8 +32,7 @@ public static CallbackMessage convert(String subscriptionId, Transaction transac
variables.put("status", new CamundaVariable(state.toString(), "String"));

// todo handle communication between Camunda and Fabric
if (transaction instanceof LinearChainTransaction) {
LinearChainTransaction tx = (LinearChainTransaction) transaction;
if (transaction instanceof LinearChainTransaction tx) {

if (state != TransactionState.RETURN_VALUE) {
variables.put("from", new CamundaVariable(tx.getFrom(), "String"));
Expand Down
Loading
Loading