KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mr > ra > inbound > ActivationSpecImpl


1 /*
2  * Copyright 2002 by
3  * <a HREF="http://www.coridan.com">Coridan</a>
4  * <a HREF="mailto: support@coridan.com ">support@coridan.com</a>
5  *
6  * The contents of this file are subject to the Mozilla Public License Version
7  * 1.1 (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  * http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is "MantaRay" (TM).
17  *
18  * The Initial Developer of the Original Code is Coridan.
19  * Portions created by the Initial Developer are Copyright (C) 2006
20  * Coridan Inc. All Rights Reserved.
21  *
22  * Contributor(s): all the names of the contributors are added in the source
23  * code where applicable.
24  *
25  * Alternatively, the contents of this file may be used under the terms of the
26  * LGPL license (the "GNU LESSER GENERAL PUBLIC LICENSE"), in which case the
27  * provisions of LGPL are applicable instead of those above. If you wish to
28  * allow use of your version of this file only under the terms of the LGPL
29  * License and not to allow others to use your version of this file under
30  * the MPL, indicate your decision by deleting the provisions above and
31  * replace them with the notice and other provisions required by the LGPL.
32  * If you do not delete the provisions above, a recipient may use your version
33  * of this file under either the MPL or the GNU LESSER GENERAL PUBLIC LICENSE.
34  
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Lesser General Public License as published by the Free Software Foundation;
39  * either version 2.1 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
44  * License for more details.
45  */

46
47 package org.mr.ra.inbound;
48
49 import java.beans.IntrospectionException JavaDoc;
50 import java.beans.PropertyDescriptor JavaDoc;
51 import java.io.Serializable JavaDoc;
52 import java.util.ArrayList JavaDoc;
53 import java.util.Iterator JavaDoc;
54 import java.util.List JavaDoc;
55
56 import org.mr.api.jms.selector.syntax.Selector;
57
58 import javax.jms.Queue JavaDoc;
59 import javax.jms.Session JavaDoc;
60 import javax.jms.Topic JavaDoc;
61 import javax.resource.ResourceException JavaDoc;
62 import javax.resource.spi.ActivationSpec JavaDoc;
63 import javax.resource.spi.InvalidPropertyException JavaDoc;
64 import javax.resource.spi.ResourceAdapter JavaDoc;
65
66 import org.mr.ra.ResourceAdapterImpl;
67
68 /**
69  * @version $Revision: 1.1.1.1 $ $Date: 2005/03/11 21:15:09 $
70  */

