-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #866 from b00lean/master
BATM-5644 - Create template module for customers to develop their extensions
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,33 @@ | ||
plugins { | ||
id("shared-build-conventions") | ||
id("shared-repositories-ext-conventions") | ||
} | ||
|
||
group = projectGroup | ||
version = projectVersion | ||
|
||
jar { | ||
archiveFileName = "myfirstextension.${archiveExtension.get()}" | ||
} | ||
|
||
configurations { | ||
artifactOnly | ||
|
||
// handle Github (e.g. community) vs GENERAL BYTES dichotomy | ||
generalBytesCompile | ||
githubCompile | ||
if (hasGbArtifactory) { | ||
implementation { extendsFrom generalBytesCompile } | ||
} else { | ||
implementation { extendsFrom githubCompile } | ||
} | ||
} | ||
|
||
artifacts { | ||
artifactOnly jar | ||
} | ||
|
||
dependencies { | ||
implementation project(":server_extensions_api") | ||
implementation project(":currencies") | ||
} |
18 changes: 18 additions & 0 deletions
18
...ain/java/com/mygreatcompany/batm/server/extensions/myfirstextension/MyFirstExtension.java
This file contains 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,18 @@ | ||
package com.mygreatcompany.batm.server.extensions.myfirstextension; | ||
|
||
import com.generalbytes.batm.server.extensions.AbstractExtension; | ||
import com.generalbytes.batm.server.extensions.IExtensionContext; | ||
|
||
public class MyFirstExtension extends AbstractExtension { | ||
|
||
@Override | ||
public String getName() { | ||
return "My first extension"; | ||
} | ||
|
||
@Override | ||
public void init(IExtensionContext ctx) { | ||
super.init(ctx); | ||
ctx.addTransactionListener(new MyTransactionListener(ctx)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...ava/com/mygreatcompany/batm/server/extensions/myfirstextension/MyTransactionListener.java
This file contains 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,27 @@ | ||
package com.mygreatcompany.batm.server.extensions.myfirstextension; | ||
|
||
import com.generalbytes.batm.server.extensions.IExtensionContext; | ||
import com.generalbytes.batm.server.extensions.ITransactionDetails; | ||
import com.generalbytes.batm.server.extensions.ITransactionListener; | ||
|
||
import java.util.Map; | ||
|
||
public class MyTransactionListener implements ITransactionListener { | ||
private IExtensionContext ctx; | ||
|
||
public MyTransactionListener(IExtensionContext ctx) { | ||
this.ctx = ctx; | ||
} | ||
|
||
@Override | ||
public Map<String, String> onTransactionCreated(ITransactionDetails transactionDetails) { | ||
System.out.println("Bravo! Transaction has been created! Here are the details: = " + transactionDetails); | ||
return null; | ||
} | ||
|
||
@Override | ||
public Map<String, String> onTransactionUpdated(ITransactionDetails transactionDetails) { | ||
System.out.println("Hey! Transaction has been updated! Here are the details: " + transactionDetails); | ||
return null; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
server_extensions_template/src/main/resources/batm-extensions.xml
This file contains 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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extensions> | ||
<extension class="com.mygreatcompany.batm.server.extensions.myfirstextension.MyFirstExtension" /> | ||
</extensions> |
This file contains 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