From 1d2716fa7f863df15162e1974cf6003a861a3b07 Mon Sep 17 00:00:00 2001 From: b00lean Date: Sat, 13 Dec 2014 01:15:18 +0100 Subject: [PATCH] Added comments and licenses. --- .../server/extensions/IExchangeAdvanced.java | 31 ++++++++++- .../batm/server/extensions/ITask.java | 55 +++++++++++++++++-- 2 files changed, 79 insertions(+), 7 deletions(-) diff --git a/server_extensions_api/src/com/generalbytes/batm/server/extensions/IExchangeAdvanced.java b/server_extensions_api/src/com/generalbytes/batm/server/extensions/IExchangeAdvanced.java index a4be739..bf1b09f 100644 --- a/server_extensions_api/src/com/generalbytes/batm/server/extensions/IExchangeAdvanced.java +++ b/server_extensions_api/src/com/generalbytes/batm/server/extensions/IExchangeAdvanced.java @@ -1,10 +1,35 @@ +/************************************************************************************* + * Copyright (C) 2014 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; import java.math.BigDecimal; -/** - * Created by b00lean on 12/12/14. - */ + public interface IExchangeAdvanced extends IExchange{ + /** + * This method is used for instantiating task that is later called to purchase coins on the exchange using specified fiat currency to use. + * If something fails this method should return NULL otherwise it should return orderId or any other identifier that exchange provides for later tracking + * + * @param amount + * @param cryptoCurrency + * @param fiatCurrencyToUse + * @param description + * @return + */ public ITask createPurchaseCoinsTask(BigDecimal amount, String cryptoCurrency, String fiatCurrencyToUse, String description); } diff --git a/server_extensions_api/src/com/generalbytes/batm/server/extensions/ITask.java b/server_extensions_api/src/com/generalbytes/batm/server/extensions/ITask.java index e59cd1f..7cf97a3 100644 --- a/server_extensions_api/src/com/generalbytes/batm/server/extensions/ITask.java +++ b/server_extensions_api/src/com/generalbytes/batm/server/extensions/ITask.java @@ -1,14 +1,61 @@ +/************************************************************************************* + * Copyright (C) 2014 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; -/** - * Created by b00lean on 12/12/14. - */ + public interface ITask { + /** + * Called when task is created + * @return + */ public boolean onCreate(); + /** + * Called periodically to perform repeating jobs + * @return + */ public boolean onDoStep(); + /** + * Called when task is finished + * @return + */ public void onFinish(); + + /** + * This method is called by task manager to test if it should be removed from list of tasks + * @return + */ public boolean isFinished(); - public String getResult(); + + /** + * Called to obtain result of task + * @return + */ + public Object getResult(); + + /** + * Called to check if task has failed + * @return + */ public boolean isFailed(); + + /** + * Called by task manager to correctly schedule next call of onDoStep + * @return + */ public long getShortestTimeForNexStepInvocation(); }