71 public class ActivationSpecImpl implements ActivationSpec JavaDoc, Serializable JavaDoc {
72     
73     /** Auto-acknowledge constant for <code>acknowledgeMode</code> property **/
74     public static final String JavaDoc AUTO_ACKNOWLEDGE_MODE = "Auto-acknowledge";
75     
76     /** Dups-ok-acknowledge constant for <code>acknowledgeMode</code> property * */
77     public static final String JavaDoc DUPS_OK_ACKNOWLEDGE_MODE = "Dups-ok-acknowledge";
78     
79     /** Durable constant for <code>subscriptionDurability</code> property * */
80     public static final String JavaDoc DURABLE_SUBSCRIPTION = "Durable";
81     
82     /** NonDurable constant for <code>subscriptionDurability</code> property * */
83     public static final String JavaDoc NON_DURABLE_SUBSCRIPTION = "NonDurable";
84     
85     public static final int INVALID_ACKNOWLEDGE_MODE = -1;
86     
87     private ResourceAdapterImpl resourceAdapter = null;
88     private String JavaDoc destination = null;
89     private String JavaDoc destinationType = null;
90     private String JavaDoc messageSelector = null;
91     private String JavaDoc acknowledgeMode = AUTO_ACKNOWLEDGE_MODE;
92     private String JavaDoc userName = null;
93     private String JavaDoc password = null;
94     private String JavaDoc clientId = null;
95     private String JavaDoc subscriptionName = null;
96     private String JavaDoc subscriptionDurability = NON_DURABLE_SUBSCRIPTION;
97     private String JavaDoc noLocal = "false";
98     private String JavaDoc maxMessagesPerSessions = "10";
99     private String JavaDoc maxSessions = "10";
100     private String JavaDoc enableBatch = "false";
101     private String JavaDoc maxMessagesPerBatch = "10";
102     private String JavaDoc useRAManagedTransaction = "false";
103
104     /**
105      * @see javax.resource.spi.ActivationSpec#validate()
106      */

107     public void validate() throws InvalidPropertyException JavaDoc {
108         List JavaDoc errorMessages = new ArrayList JavaDoc();
109         List JavaDoc propsNotSet = new ArrayList JavaDoc();
110         try {
111             if (!isValidDestination(errorMessages))
112                 propsNotSet.add(new PropertyDescriptor JavaDoc("destination", ActivationSpecImpl.class));
113             if (!isValidDestinationType(errorMessages))
114                 propsNotSet.add(new PropertyDescriptor JavaDoc("destinationType", ActivationSpecImpl.class));
115             if (!isValidAcknowledgeMode(errorMessages))
116                 propsNotSet.add(new PropertyDescriptor JavaDoc("acknowledgeMode", ActivationSpecImpl.class));
117             if (!isValidSubscriptionDurability(errorMessages))
118                 propsNotSet.add(new PropertyDescriptor JavaDoc("subscriptionDurability", ActivationSpecImpl.class));
119             if (!isValidClientId(errorMessages))
120                 propsNotSet.add(new PropertyDescriptor JavaDoc("clientId", ActivationSpecImpl.class));
121             if (!isValidSubscriptionName(errorMessages))
122                 propsNotSet.add(new PropertyDescriptor JavaDoc("subscriptionName", ActivationSpecImpl.class));
123             if (!isValidMaxMessagesPerSessions(errorMessages))
124                 propsNotSet.add(new PropertyDescriptor JavaDoc("maxMessagesPerSessions", ActivationSpecImpl.class));
125             if (!isValidMessageSelector(errorMessages))
126                 propsNotSet.add(new PropertyDescriptor JavaDoc("messageSelector", ActivationSpecImpl.class));
127             if (!isValidNoLocal(errorMessages))
128                 propsNotSet.add(new PropertyDescriptor JavaDoc("noLocal", ActivationSpecImpl.class));
129             if (!isValidMaxSessions(errorMessages))
130                 propsNotSet.add(new PropertyDescriptor JavaDoc("maxSessions", ActivationSpecImpl.class));
131             if (!isValidEnableBatch(errorMessages))
132                 propsNotSet.add(new PropertyDescriptor JavaDoc("enableBatch", ActivationSpecImpl.class));
133             if (!isValidMaxMessagesPerBatch(errorMessages))
134                 propsNotSet.add(new PropertyDescriptor JavaDoc("maxMessagesPerBatch", ActivationSpecImpl.class));
135             if (!isValidUseRAManagedTransaction(errorMessages))
136                 propsNotSet.add(new PropertyDescriptor JavaDoc("useRAManagedTransaction", ActivationSpecImpl.class));
137         } catch (IntrospectionException JavaDoc e) {
138             e.printStackTrace();
139         }
140         
141         if (propsNotSet.size() > 0) {
142             StringBuffer JavaDoc b = new StringBuffer JavaDoc();
143             b.append("Invalid settings:");
144             for (Iterator JavaDoc iter = errorMessages.iterator(); iter.hasNext();) {
145                 b.append(" ");
146                 b.append(iter.next());
147             }
148             InvalidPropertyException JavaDoc e = new InvalidPropertyException JavaDoc(b.toString());
149             final PropertyDescriptor JavaDoc[] descriptors = (PropertyDescriptor JavaDoc[]) propsNotSet.toArray(new PropertyDescriptor JavaDoc[propsNotSet.size()]);
150             e.setInvalidPropertyDescriptors(descriptors);
151             throw e;
152         }
153     }
154     
155     /**
156      * Checks the validity of destination
157      * @param errorMessages
158      * @return
159      */

160     private boolean isValidDestination(List JavaDoc errorMessages) {
161         if (!isEmpty(destination))
162             return true;
163         errorMessages.add("destination is a required field and must be set to the destination name.");
164         return false;
165     }
166     
167     /**
168      * Checks the validity of destinationType
169      * @param errorMessages
170      * @return
171      */

172     private boolean isValidDestinationType(List JavaDoc errorMessages) {
173         if (Queue JavaDoc.class.getName().equals(destinationType) || Topic JavaDoc.class.getName().equals(destinationType))
174             return true;
175         errorMessages.add("destinationType must be set to: "+Queue JavaDoc.class.getName()+" or "+Topic JavaDoc.class.getName()+".");
176         return false;
177     }
178     
179     /**
180      * Checks the validity of acknowledgeMode
181      * @param errorMessages
182      * @return
183      */

184     private boolean isValidAcknowledgeMode(List JavaDoc errorMessages) {
185         if (AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode) || DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode))
186             return true;
187         errorMessages.add("acknowledgeMode must be set to: "+AUTO_ACKNOWLEDGE_MODE+" or "+DUPS_OK_ACKNOWLEDGE_MODE+".");
188         return false;
189     }
190     
191     /**
192      * Checks the validity of subscriptionDurability
193      * @param errorMessages
194      * @return
195      */

