Clover coverage report - Flock Flock - 0.7-dev
Coverage timestamp: Thu Jan 30 2003 01:35:37 EST
file stats: LOC: 82   Methods: 7
NCLOC: 58   Classes: 1
This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
SubscriptionsPage.java 0% 0% 0% 0%
 1   
 package net.sf.flock.webapp;
 2   
 
 3   
 import java.net.URL;
 4   
 
 5   
 import net.sf.flock.FlockResourceException;
 6   
 import net.sf.flock.MetaData;
 7   
 import net.sf.flock.SubscriptionI;
 8   
 import net.sf.tapestry.IRequestCycle;
 9   
 import net.sf.tapestry.html.BasePage;
 10   
 import net.sf.tapestry.valid.IValidationDelegate;
 11   
 import org.apache.log4j.LogManager;
 12   
 import org.apache.log4j.Logger;
 13   
 
 14   
 public class SubscriptionsPage extends BasePage {
 15   
 
 16   
     private final static Logger LOGGER = LogManager.getLogger(SubscriptionsPage.class); 
 17   
 
 18   
     private URL feedUrl;
 19   
     private String path;
 20   
 
 21   
     /**
 22   
      * @see net.sf.tapestry.IPage#detach()
 23   
      */
 24  0
     public void detach() {
 25  0
         this.feedUrl = null;
 26  0
         this.path = null;
 27   
         
 28  0
         super.detach();
 29   
     }
 30   
 
 31  0
     public URL getFeedUrl() {
 32  0
         return this.feedUrl;    
 33   
     }
 34   
     
 35  0
     public void setFeedUrl(URL feedUrl) {
 36  0
         this.feedUrl = feedUrl;
 37  0
         this.fireObservedChange("feedUrl", feedUrl);
 38   
     }
 39   
     
 40   
 
 41  0
     public String getPath() {
 42  0
         return path;
 43   
     }
 44   
 
 45  0
     public void setPath(String path) {
 46  0
         this.path = path;
 47  0
         this.fireObservedChange("path", path);
 48   
     }
 49   
 
 50  0
     public void formSubmit(IRequestCycle requestCycle) {
 51  0
         IValidationDelegate delegate = (IValidationDelegate) getBeans().getBean("delegate");
 52   
         
 53  0
         if (!delegate.getHasErrors()) {
 54  0
             LOGGER.info("Subscribing to " + this.getFeedUrl() + " path: " + this.getPath());
 55   
 
 56  0
             try {
 57  0
                 MetaData md = new MetaData();
 58  0
                 md.set("path", this.getPath());
 59   
 
 60  0
                 SubscriptionI[] subscriptions =
 61   
                     FlockContext.getSubscriptionManager().subscribe( this.getFeedUrl(), md );
 62   
 
 63  0
                 LOGGER.info("Added "+subscriptions.length+" feeds");
 64   
 
 65   
             } catch (FlockResourceException e) {
 66  0
                 LOGGER.warn("Unable to add feed", e);
 67  0
                 delegate.setFormComponent(null);
 68  0
                 delegate.record(e.getMessage(), null, null);
 69  0
                 return;
 70   
             }
 71   
             
 72  0
             HomePage browsePage = (HomePage)requestCycle.getPage("Home");
 73  0
             browsePage.setSelectedPath( this.getPath() );
 74  0
             requestCycle.setPage(browsePage);
 75   
         }
 76   
     }    
 77   
     
 78  0
     public void refreshAll(IRequestCycle cycle) {
 79  0
         FlockContext.getSubscriptionManager().refreshAll();
 80   
     }
 81   
 }
 82