Coverage report

  %line %branch
org.apache.jetspeed.Jetspeed
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      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.jetspeed;
 18  
 
 19  
 import java.util.Locale;
 20  
 
 21  
 import org.apache.jetspeed.administration.PortalConfiguration;
 22  
 import org.apache.jetspeed.components.ComponentManager;
 23  
 import org.apache.jetspeed.engine.Engine;
 24  
 import org.apache.jetspeed.exception.JetspeedException;
 25  
 import org.apache.jetspeed.request.RequestContext;
 26  
 
 27  
 /**
 28  
  * Jetspeed environment
 29  
  * <br/>
 30  
  * Provides an easy way to access the current running environment 
 31  
  * of jetspeed.
 32  
  *
 33  
  * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
 34  
  * @version $Id: Jetspeed.java 552657 2007-07-03 03:57:47Z taylor $
 35  
  */
 36  0
 public class Jetspeed
 37  
 {
 38  0
     private static Engine engine = null;
 39  
     /**
 40  
      * Shuts down the currently running instance of the portal
 41  
      * Engine.
 42  
      * @throws JetspeedException
 43  
      */
 44  
     public static void shutdown() throws JetspeedException
 45  
     {
 46  0
         if (engine != null)
 47  0
             engine.shutdown();
 48  0
     }
 49  
 
 50  
     public static Engine getEngine()
 51  
     {
 52  0
         return engine;
 53  
     }
 54  
 
 55  
     public static PortalContext getContext()
 56  
     {
 57  0
         if (engine == null)
 58  
         {
 59  0
             throw new NullPointerException("The engine is null, have you called createEngine() yet?");
 60  
         }
 61  0
         return engine.getContext();
 62  
     }
 63  
 
 64  
     /**
 65  
      * Given a application relative path, returns the real path relative to the application root
 66  
      *
 67  
      */
 68  
     public static String getRealPath(String path)
 69  
     {
 70  0
         if (engine == null)
 71  
         {
 72  0
             return null;
 73  
         }
 74  0
         return engine.getRealPath(path);
 75  
     }
 76  
 
 77  
     /**
 78  
      * Delegtes to the current Engine to retreive the RequestContext
 79  
      * appropriate for the current thread.
 80  
      * 
 81  
      * @see org.apache.jetspeed.engine.Engine#getCurrentRequestContext()
 82  
      * 
 83  
      * @return The RequestContext for this current Thread.
 84  
      */
 85  
     public static RequestContext getCurrentRequestContext()
 86  
     {
 87  0
         if (engine != null)
 88  0
             return engine.getCurrentRequestContext();
 89  0
         return null;
 90  
     }
 91  
 
 92  
     // TODO We need to get this from the Engine and the engine should get it from the configuration. 
 93  
 
 94  
     public static Locale getDefaultLocale()
 95  
     {
 96  0
         return Locale.getDefault();
 97  
     }
 98  
 
 99  
     public static ComponentManager getComponentManager()
 100  
     {
 101  0
         if (engine == null)
 102  0
             return null;
 103  0
         return engine.getComponentManager();
 104  
     }
 105  
 
 106  
     public static void setEngine(Engine engine)
 107  
     {
 108  0
         Jetspeed.engine = engine;
 109  0
     }
 110  
     
 111  
     public static PortalConfiguration getConfiguration()
 112  
     {
 113  0
         ComponentManager manager = getComponentManager(); 
 114  0
         if (manager != null)
 115  0
             return (PortalConfiguration)manager.getComponent("PortalConfiguration");
 116  0
         return null;        
 117  
     }
 118  
     
 119  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.