2011/08/05 - Jakarta Cactus has been retired.

For more information, please explore the Attic.

View Javadoc

1   /* 
2    * ========================================================================
3    * 
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   * 
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * 
19   * ========================================================================
20   */
21  package org.apache.cactus.util;
22  
23  import org.apache.cactus.internal.configuration.ConfigurationInitializer;
24  
25  /**
26   * Provides access to the Cactus configuration parameters related to the
27   * JMS Redirector.
28   *
29   * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
30   *
31   * @since 1.4
32   *
33   * @version $Id$
34   */
35  public class JmsConfiguration extends ConfigurationInitializer
36  {
37      /**
38       * @return the JNDI Server Initial Context Factory class (from which the
39       *         Queue connection factory will be retrieved)
40       */
41      public static String getJndiInitialContextFactory()
42      {
43          initialize();
44  
45          String property =
46              System.getProperty("cactus.jndi.initialContextFactory");
47          if (property == null) 
48          {
49              throw new ChainedRuntimeException("Missing Cactus property [" +
50                  "cactus.jndi.initialContextFactory" + "]");
51          }
52          return property;
53      }
54  
55      /**
56       * @return the JNDI Server URL (from which the Queue connection factory
57       *         will be retrieved)
58       */
59      public static String getJndiProviderURL()
60      {
61          initialize();
62  
63          String property =
64              System.getProperty("cactus.jndi.providerUrl");
65          if (property == null) 
66          {
67              throw new ChainedRuntimeException("Missing Cactus property [" +
68                  "cactus.jndi.providerUrl" + "]");
69          }
70          return property;
71      }
72      
73      /**
74       * @return the JNDI Server URL (from which the Queue connection factory
75       *         will be retrieved)
76       */
77      public static String getJndiUrlPkgPrefixes()
78      {
79          initialize();
80  
81          String property =
82              System.getProperty("cactus.jndi.urlPkgPrefixes");
83          if (property == null) 
84          {
85              throw new ChainedRuntimeException("Missing Cactus property [" +
86                  "cactus.jndi.urlPkgPrefixes" + "]");
87          }
88          return property;
89      }
90  
91      /**
92       * @return the JNDI Server user name (from which the Queue connection
93       *         factory will be retrieved)
94       */
95      public static String getJndiSecurityPrincipal()
96      {
97          initialize();
98  
99          String property =
100             System.getProperty("cactus.jndi.securityPrincipal");
101         if (property == null) 
102         {
103             throw new ChainedRuntimeException("Missing Cactus property [" +
104                 "cactus.jndi.securityPrincipal" + "]");
105         }
106         return property;
107     }
108 
109     /**
110      * @return the JNDI Server user password (from which the Queue connection
111      *         factory will be retrieved)
112      */
113     public static String getJndiSecurityCredentials()
114     {
115         initialize();
116 
117         String property =
118             System.getProperty("cactus.jndi.securityCredentials");
119         if (property == null) 
120         {
121             throw new ChainedRuntimeException("Missing Cactus property [" +
122                 "cactus.jndi.securityCredentials" + "]");
123         }
124         return property;
125     }
126 
127     /**
128      * @return the JNDI Name for the JMS Connection Factory to use (ex:
129      *         "javax.jms.QueueConnectionFactory")
130      */
131     public static String getJmsConnectionFactoryJndiName()
132     {
133         initialize();
134 
135         String property =
136             System.getProperty("cactus.jms.connectionFactoryJndiName");
137         if (property == null) 
138         {
139             throw new ChainedRuntimeException("Missing Cactus property [" +
140                 "cactus.jms.connectionFactoryJndiName" + "]");
141         }
142         return property;
143     }
144 
145 }