-
Notifications
You must be signed in to change notification settings - Fork 33
/
ActivationSpec.java
1239 lines (1106 loc) · 51.7 KB
/
ActivationSpec.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2000, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.messaging.jms.ra;
import java.util.Hashtable;
import java.util.Enumeration;
import jakarta.resource.*;
import jakarta.resource.spi.*;
import java.util.logging.Logger;
import com.sun.messaging.jmq.DestinationName;
import com.sun.messaging.jms.ra.util.CustomTokenizer;
import lombok.Getter;
import lombok.Setter;
/**
* Encapsulates the configuration of a MessageEndpoint. An Application Server configures an instance of this class and
* uses it to activate message inflow to a message listener in the application server.
*/
public class ActivationSpec
implements jakarta.resource.spi.ActivationSpec, jakarta.resource.spi.ResourceAdapterAssociation, java.io.Serializable, GenericConnectionFactoryProperties {
/** String constants used to map standard values to JMS equivalents */
private static final String AUTOACKNOWLEDGE = "Auto-acknowledge";
private static final String DUPSOKACKNOWLEDGE = "Dups-ok-acknowledge";
private static final String NOACKNOWLEDGE = "No-acknowledge";
private static final String DURABLE = "Durable";
private static final String NONDURABLE = "NonDurable";
private static final String QUEUE = "jakarta.jms.Queue";
private static final String TOPIC = "jakarta.jms.Topic";
/* Loggers */
private static final String _className = "com.sun.messaging.jms.ra.ActivationSpec";
protected static final String _lgrNameInboundMessage = "javax.resourceadapter.mqjmsra.inbound.message";
protected static final Logger _loggerIM = Logger.getLogger(_lgrNameInboundMessage);
protected static final String _lgrMIDPrefix = "MQJMSRA_AS";
protected static final String _lgrMID_EET = _lgrMIDPrefix + "1001: ";
protected static final String _lgrMID_INF = _lgrMIDPrefix + "1101: ";
protected static final String _lgrMID_WRN = _lgrMIDPrefix + "2001: ";
protected static final String _lgrMID_ERR = _lgrMIDPrefix + "3001: ";
protected static final String _lgrMID_EXC = _lgrMIDPrefix + "4001: ";
/** The resource adapter instance that this instance is bound to */
private com.sun.messaging.jms.ra.ResourceAdapter ra = null;
/** The instance carries on properties of connection factory */
private com.sun.messaging.jms.ra.ManagedConnectionFactory mcf;
/* ActivationSpec attributes recommended for JMS RAs */
/** The type of the destination for the MessageEndpoint consumer
*
* The destination type values are "jakarta.jms.Queue" or "jakarta.jms.Topic"
*/
@Getter
private String destinationType = null;
/** The name of the destination for the MessageEndpoint consumer */
private String destination = null;
/** The message selector for the MessageEndpoint consumer */
private String messageSelector = null;
/** The acknowledgement mode for the MessageEndpoitn consumer */
private String acknowledgeMode = AUTOACKNOWLEDGE;
/** The subscription durability of the MessageEndpoint consumer */
private String subscriptionDurability = NONDURABLE;
/** The clientId of the MessageEndpoint consumer */
private String clientId = null;
/** The subscription name of the MessageEndpoint consumer */
private String subscriptionName = null;
/** The subscription scope of the MessageEndpoint consumer */
private String subscriptionScope = null;
/* ActivationSpec attributes for the GlassFish(tm) MQ JMS Resource Adapter */
/** The ConnectionFactory JNDI Name to be used */
private String connectionFactoryJNDIName;
/** The Maximum endpoint pool size that will be used */
private int endpointPoolMaxSize = 15;
/** The Steady endpoint pool size that will be used */
private int endpointPoolSteadySize = 10;
/** The endpoint pool re-size count that will be used */
private int endpointPoolResizeCount = 1;
/** The endpoint pool re-size timeout in seconds that will be used */
private int endpointPoolResizeTimeout = 5;
/** The Maximum # of endpoint delivery attempts for endpoints that throw an Exception */
private int endpointExceptionRedeliveryAttempts = 6;
/** The interval for endpoint delivery attempts for endpoints that throw an Exception */
private int endpointExceptionRedeliveryInterval = 500;
/** The flag indicating whether to send undeliverable messages to the DMQ */
private boolean sendUndeliverableMsgsToDMQ = true;
/** Indicates whether the endpoint deployment requires a shared client Identifier */
// private boolean enableSharedClientID = false;
/** The Message Service Address List to use to connect to GlassFish(tm) MQ */
private String addressList = null;
private boolean addressListSet = false;
private String addressListBehavior = null;
/** The custom acknowledgement mode for this MessageEndpoint consumer */
private String customAcknowledgeMode = null;
/** The username that will be used for this endpoint - default is to use the one from the RA */
private String userName = null;
/** The password that will be used for this endpoint - default is to use the one from the RA */
private String password = null;
private int addressListIterations;
private boolean addressListIterationsSet = false;
private int reconnectAttempts;
private boolean reconnectAttemptsSet = false;
private int reconnectInterval;
private boolean reconnectIntervalSet = false;
@Getter
@Setter
private String destinationLookup;
@Getter
@Setter
private String connectionFactoryLookup;
/** ContextClassLoader for the onMessage Thread */
private transient ClassLoader contextClassLoader = null;
/**
* The name of the MDB (or a name which represents it). This is used when sharing non-durable topic subscriptions in a
* clustered container to set the clientID. This then allows the subscription to be shared with the MDB of the same name
* in the other container instances. It must be unique within an individual container instance. Only used in a clustered
* container when shared subscriptions are enabled. Only used for non-durable topic subscriptions. Only used if clientID
* is not explicitly set, and is mandatory if this is the case.
*/
private String mdbName = null;
/**
* If this is a clustered container, this is a name which identifies the cluster, and is always optional. When sharing
* non-durable topic subscriptions in a clustered container this is appended to the clientID. Only used in a clustered
* container when shared subscriptions are enabled. Only used for non-durable topic subscriptions. Only used if clientID
* is not explicitly set, and is always optional.
*
* (For info) In GlassFish 3.1 this will be set to <domainName>#<clusterName>
*/
private String groupName = null;
/** The Resource Adapter UID to use to ensure that ClientIDs are unique within an RA */
private String raUID = null;
/** The flag indicating whether this is being activated in a Clustered Container */
private boolean inClusteredContainer = false;
/** Internal flag indicating whether this is being activated using serial msg delivery */
/** Default (false) implies concurrent msg delivery */
private boolean deliverySerial = false;
/** additional connection factory properties, as a comma-separated list of name=value pairs */
private String options;
/** ActivationSpec must provide a default constructor */
public ActivationSpec() {
_loggerIM.entering(_className, "constructor()");
}
// ActivationSpec interface defined methods //
/**
* Validates the configuration of this ActivationSpec instance ActivationSpec instance.
*
* @throws InvalidPropertyException If this activation spec instance has any invalid property
*/
@Override
public void validate() throws InvalidPropertyException {
InvalidPropertyException ipe;
_loggerIM.entering(_className, "validate()", this);
// Require destinationName to be valid if destinationLookup is not set
if (destinationLookup == null && !DestinationName.isSyntaxValid(destination)) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:Invalid destination name=" + destination);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (QUEUE.equals(destinationType) && subscriptionScope != null) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:subscriptionScope must not be set if destinationType is " + QUEUE);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (TOPIC.equals(destinationType)) {
if (subscriptionScope != null && clientId != null) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:clientId must not be set if subscriptionScope is set");
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
// Require subscriptionName to be
// valid for durable subscriptions
if (subscriptionDurability.equals(DURABLE)) {
if ((subscriptionName == null) || ("".equals(subscriptionName))) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:subscriptionName must be non-null" + "\n\tsubscriptionName=" + subscriptionName);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
}
}
// Require valid values of endpoint properties
if (endpointExceptionRedeliveryInterval < 1) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:" + "\nendpointExceptionRedeliveryInterval must be greater than 0" + "\nInvalid value="
+ endpointExceptionRedeliveryInterval);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (endpointExceptionRedeliveryAttempts < 0) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:" + "\nendpointExceptionRedeliveryAttempts must be greater than or equal to 0"
+ "\nInvalid value=" + endpointExceptionRedeliveryAttempts);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (endpointPoolResizeTimeout < 0) {
ipe = new InvalidPropertyException(
_lgrMID_EXC + "validate:" + "\nendpointPoolResizeTimeout must not be negative" + "\nInvalid value=" + endpointPoolResizeTimeout);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (endpointPoolResizeCount < 1) {
ipe = new InvalidPropertyException(
_lgrMID_EXC + "validate:" + "\nendpointPoolResizeCount must be greater than 0" + "\nInvalid value=" + endpointPoolResizeCount);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (endpointPoolMaxSize < 1) {
ipe = new InvalidPropertyException(
_lgrMID_EXC + "validate:" + "\nendpointPoolMaxSize must be greater than 0" + "\nInvalid value=" + endpointPoolMaxSize);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (endpointPoolSteadySize < 0) {
ipe = new InvalidPropertyException(
_lgrMID_EXC + "validate:" + "\nendpointPoolSteadySize must be greater than or equal to 0" + "\nInvalid value=" + endpointPoolSteadySize);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
if (endpointPoolSteadySize > endpointPoolMaxSize) {
ipe = new InvalidPropertyException(_lgrMID_EXC + "validate:" + "\nendpointPoolSteadySize must be less than or equal to endpointPoolMaxSize"
+ "\nendpointPoolSteadySize value=" + endpointPoolSteadySize + "\nendpointPoolMaxSize value=" + endpointPoolSteadySize);
_loggerIM.throwing(_className, "validate()", ipe);
throw ipe;
}
_loggerIM.exiting(_className, "validate()");
}
// ResourceAdapterAssociation interface defined methods //
/**
* Sets the Resource Adapter Javabean that is associated with this ActivationSpec instance.
*
* @param ra The ResourceAdapter Javabean
*/
@Override
public void setResourceAdapter(jakarta.resource.spi.ResourceAdapter ra) throws ResourceException {
_loggerIM.entering(_className, "setResourceAdapter()", ra);
synchronized (this) {
if (this.ra == null) {
if (!(ra instanceof com.sun.messaging.jms.ra.ResourceAdapter)) {
ResourceException rae = new ResourceException(_lgrMID_EXC + "setResourceAdapter:Incompatible ResourceAdapter class=" + ra.getClass());
_loggerIM.warning(rae.getMessage());
_loggerIM.throwing(_className, "setResourceAdapter()", rae);
throw rae;
}
this.ra = (com.sun.messaging.jms.ra.ResourceAdapter) ra;
this.groupName = this.ra.getGroupName();
this.inClusteredContainer = this.ra.getInClusteredContainer();
this.raUID = this.ra._getRAUID();
} else {
ResourceException rae = new ResourceException(_lgrMID_EXC + "setResourceAdapter:Illegal to re-associate ResourceAdapter");
_loggerIM.warning(rae.getMessage());
_loggerIM.throwing(_className, "setResourceAdapter()", rae);
throw rae;
}
}
_loggerIM.exiting(_className, "setResourceAdapter()");
}
/**
* Gets the Resource Adapter Javabean that is associated with this ActivationSpec instance.
*
* @return The ResourceAdapter Javabean
*/
@Override
public jakarta.resource.spi.ResourceAdapter getResourceAdapter() {
_loggerIM.entering(_className, "getResourceAdapter()");
return ra;
}
public void setMCF(com.sun.messaging.jms.ra.ManagedConnectionFactory mcf) {
this.mcf = mcf;
}
// ActivationSpec Javabean configuration methods //
// These Methods can throw java.lang.RuntimeException or subclasses //
/**
* Sets the type of the destination for the MessageEndpoint consumer
*
* @param destinationType The destination type valid values are "jakarta.jms.Queue" and "jakarta.jms.Topic"
*
* @throws IllegalArgumentException If destinationType is not one of the above
*/
public void setDestinationType(String destinationType) {
_loggerIM.entering(_className, "setDestinationType()", destinationType);
// Must be jakarta.jms.Queue or Topic
if (QUEUE.equals(destinationType) || TOPIC.equals(destinationType)) {
this.destinationType = destinationType;
} else {
IllegalArgumentException iae = new IllegalArgumentException(_lgrMID_EXC + "setDestinationType:Invalid destinationType=" + destinationType);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setDestinationType()", iae);
throw iae;
}
}
/**
* Sets the name of the destination for the MessageEndpoint consumer
*
* @param destination The destination name
*
* @throws IllegalArgumentException If destination is not a valid name
*/
public void setDestination(String destination) {
_loggerIM.entering(_className, "setDestination()", destination);
// Destination must be valid name according to MQ rule
if (!DestinationName.isSyntaxValid(destination)) {
IllegalArgumentException iae = new IllegalArgumentException(_lgrMID_EXC + "setDestination:Invalid destination name=" + destination);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setDestination()", iae);
throw iae;
}
this.destination = destination;
}
/**
* Gets the name of the destination for the MessageEndpoint consumer
*
* @return The destination name
*/
public String getDestination() {
_loggerIM.entering(_className, "getDestination()", destination);
return destination;
}
/**
* Sets the message selector for the MessageEndpoint consumer
*
* @param messageSelector The selector
*/
public void setMessageSelector(String messageSelector) {
_loggerIM.entering(_className, "setMessageSelector()", messageSelector);
this.messageSelector = messageSelector;
}
/**
* Gets the message selector for the MessageEndpoint consumer
*
* @return The message selector
*/
public String getMessageSelector() {
_loggerIM.entering(_className, "getMessageSelector()", messageSelector);
return messageSelector;
}
/**
* Sets the acknowledgement mode for the MessageEndpoint consumer
*
* @param acknowledgeMode The acknowledgement mode valid values are "Auto-acknowledge" and "Dups-ok-acknowledge" and
* "No-acknowledge" (Non-Durable/Topic only)
*
* @throws IllegalArgumentException If acknowledgement mode is not valid
*/
public void setAcknowledgeMode(String acknowledgeMode) {
_loggerIM.entering(_className, "setAcknowledgeMode()", acknowledgeMode);
// Must be Auto-acknowledge or Dups-ok-acknowledge
if (AUTOACKNOWLEDGE.equals(acknowledgeMode) || DUPSOKACKNOWLEDGE.equals(acknowledgeMode)) {
this.acknowledgeMode = acknowledgeMode;
} else {
IllegalArgumentException iae = new IllegalArgumentException(_lgrMID_EXC + "setAcknowledgeMode:Invalid acknowledgeMode=" + acknowledgeMode);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setAcknowledgeMode()", iae);
throw iae;
}
}
/**
* Gets the acknowledgement mode for the MessageEndpoint consumer
*
* @return The acknowledgement mode one of either "Auto-acknowledge" or "Dups-ok-acknowledge" or null
*/
public String getAcknowledgeMode() {
_loggerIM.entering(_className, "getAcknowledgeMode()", acknowledgeMode);
return acknowledgeMode;
}
/**
* Sets a custom acknowledgement mode for the MessageEndpoint consumer
*
* @param customAcknowledgeMode The customAcknowledgement mode valid values are "No-acknowledge" (Non-Durable/Topic
* only)
*
* @throws IllegalArgumentException If customAcknowledgement mode is not valid
*/
public void setCustomAcknowledgeMode(String customAcknowledgeMode) {
_loggerIM.entering(_className, "setCustomAcknowledgeMode()", customAcknowledgeMode);
// Must be No-acknowledge
if (NOACKNOWLEDGE.equals(customAcknowledgeMode)) {
this.customAcknowledgeMode = customAcknowledgeMode;
} else {
IllegalArgumentException iae = new IllegalArgumentException(
_lgrMID_EXC + "setCustomAcknowledgeMode:Invalid customAcknowledgeMode=" + customAcknowledgeMode);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setCustomAcknowledgeMode()", iae);
throw iae;
}
}
/**
* Gets the CustomAcknowledgement mode for the MessageEndpoint consumer
*
* @return The CustomAcknowledgement mode currently only "No-acknowledge" or null
*/
public String getCustomAcknowledgeMode() {
_loggerIM.entering(_className, "getCustomAcknowledgeMode()", customAcknowledgeMode);
return customAcknowledgeMode;
}
/**
* Sets the subscription durability for the MessageEndpoint consumer
*
* @param subscriptionDurability The durability mode valid values are "Durable" and "NonDurable"
*
* @throws IllegalArgumentException If subscriptionDurability is not valid
*/
public void setSubscriptionDurability(String subscriptionDurability) {
_loggerIM.entering(_className, "setSubscriptionDurability()", subscriptionDurability);
// Must be Durable or NonDurable
if (DURABLE.equals(subscriptionDurability) || NONDURABLE.equals(subscriptionDurability)) {
this.subscriptionDurability = subscriptionDurability;
} else {
IllegalArgumentException iae = new IllegalArgumentException(
_lgrMID_EXC + "setSubscriptionDurability:Invalid subscriptionDurability=" + subscriptionDurability);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setSubscriptionDurability()", iae);
throw iae;
}
}
/**
* Gets the subscription durability for the MessageEndpoint consumer
*
* @return The subscription durability one of either "Durable" or "NonDurable" or null
*/
public String getSubscriptionDurability() {
_loggerIM.entering(_className, "getSubscriptionDurability()", subscriptionDurability);
return subscriptionDurability;
}
/**
* Sets the client identifier for the MessageEndpoint consumer
*
* @param clientId The client identifier
*/
@Override
public void setClientId(String clientId) {
_loggerIM.entering(_className, "setClientId()", clientId);
this.clientId = clientId;
}
/**
* Return the client identifier for the MessageEndpoint consumer
*
* @return The client identifier
*/
@Override
public String getClientId() {
_loggerIM.entering(_className, "getClientId()", clientId);
return clientId;
}
/**
* Sets the subscription name for the MessageEndpoint consumer
*
* @param subscriptionName The name of the subscription
*/
public void setSubscriptionName(String subscriptionName) {
_loggerIM.entering(_className, "setSubscriptionName()", subscriptionName);
this.subscriptionName = subscriptionName;
}
/**
* Returns the subscription name for the MessageEndpoint consumer
*
* @return The name of the subscription
*/
public String getSubscriptionName() {
_loggerIM.entering(_className, "getSubscriptionName()", subscriptionName);
return subscriptionName;
}
/*
* Sets the subscription scope for the MessageEndpoint consumer
*
* @param subscriptionScope The scope of the subscription valid values are "Instance" and "Cluster"
*
* @throws IllegalArgumentException If subscriptionScope is not valid
*/
// Disable the feature of JMS_SPEC-73 temporarily for it is removed from JMS 2.0.
// It will be added back in future release.
/*
* public void setSubscriptionScope(String subscriptionScope) { _loggerIM.entering(_className, "setSubscriptionScope()",
* subscriptionScope); //Must be Instance or Cluster if (INSTANCE.equals(subscriptionScope) ||
* CLUSTER.equals(subscriptionScope)) {
*
* this.subscriptionScope = subscriptionScope;
*
* } else { IllegalArgumentException iae = new IllegalArgumentException(_lgrMID_EXC +
* "setSubscriptionScope:Invalid subscriptionScope=" + subscriptionScope); _loggerIM.warning(iae.getMessage());
* _loggerIM.throwing(_className, "setSubscriptionScope()", iae); throw iae; } }
*/
/**
* Returns the subscription scope for the MessageEndpoint consumer
*
* @return The scope of the subscription one of either "Instance" or "Cluster" or null
*/
public String getSubscriptionScope() {
_loggerIM.entering(_className, "getSubscriptionScope()", subscriptionScope);
return subscriptionScope;
}
/**
* Sets the connectionFactoryJNDIName for the MessageEndpoint consumer
*
* @param connectionFactoryJNDIName The connectionFactoryJNDIName
*/
public void _setConnectionFactoryJNDIName(String connectionFactoryJNDIName) {
_loggerIM.entering(_className, "_setConnectionFactoryJNDIName()", connectionFactoryJNDIName);
this.connectionFactoryJNDIName = connectionFactoryJNDIName;
}
/**
* Returns the connectionFactoryJNDIName for the MessageEndpoint consumer
*
* @return The connectionFactoryJNDIName
*/
public String _getConnectionFactoryJNDIName() {
_loggerIM.entering(_className, "_getConnectionFactoryJNDIName()", connectionFactoryJNDIName);
return connectionFactoryJNDIName;
}
/**
* Sets the endpointPoolMaxSize for the MessageEndpoint consumer
*
* @param endpointPoolMaxSize The endpointPoolMaxSize
*/
public void setEndpointPoolMaxSize(int endpointPoolMaxSize) {
_loggerIM.entering(_className, "setEndpointPoolMaxSize()", Integer.toString(endpointPoolMaxSize));
if (endpointPoolMaxSize < 1) {
IllegalArgumentException iae = new IllegalArgumentException(
_lgrMID_EXC + "setEndpointPoolMaxSize:" + "Value must be greater than 0 " + "Invalid value=" + endpointPoolMaxSize);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setEndpointPoolMaxSize()", iae);
throw iae;
}
this.endpointPoolMaxSize = endpointPoolMaxSize;
}
/**
* Returns the endpointPoolMaxSize for the MessageEndpoint consumer
*
* @return The endpointPoolMaxSize
*/
public int getEndpointPoolMaxSize() {
_loggerIM.entering(_className, "getEndpointPoolMaxSize()", Integer.toString(endpointPoolMaxSize));
return endpointPoolMaxSize;
}
/**
* Sets the endpointPoolSteadySize for the MessageEndpoint consumer
*
* @param endpointPoolSteadySize The endpointPoolSteadySize
*/
public void setEndpointPoolSteadySize(int endpointPoolSteadySize) {
_loggerIM.entering(_className, "setEndpointPoolSteadySize()", Integer.toString(endpointPoolSteadySize));
if (endpointPoolSteadySize < 0) {
IllegalArgumentException iae = new IllegalArgumentException(
_lgrMID_EXC + "setEndpointPoolSteadySize:" + "Value must be greater than or equal to 0 " + "Invalid value=" + endpointPoolSteadySize);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setEndpointPoolSteadySize()", iae);
throw iae;
}
this.endpointPoolSteadySize = endpointPoolSteadySize;
}
/**
* Returns the endpointPoolSteadySize for the MessageEndpoint consumer
*
* @return The endpointPoolSteadySize
*/
public int getEndpointPoolSteadySize() {
_loggerIM.entering(_className, "getEndpointPoolSteadySize()", Integer.toString(endpointPoolSteadySize));
return endpointPoolSteadySize;
}
/**
* Sets the endpointPoolResizeCount for the MessageEndpoint consumer
*
* @param endpointPoolResizeCount The endpointPoolResizeCount
*/
public void setEndpointPoolResizeCount(int endpointPoolResizeCount) {
_loggerIM.entering(_className, "setEndpointPoolResizeCount()", Integer.toString(endpointPoolResizeCount));
if (endpointPoolResizeCount < 1) {
IllegalArgumentException iae = new IllegalArgumentException(
_lgrMID_EXC + "setEndpointPoolResizeCount:Value must be greater than 0:Invalid value=" + endpointPoolResizeCount);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setEndpointPoolResizeCount()", iae);
throw iae;
}
this.endpointPoolResizeCount = endpointPoolResizeCount;
}
/**
* Returns the endpointPoolResizeCount for the MessageEndpoint consumer
*
* @return The endpointPoolResizeCount
*/
public int getEndpointPoolResizeCount() {
_loggerIM.entering(_className, "getEndpointPoolResizeCount()", Integer.toString(endpointPoolResizeCount));
return endpointPoolResizeCount;
}
/**
* Sets the endpointPoolResizeTimeout for the MessageEndpoint consumer
*
* @param endpointPoolResizeTimeout The endpointPoolResizeTimeout
*/
public void setEndpointPoolResizeTimeout(int endpointPoolResizeTimeout) {
_loggerIM.entering(_className, "setEndpointPoolResizeTimeout()", Integer.toString(endpointPoolResizeTimeout));
if (endpointPoolResizeTimeout < 0) {
IllegalArgumentException iae = new IllegalArgumentException(
_lgrMID_EXC + "setEndpointPoolResizeTimeout:Value must not be negative:Invalid value=" + endpointPoolResizeTimeout);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setEndpointPoolResizeTimeout()", iae);
throw iae;
}
this.endpointPoolResizeTimeout = endpointPoolResizeTimeout;
}
/**
* Returns the endpointPoolResizeTimeout for the MessageEndpoint consumer
*
* @return The endpointPoolResizeTimeout
*/
public int getEndpointPoolResizeTimeout() {
_loggerIM.entering(_className, "getEndpointPoolResizeTimeout()", Integer.toString(endpointPoolResizeTimeout));
return endpointPoolResizeTimeout;
}
/**
* Sets the maximum number of Redelivery attempts to an Endpoint that throws an Exception. This enables the RA to stop
* endlessly delivering messages to an Endpoint that repeatedly throws an Exception
*
* @param endpointExceptionRedeliveryAttempts The maximum number of Redelivery attempts
*/
public void setEndpointExceptionRedeliveryAttempts(int endpointExceptionRedeliveryAttempts) {
_loggerIM.entering(_className, "setEndpointExceptionRedeliveryAttempts()", Integer.toString(endpointExceptionRedeliveryAttempts));
if (endpointExceptionRedeliveryAttempts < 0) {
IllegalArgumentException iae = new IllegalArgumentException(_lgrMID_EXC + "setEndpointExceptionRedeliveryAttempts:"
+ "Value must be greater than or equal to 0:" + "Invalid value=" + endpointExceptionRedeliveryAttempts);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setEndpointExceptionRedeliveryAttempts()", iae);
throw iae;
}
this.endpointExceptionRedeliveryAttempts = endpointExceptionRedeliveryAttempts;
}
/**
* Returns the the maximum number of Redelivery attempts to an Endpoint that throws an Exception. This enables the RA to
* stop endlessly delivering messages to an Endpoint that repeatedly throws an Exception
*
* @return The maximum number of Redelivery attempts to an Endpoint.
*/
public int getEndpointExceptionRedeliveryAttempts() {
_loggerIM.entering(_className, "getEndpointExceptionRedeliveryAttempts()", Integer.toString(endpointExceptionRedeliveryAttempts));
return endpointExceptionRedeliveryAttempts;
}
/**
* Sets the interval for Redelivery attempts to an Endpoint that throws an Exception.
*
* @param endpointExceptionRedeliveryInterval The maximum number of Redelivery attempts
*/
public void setEndpointExceptionRedeliveryInterval(int endpointExceptionRedeliveryInterval) {
_loggerIM.entering(_className, "setEndpointExceptionRedeliveryInterval()", Integer.toString(endpointExceptionRedeliveryInterval));
if (endpointExceptionRedeliveryInterval < 1) {
IllegalArgumentException iae = new IllegalArgumentException(_lgrMID_EXC + "setEndpointExceptionRedeliveryInterval:"
+ "Value must be greater than 0:" + "Invalid value=" + endpointExceptionRedeliveryInterval);
_loggerIM.warning(iae.getMessage());
_loggerIM.throwing(_className, "setEndpointExceptionRedeliveryInterval()", iae);
throw iae;
}
this.endpointExceptionRedeliveryInterval = endpointExceptionRedeliveryInterval;
}
/**
* Returns the interval for Redelivery attempts to an Endpoint that throws an Exception.
*
* @return The interval for Redelivery attempts to an Endpoint.
*/
public int getEndpointExceptionRedeliveryInterval() {
_loggerIM.entering(_className, "getEndpointExceptionRedeliveryInterval()", Integer.toString(endpointExceptionRedeliveryInterval));
return endpointExceptionRedeliveryInterval;
}
/**
* Sets whether to send undeliverable messages to the DMQ
*
* @param sendUndeliverableMsgsToDMQ If true; sends the undeliverable messages to the DMQ.
*/
public void setSendUndeliverableMsgsToDMQ(boolean sendUndeliverableMsgsToDMQ) {
_loggerIM.entering(_className, "setSendUndeliverableMsgsToDMQ()", Boolean.toString(sendUndeliverableMsgsToDMQ));
this.sendUndeliverableMsgsToDMQ = sendUndeliverableMsgsToDMQ;
}
/**
* Returns whether to send undeliverable messages to the DMQ
*
* @return sendUndeliverableMsgsToDM Whether to send undeliverable messages to the DMQ
*/
public boolean getSendUndeliverableMsgsToDMQ() {
_loggerIM.entering(_className, "getSendUndeliverableMsgsToDMQ()", Boolean.toString(sendUndeliverableMsgsToDMQ));
return sendUndeliverableMsgsToDMQ;
}
/**
* Sets the ContextClassLoader to be used for the MessageEndpoint consumer
*
* @param contextClassLoader The contextClassLoader
*/
public void setContextClassLoader(ClassLoader contextClassLoader) {
_loggerIM.entering(_className, "setContextClassLoader()", contextClassLoader);
this.contextClassLoader = contextClassLoader;
}
/**
* Returns the contextClassLoader used for the MessageEndpoint consumer
*
* @return The contextClassLoader
*/
public ClassLoader getContextClassLoader() {
_loggerIM.entering(_className, "getContextClassLoader()", contextClassLoader);
return contextClassLoader;
}
/**
* Sets the specified addressList for this ActivationSpec
*/
@Override
public void setAddressList(String addressList) {
_loggerIM.entering(_className, "setAddressList()", addressList);
this.addressList = addressList;
if ((addressList != null) && !"".equals(addressList)) {
this.addressListSet = true;
}
}
/**
* Returns the specified addressList for this ActivationSpec
*
* @return The addressList
*/
@Override
public String getAddressList() {
_loggerIM.entering(_className, "getAddressList()", addressList);
return addressList;
}
@Override
public void setAddressListBehavior(String addressListBehavior) {
_loggerIM.entering(_className, "setAddressListBehavior()", addressListBehavior);
this.addressListBehavior = addressListBehavior;
}
/**
* Returns the specified addressListBehavior for this ActivationSpec if it is set, otherwise, returns the value
* specified on ManagedConnectionFactory if it is set, otherwise, returns the value specified on ResourceAdaptor.
*
* @return The addressListBehavior
*/
@Override
public String getAddressListBehavior() {
_loggerIM.entering(_className, "getAddressListBehavior()", addressListBehavior);
if (addressListBehavior != null) {
return addressListBehavior;
} else {
if (mcf != null)
return mcf.getAddressListBehavior();
else if (ra != null)
return ra.getAddressListBehavior();
else
return null;
}
}
/**
* Set the name of the MDB (or a name which represents it). This is used when sharing non-durable topic subscriptions in
* a clustered container to set the clientID. This then allows the subscription to be shared with the MDB of the same
* name in the other container instances. It must be unique within an individual container instance. Only used in a
* clustered container when shared subscriptions are enabled. Only used for non-durable topic subscriptions. Only used
* if clientID is not explicitly set, and is mandatory if this is the case.
*
* For info: In GlassFish 3.1 this will be set to <domainName>#<clusterName>#<EJBMessageBeanDescriptor.uniqueId>.
*/
public void setMdbName(String mdbName) {
_loggerIM.entering(_className, "setMdbName()", mdbName);
this.mdbName = mdbName;
}
/**
* Returns the name of the MDB (or a name which represents it).
*/
public String getMdbName() {
_loggerIM.entering(_className, "getMdbName()", mdbName);
return mdbName;
}
/**
* Sets the userName for this activationSpec.
*/
@Override
public void setUserName(String userName) {
_loggerIM.entering(_className, "setUserName()", userName);
this.userName = userName;
}
/**
* Returns the specified username for this ActivationSpec if it is set, otherwise, returns the value specified on
* ManagedConnectionFactory if it is set, otherwise, returns the value specified on ResourceAdaptor.
*
* @return The username
*/
@Override
public String getUserName() {
_loggerIM.entering(_className, "getUserName()", userName);
if (userName != null) {
return userName;
} else {
if (mcf != null && mcf.getUserName() != null)
return mcf.getUserName();
else if (ra != null)
return ra.getUserName();
else
return null;
}
}
/**
* Sets the password for this activationSpec.
*/
@Override
public void setPassword(String password) {
_loggerIM.entering(_className, "setPassword()");
this.password = password;
}
/**
* Returns the specified password for this ActivationSpec if it is set, otherwise, returns the value specified on
* ManagedConnectionFactory if it is set, otherwise, returns the value specified on ResourceAdaptor.
*
* @return The password
*/
@Override
public String getPassword() {
_loggerIM.entering(_className, "getPassword()");
if (password != null) {
return password;
} else {
if (mcf != null && mcf.getPassword() != null)
return mcf.getPassword();
else if (ra != null)
return ra.getPassword();
else
return null;
}
}
/**
* Sets the value of addressListIterations for this activationSpec.
*/
@Override
public void setAddressListIterations(int addressListIterations) {
_loggerIM.entering(_className, "setAddressListIterations()");
this.addressListIterations = addressListIterations;
this.addressListIterationsSet = true;
}
/**
* Returns the specified addressListIterations for this ActivationSpec if it is set, otherwise, returns the value
* specified on ManagedConnectionFactory if it is set, otherwise, returns the value specified on ResourceAdaptor.
*
* @return The addressListIterations
*/
@Override
public int getAddressListIterations() {
if (addressListIterationsSet) {
return addressListIterations;
} else {
if (mcf != null)
return mcf.getAddressListIterations();
else
return ra.getAddressListIterations();
}
}
/**
* Sets the value of reconnectAttempts for this activationSpec.
*/
@Override
public void setReconnectAttempts(int reconnectAttempts) {
_loggerIM.entering(_className, "setReconnectAttempts()");
this.reconnectAttempts = reconnectAttempts;
this.reconnectAttemptsSet = true;
}
/**
* Returns the specified reconnectAttempts for this ActivationSpec if it is set, otherwise, returns the value specified
* on ManagedConnectionFactory if it is set, otherwise, returns the value specified on ResourceAdaptor.
*
* @return The reconnectAttempts
*/
@Override
public int getReconnectAttempts() {
if (reconnectAttemptsSet) {
return reconnectAttempts;
} else {
if (mcf != null)
return mcf.getReconnectAttempts();
else
return ra.getReconnectAttempts();
}
}
/**
* Sets the value of reconnectInterval for this activationSpec.
*/
@Override
public void setReconnectInterval(int reconnectInterval) {
_loggerIM.entering(_className, "setReconnectInterval()");
this.reconnectInterval = reconnectInterval;
this.reconnectIntervalSet = true;
}
/**
* Returns the specified reconnectInterval for this ActivationSpec if it is set, otherwise, returns the value specified
* on ManagedConnectionFactory if it is set, otherwise, returns the value specified on ResourceAdaptor.
*
* @return The reconnectInterval
*/