196     private boolean isValidSubscriptionDurability(List JavaDoc errorMessages) {
197         if (NON_DURABLE_SUBSCRIPTION.equals(subscriptionDurability) || DURABLE_SUBSCRIPTION.equals(subscriptionDurability))
198             return true;
199         errorMessages.add("subscriptionDurability must be set to: "+NON_DURABLE_SUBSCRIPTION+" or "+DURABLE_SUBSCRIPTION+".");
200         return false;
201     }
202     
203     /**
204      * Checks the validity of clientId
205      * @param errorMessages
206      * @return
207      */

208     private boolean isValidClientId(List JavaDoc errorMessages) {
209         if (!isDurableSubscription()) {
210             return true;
211         }
212         if (!isEmpty(clientId)) {
213             return true;
214         }
215         errorMessages.add("clientId must be set since durable subscription was requested.");
216         return false;
217     }
218     
219     /**
220      * Checks the validity of subscriptionName
221      * @param errorMessages
222      * @return
223      */

224     private boolean isValidSubscriptionName(List JavaDoc errorMessages) {
225         if (!isDurableSubscription()) {
226             return true;
227         }
228         if (!isEmpty(subscriptionName)) {
229             return true;
230         }
231         errorMessages.add("subscriptionName must be set since durable subscription was requested.");
232         return false;
233     }
234     
235     /**
236      * Checks the validity of maxMessagesPerSessions
237      * @param errorMessages
238      * @return
239      */

240     private boolean isValidMaxMessagesPerSessions(List JavaDoc errorMessages) {
241         try {
242             if (Integer.parseInt(maxMessagesPerSessions) > 0) {
243                 return true;
244             }
245         } catch (NumberFormatException JavaDoc e) {}
246         errorMessages.add("maxMessagesPerSessions must be set to number > 0.");
247         return false;
248     }
249     
250     /**
251      * Checks the validity of messageSelector
252      * @param errorMessages
253      * @return
254      */

255     private boolean isValidMessageSelector(List JavaDoc errorMessages) {
256         try {
257             new Selector(messageSelector);
258             return true;
259         }
260         catch (Throwable JavaDoc e) {}
261         errorMessages.add("messageSelector not set to valid message selector.");
262         return false;
263     }
264     
265     /**
266      * Checks the validity of noLocal
267      * @param errorMessages
268      * @return
269      */

270     private boolean isValidNoLocal(List JavaDoc errorMessages) {
271         try {
272             new Boolean JavaDoc(noLocal);
273             return true;
274         } catch (Throwable JavaDoc e) {}
275         errorMessages.add("noLocal must be set to: true or false.");
276         return false;
277     }
278     
279     /**
280      * Checks the validity of maxSessions
281      * @param errorMessages
282      * @return
283      */

284     private boolean isValidMaxSessions(List JavaDoc errorMessages) {
285         try {
286             if (Integer.parseInt(maxSessions) > 0) {
287                 return true;
288             }
289         } catch (NumberFormatException JavaDoc e) {}
290         errorMessages.add("maxSessions must be set to number > 0.");
291         return false;
292     }
293     
294     /**
295      * Checks the validity of maxMessagesPerBatch
296      * @param errorMessages
297      * @return
298      */

299     private boolean isValidMaxMessagesPerBatch(List JavaDoc errorMessages) {
300         if (!getEnableBatchBooleanValue()) {
301             return true;
302         }
303         try {
304             if (Integer.parseInt(maxMessagesPerBatch) > 0) {
305                 return true;
306             }
307         } catch (NumberFormatException JavaDoc e) {}
308         errorMessages.add("maxMessagesPerBatch must be set to number > 0.");
309         return false;
310     }
311     
312     /**
313      * Checks the validity of enableBatch
314      * @param errorMessages
315      * @return
316      */

