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  /* 
17  
18   */
19  
20  package org.apache.pluto.portalImpl.core;
21  
22  import org.apache.pluto.PortletContainer;
23  import org.apache.pluto.portalImpl.services.config.Config;
24  
25  /***
26   * 
27  
28   */
29  public class PortletContainerFactory
30  {
31  
32      public static final String ENTRANCE_IMPL = "portletcontainer.entrance.impl";
33      public static final String ENTRANCE_WRAPPER_IMPL = "portletcontainer.entrance.wrapper.impl";
34      
35      private static PortletContainer portletContainer;
36      private static PortletContainer portletContainerWrapper;
37  
38      static
39      {
40          try {
41              portletContainer = (PortletContainer)Class.forName(
42                  Config.getParameters().getString(ENTRANCE_IMPL)).newInstance();
43              portletContainerWrapper = (PortletContainer)Class.forName(
44                  Config.getParameters().getString(ENTRANCE_WRAPPER_IMPL)).newInstance();
45          }
46          catch (java.lang.IllegalAccessException e)
47          {
48              System.err.println("PortletContainerFactory.static constructor");
49              e.printStackTrace(System.err);
50          }
51          catch (java.lang.InstantiationException e)
52          {
53              System.err.println("PortletContainerFactory.static constructor");
54              e.printStackTrace(System.err);
55          }
56          catch (java.lang.ClassNotFoundException e)
57          {
58              System.err.println("PortletContainerFactory.static constructor");
59              e.printStackTrace(System.err);
60          }
61      }
62  
63      static PortletContainer getPortletContainerOriginal()
64      {
65          return portletContainer;
66      }
67  
68      public static PortletContainer getPortletContainer()
69      {
70          return portletContainerWrapper;
71      }
72  }