Home » geronimo-2.2-source-release » org.apache.geronimo.pluto » [javadoc | source]

    1   /**
    2    *
    3    * Licensed to the Apache Software Foundation (ASF) under one or more
    4    * contributor license agreements.  See the NOTICE file distributed with
    5    * this work for additional information regarding copyright ownership.
    6    * The ASF licenses this file to You under the Apache License, Version 2.0
    7    * (the "License"); you may not use this file except in compliance with
    8    * the License.  You may obtain a copy of the License at
    9    *
   10    *     http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    *  Unless required by applicable law or agreed to in writing, software
   13    *  distributed under the License is distributed on an "AS IS" BASIS,
   14    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15    *  See the License for the specific language governing permissions and
   16    *  limitations under the License.
   17    */
   18   
   19   package org.apache.geronimo.pluto;
   20   
   21   import org.slf4j.Logger;
   22   import org.slf4j.LoggerFactory;
   23   import org.apache.geronimo.gbean.GBeanInfo;
   24   import org.apache.geronimo.gbean.GBeanInfoBuilder;
   25   import org.apache.geronimo.gbean.GBeanLifecycle;
   26   import org.apache.geronimo.kernel.Kernel;
   27   import org.apache.geronimo.kernel.KernelRegistry;
   28   import org.apache.pluto.driver.config.AdminConfiguration;
   29   import org.apache.pluto.driver.config.DriverConfiguration;
   30   import org.apache.pluto.driver.services.portal.PropertyConfigService;
   31   import org.apache.pluto.driver.services.portal.RenderConfigService;
   32   import org.apache.pluto.spi.PortalCallbackService;
   33   
   34   /*
   35    * A GBean that provides access to pluto's container services.  The pluto
   36    * services are typically configured by spring.  The spring config should
   37    * create this GBean using the getSingleton() method provided here and
   38    * then provide it with references to the pluto services.
   39    */
   40   public class PortalContainerServicesGBean implements PortalContainerServices, GBeanLifecycle {
   41       private static final Logger log = LoggerFactory.getLogger(PortalContainerServicesGBean.class);
   42       
   43       private RenderConfigService renderConfigService;
   44       private PortalCallbackService portalCallbackService;
   45       private PropertyConfigService propertyConfigService;
   46       private DriverConfiguration driverConfiguration;
   47       private AdminConfiguration adminConfiguration;
   48   
   49   
   50       public void doStart() throws Exception {
   51           log.debug("Started PortalContainerServicesGBean");
   52       }
   53       
   54       public void doStop() throws Exception {
   55           log.debug("Stopped PortalContainerServicesGBean");
   56       }
   57       
   58       public void doFail() {
   59           log.warn("PortalContainerServicesGBean Failed");
   60       }
   61       
   62       public AdminConfiguration getAdminConfiguration() {
   63           return adminConfiguration;
   64       }
   65   
   66       public void setAdminConfiguration(AdminConfiguration adminConfiguration) {
   67           this.adminConfiguration = adminConfiguration;
   68       }
   69       
   70       public RenderConfigService getRenderConfigService() {
   71           return renderConfigService;
   72       }
   73   
   74       public void setRenderConfigService(RenderConfigService renderConfigService) {
   75           this.renderConfigService = renderConfigService;
   76       }
   77   
   78       public DriverConfiguration getDriverConfiguration() {
   79           return driverConfiguration;
   80       }
   81   
   82       public void setDriverConfiguration(DriverConfiguration driverConfigurion) {
   83           this.driverConfiguration = driverConfigurion;
   84       }
   85   
   86       public PortalCallbackService getPortalCallbackService() {
   87           return portalCallbackService;
   88       }
   89   
   90       public void setPortalCallbackService(
   91               PortalCallbackService portalCallbackService) {
   92           this.portalCallbackService = portalCallbackService;
   93       }
   94   
   95       public PropertyConfigService getPropertyConfigService() {
   96           return propertyConfigService;
   97       }
   98   
   99       public void setPropertyConfigService(
  100               PropertyConfigService propertyConfigService) {
  101           this.propertyConfigService = propertyConfigService;
  102       }
  103   
  104       public static PortalContainerServices getSingleton() {
  105           Kernel kernel = KernelRegistry.getSingleKernel();
  106           PortalContainerServices portalServices = null;
  107           try {
  108               portalServices = (PortalContainerServices) kernel.getGBean(PortalContainerServices.class);
  109           } catch (Exception e) {
  110               log.error("Failed to get PortalContainerServices GBean from kernel", e);
  111           }
  112           return portalServices;
  113       }
  114   
  115       public static final GBeanInfo GBEAN_INFO;
  116   
  117       static {
  118           GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("PortalContainerServicesGBean", PortalContainerServicesGBean.class);
  119           infoFactory.addInterface(PortalContainerServices.class);
  120           infoFactory.setConstructor(new String[0]);
  121           GBEAN_INFO = infoFactory.getBeanInfo();
  122       }
  123   
  124       public static GBeanInfo getGBeanInfo() {
  125           return GBEAN_INFO;
  126       }
  127   
  128   }

Home » geronimo-2.2-source-release » org.apache.geronimo.pluto » [javadoc | source]