BATM: Added support for plugable watchlists
This commit is contained in:
parent
ec6884f321
commit
c1b28fbef2
|
@ -18,6 +18,8 @@
|
|||
|
||||
package com.generalbytes.batm.server.extensions;
|
||||
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -92,4 +94,19 @@ public interface IExtension {
|
|||
*/
|
||||
public IPaperWalletGenerator createPaperWalletGenerator(String cryptoCurrency);
|
||||
|
||||
/**
|
||||
* Returns the list of watchlists that extenstion contains
|
||||
* @return
|
||||
*/
|
||||
public Set<String> getSupportedWatchLists();
|
||||
|
||||
|
||||
/**
|
||||
* Returns watchlist by name
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public IWatchList getWatchList(String name);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||
*
|
||||
* This software may be distributed and modified under the terms of the GNU
|
||||
* General Public License version 2 (GPL2) as published by the Free Software
|
||||
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||
* on this software must also be made publicly available under the terms of
|
||||
* the GPL2 ("Copyleft").
|
||||
*
|
||||
* Contact information
|
||||
* -------------------
|
||||
*
|
||||
* GENERAL BYTES s.r.o.
|
||||
* Web : http://www.generalbytes.com
|
||||
*
|
||||
************************************************************************************/
|
||||
package com.generalbytes.batm.server.extensions.watchlist;
|
||||
|
||||
/**
|
||||
* This class defines basic interface which every watchlist sould conform to
|
||||
*/
|
||||
public interface IWatchList {
|
||||
public static final int LIST_NOT_CHANGED = 0;
|
||||
public static final int LIST_CHANGED = 1;
|
||||
public static final int LIST_REFRESH_FAILED = 2;
|
||||
|
||||
/**
|
||||
* Unique name of the watchlist
|
||||
* @return
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Short description of the watchlist. For instance link to a website containing more information about the watchlist data
|
||||
* @return
|
||||
*/
|
||||
public String getDescription();
|
||||
|
||||
/**
|
||||
* Performs the re-download of the watchlist from the remote side @see LIST_NOT_CHANGED or LIST_CHANGED or LIST_REFRESH_FAILED if download fails.
|
||||
* @return
|
||||
*/
|
||||
public int refresh();
|
||||
|
||||
/**
|
||||
* This method returns number of recommended minutes for which the watchlist is considered valid. After this period method refresh() should be called again.
|
||||
* @return
|
||||
*/
|
||||
public int recommendedRefreshPeriodInMins();
|
||||
|
||||
/**
|
||||
* This method is used to query the watchlist for results
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
public WatchListResult search(WatchListQuery query);
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||
*
|
||||
* This software may be distributed and modified under the terms of the GNU
|
||||
* General Public License version 2 (GPL2) as published by the Free Software
|
||||
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||
* on this software must also be made publicly available under the terms of
|
||||
* the GPL2 ("Copyleft").
|
||||
*
|
||||
* Contact information
|
||||
* -------------------
|
||||
*
|
||||
* GENERAL BYTES s.r.o.
|
||||
* Web : http://www.generalbytes.com
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
package com.generalbytes.batm.server.extensions.watchlist;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
public class WatchListMatch implements Serializable{
|
||||
private int score;
|
||||
private String details;
|
||||
private String matchedWatchListName;
|
||||
|
||||
|
||||
public WatchListMatch(int score, String details, String matchedWatchListName) {
|
||||
this.score = score;
|
||||
this.details = details;
|
||||
this.matchedWatchListName = matchedWatchListName;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public String getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public String getMatchedWatchListName() {
|
||||
return matchedWatchListName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WatchlistMatch{" +
|
||||
"score=" + score +
|
||||
", details='" + details + '\'' +
|
||||
", matchedWatchListName=" + matchedWatchListName +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||
*
|
||||
* This software may be distributed and modified under the terms of the GNU
|
||||
* General Public License version 2 (GPL2) as published by the Free Software
|
||||
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||
* on this software must also be made publicly available under the terms of
|
||||
* the GPL2 ("Copyleft").
|
||||
*
|
||||
* Contact information
|
||||
* -------------------
|
||||
*
|
||||
* GENERAL BYTES s.r.o.
|
||||
* Web : http://www.generalbytes.com
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
package com.generalbytes.batm.server.extensions.watchlist;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
public class WatchListQuery implements Serializable{
|
||||
public static final int TYPE_INDIVIDUAL = 0;
|
||||
public static final int TYPE_ENTITY = 1;
|
||||
|
||||
private int type = TYPE_INDIVIDUAL;
|
||||
private String name;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
|
||||
public WatchListQuery(String name) {
|
||||
this.type = TYPE_ENTITY;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public WatchListQuery(String firstName, String lastName) {
|
||||
this.type = TYPE_INDIVIDUAL;
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||
*
|
||||
* This software may be distributed and modified under the terms of the GNU
|
||||
* General Public License version 2 (GPL2) as published by the Free Software
|
||||
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||
* on this software must also be made publicly available under the terms of
|
||||
* the GPL2 ("Copyleft").
|
||||
*
|
||||
* Contact information
|
||||
* -------------------
|
||||
*
|
||||
* GENERAL BYTES s.r.o.
|
||||
* Web : http://www.generalbytes.com
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
package com.generalbytes.batm.server.extensions.watchlist;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WatchListResult implements Serializable{
|
||||
public static final int RESULT_TYPE_WATCHLIST_SEARCHED = 0;
|
||||
public static final int RESULT_TYPE_WATCHLIST_NOT_READY = 1;
|
||||
|
||||
private int resultType = RESULT_TYPE_WATCHLIST_NOT_READY;
|
||||
private List<WatchListMatch> matches = new ArrayList<WatchListMatch>();
|
||||
|
||||
|
||||
public WatchListResult(int resultType) {
|
||||
this.resultType = resultType;
|
||||
}
|
||||
|
||||
public WatchListResult(List<WatchListMatch> matches) {
|
||||
this.matches = matches;
|
||||
this.resultType=RESULT_TYPE_WATCHLIST_SEARCHED;
|
||||
}
|
||||
|
||||
public List<WatchListMatch> getMatches() {
|
||||
return matches;
|
||||
}
|
||||
|
||||
public int getResultType() {
|
||||
return resultType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WatchListResult{" +
|
||||
"resultType=" + resultType +
|
||||
", matches=" + matches +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@ import com.generalbytes.batm.server.extensions.extra.bitcoin.sources.FixPriceRat
|
|||
import com.generalbytes.batm.server.extensions.extra.bitcoin.wallets.bitcoind.BATMBitcoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.extra.bitcoin.wallets.bitcore.BitcoreWallet;
|
||||
import com.generalbytes.batm.server.extensions.extra.bitcoin.wallets.coinkite.CoinkiteWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
@ -180,4 +181,13 @@ public class BitcoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.generalbytes.batm.server.extensions.extra.dogecoin.sources.FixPriceRa
|
|||
import com.generalbytes.batm.server.extensions.extra.dogecoin.sources.chainso.ChainSoRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.dogecoin.wallets.blockio.BlockIOWallet;
|
||||
import com.generalbytes.batm.server.extensions.extra.dogecoin.wallets.dogecoind.DogecoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
@ -122,4 +123,13 @@ public class DogecoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.generalbytes.batm.server.extensions.*;
|
|||
import com.generalbytes.batm.server.extensions.extra.groestlcoin.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.groestlcoin.sources.GroestlcoinTickerRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.groestlcoin.wallets.groestlcoind.GroestlcoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -122,4 +123,13 @@ public class GroestlcoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.generalbytes.batm.server.extensions.*;
|
|||
import com.generalbytes.batm.server.extensions.extra.guldencoin.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.guldencoin.sources.GuldencoinTickerRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.guldencoin.wallets.guldencoind.GuldencoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -122,4 +123,13 @@ public class GuldencoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.generalbytes.batm.server.extensions.extra.incognitocoin;
|
|||
import com.generalbytes.batm.server.extensions.*;
|
||||
import com.generalbytes.batm.server.extensions.extra.incognitocoin.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.incognitocoin.wallets.incognitocoind.IncognitocoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -116,4 +117,13 @@ public class IncognitocoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.generalbytes.batm.server.extensions.extra.leocoin;
|
|||
import com.generalbytes.batm.server.extensions.*;
|
||||
import com.generalbytes.batm.server.extensions.extra.leocoin.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.leocoin.wallets.leocoind.LeocoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -117,4 +118,13 @@ public class LeocoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.generalbytes.batm.server.extensions.extra.bitcoin.wallets.coinkite.Co
|
|||
import com.generalbytes.batm.server.extensions.extra.litecoin.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.litecoin.sources.btce.BTCeRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.litecoin.wallets.litecoind.LitecoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
@ -128,4 +129,13 @@ public class LitecoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.generalbytes.batm.server.extensions.*;
|
|||
import com.generalbytes.batm.server.extensions.extra.maxcoin.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.maxcoin.sources.MaxcoinTickerRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.maxcoin.wallets.maxcoind.MaxcoindRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -119,4 +120,13 @@ public class MaxcoinExtension implements IExtension{
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.generalbytes.batm.server.extensions.*;
|
|||
import com.generalbytes.batm.server.extensions.extra.nubits.NubitsAddressValidator;
|
||||
import com.generalbytes.batm.server.extensions.extra.nubits.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.nubits.wallets.nud.NubitsRPCWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -98,4 +99,14 @@ public class NubitsExtension implements IExtension{
|
|||
result.add(ICurrencies.NBT);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.generalbytes.batm.server.extensions.*;
|
|||
import com.generalbytes.batm.server.extensions.extra.nxt.sources.FixPriceRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.nxt.sources.poloniex.PoloniexRateSource;
|
||||
import com.generalbytes.batm.server.extensions.extra.nxt.wallets.mynxt.MynxtWallet;
|
||||
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
|
@ -116,4 +117,14 @@ public class NXTExtension implements IExtension{
|
|||
result.add(ICurrencies.NXT);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedWatchLists() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWatchList getWatchList(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue