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 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 final char cHYPHEN = '-';
556 if( appID.indexOf( cHYPHEN ) > -1 ) {
557 this.cpid = appID.substring(0, appID.indexOf(cHYPHEN));
558 }
559 this.applicationId = appID;
560 }
561 }
562
563 public String getApplicationId(){
564 return this.applicationId;
565 }
566
567
568
569
570 public void setAcknowledgementPushLookupRetryDelay(int value) {
571 this.acknowledgementPushLookupRetryDelay = value;
572 }
573
574
575
576
577 public void setDatabaseType(String value) {
578 this.databaseType = value;
579 }
580
581
582
583
584 public void setDefaultDeliverBeforeTimestampOffset(long value) {
585 this.defaultDeliverBeforeTimestampOffset = value;
586 }
587
588
589
590
591 public void setMaxInClauseValues(int value) {
592 this.maxInClauseValues = value;
593 }
594
595
596
597
598 public void setPublicPpgAddress(String value) {
599 this.publicPpgAddress = value;
600 }
601
602
603
604
605 public void setEnterprisePpgAddress(String value){
606 this.enterprisePpgAddress = value;
607 }
608
609
610
611
612 public void setBDSPpgAddress(String value) {
613 this.BDSPpgAddress = value;
614 }
615
616
617
618
619 public void setPushRequestDetailFindMaxResults(int value) {
620 this.pushRequestDetailFindMaxResults = value;
621 }
622
623
624
625
626 public void setRegeneratePushIdMaxAttempts(int value) {
627 this.regeneratePushIdMaxAttempts = value;
628 }
629
630
631
632
633 public void setSubscriptionDeregistrationUrl(String value) {
634 this.subscriptionDeregistrationUrl = value;
635 }
636
637
638
639
640 public void setSubscriptionFindMaxResults(int value) {
641 this.subscriptionFindMaxResults = value;
642 }
643
644
645
646
647 public void setSubscriptionMatchingMaxThreads(int value) {
648 this.subscriptionMatchingMaxThreads = value;
649 }
650
651
652
653
654 public void setSubscriptionResumeUrl(String value) {
655 this.subscriptionResumeUrl = value;
656 }
657
658
659
660
661 public void setSubscriptionSuspendUrl(String value) {
662 this.subscriptionSuspendUrl = value;
663 }
664
665
666
667
668 public void setSubscriptionValidationBatchSize(int value){
669 if (value <= 0){
670 this.subscriptionValidationBatchSize = 1;
671 }else{
672 this.subscriptionValidationBatchSize = value;
673 }
674 }
675
676
677
678
679 public void setSubscriptionValidationHighWaterMark(int value) {
680 this.subscriptionValidationHighWaterMark = value;
681 }
682
683
684
685
686 public int getHttpConnectionTimeout() {
687 return this.httpConnectionTimeout;
688 }
689
690
691
692
693 public boolean getHttpIsPersistent() {
694 return this.httpIsPersistent;
695 }
696
697
698
699
700 public int getHttpReadTimeout() {
701 return httpReadTimeout;
702 }
703
704
705
706
707 public void setHttpConnectionTimeout(int value) {
708 this.httpConnectionTimeout = value;
709 }
710
711
712
713
714 public void setHttpIsPersistent(boolean value) {
715 this.httpIsPersistent = value;
716 }
717
718
719
720
721 public void setHttpReadTimeout(int value){
722 this.httpReadTimeout = value;
723 }
724
725
726
727
728 public int getPushAppDeleteUnsubscribeQueueSize(){
729 return this.pushAppDeleteUnsubscribeQueueSize;
730 }
731
732
733
734
735 public void setPushAppDeleteUnsubscribeQueueSize(int size){
736 this.pushAppDeleteUnsubscribeQueueSize = size;
737 }
738
739
740
741
742 public int getPushAppDeleteUnsubscribeTimeout(){
743 return this.pushAppDeleteUnsubscribeTimeout;
744 }
745
746
747
748
749 public void setPushAppDeleteUnsubscribeTimeout(int timeout){
750 this.pushAppDeleteUnsubscribeTimeout = timeout;
751 }
752
753
754
755
756 public int getPushAppSubscriberDeleteTimeout(){
757 return this.pushAppSubscriberDeleteTimeout;
758 }
759
760
761
762
763 public void setPushAppSubscriberDeleteTimeout(int timeout){
764 this.pushAppSubscriberDeleteTimeout = timeout;
765 }
766
767
768
769
770 public int getSubscriptionMatchingQueueSize() {
771 return this.subscriptionMatchingQueueSize;
772 }
773
774
775
776
777 public void setSubscriptionMatchingQueueSize(int size) {
778 this.subscriptionMatchingQueueSize = size;
779 }
780
781
782
783
784 public int getSubscriptionPPGSyncBatchSize(){
785 return this.subscriptionPPGSyncBatchSize;
786 }
787
788
789
790
791 public void setSubscriptionPPGSyncBatchSize(int size){
792 this.subscriptionPPGSyncBatchSize = size;
793 }
794
795
796
797
798 public String getSubscriptionQueryUrl(){
799 return this.getBasePpgUrl() + this.subscriptionQueryUrl;
800 }
801
802
803
804
805 public void setSubscriptionQueryUrl(String url){
806 this.subscriptionQueryUrl = url;
807 }
808
809
810
811
812 public int getSubscriptionPPGSyncQueueSize(){
813 return this.subscriptionPPGSyncQueueSize;
814 }
815
816
817
818
819 public void setSubscriptionPPGSyncQueueSize(int size){
820 this.subscriptionPPGSyncQueueSize = size;
821 }
822
823
824
825
826 public int getSubscriptionPPGSyncTimeout() {
827 return this.subscriptionPPGSyncTimeout;
828 }
829
830
831
832
833 public void setSubscriptionPPGSyncTimeout(int timeout){
834 this.subscriptionPPGSyncTimeout = timeout;
835 }
836
837
838
839
840
841 public char[] getParserSpecialCharacters(){
842 return this.parserSpecialCharacters;
843 }
844
845
846
847
848 public void setParserSpecialCharacters(char[] value){
849 if(value != null){
850 this.parserSpecialCharacters = value.clone();
851
852 }
853 }
854
855
856
857
858 public int getSubscriptionPPGSyncMaxThreads() {
859 return this.subscriptionPPGSyncMaxThreads;
860 }
861
862
863
864
865 public void setSubscriptionPPGSyncMaxThreads(int value){
866 this.subscriptionPPGSyncMaxThreads = value;
867 }
868
869
870
871
872 public int getPushStatsUpdateFrequency(){
873 return this.pushStatsUpdateFrequency;
874 }
875
876
877
878
879 public void setPushStatsUpdateFrequency(int value){
880 this.pushStatsUpdateFrequency = value;
881 }
882
883
884
885
886 public int getPushStatsUpdateQueueSize(){
887 return this.pushStatsUpdateQueueSize;
888 }
889
890
891
892
893 public void setPushStatsUpdateQueueSize(int value){
894 this.pushStatsUpdateQueueSize = value;
895 }
896
897
898
899
900 public String getDtdDeclarationPublic(){
901 return this.dtdDeclarationPublic;
902 }
903
904
905
906
907 public void setDtdDeclarationPublic(String value){
908 this.dtdDeclarationPublic = value;
909 }
910
911
912
913
914
915 public String getDtdDeclarationEnterprise(){
916 return this.dtdDeclarationEnterprise;
917 }
918
919
920
921
922 public void setDtdDeclarationEnterprise(String value){
923 this.dtdDeclarationEnterprise = value;
924 }
925
926
927
928
929 public Properties getKmeProperties() {
930 return kmeProperties;
931 }
932
933
934
935
936 public void setKmeProperties(Properties kmeProperties) {
937 this.kmeProperties = kmeProperties;
938 }
939 }