1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.push.service.send.config;
16
17 import java.util.Properties;
18
19 import net.rim.pushsdk.commons.PushSDKProperties;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.beans.factory.annotation.Qualifier;
24
25
26
27
28
29
30
31
32 public class BlackberryPushConfig implements PushSDKProperties {
33
34
35 private boolean eval = true;
36
37
38
39
40 private String applicationId;
41
42
43
44
45 private String cpid = "";
46
47
48
49
50 private String ppgBaseUrl;
51
52
53
54
55 private String pushUrl;
56
57
58
59
60 @Autowired
61 @Qualifier("kmeProperties")
62 private Properties kmeProperties;
63
64
65
66
67
68 private int regeneratePushIdMaxAttempts = 5;
69
70
71
72
73
74
75
76 private long defaultDeliverBeforeTimestampOffset = 3600000L;
77
78
79
80
81
82
83
84 private char[] parserSpecialCharacters = new char[] {'&','"',':','<'};
85
86
87
88
89
90 private int maxInClauseValues = 1000;
91
92
93
94
95
96
97 private String publicPpgAddress = "/mss/PD_pushRequest";
98
99
100
101
102
103
104
105 private String enterprisePpgAddress = "/pap";
106
107
108
109
110
111
112 private String BDSPpgAddress = "/pap";
113
114
115
116
117
118 private int acknowledgementMaxQueueSize = 100000;
119
120
121
122
123
124 private int acknowledgementMaxThreads = 20;
125
126
127
128
129
130 private int acknowledgementBatchSize = 500;
131
132
133
134
135
136
137
138
139
140 private int acknowledgementPushLookupRetryDelay = 5000;
141
142
143
144
145
146
147 private int subscriptionValidationHighWaterMark = 100000;
148
149
150
151
152
153
154
155 private int subscriptionValidationBatchSize = 100000;
156
157
158
159
160
161
162 private String subscriptionDeregistrationUrl = "/mss/PD_cpDeregUser?pin=";
163
164
165
166
167
168
169 private String subscriptionSuspendUrl = "/mss/PD_cpSub?cpAction=suspend&pin=";
170
171
172
173
174
175
176 private String subscriptionResumeUrl = "/mss/PD_cpSub?cpAction=resume&pin=";
177
178
179
180
181
182 private int subscriptionMatchingMaxThreads = 5;
183
184
185
186
187
188 private int subscriptionFindMaxResults = 100000;
189
190
191
192
193
194 private int pushRequestDetailFindMaxResults = 100000;
195
196
197
198
199
200 private String databaseType = "mysql";
201
202
203
204
205
206
207
208 private String dtdDeclarationPublic = "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 2.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd\">";
209
210
211
212
213
214
215
216 private String dtdDeclarationEnterprise = "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 2.0//EN\" \"http://www.wapforum.org/DTD/pap_2.0.dtd\" [<?wap-pap-ver supported-versions=\"2.0\"?>]>";
217
218
219
220
221
222
223 private int httpConnectionTimeout = 60000;
224
225
226
227
228
229
230 private int httpReadTimeout = 120000;
231
232
233
234
235
236
237 private boolean httpIsPersistent = true;
238
239
240
241
242
243
244 private int pushAppDeleteUnsubscribeQueueSize = 100000;
245
246
247
248
249
250
251 private int pushAppDeleteUnsubscribeTimeout = 30;
252
253
254
255
256
257
258 private int pushAppSubscriberDeleteTimeout = 10;
259
260
261
262
263
264
265 private int subscriptionMatchingQueueSize = 50000;
266
267
268
269
270
271
272
273
274 private int subscriptionPPGSyncBatchSize = 10000;
275
276
277
278
279
280
281
282 private String subscriptionQueryUrl = "/mss/PD_cpSubQuery";
283
284
285
286
287
288
289
290 private int subscriptionPPGSyncQueueSize = 5000;
291
292
293
294
295
296
297
298 private int subscriptionPPGSyncTimeout = 30;
299
300
301
302
303
304
305 private int subscriptionPPGSyncMaxThreads = 5;
306
307
308
309
310
311
312
313
314 private int pushStatsUpdateFrequency = 120;
315
316
317
318
319
320
321 private int pushStatsUpdateQueueSize = 100000;
322
323
324
325
326
327
328 private String pushArea = "na";
329
330
331
332
333 public void initialize(){
334 this.setApplicationId(getKmeProperties().getProperty("push.blackberry.appId"));
335 this.setEval(Boolean.valueOf(getKmeProperties().getProperty("push.blackberry.eval","true")));
336 }
337
338
339
340
341 private final String getBasePpgUrl(){
342 if (this.ppgBaseUrl == null){
343 if (this.eval){
344 this.ppgBaseUrl = "https://"+this.cpid+".pushapi.eval.blackberry.com";
345 }
346 else{
347 this.ppgBaseUrl = "https://"+this.cpid+".pushapi.blackberry.com";
348 }
349 }
350 return ppgBaseUrl;
351 }
352
353
354
355
356
357 public String getPushUrl(){
358 if (this.pushUrl == null){
359 if (this.eval){
360 this.pushUrl = "http://cpXXX.pushapi.eval.blackberry.com";
361 }
362 else{
363 this.pushUrl = "http://cp"+this.cpid+".pushapi." + this.pushArea + ".blackberry.com";
364 }
365 }
366 return this.pushUrl;
367
368 }
369
370
371
372
373
374 public final String getBaseBdsUrl(){
375 throw new IllegalArgumentException("Method not implemented");
376 }
377
378
379
380
381
382 public final String getBaseBesUrl(){
383 throw new IllegalArgumentException("Method not implemented");
384 }
385
386
387
388
389 public int getAcknowledgementMaxQueueSize(){
390 return this.acknowledgementMaxQueueSize;
391 }
392
393
394
395
396 public int getAcknowledgementMaxThreads(){
397 return this.acknowledgementMaxThreads;
398 }
399
400
401
402
403 public int getAcknowledgementBatchSize() {
404 return this.acknowledgementBatchSize;
405 }
406
407
408
409
410 public int getAcknowledgementPushLookupRetryDelay(){
411 return this.acknowledgementPushLookupRetryDelay;
412 }
413
414
415
416
417 public String getDatabaseType(){
418 return this.databaseType;
419 }
420
421
422
423
424 public long getDefaultDeliverBeforeTimestampOffset() {
425 return defaultDeliverBeforeTimestampOffset;
426 }
427
428
429
430
431 public int getMaxInClauseValues(){
432 return this.maxInClauseValues;
433 }
434
435
436
437
438 public String getPublicPpgAddress() {
439 return this.getBasePpgUrl() + this.publicPpgAddress;
440 }
441
442
443
444
445 public String getEnterprisePpgAddress(){
446 return this.getBaseBesUrl() + this.enterprisePpgAddress;
447 }
448
449
450
451
452
453 public String getBDSPpgAddress(){
454 return this.getBaseBdsUrl() + this.BDSPpgAddress;
455 }
456
457
458
459
460 public int getPushRequestDetailFindMaxResults() {
461 return this.pushRequestDetailFindMaxResults;
462 }
463
464
465
466
467 public int getRegeneratePushIdMaxAttempts(){
468 return this.regeneratePushIdMaxAttempts;
469 }
470
471
472
473
474 public String getSubscriptionDeregistrationUrl(){
475 return this.getBasePpgUrl() + this.subscriptionDeregistrationUrl;
476 }
477
478
479
480
481 public int getSubscriptionFindMaxResults(){
482 return this.subscriptionFindMaxResults;
483 }
484
485
486
487
488 public int getSubscriptionMatchingMaxThreads(){
489 return this.subscriptionMatchingMaxThreads;
490 }
491
492
493
494
495 public String getSubscriptionResumeUrl(){
496 return this.getBasePpgUrl() + this.subscriptionResumeUrl;
497 }
498
499
500
501
502 public String getSubscriptionSuspendUrl(){
503 return this.getBasePpgUrl() + this.subscriptionSuspendUrl;
504 }
505
506
507
508
509 public int getSubscriptionValidationBatchSize() {
510 return this.subscriptionValidationBatchSize;
511 }
512
513
514
515
516 public int getSubscriptionValidationHighWaterMark() {
517 return this.subscriptionValidationHighWaterMark;
518 }
519
520
521
522
523 public void setAcknowledgementMaxQueueSize(int value){
524 this.acknowledgementMaxQueueSize = value;
525 }
526
527
528
529
530 public void setAcknowledgementMaxThreads(int value){
531 this.acknowledgementMaxThreads = value;
532 }
533
534
535
536
537 public void setAcknowledgementBatchSize(int value){
538 this.acknowledgementBatchSize = value;
539 }
540
541 public boolean isEval() {
542 return this.eval;
543 }
544
545 public void setEval(boolean isEval) {
546 this.eval = isEval;
547 }
548
549 public String getCpid() {
550 return cpid;
551 }
552
553 public void setApplicationId(String appID) {
554 if(!StringUtils.isEmpty(appID)) {
555 if( appID.indexOf( "-" ) > -1 ) {
556 this.cpid = appID.substring(0, appID.indexOf("-"));
557 }
558 this.applicationId = appID;
559 }
560 }
561
562 public String getApplicationId(){
563 return this.applicationId;
564 }
565
566
567
568
569 public void setAcknowledgementPushLookupRetryDelay(int value) {
570 this.acknowledgementPushLookupRetryDelay = value;
571 }
572
573
574
575
576 public void setDatabaseType(String value) {
577 this.databaseType = value;
578 }
579
580
581
582
583 public void setDefaultDeliverBeforeTimestampOffset(long value) {
584 this.defaultDeliverBeforeTimestampOffset = value;
585 }
586
587
588
589
590 public void setMaxInClauseValues(int value) {
591 this.maxInClauseValues = value;
592 }
593
594
595
596
597 public void setPublicPpgAddress(String value) {
598 this.publicPpgAddress = value;
599 }
600
601
602
603
604 public void setEnterprisePpgAddress(String value){
605 this.enterprisePpgAddress = value;
606 }
607
608
609
610
611 public void setBDSPpgAddress(String value) {
612 this.BDSPpgAddress = value;
613 }
614
615
616
617
618 public void setPushRequestDetailFindMaxResults(int value) {
619 this.pushRequestDetailFindMaxResults = value;
620 }
621
622
623
624
625 public void setRegeneratePushIdMaxAttempts(int value) {
626 this.regeneratePushIdMaxAttempts = value;
627 }
628
629
630
631
632 public void setSubscriptionDeregistrationUrl(String value) {
633 this.subscriptionDeregistrationUrl = value;
634 }
635
636
637
638
639 public void setSubscriptionFindMaxResults(int value) {
640 this.subscriptionFindMaxResults = value;
641 }
642
643
644
645
646 public void setSubscriptionMatchingMaxThreads(int value) {
647 this.subscriptionMatchingMaxThreads = value;
648 }
649
650
651
652
653 public void setSubscriptionResumeUrl(String value) {
654 this.subscriptionResumeUrl = value;
655 }
656
657
658
659
660 public void setSubscriptionSuspendUrl(String value) {
661 this.subscriptionSuspendUrl = value;
662 }
663
664
665
666
667 public void setSubscriptionValidationBatchSize(int value){
668 if (value <= 0){
669 value = 1;
670 }
671 this.subscriptionValidationBatchSize = value;
672 }
673
674
675
676
677 public void setSubscriptionValidationHighWaterMark(int value) {
678 this.subscriptionValidationHighWaterMark = value;
679 }
680
681
682
683
684 public int getHttpConnectionTimeout() {
685 return this.httpConnectionTimeout;
686 }
687
688
689
690
691 public boolean getHttpIsPersistent() {
692 return this.httpIsPersistent;
693 }
694
695
696
697
698 public int getHttpReadTimeout() {
699 return httpReadTimeout;
700 }
701
702
703
704
705 public void setHttpConnectionTimeout(int value) {
706 this.httpConnectionTimeout = value;
707 }
708
709
710
711
712 public void setHttpIsPersistent(boolean value) {
713 this.httpIsPersistent = value;
714 }
715
716
717
718
719 public void setHttpReadTimeout(int value){
720 this.httpReadTimeout = value;
721 }
722
723
724
725
726 public int getPushAppDeleteUnsubscribeQueueSize(){
727 return this.pushAppDeleteUnsubscribeQueueSize;
728 }
729
730
731
732
733 public void setPushAppDeleteUnsubscribeQueueSize(int size){
734 this.pushAppDeleteUnsubscribeQueueSize = size;
735 }
736
737
738
739
740 public int getPushAppDeleteUnsubscribeTimeout(){
741 return this.pushAppDeleteUnsubscribeTimeout;
742 }
743
744
745
746
747 public void setPushAppDeleteUnsubscribeTimeout(int timeout){
748 this.pushAppDeleteUnsubscribeTimeout = timeout;
749 }
750
751
752
753
754 public int getPushAppSubscriberDeleteTimeout(){
755 return this.pushAppSubscriberDeleteTimeout;
756 }
757
758
759
760
761 public void setPushAppSubscriberDeleteTimeout(int timeout){
762 this.pushAppSubscriberDeleteTimeout = timeout;
763 }
764
765
766
767
768 public int getSubscriptionMatchingQueueSize() {
769 return this.subscriptionMatchingQueueSize;
770 }
771
772
773
774
775 public void setSubscriptionMatchingQueueSize(int size) {
776 this.subscriptionMatchingQueueSize = size;
777 }
778
779
780
781
782 public int getSubscriptionPPGSyncBatchSize(){
783 return this.subscriptionPPGSyncBatchSize;
784 }
785
786
787
788
789 public void setSubscriptionPPGSyncBatchSize(int size){
790 this.subscriptionPPGSyncBatchSize = size;
791 }
792
793
794
795
796 public String getSubscriptionQueryUrl(){
797 return this.getBasePpgUrl() + this.subscriptionQueryUrl;
798 }
799
800
801
802
803 public void setSubscriptionQueryUrl(String url){
804 this.subscriptionQueryUrl = url;
805 }
806
807
808
809
810 public int getSubscriptionPPGSyncQueueSize(){
811 return this.subscriptionPPGSyncQueueSize;
812 }
813
814
815
816
817 public void setSubscriptionPPGSyncQueueSize(int size){
818 this.subscriptionPPGSyncQueueSize = size;
819 }
820
821
822
823
824 public int getSubscriptionPPGSyncTimeout() {
825 return this.subscriptionPPGSyncTimeout;
826 }
827
828
829
830
831 public void setSubscriptionPPGSyncTimeout(int timeout){
832 this.subscriptionPPGSyncTimeout = timeout;
833 }
834
835
836
837
838
839 public char[] getParserSpecialCharacters(){
840 return this.parserSpecialCharacters;
841 }
842
843
844
845
846 public void setParserSpecialCharacters(char[] value){
847 this.parserSpecialCharacters = value;
848 }
849
850
851
852
853 public int getSubscriptionPPGSyncMaxThreads() {
854 return this.subscriptionPPGSyncMaxThreads;
855 }
856
857
858
859
860 public void setSubscriptionPPGSyncMaxThreads(int value){
861 this.subscriptionPPGSyncMaxThreads = value;
862 }
863
864
865
866
867 public int getPushStatsUpdateFrequency(){
868 return this.pushStatsUpdateFrequency;
869 }
870
871
872
873
874 public void setPushStatsUpdateFrequency(int value){
875 this.pushStatsUpdateFrequency = value;
876 }
877
878
879
880
881 public int getPushStatsUpdateQueueSize(){
882 return this.pushStatsUpdateQueueSize;
883 }
884
885
886
887
888 public void setPushStatsUpdateQueueSize(int value){
889 this.pushStatsUpdateQueueSize = value;
890 }
891
892
893
894
895 public String getDtdDeclarationPublic(){
896 return this.dtdDeclarationPublic;
897 }
898
899
900
901
902 public void setDtdDeclarationPublic(String value){
903 this.dtdDeclarationPublic = value;
904 }
905
906
907
908
909
910 public String getDtdDeclarationEnterprise(){
911 return this.dtdDeclarationEnterprise;
912 }
913
914
915
916
917 public void setDtdDeclarationEnterprise(String value){
918 this.dtdDeclarationEnterprise = value;
919 }
920
921
922
923
924 public Properties getKmeProperties() {
925 return kmeProperties;
926 }
927
928
929
930
931 public void setKmeProperties(Properties kmeProperties) {
932 this.kmeProperties = kmeProperties;
933 }
934 }