317     private boolean isValidEnableBatch(List JavaDoc errorMessages) {
318         try {
319             new Boolean JavaDoc(enableBatch);
320             return true;
321         } catch (Throwable JavaDoc e) {}
322         errorMessages.add("enableBatch must be set to: true or false.");
323         return false;
324     }
325     
326     /**
327      * Checks the validity of useRAManagedTransaction
328      * @param errorMessages
329      * @return
330      */

331     private boolean isValidUseRAManagedTransaction(List JavaDoc errorMessages) {
332         try {
333             new Boolean JavaDoc(useRAManagedTransaction);
334             return true;
335         } catch (Throwable JavaDoc e) {}
336         errorMessages.add("useRAManagedTransaction must be set to: true or false.");
337         return false;
338     }
339     
340     
341     
342     /**
343      * @see javax.resource.spi.ResourceAdapterAssociation#getResourceAdapter()
344      */

345     public ResourceAdapter JavaDoc getResourceAdapter() {
346         return resourceAdapter;
347     }
348     
349     /**
350      * @see javax.resource.spi.ResourceAdapterAssociation#setResourceAdapter(javax.resource.spi.ResourceAdapter)
351      */

352     public void setResourceAdapter(ResourceAdapter JavaDoc resourceAdapter) throws ResourceException JavaDoc {
353         //spec section 5.3.3
354
if (this.resourceAdapter != null) {
355             throw new ResourceException JavaDoc("ResourceAdapter already set");
356         }
357         if (!(resourceAdapter instanceof ResourceAdapterImpl)) {
358             throw new ResourceException JavaDoc("ResourceAdapter is not of type: " + ResourceAdapterImpl.class.getName());
359         }
360         this.resourceAdapter = (ResourceAdapterImpl) resourceAdapter;
361     }
362     
363     
364     /////////////////////////////////////////////////////////////////////////
365
//
366
// Java Bean getters and setters for this ActivationSpec class.
367
//
368
/////////////////////////////////////////////////////////////////////////
369

370     /**
371      * @return Returns the destination.
372      */

373     public String JavaDoc getDestination() {
374         if (!isEmpty(destination)) {
375             return destination;
376         }
377         return null;
378     }
379     
380     /**
381      * @param destination The destination to set.
382      */

383     public void setDestination(String JavaDoc destination) {
384         if (destination != null) {
385             destination = destination.trim();
386         }
387         this.destination = destination;
388     }
389     
390     /**
391      * @return Returns the destinationType.
392      */

393     public String JavaDoc getDestinationType() {
394         if (!isEmpty(destinationType)) {
395             return destinationType;
396         }
397         return null;
398     }
399     
400     /**
401      * @param destinationType The destinationType to set.
402      */

403     public void setDestinationType(String JavaDoc destinationType) {
404         if (destinationType != null) {
405             destinationType = destinationType.trim();
406         }
407         this.destinationType = destinationType;
408     }
409     
410     /**
411      * @return Returns the userName.
412      */

413     public String JavaDoc getUserName() {
414         if (!isEmpty(userName)) {
415             return userName;
416         }
417         return null;
418     }
419     
420     /**
421      * @param userName The userName to set.
422      */

423     public void setUserName(String JavaDoc userName) {
424         if (userName != null) {
425             userName = userName.trim();
426         }
427         this.userName = userName;
428     }
429     
430     /**
431      * @return Returns the password.
432      */

433     public String JavaDoc getPassword() {
434         if (!isEmpty(password)) {
435             return password;
436         }
437         return null;
438     }
439     
440     /**
441      * @param password The password to set.
442      */

443     public void setPassword(String JavaDoc password) {
444         if (password != null) {
445             password = password.trim();
446         }
447         this.password = password;
448     }
449     
450     /**
451      * @return Returns the messageSelector.
452      */

453     public String JavaDoc getMessageSelector() {
454         if (!isEmpty(messageSelector)) {
455             return messageSelector;
456         }
457         return null;
458     }
459     
460     /**
461      * @param messageSelector The messageSelector to set.
462      */

