59 lines
1.8 KiB
Java
59 lines
1.8 KiB
Java
package de.rwu.easydrop;
|
|
|
|
import javax.naming.ConfigurationException;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import de.rwu.easydrop.api.client.AmazonProductDataSource;
|
|
import de.rwu.easydrop.api.client.EbayItemDataSource;
|
|
import de.rwu.easydrop.util.Config;
|
|
|
|
/**
|
|
* Kickoff point for the service.
|
|
*
|
|
* @since 0.1.0
|
|
*/
|
|
public final class Main {
|
|
/**
|
|
* Logger for main process.
|
|
*/
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
|
|
|
|
/**
|
|
* Prevents unwanted instantiation.
|
|
*/
|
|
private Main() throws IllegalAccessException {
|
|
throw new IllegalAccessException("Don't instantiate me! >:(");
|
|
}
|
|
|
|
/**
|
|
* Application entrypoint.
|
|
*
|
|
* @param args
|
|
*/
|
|
public static void main(final String[] args) throws ConfigurationException {
|
|
Config config = Config.getInstance();
|
|
config.loadConfig();
|
|
|
|
String amznBaseUrl = config.getProperty("AMAZON_API_URL");
|
|
String amznApiKey = config.getProperty("AMAZON_API_KEY");
|
|
String ebayBaseUrl = config.getProperty("EBAY_API_URL");
|
|
String ebayApiKey = config.getProperty("EBAY_API_KEY");
|
|
|
|
String amznTestProduct = null;
|
|
String ebayTestProduct = null;
|
|
|
|
AmazonProductDataSource amznSrc = new AmazonProductDataSource(amznBaseUrl, amznApiKey);
|
|
EbayItemDataSource ebaySrc = new EbayItemDataSource(ebayBaseUrl, ebayApiKey);
|
|
try {
|
|
amznTestProduct = amznSrc.getProductDTOById("B096Y2TYKV").toString();
|
|
LOGGER.info(amznTestProduct);
|
|
ebayTestProduct = ebaySrc.getProductDTOById("Gigabyte GeForce RTX 3060").toString();
|
|
LOGGER.info(ebayTestProduct);
|
|
} catch (IllegalArgumentException e) {
|
|
LOGGER.error("Something went wrong :(", e);
|
|
}
|
|
}
|
|
}
|