KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sample > amazon > amazonSimpleQueueService > util > QueueManager


1 package sample.amazon.amazonSimpleQueueService.util;
2
3 import java.io.InputStream JavaDoc;
4 import java.util.Properties JavaDoc;
5
6 /*
7 * Copyright 2004,2005 The Apache Software Foundation.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *
22 */

23 public class QueueManager {
24     private static String JavaDoc key = null;
25
26     static{
27         Class JavaDoc clazz = new Object JavaDoc().getClass();
28         InputStream JavaDoc stream = clazz.getResourceAsStream("/sample/amazon/common/conf/key.properties");
29         Properties JavaDoc properties = new Properties JavaDoc();
30         try {
31             properties.load(stream);
32             key = properties.getProperty("key");
33         } catch (Exception JavaDoc e) {
34             e.printStackTrace();
35         }
36
37     }
38
39     public static String JavaDoc getKey() {
40         return key;
41     }
42
43     public synchronized static void setKey(String JavaDoc tkey){
44         key = tkey;
45     }
46 }
47
Popular Tags