View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Hiram Chirino
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   **/
    18  package org.codehaus.activemq.ra;
    19
    20  import javax.resource.ResourceException;
    21  import javax.resource.spi.ActivationSpec;
    22  import javax.resource.spi.InvalidPropertyException;
    23  import javax.resource.spi.ResourceAdapter;
    24
    25  /***
    26   * @version $Revision: 1.5 $ $Date: 2004/07/06 17:55:25 $
    27   */
    28  public class ActiveMQActivationSpec implements ActivationSpec {
    29
    30      private ActiveMQResourceAdapter resourceAdapter;
    31      private String destinationType;
    32      private String destinationName;
    33      private String durableSubscriptionName;
    34      private String messageSelector;
    35      boolean noLocal = false;
    36
    37
    38      /***
    39       * @see javax.resource.spi.ActivationSpec#validate()
    40       */
    41      public void validate() throws InvalidPropertyException {
    42      }
    43
    44      /***
    45       * @see javax.resource.spi.ResourceAdapterAssociation#getResourceAdapter()
    46       */
    47      public ResourceAdapter getResourceAdapter() {
    48          return resourceAdapter;
    49      }
    50
    51      /***
    52       * @see javax.resource.spi.ResourceAdapterAssociation#setResourceAdapter(javax.resource.spi.ResourceAdapter)
    53       */
    54      public void setResourceAdapter(ResourceAdapter resourceAdapter) throws ResourceException {
    55          //spec section 5.3.3
    56          if (this.resourceAdapter != null) {
    57              throw new ResourceException("ResourceAdapter already set");
    58          }
    59          if (!(resourceAdapter instanceof ActiveMQResourceAdapter)) {
    60              throw new ResourceException("ResourceAdapter is not of type: " + ActiveMQResourceAdapter.class.getName());
    61          }
    62          this.resourceAdapter = (ActiveMQResourceAdapter) resourceAdapter;
    63      }
    64
    65
    66      /////////////////////////////////////////////////////////////////////////
    67      //
    68      // Java Bean getters and setters for this ActivationSpec class.
    69      //
    70      /////////////////////////////////////////////////////////////////////////
    71
    72      /***
    73       * @return Returns the destinationName.
    74       */
    75      public String getDestinationName() {
    76          return destinationName;
    77      }
    78
    79      /***
    80       * @param destinationName The destinationName to set.
    81       */
    82      public void setDestinationName(String destinationName) {
    83          this.destinationName = destinationName;
    84      }
    85
    86      /***
    87       * @return Returns the destinationType.
    88       */
    89      public String getDestinationType() {
    90          return destinationType;
    91      }
    92
    93      /***
    94       * @param destinationType The destinationType to set.
    95       */
    96      public void setDestinationType(String destinationType) {
    97          this.destinationType = destinationType;
    98      }
    99
    100     /***
    101      * @return Returns the durableSubscriptionName.
    102      */
    103     public String getDurableSubscriptionName() {
    104         return durableSubscriptionName;
    105     }
    106
    107     /***
    108      * @param durableSubscriptionName The durableSubscriptionName to set.
    109      */
    110     public void setDurableSubscriptionName(String durableSubscriptionName) {
    111         this.durableSubscriptionName = durableSubscriptionName;
    112     }
    113
    114     /***
    115      * @return Returns the messageSelector.
    116      */
    117     public String getMessageSelector() {
    118         return messageSelector;
    119     }
    120
    121     /***
    122      * @param messageSelector The messageSelector to set.
    123      */
    124     public void setMessageSelector(String messageSelector) {
    125         this.messageSelector = messageSelector;
    126     }
    127
    128     /***
    129      * @return Returns the noLocal.
    130      */
    131     public boolean getNoLocal() {
    132         return noLocal;
    133     }
    134
    135     /***
    136      * @param noLocal The noLocal to set.
    137      */
    138     public void setNoLocal(boolean noLocal) {
    139         this.noLocal = noLocal;
    140     }
    141 }