01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: package org.apache.pluto.internal;
18:
19: import org.apache.commons.logging.Log;
20: import org.apache.commons.logging.LogFactory;
21:
22: import java.util.MissingResourceException;
23: import java.util.PropertyResourceBundle;
24: import java.util.ResourceBundle;
25:
26: /**
27: * Central location for Configuration info.
28: *
29: * @since Jul 2, 2005
30: */
31: public class Configuration {
32:
33: private static final Log LOG = LogFactory
34: .getLog(Configuration.class);
35:
36: public static final ResourceBundle BUNDLE = PropertyResourceBundle
37: .getBundle("org.apache.pluto.core.pluto-configuration");
38:
39: private static final String DESCRIPTOR_SERVICE = "org.apache.pluto.descriptors.services.PortletAppDescriptorService";
40:
41: /**
42: * org.apache.pluto.ALLOW_BUFFER
43: */
44: private static final String BUFFER_SUPPORT = "org.apache.pluto.ALLOW_BUFFER";
45:
46: /**
47: * org.apache.pluto.PREVENT_UNECESSARY_CROSS_CONTEXT
48: */
49: private static final String PREVENT_UNECESSARY_CROSS_CONTEXT = "org.apache.pluto.PREVENT_UNECESSARY_CROSS_CONTEXT";
50:
51: public static String getPortletAppDescriptorServiceImpl() {
52: String impl = BUNDLE.getString(DESCRIPTOR_SERVICE);
53: if (LOG.isDebugEnabled()) {
54: LOG.debug("Using Descriptor Service Impl: " + impl);
55: }
56: return impl;
57: }
58:
59: private static Boolean buffering;
60:
61: public static boolean isBufferingSupported() {
62: if (buffering == null) {
63: try {
64: String buffer = BUNDLE.getString(BUFFER_SUPPORT);
65: buffering = new Boolean(buffer);
66: } catch (MissingResourceException mre) {
67: buffering = Boolean.FALSE;
68: }
69: }
70: return buffering.booleanValue();
71: }
72:
73: private static Boolean prevent;
74:
75: public static boolean preventUnecessaryCrossContext() {
76: if (prevent == null) {
77: try {
78: String test = BUNDLE
79: .getString(PREVENT_UNECESSARY_CROSS_CONTEXT);
80: prevent = new Boolean(test);
81: } catch (MissingResourceException mre) {
82: prevent = Boolean.FALSE;
83: }
84: }
85: return prevent.booleanValue();
86: }
87: }
|