463     public void setMessageSelector(String JavaDoc messageSelector) {
464         if (messageSelector != null) {
465             messageSelector = messageSelector.trim();
466         }
467         this.messageSelector = messageSelector;
468     }
469     
470     /**
471      * @return Returns the acknowledgeMode.
472      */

473     public String JavaDoc getAcknowledgeMode() {
474         if (!isEmpty(acknowledgeMode)) {
475             return acknowledgeMode;
476         }
477         return null;
478     }
479     
480     /**
481      * @param acknowledgeMode The acknowledgeMode to set.
482      */

483     public void setAcknowledgeMode(String JavaDoc acknowledgeMode) {
484         if (acknowledgeMode != null) {
485             acknowledgeMode = acknowledgeMode.trim();
486         }
487         this.acknowledgeMode = acknowledgeMode;
488     }
489     
490     /**
491      * @return Returns the maxMessagesPerSessions.
492      */

493     public String JavaDoc getMaxMessagesPerSessions() {
494         if (!isEmpty(maxMessagesPerSessions)) {
495             return maxMessagesPerSessions;
496         }
497         return null;
498     }
499     
500     /**
501      * @param maxMessagesPerSessions The maxMessagesPerSessions to set.
502      */

503     public void setMaxMessagesPerSessions(String JavaDoc maxMessagesPerSessions) {
504         if (maxMessagesPerSessions != null) {
505             maxMessagesPerSessions = maxMessagesPerSessions.trim();
506         }
507         this.maxMessagesPerSessions = maxMessagesPerSessions;
508     }
509     
510     /**
511      * @return Returns the maxSessions.
512      */

513     public String JavaDoc getMaxSessions() {
514         return maxSessions;
515     }
516     
517     /**
518      * @param maxSessions The maxSessions to set.
519      */

520     public void setMaxSessions(String JavaDoc maxSessions) {
521         if( maxSessions!=null ) {
522             this.maxSessions = maxSessions;
523         }
524     }
525     
526     /**
527      * @return Returns the noLocal.
528      */

529     public String JavaDoc getNoLocal() {
530         if (!isEmpty(noLocal)) {
531             return noLocal;
532         }
533         return null;
534     }
535     
536     /**
537      * @param noLocal The noLocal to set.
538      */

539     public void setNoLocal(String JavaDoc noLocal) {
540         if (noLocal != null) {
541             noLocal = noLocal.trim();
542         }
543         this.noLocal = noLocal;
544     }
545     
546     /**
547      * @return Returns the clientId.
548      */

549     public String JavaDoc getClientId() {
550         if (!isEmpty(clientId)) {
551             return clientId;
552         }
553         return null;
554     }
555     
556     /**
557      * @param clientId The clientId to set.
558      */

559     public void setClientId(String JavaDoc clientId) {
560         if (clientId != null) {
561             clientId = clientId.trim();
562         }
563         this.clientId = clientId;
564     }
565     
566     /**
567      * @return Returns the subscriptionDurability.
568      */

569     public String JavaDoc getSubscriptionDurability() {
570         if (!isEmpty(subscriptionDurability)) {
571             return subscriptionDurability;
572         }
573         return null;
574     }
575     
576     /**
577      * @param subscriptionDurability The subscriptionDurability to set.
578      */

579     public void setSubscriptionDurability(String JavaDoc subscriptionDurability) {
580         if (subscriptionDurability != null) {
581             subscriptionDurability = subscriptionDurability.trim();
582         }
583         this.subscriptionDurability = subscriptionDurability;
584     }
585     
586     /**
587      * @return Returns the subscriptionName.
588      */

589     public String JavaDoc getSubscriptionName() {
590         if (!isEmpty(subscriptionName)) {
591             return subscriptionName;
592         }
593         return null;
594     }
595     
596     /**
597      * @param subscriptionName The subscriptionName to set.
598      */

599     public void setSubscriptionName(String JavaDoc subscriptionName) {
600         if (subscriptionName != null) {
601             subscriptionName = subscriptionName.trim();
602         }
603         this.subscriptionName = subscriptionName;
604     }
605     
606     /**
607      * @return Returns the enableBatch.
608      */

609     public String JavaDoc getEnableBatch() {
610         return enableBatch;
611     }
612     
613     /**
614      * @param enableBatch The enableBatch to set.
615      */

