View Javadoc

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;
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 PROPS;
26  
27      static {
28          PROPS = ResourceBundle.getBundle("org.apache.pluto.environment");
29      }
30  
31  
32      public static final String getPortletContainerName() {
33          return PROPS.getString("pluto.container.name");
34      }
35  
36      public static final String getPortletContainerMajorVersion() {
37          return PROPS.getString("pluto.container.version.major");
38      }
39  
40      public static final String 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 getServerInfo() {
53          StringBuffer sb = new StringBuffer(getPortletContainerName())
54              .append("/")
55              .append(getPortletContainerMajorVersion())
56              .append(".")
57              .append(getPortletContainerMinorVersion());
58          return sb.toString();
59      }
60  
61  }