View Javadoc
1   package org.oxerr.peatio.rest.service.polling;
2   
3   import org.oxerr.peatio.rest.service.PeatioDigest;
4   
5   import si.mazi.rescu.SynchronizedValueFactory;
6   
7   import com.xeiam.xchange.Exchange;
8   import com.xeiam.xchange.ExchangeSpecification;
9   import com.xeiam.xchange.service.polling.BasePollingService;
10  import com.xeiam.xchange.utils.Assert;
11  
12  /**
13   * Base private service. Provides {@link SynchronizedValueFactory} and {@link PeatioDigest} for subclasses.
14   */
15  public class PeatioBasePrivatePollingService extends PeatioBasePollingService
16  		implements BasePollingService {
17  
18  	protected final SynchronizedValueFactory<Long> tonce;
19  	protected final String accessKey;
20  	protected final PeatioDigest signature;
21  
22  	protected PeatioBasePrivatePollingService(Exchange exchange) {
23  		super(exchange);
24  		this.tonce = exchange.getNonceFactory();
25  		ExchangeSpecification exchangeSpecification = exchange.getExchangeSpecification();
26  		this.accessKey = exchangeSpecification.getApiKey();
27  		String secretKey = exchangeSpecification.getSecretKey();
28  
29  		Assert.notNull(accessKey, "Exchange specification access key cannot be null");
30  		Assert.notNull(secretKey, "Exchange specification secret key cannot be null.");
31  
32  		signature = new PeatioDigest(secretKey);
33  	}
34  
35  }