616     public void setEnableBatch(String JavaDoc enableBatch) {
617         if (enableBatch != null) {
618             enableBatch = enableBatch.trim();
619         }
620         this.enableBatch = enableBatch;
621     }
622     
623     /**
624      * @return Returns the maxMessagesPerBatch.
625      */

626     public String JavaDoc getMaxMessagesPerBatch() {
627         return maxMessagesPerBatch.toString();
628     }
629     
630     /**
631      * @param maxMessagesPerBatch The maxMessagesPerBatch to set.
632      */

633     public void setMaxMessagesPerBatch(String JavaDoc maxMessagesPerBatch) {
634         if (maxMessagesPerBatch != null) {
635             maxMessagesPerBatch = maxMessagesPerBatch.trim();
636         }
637         this.maxMessagesPerBatch = maxMessagesPerBatch;
638     }
639     
640     /**
641      * @return Returns the useRAManagedTransaction.
642      */

643     public String JavaDoc getUseRAManagedTransaction() {
644         return useRAManagedTransaction;
645     }
646         
647     /**
648      * @param useRAManagedTransaction The useRAManagedTransaction to set.
649      */

650     public void setUseRAManagedTransaction(String JavaDoc useRAManagedTransaction) {
651         if (useRAManagedTransaction != null) {
652             useRAManagedTransaction = useRAManagedTransaction.trim();
653         }
654         this.useRAManagedTransaction = useRAManagedTransaction;
655     }
656         
657         
658         
659     public String JavaDoc toString() {
660         return "ActivationSpecImpl{"+
661         "destination='"+destination+"'"+
662         ", destinationType='"+destinationType+"'"+
663         ", messageSelector='"+messageSelector+"'"+
664         ", acknowledgeMode='"+acknowledgeMode+"'"+
665         ", subscriptionDurability='"+subscriptionDurability+"'"+
666         ", clientId='"+clientId+"'" +
667         ", subscriptionName='"+subscriptionName+"'"+
668         ", noLocal='"+noLocal+"'"+
669         ", maxMessagesPerSessions='"+maxMessagesPerSessions+"'"+
670         ", enableBatch='"+enableBatch+"'"+
671         ", maxMessagesPerBatch='"+maxMessagesPerBatch+"'"+
672         ", useRAManagedTransaction='"+useRAManagedTransaction+"'"+
673         "}";
674     }
675     
676     int getAcknowledgeModeForSession() {
677         if (AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode)) {
678             return Session.AUTO_ACKNOWLEDGE;
679         } else if (DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode)) {
680             return Session.DUPS_OK_ACKNOWLEDGE;
681         } else {
682             return INVALID_ACKNOWLEDGE_MODE;
683         }
684     }
685     
686     public boolean getNoLocalBooleanValue() {
687         return new Boolean JavaDoc(noLocal).booleanValue();
688     }
689     
690     public int getMaxMessagesPerSessionsIntValue() {
691         return Integer.parseInt(maxMessagesPerSessions);
692     }
693     
694     public int getMaxSessionsIntValue() {
695         return Integer.parseInt(maxSessions);
696     }
697     
698     public boolean getEnableBatchBooleanValue() {
699         return new Boolean JavaDoc(enableBatch).booleanValue();
700     }
701     
702     public int getMaxMessagesPerBatchIntValue() {
703         return Integer.parseInt(maxMessagesPerBatch);
704     }
705     
706     public boolean isDurableSubscription() {
707         return DURABLE_SUBSCRIPTION.equals(subscriptionDurability);
708     }
709     
710     public boolean isUseRAManagedTransactionEnabled() {
711         return new Boolean JavaDoc(useRAManagedTransaction).booleanValue();
712     }
713     
714     private boolean isEmpty(String JavaDoc value) {
715         return value == null || "".equals(value);
716     }
717     
718     
719 // public MantaDestination createDestination() {
720
// if( isEmpty(destinationType) || isEmpty(destination) )
721
// return null;
722
//
723
// MantaDestination dest = null;
724
// if (Queue.class.getName().equals(destinationType)) {
725
// dest = new MantaQueue(destination);
726
// } else if (Topic.class.getName().equals(destinationType)) {
727
// dest = new MantaTopic(destination);
728
// } else {
729
// //assert false : "Execution should never reach here";
730
// System.out.println("Execution should never reach here");
731
// }
732
// return dest;
733
// }
734

735     
736 }
Popular Tags