diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java index 98642b8d28..4e542a79f0 100644 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java @@ -140,7 +140,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - private boolean isValidUseRAManagedTransaction(List errorMessages) { + public boolean isValidUseRAManagedTransaction(List errorMessages) { try { new Boolean(noLocal); return true; @@ -151,7 +151,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidNoLocal(List errorMessages) { + public boolean isValidNoLocal(List errorMessages) { try { new Boolean(noLocal); return true; @@ -162,7 +162,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidMessageSelector(List errorMessages) { + public boolean isValidMessageSelector(List errorMessages) { try { if (!isEmpty(messageSelector)) { new SelectorParser().parse(messageSelector); @@ -174,7 +174,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - private boolean isValidMaxSessions(List errorMessages) { + public boolean isValidMaxSessions(List errorMessages) { try { if (Integer.parseInt(maxSessions) > 0) { return true; @@ -186,7 +186,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidMaxMessagesPerSessions(List errorMessages) { + public boolean isValidMaxMessagesPerSessions(List errorMessages) { try { if (Integer.parseInt(maxMessagesPerSessions) > 0) { return true; @@ -198,7 +198,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidMaxMessagesPerBatch(List errorMessages) { + public boolean isValidMaxMessagesPerBatch(List errorMessages) { try { if (Integer.parseInt(maxMessagesPerBatch) > 0) { return true; @@ -210,7 +210,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidEnableBatch(List errorMessages) { + public boolean isValidEnableBatch(List errorMessages) { try { new Boolean(enableBatch); return true; @@ -221,9 +221,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - /** - * @see javax.resource.spi.ResourceAdapterAssociation#getResourceAdapter() - */ public ResourceAdapter getResourceAdapter() { return resourceAdapter; } @@ -247,9 +244,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab // Java Bean getters and setters for this ActivationSpec class. // // /////////////////////////////////////////////////////////////////////// - /** - * @return Returns the destinationType. - */ public String getDestinationType() { if (!isEmpty(destinationType)) { return destinationType; @@ -264,9 +258,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.destinationType = destinationType; } - /** - * - */ public String getPassword() { if (!isEmpty(password)) { return password; @@ -281,9 +272,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.password = password; } - /** - * - */ public String getUserName() { if (!isEmpty(userName)) { return userName; @@ -298,9 +286,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.userName = userName; } - /** - * @return Returns the messageSelector. - */ public String getMessageSelector() { if (!isEmpty(messageSelector)) { return messageSelector; @@ -315,9 +300,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.messageSelector = messageSelector; } - /** - * @return Returns the noLocal. - */ public String getNoLocal() { return noLocal; } @@ -331,9 +313,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - /** - * - */ public String getAcknowledgeMode() { if (!isEmpty(acknowledgeMode)) { return acknowledgeMode; @@ -348,9 +327,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.acknowledgeMode = acknowledgeMode; } - /** - * - */ public String getClientId() { if (!isEmpty(clientId)) { return clientId; @@ -365,9 +341,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.clientId = clientId; } - /** - * - */ public String getDestination() { if (!isEmpty(destination)) { return destination; @@ -382,9 +355,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.destination = destination; } - /** - * - */ public String getSubscriptionDurability() { if (!isEmpty(subscriptionDurability)) { return subscriptionDurability; @@ -399,9 +369,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.subscriptionDurability = subscriptionDurability; } - /** - * - */ public String getSubscriptionName() { if (!isEmpty(subscriptionName)) { return subscriptionName; @@ -416,7 +383,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab this.subscriptionName = subscriptionName; } - private boolean isValidSubscriptionName(List errorMessages) { + public boolean isValidSubscriptionName(List errorMessages) { if (!isDurableSubscription() ? true : subscriptionName != null && subscriptionName.trim().length() > 0) { return true; } @@ -424,7 +391,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidClientId(List errorMessages) { + public boolean isValidClientId(List errorMessages) { if (!isDurableSubscription() ? true : clientId != null && clientId.trim().length() > 0) { return true; } @@ -432,14 +399,11 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - /** - * - */ public boolean isDurableSubscription() { return DURABLE_SUBSCRIPTION.equals(subscriptionDurability); } - private boolean isValidSubscriptionDurability(List errorMessages) { + public boolean isValidSubscriptionDurability(List errorMessages) { // subscriptionDurability only applies to Topics if (DURABLE_SUBSCRIPTION.equals(subscriptionDurability) && getDestinationType() != null && !Topic.class.getName().equals(getDestinationType())) { errorMessages.add("subscriptionDurability cannot be set to: " + DURABLE_SUBSCRIPTION + " when destinationType is set to " + Queue.class.getName() @@ -453,7 +417,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidAcknowledgeMode(List errorMessages) { + public boolean isValidAcknowledgeMode(List errorMessages) { if (AUTO_ACKNOWLEDGE_MODE.equals(acknowledgeMode) || DUPS_OK_ACKNOWLEDGE_MODE.equals(acknowledgeMode)) { return true; } @@ -461,7 +425,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidDestinationType(List errorMessages) { + public boolean isValidDestinationType(List errorMessages) { if (Queue.class.getName().equals(destinationType) || Topic.class.getName().equals(destinationType)) { return true; } @@ -469,7 +433,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isValidDestination(List errorMessages) { + public boolean isValidDestination(List errorMessages) { if (!(destination == null || destination.equals(""))) { return true; } @@ -477,7 +441,7 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return false; } - private boolean isEmpty(String value) { + public boolean isEmpty(String value) { return value == null || "".equals(value.trim()); } @@ -547,9 +511,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - /** - * - */ public String getMaxSessions() { return maxSessions; } @@ -563,9 +524,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - /** - * - */ public String getUseRAManagedTransaction() { return useRAManagedTransaction; } @@ -579,16 +537,10 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - /** - * - */ public int getMaxMessagesPerSessionsIntValue() { return Integer.parseInt(maxMessagesPerSessions); } - /** - * - */ public int getMaxSessionsIntValue() { return Integer.parseInt(maxSessions); } @@ -597,9 +549,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return Boolean.valueOf(useRAManagedTransaction).booleanValue(); } - /** - * - */ public boolean getNoLocalBooleanValue() { return Boolean.valueOf(noLocal).booleanValue(); } @@ -638,9 +587,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } } - /** - * - */ public short getBackOffMultiplier() { if (redeliveryPolicy == null) { return 0; @@ -648,9 +594,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return redeliveryPolicy.getBackOffMultiplier(); } - /** - * - */ public long getInitialRedeliveryDelay() { if (redeliveryPolicy == null) { return 0; @@ -658,9 +601,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return redeliveryPolicy.getInitialRedeliveryDelay(); } - /** - * - */ public int getMaximumRedeliveries() { if (redeliveryPolicy == null) { return 0; @@ -668,9 +608,6 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab return redeliveryPolicy.getMaximumRedeliveries(); } - /** - * - */ public boolean isUseExponentialBackOff() { if (redeliveryPolicy == null) { return false; @@ -707,14 +644,11 @@ public class ActiveMQActivationSpec implements MessageActivationSpec, Serializab } // don't use getter to avoid causing introspection errors in containers - /** - * - */ public RedeliveryPolicy redeliveryPolicy() { return redeliveryPolicy; } - protected RedeliveryPolicy lazyCreateRedeliveryPolicy() { + public RedeliveryPolicy lazyCreateRedeliveryPolicy() { if (redeliveryPolicy == null) { redeliveryPolicy = new RedeliveryPolicy(); } diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/MessageActivationSpec.java b/activemq-ra/src/main/java/org/apache/activemq/ra/MessageActivationSpec.java index 098a80cc12..af49070538 100755 --- a/activemq-ra/src/main/java/org/apache/activemq/ra/MessageActivationSpec.java +++ b/activemq-ra/src/main/java/org/apache/activemq/ra/MessageActivationSpec.java @@ -1,137 +1,129 @@ /** - * $Header$ * - * Broker Office ESPECIAL (Release) - org.apache.activemq.ra + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * Copyright (C) 2005-2007 Norvax, Inc. - * All Rights Reserved + * http://www.apache.org/licenses/LICENSE-2.0 * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Norvax, Inc.; the contents - * of this file may not be disclosed to third parties, copied or duplicated - * in any form, in whole or in part, without the prior written permission of - * Norvax, Inc. The copyright notice above does not evidence any actual or - * intended publication of such source code. - * - * Permission is hereby granted solely to the licensee for use of this source - * code in its unaltered state. This source code may not be modified by - * licensee except under direction of Norvax, Inc. Neither may this source - * code be given under any circumstances to non-licensees in any form, - * including source or binary. Modification of this source constitutes breach - * of contract, which voids any potential pending support responsibilities by - * Norvax, Inc. Divulging the exact or paraphrased contents of this source - * code to unlicensed parties either directly or indirectly constitutes - * violation of federal and international copyright and trade secret laws, and - * will be duly prosecuted to the fullest extent permitted under law. - * - * This software is provided by Norvax, Inc. ``as is'' and any express or - * implied warranties, including, but not limited to, the implied warranties - * of merchantability and fitness for a particular purpose are disclaimed. In - * no event shall the regents or contributors be liable for any direct, - * indirect, incidental, special, exemplary, or consequential damages - * (including, but not limited to, procurement of substitute goods or - * services; loss of use, data, or profits; or business interruption) however - * caused and on any theory of liability, whether in contract, strict - * liability, or tort (including negligence or otherwise) arising in any way - * out of the use of this software, even if advised of the possibility of such - * damage. - * - **/ - + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.activemq.ra; -import javax.resource.spi.ActivationSpec; - import org.apache.activemq.RedeliveryPolicy; +import javax.resource.spi.ResourceAdapter; +import javax.resource.spi.ActivationSpec; +import java.util.List; + /** - * Description: Description goes here. - * - * @author Christopher G. Stach II - * @version $Revision$ $Date$ - * @since 0.1 + * @version $Revision: 1.1 $ */ public interface MessageActivationSpec extends ActivationSpec { + boolean isValidUseRAManagedTransaction(List errorMessages); + + boolean isValidNoLocal(List errorMessages); + + boolean isValidMessageSelector(List errorMessages); + + boolean isValidMaxSessions(List errorMessages); + + boolean isValidMaxMessagesPerSessions(List errorMessages); + + boolean isValidMaxMessagesPerBatch(List errorMessages); + + boolean isValidEnableBatch(List errorMessages); /** + * @see javax.resource.spi.ResourceAdapterAssociation#getResourceAdapter() */ - String getClientId(); + ResourceAdapter getResourceAdapter(); /** + * @return Returns the destinationType. */ - boolean isDurableSubscription(); + String getDestinationType(); - /** - */ String getPassword(); - /** - */ String getUserName(); /** - */ - RedeliveryPolicy redeliveryPolicy(); - - /** - */ - String getSubscriptionName(); - - /** + * @return Returns the messageSelector. */ String getMessageSelector(); /** + * @return Returns the noLocal. */ - int getMaxMessagesPerSessionsIntValue(); + String getNoLocal(); - /** - */ - boolean getNoLocalBooleanValue(); + String getAcknowledgeMode(); - /** - */ - String getDestinationType(); + String getClientId(); - /** - */ String getDestination(); - /** - */ - int getMaxSessionsIntValue(); + String getSubscriptionDurability(); + + String getSubscriptionName(); + + boolean isValidSubscriptionName(List errorMessages); + + boolean isValidClientId(List errorMessages); + + boolean isDurableSubscription(); + + boolean isValidSubscriptionDurability(List errorMessages); + + boolean isValidAcknowledgeMode(List errorMessages); + + boolean isValidDestinationType(List errorMessages); + + boolean isValidDestination(List errorMessages); + + boolean isEmpty(String value); - /** - * - */ int getAcknowledgeModeForSession(); - /** - * - */ String getMaxMessagesPerSessions(); - /** - * - */ + String getMaxSessions(); + + String getUseRAManagedTransaction(); + + int getMaxMessagesPerSessionsIntValue(); + + int getMaxSessionsIntValue(); + boolean isUseRAManagedTransactionEnabled(); - /** - * - */ + boolean getNoLocalBooleanValue(); + String getEnableBatch(); - /** - * - */ boolean getEnableBatchBooleanValue(); - /** - * - */ int getMaxMessagesPerBatchIntValue(); - /** - * - */ String getMaxMessagesPerBatch(); + + short getBackOffMultiplier(); + + long getInitialRedeliveryDelay(); + + int getMaximumRedeliveries(); + + boolean isUseExponentialBackOff(); + + RedeliveryPolicy redeliveryPolicy(); + + RedeliveryPolicy lazyCreateRedeliveryPolicy(); }