KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > Environment


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

16 package org.apache.pluto;
17
18 import java.util.ResourceBundle JavaDoc;
19
20 /**
21  * @author <a HREF="ddewolf@apache.org">David H. DeWolf</a>
22  */

23 public final class Environment {
24
25     public static final ResourceBundle JavaDoc PROPS;
26
27     static {
28         PROPS = ResourceBundle.getBundle("org.apache.pluto.environment");
29     }
30
31
32     public static final String JavaDoc getPortletContainerName() {
33         return PROPS.getString("pluto.container.name");
34     }
35
36     public static final String JavaDoc getPortletContainerMajorVersion() {
37         return PROPS.getString("pluto.container.version.major");
38     }
39
40     public static final String JavaDoc getPortletContainerMinorVersion() {
41         return PROPS.getString("pluto.container.version.minor");
42     }
43
44     public static final int getMajorSpecificationVersion() {
45         return Integer.parseInt(PROPS.getString("javax.portlet.version.major"));
46     }
47
48     public static final int getMinorSpecificationVersion() {
49         return Integer.parseInt(PROPS.getString("javax.portlet.version.minor"));
50     }
51
52     public static final String JavaDoc getServerInfo() {
53         StringBuffer JavaDoc sb = new StringBuffer JavaDoc(getPortletContainerName())
54             .append("/")
55             .append(getPortletContainerMajorVersion())
56             .append(".")
57             .append(getPortletContainerMinorVersion());
58         return sb.toString();
59     }
60
61 }
62
Popular Tags