Coverage report

  %line %branch
org.apache.jetspeed.aggregator.impl.PortletContentImpl
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.aggregator.impl;
 18  
 
 19  
 import java.io.CharArrayWriter;
 20  
 import java.io.PrintWriter;
 21  
 
 22  
 import org.apache.jetspeed.aggregator.PortletContent;
 23  
 import org.apache.jetspeed.aggregator.PortletRenderer;
 24  
 import org.apache.jetspeed.cache.ContentCacheKey;
 25  
 
 26  
 
 27  
 public class PortletContentImpl implements PortletContent
 28  
 {
 29  
     private CharArrayWriter cw;
 30  
     private PrintWriter writer;
 31  0
     private boolean complete = false;
 32  
     private ContentCacheKey cacheKey;
 33  0
     private int expiration = 0;
 34  
     private String title;
 35  0
     private PortletRenderer renderer = null;
 36  
     
 37  
     PortletContentImpl()
 38  0
     {
 39  0
         init();
 40  0
     }
 41  
     
 42  
     PortletContentImpl(PortletRenderer renderer, ContentCacheKey cacheKey, int expiration, String title)
 43  0
     {
 44  0
         this.renderer = renderer;
 45  0
         this.cacheKey = cacheKey;
 46  0
         this.expiration = expiration;
 47  0
         this.title = title;
 48  0
         init();
 49  0
     }
 50  
 
 51  
     PortletContentImpl(PortletRenderer renderer, ContentCacheKey cacheKey, int expiration)
 52  
     {
 53  0
         this(renderer, cacheKey, expiration,"no title");
 54  0
     }
 55  
    
 56  
     public PrintWriter getWriter()
 57  
     {
 58  0
         return writer;
 59  
     }
 60  
 
 61  
     public void init()
 62  
     {
 63  0
         cw = new CharArrayWriter();
 64  0
         writer = new PrintWriter(cw);
 65  0
     }
 66  
 
 67  
     public void release()
 68  
     {
 69  0
         writer.close();
 70  0
     }
 71  
 
 72  
     public String toString()
 73  
     {
 74  0
         writer.flush();
 75  0
         return cw.toString();
 76  
     }
 77  
 
 78  
     public void writeTo( java.io.Writer out ) throws java.io.IOException
 79  
     {
 80  0
         writer.flush();
 81  0
         cw.writeTo(out);
 82  0
     }
 83  
 
 84  
     public char[] toCharArray()
 85  
     {
 86  0
         writer.flush();
 87  0
         return cw.toCharArray();
 88  
     }
 89  
 
 90  
     public boolean isComplete()
 91  
     {
 92  0
         return complete;
 93  
     }
 94  
 
 95  
     void setComplete(boolean state, class="keyword">boolean notify)
 96  
     {
 97  0
         if (renderer != null && notclass="keyword">ify)
 98  0
             renderer.notifyContentComplete(this);
 99  0
         this.complete = state;
 100  0
     }
 101  
     
 102  
     public String getContent()
 103  
     {
 104  0
         return toString();
 105  
     }
 106  
     /**
 107  
      * <p>
 108  
      * complete
 109  
      * </p>
 110  
      *
 111  
      * @see org.apache.jetspeed.aggregator.PortletContent#complete()
 112  
      * 
 113  
      */
 114  
     public void complete()
 115  
     {
 116  0
        setComplete(true, class="keyword">true);
 117  0
     }
 118  
     
 119  
     // error case, don't notify 
 120  
     public void completeWithError()
 121  
     {
 122  0
         setComplete(true, false);
 123  0
     }
 124  
     
 125  
     public ContentCacheKey getCacheKey()
 126  
     {
 127  0
         return cacheKey;
 128  
     }
 129  
    
 130  
     public int getExpiration()
 131  
     {
 132  0
         return expiration;
 133  
     }
 134  
     
 135  
     public void setExpiration(int expiration)
 136  
     {
 137  0
         this.expiration = expiration;
 138  0
     }
 139  
     
 140  
     public String getTitle()
 141  
     {
 142  0
         return title;
 143  
     }
 144  
     
 145  
     public void setTitle(String title)
 146  
     {
 147  0
         this.title = title;
 148  0
     }
 149  
         
 150  
 }

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