Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12451 kshitij.so 1
/******************************************************************************* 
2
 *  Copyright 2009 Amazon Services.
3
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
4
 *  
5
 *  You may not use this file except in compliance with the License. 
6
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
7
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
8
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
9
 *  specific language governing permissions and limitations under the License.
10
 * ***************************************************************************** 
11
 *
12
 *  Marketplace Web Service Java Library
13
 *  API Version: 2009-01-01
14
 *  Generated: Tue Feb 03 15:59:58 PST 2009 
15
 * 
16
 */
17
 
18
 
19
 
20
 
21
 
22
package com.amazonaws.mws;
23
 
24
/**
25
 * Configuration for accessing Marketplace Web Service  service
26
 */
27
public class MarketplaceWebServiceConfig {
28
 
29
    private int connectionTimeout = 50000;
30
    private int socketTimeout = 50000;
31
    private String serviceVersion = "2009-01-01";
32
    private String serviceURL = null;
33
    private String userAgent = null;
34
    private String signatureMethod = "HmacSHA256";
35
    private String proxyHost = null;
36
    private int proxyPort = -1;
37
    private String proxyUsername = null;
38
    private String proxyPassword = null;
39
    private int maxErrorRetry = 3;
40
    private int maxAsyncThreads = 30;
41
    private int maxAsyncQueueSize = maxAsyncThreads * 10;
42
 
43
 
44
    /**
45
     * Gets Version of the API
46
     *
47
     * @return Version of the Service
48
     */
49
    public String getServiceVersion() {
50
        return serviceVersion;
51
    }
52
 
53
    /**
54
     * Gets ConnectionTimeout property
55
     *
56
     * @return Connection Timeout for establishing connections
57
     */
58
    public int getConnectionTimeout() {
59
        return connectionTimeout;
60
    }
61
 
62
    /**
63
     * Sets ConnectionTimeout property
64
     *
65
     * @param connectionTimeout Timeout until connection is established
66
     */
67
    public void setConnectionTimeout(int connectionTimeout) {
68
        this.connectionTimeout = connectionTimeout;
69
    }
70
 
71
    /**
72
     * Sets ConnectionTimeout property and returns current MarketplaceWebServiceConfig
73
     *
74
     * @param connectionTimeout until connection is established
75
     *
76
     * @return MarketplaceWebServiceConfig
77
     */
78
    public MarketplaceWebServiceConfig withConnectionTimeout(int connectionTimeout) {
79
        setConnectionTimeout(connectionTimeout);
80
        return this;
81
    }
82
 
83
    /**
84
     * Checks if ConnectionTimeout property is set
85
     *
86
     * @return true if ConnectionTimeout property is set
87
     */
88
    public boolean isSetConnectionTimeout() {
89
        return true;
90
    }
91
 
92
    /**
93
     * Gets SocketTimeout property
94
     *
95
     * @return Socket Timeout for waiting for data
96
     */
97
    public int getSoTimeout() {
98
        return socketTimeout;
99
    }
100
 
101
    /**
102
     * Sets SocketTimeout property
103
     *
104
     * @param socketTimeout Timeout for waiting for data
105
     */
106
    public void setSoTimeout(int socketTimeout) {
107
        this.socketTimeout = socketTimeout;
108
    }
109
 
110
    /**
111
     * Sets SocketTimeout property and returns current MarketplaceWebServiceConfig
112
     *
113
     * @param socketTimeout for waiting for data
114
     *
115
     * @return MarketplaceWebServiceConfig
116
     */
117
    public MarketplaceWebServiceConfig withSoTimeout(int socketTimeout) {
118
    	setSoTimeout(socketTimeout);
119
        return this;
120
    }
121
 
122
    /**
123
     * Checks if SocketTimeout property is set
124
     *
125
     * @return true if SocketTimeout property is set
126
     */
127
    public boolean isSetSoTimeout() {
128
        return true;
129
    }
130
 
131
    /**
132
     * Gets SignatureMethod property
133
     *
134
     * @return Signature Method for signing requests
135
     */
136
    public String getSignatureMethod() {
137
        return signatureMethod;
138
    }
139
 
140
    /**
141
     * Sets SignatureMethod property
142
     *
143
     * @param signatureMethod Signature Method for signing requests
144
     */
145
    public void setSignatureMethod(String signatureMethod) {
146
        this.signatureMethod = signatureMethod;
147
    }
148
 
149
    /**
150
     * Sets SignatureMethod property and returns current MarketplaceWebServiceConfig
151
     *
152
     * @param signatureMethod Signature Method for signing requests
153
     *
154
     * @return MarketplaceWebServiceConfig
155
     */
156
    public MarketplaceWebServiceConfig withSignatureMethod(String signatureMethod) {
157
        setSignatureMethod(signatureMethod);
158
        return this;
159
    }
160
 
161
    /**
162
     * Checks if SignatureMethod property is set
163
     *
164
     * @return true if SignatureMethod property is set
165
     */
166
    public boolean isSetSignatureMethod() {
167
        return true;
168
    }
169
 
170
    /**
171
     * Gets UserAgent property
172
     *
173
     * @return User Agent String to use when sending request
174
     */
175
    public String getUserAgent() {
176
        return userAgent;
177
    }
178
 
179
    /**
180
     * Sets UserAgent property
181
     *
182
     * @param userAgent User Agent String to use when sending request
183
     *
184
     */
185
    public void setUserAgent(
186
    		String applicationName, 
187
    		String applicationVersion, 
188
    		String programmingLanguage, 
189
    		String... additionalNameValuePairs) {
190
    	if(applicationName==null) throw new IllegalArgumentException(
191
    			"applicationName cannot be NULL");
192
    	if(applicationVersion==null) throw new IllegalArgumentException(
193
    			"applicationVersion cannot be NULL");
194
    	if(programmingLanguage==null) throw new IllegalArgumentException(
195
    			"programmingLanguage cannot be NULL");
196
    	if(additionalNameValuePairs.length % 2 != 0) throw new IllegalArgumentException(
197
    			"there must be a matching value for every name you pass in");
198
    	StringBuilder b = new StringBuilder();
199
    	b.append(applicationName);
200
    	b.append("/");
201
    	b.append(applicationVersion);
202
    	b.append(" (Language=");
203
    	b.append(programmingLanguage);
204
    	int i=0;
205
    	while(i<additionalNameValuePairs.length) {
206
    		String name = additionalNameValuePairs[i];
207
    		String value = additionalNameValuePairs[i+1];
208
    		b.append("; ");
209
    		b.append(name);
210
    		b.append("=");
211
    		b.append(value);
212
    		i+=2;
213
    	}
214
    	b.append(")");
215
        this.userAgent = b.toString();
216
    }
217
 
218
    /**
219
     * Sets UserAgent property and returns current MarketplaceWebServiceConfig
220
     *
221
     * @param userAgent User Agent String to use when sending request
222
     *
223
     * @return MarketplaceWebServiceConfig
224
     */
225
    public MarketplaceWebServiceConfig withUserAgent(
226
            String applicationName, 
227
            String applicationVersion, 
228
            String programmingLanguage, 
229
            String... additionalNameValuePairs) {
230
        setUserAgent(
231
                applicationName, 
232
                applicationVersion, 
233
                programmingLanguage, 
234
                additionalNameValuePairs);
235
        return this;
236
    }
237
 
238
    /**
239
     * Checks if UserAgent property is set
240
     *
241
     * @return true if UserAgent property is set
242
     */
243
    public boolean isSetUserAgent() {
244
        return this.userAgent != null;
245
    }
246
 
247
    /**
248
     * Gets ServiceURL property
249
     *
250
     * @return Service Endpoint URL
251
     */
252
    public String getServiceURL() {
253
        return serviceURL;
254
    }
255
 
256
    /**
257
     * Sets ServiceURL property
258
     *
259
     * @param serviceURL Service Endpoint URL
260
     *
261
     */
262
    public void setServiceURL(String serviceURL) {
263
        this.serviceURL = serviceURL;
264
    }
265
 
266
    /**
267
     * Sets ServiceURL property and returns current MarketplaceWebServiceConfig
268
     *
269
     * @param serviceURL Service Endpoint URL
270
     *
271
     * @return MarketplaceWebServiceConfig
272
     */
273
    public MarketplaceWebServiceConfig withServiceURL(String serviceURL) {
274
        setServiceURL(serviceURL);
275
        return this;
276
    }
277
 
278
    /**
279
     * Checks if ServiceURL property is set
280
     *
281
     * @return true if ServiceURL property is set
282
     */
283
    public boolean isSetServiceURL() {
284
        return this.serviceURL != null;
285
    }
286
 
287
    /**
288
     * Gets ProxyHost property
289
     *
290
     * @return Proxy Host for connection
291
     */
292
    public String getProxyHost() {
293
        return proxyHost;
294
    }
295
 
296
    /**
297
     * Sets ProxyHost property
298
     *
299
     * @param proxyHost Proxy Host for connection
300
     *
301
     */
302
    public void setProxyHost(String proxyHost) {
303
        this.proxyHost = proxyHost;
304
    }
305
 
306
    /**
307
     * Sets ProxyHost property and returns current MarketplaceWebServiceConfig
308
     *
309
     * @param proxyHost Proxy Host for connection
310
     *
311
     * @return MarketplaceWebServiceConfig
312
     */
313
    public MarketplaceWebServiceConfig withProxyHost(String proxyHost) {
314
        setProxyHost(proxyHost);
315
        return this;
316
    }
317
 
318
    /**
319
     * Checks if ProxyHost property is set
320
     *
321
     * @return true if ProxyHost property is set
322
     */
323
    public boolean isSetProxyHost() {
324
        return this.proxyHost != null;
325
    }
326
 
327
    /**
328
     * Gets ProxyPort property
329
     *
330
     * @return Proxy Port for connection
331
     */
332
    public int getProxyPort() {
333
        return proxyPort;
334
    }
335
 
336
    /**
337
     * Sets ProxyPort property
338
     *
339
     * @param proxyPort Proxy Port for connection
340
     *
341
     */
342
    public void setProxyPort(int proxyPort) {
343
        this.proxyPort = proxyPort;
344
    }
345
 
346
    /**
347
     * Sets ProxyPort property and returns current MarketplaceWebServiceConfig
348
     *
349
     * @param proxyPort Proxy Port for connection
350
     *
351
     * @return MarketplaceWebServiceConfig
352
     */
353
    public MarketplaceWebServiceConfig withProxyPort(int proxyPort) {
354
        setProxyPort(proxyPort);
355
        return this;
356
    }
357
 
358
    /**
359
     * Checks if ProxyPort property is set
360
     *
361
     * @return true if ProxyPort property is set
362
     */
363
    public boolean isSetProxyPort() {
364
        return this.proxyPort != -1;
365
    }
366
 
367
    /**
368
     * Gets ProxyUsername property
369
     *
370
     * @return Proxy Username
371
     */
372
    public String getProxyUsername() {
373
        return proxyUsername;
374
    }
375
 
376
    /**
377
     * Sets ProxyUsername property
378
     *
379
     * @param proxyUsername Proxy Username for connection
380
     *
381
     */
382
    public void setProxyUsername(String proxyUsername) {
383
        this.proxyUsername = proxyUsername;
384
    }
385
 
386
    /**
387
     * Sets ProxyUsername property and returns current MarketplaceWebServiceConfig
388
     *
389
     * @param proxyUsername Proxy Username for connection
390
     *
391
     * @return MarketplaceWebServiceConfig
392
     */
393
    public MarketplaceWebServiceConfig withProxyUsername(String proxyUsername) {
394
        setProxyUsername(proxyUsername);
395
        return this;
396
    }
397
 
398
    /**
399
     * Checks if ProxyUsername property is set
400
     *
401
     * @return true if ProxyUsername property is set
402
     */
403
    public boolean isSetProxyUsername() {
404
        return this.proxyUsername != null;
405
    }
406
 
407
    /**
408
     * Gets ProxyPassword property
409
     *
410
     * @return Proxy Password
411
     */
412
    public String getProxyPassword() {
413
        return proxyPassword;
414
    }
415
 
416
    /**
417
     * Sets ProxyPassword property
418
     *
419
     * @param proxyPassword Proxy Password for connection
420
     *
421
     */
422
    public void setProxyPassword(String proxyPassword) {
423
        this.proxyPassword = proxyPassword;
424
    }
425
 
426
    /**
427
     * Sets ProxyPassword property and returns current MarketplaceWebServiceConfig
428
     *
429
     * @param proxyPassword Proxy Password for connection
430
     *
431
     * @return MarketplaceWebServiceConfig
432
     */
433
    public MarketplaceWebServiceConfig withProxyPassword(String proxyPassword) {
434
        setProxyPassword(proxyPassword);
435
        return this;
436
    }
437
 
438
    /**
439
     * Checks if ProxyPassword property is set
440
     *
441
     * @return true if ProxyPassword property is set
442
     */
443
    public boolean isSetProxyPassword() {
444
        return this.proxyPassword != null;
445
    }
446
 
447
    /**
448
     * Gets MaxErrorRetry property
449
     *
450
     * @return Max number of retries on 500th errors
451
     */
452
    public int getMaxErrorRetry() {
453
        return maxErrorRetry;
454
    }
455
 
456
    /**
457
     * Sets MaxErrorRetry property
458
     *
459
     * @param maxErrorRetry Max number of retries on 500th errors
460
     *
461
     */
462
    public void setMaxErrorRetry(int maxErrorRetry) {
463
        this.maxErrorRetry = maxErrorRetry;
464
    }
465
 
466
    /**
467
     * Sets MaxErrorRetry property and returns current MarketplaceWebServiceConfig
468
     *
469
     * @param maxErrorRetry Max number of retries on 500th errors
470
     *
471
     * @return MarketplaceWebServiceConfig
472
     */
473
    public MarketplaceWebServiceConfig withMaxErrorRetry(int maxErrorRetry) {
474
        setMaxErrorRetry(maxErrorRetry);
475
        return this;
476
    }
477
 
478
    /**
479
     * Checks if MaxErrorRetry property is set
480
     *
481
     * @return true if MaxErrorRetry property is set
482
     */
483
    public boolean isSetMaxErrorRetry() {
484
        return this.maxErrorRetry > 0;
485
    }
486
    /**
487
     * Gets MaxAsyncThreads property
488
     *
489
     * @return Max number of threads to be used for async operations
490
     */
491
    public int getMaxAsyncThreads() {
492
        return maxAsyncThreads;
493
    }
494
 
495
    /**
496
     * Sets MaxAsyncThreads property
497
     *
498
     * @param maxAsyncThreads Max number of threads to spawn for async operation.
499
     * Note, this parameter works in conjuction with MaxAsyncQueueSize. When
500
     * Max number of threads is reached, requests will be stored in the queue.
501
     * If queue becomes full, request will be executed on the calling thread.
502
     *
503
     * There is not a perfect combination of these two parameters, it will depend
504
     * on your particular environment. Experiment.
505
     *
506
     */
507
    public void setMaxAsyncThreads(int maxAsyncThreads) {
508
        this.maxAsyncThreads = maxAsyncThreads;
509
    }
510
 
511
    /**
512
     * Sets MaxAsyncThreads property and returns current MarketplaceWebServiceConfig
513
     *
514
     * @param maxAsyncThreads Max number of threads to spawn for async operation.
515
     * Note, this parameter works in conjuction with MaxAsyncQueueSize. When
516
     * Max number of threads is reached, requests will be stored in the queue.
517
     *
518
     * If queue becomes full, request will be executed on the calling thread.
519
     *
520
     * There is not a perfect combination of these two parameters, it will depend
521
     * on your particular environment. Experiment.
522
     *
523
     *
524
     * @return MarketplaceWebServiceConfig
525
     */
526
    public MarketplaceWebServiceConfig withMaxAsyncThreads(int maxAsyncThreads) {
527
        setMaxAsyncThreads(maxAsyncThreads);
528
        return this;
529
    }
530
 
531
    /**
532
     * Checks if MaxAsyncThreads property is set
533
     *
534
     * @return true if MaxAsyncThreads property is set
535
     */
536
    public boolean isSetMaxAsyncThreads() {
537
        return this.maxAsyncThreads > 0;
538
    }
539
 
540
    /**
541
     * Gets MaxAsyncQueueSize property
542
     *
543
     * @return Max number of requests to be queued when max number of threads is
544
     * reached and all those threads are busy processing.
545
     */
546
    public int getMaxAsyncQueueSize() {
547
        return maxAsyncQueueSize;
548
    }
549
 
550
    /**
551
     * Checks if MaxAsyncQueueSize property is set
552
     *
553
     * @return true if MaxAsyncQueueSize property is set
554
     */
555
    public boolean isSetMaxAsyncQueueSize() {
556
        return this.maxAsyncQueueSize > 0;
557
    }
558
 
559
    /**
560
     * Sets MaxAsyncQueueSize property
561
     *
562
     * @param maxAsyncQueueSize Max number of requests to queue when max number of
563
     * threads is reached, and all threads are busy processing.
564
     *
565
     * Note, this parameter works in conjuction with MaxAsyncThreads.
566
     *
567
     * When max number of threads is reached and queue is full, request will
568
     * be executed on the calling thread.
569
     *
570
     * There is not a perfect combination of these two parameters, it will depend
571
     * on your particular environment. Experiment.
572
     *
573
     */
574
    public void setMaxAsyncQueueSize(int maxAsyncQueueSize) {
575
        this.maxAsyncQueueSize = maxAsyncQueueSize;
576
    }
577
 
578
    /**
579
     * Sets MaxAsyncQueueSize property and returns current MarketplaceWebServiceConfig
580
     *
581
     * @param maxAsyncQueueSize Max number of requests to queue when max number of
582
     * threads is reached, and all threads are busy processing.
583
     *
584
     * Note, this parameter works in conjuction with MaxAsyncThreads.
585
     *
586
     * When max number of threads is reached and queue is full, request will
587
     * be executed on the calling thread.
588
     *
589
     * There is not a perfect combination of these two parameters, it will depend
590
     * on your particular environment. Experiment.
591
     *
592
     */
593
    public MarketplaceWebServiceConfig withMaxAsyncQueueSize(int maxAsyncQueueSize) {
594
        setMaxAsyncQueueSize(maxAsyncQueueSize);
595
        return this;
596
    }
597
 
598
}