Clover coverage report - Graph - 1.0.0
Coverage timestamp: ven. déc. 26 2003 02:14:20 CET
file stats: LOC: 172   Methods: 11
NCLOC: 91   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
GraphServiceProvider.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * EJTools, the Enterprise Java Tools
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at www.gnu.org.
 6   
  */
 7   
 package org.ejtools.graph.service;
 8   
 
 9   
 import java.beans.beancontext.BeanContext;
 10   
 import java.beans.beancontext.BeanContextServices;
 11   
 import java.util.Iterator;
 12   
 import java.util.Vector;
 13   
 
 14   
 import org.apache.log4j.Logger;
 15   
 import org.ejtools.beans.Sort;
 16   
 import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider;
 17   
 
 18   
 /**
 19   
  * @author    Laurent Etiemble
 20   
  * @version   $Revision: 1.5 $
 21   
  */
 22   
 public class GraphServiceProvider extends CustomBeanContextServiceProvider implements GraphService
 23   
 {
 24   
    /** Description of the Field */
 25   
    protected GraphService service = null;
 26   
    /** Description of the Field */
 27   
    private static Logger logger = Logger.getLogger(GraphServiceProvider.class);
 28   
 
 29   
 
 30   
    /** Constructor for GraphServiceProvider. */
 31  0
    public GraphServiceProvider()
 32   
    {
 33  0
       this.service = this;
 34   
    }
 35   
 
 36   
 
 37   
    /**
 38   
     * @param consumer  The feature to be added to the GraphConsumer attribute
 39   
     */
 40  0
    public void addGraphConsumer(GraphConsumer consumer)
 41   
    {
 42  0
       BeanContext parent = this.getBeanContext();
 43  0
       if (parent != null)
 44   
       {
 45  0
          parent.add(consumer);
 46  0
          logger.debug("GraphConsumer added");
 47   
       }
 48   
    }
 49   
 
 50   
 
 51   
    /**
 52   
     * @param consumer  The feature to be added to the GraphProducer attribute
 53   
     * @param producer  The feature to be added to the GraphProducer attribute
 54   
     */
 55  0
    public void addGraphProducer(GraphConsumer consumer, GraphProducer producer)
 56   
    {
 57  0
       if (!this.containsGraphConsumer(consumer))
 58   
       {
 59  0
          this.addGraphConsumer(consumer);
 60   
       }
 61  0
       consumer.addGraphProducer(producer);
 62   
    }
 63   
 
 64   
 
 65   
    /**
 66   
     * Description of the Method
 67   
     *
 68   
     * @param consumer  Description of the Parameter
 69   
     * @return          Description of the Return Value
 70   
     */
 71  0
    public boolean containsGraphConsumer(GraphConsumer consumer)
 72   
    {
 73  0
       BeanContext parent = this.getBeanContext();
 74  0
       if (parent != null)
 75   
       {
 76  0
          return parent.contains(consumer);
 77   
       }
 78  0
       return false;
 79   
    }
 80   
 
 81   
 
 82   
    /**
 83   
     * @param bcs           Description of the Parameter
 84   
     * @param serviceClass  Description of the Parameter
 85   
     * @return              The currentServiceSelectors value
 86   
     */
 87  0
    public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass)
 88   
    {
 89  0
       return (new Vector()).iterator();
 90   
    }
 91   
 
 92   
 
 93   
    /**
 94   
     * @return   The graphConsumers value
 95   
     */
 96  0
    public GraphConsumer[] getGraphConsumers()
 97   
    {
 98  0
       Vector result = new Vector();
 99  0
       BeanContext parent = this.getBeanContext();
 100  0
       if (parent != null)
 101   
       {
 102  0
          for (Iterator iterator = Sort.getChildrenByClass(parent.iterator(), GraphConsumer.class); iterator.hasNext(); )
 103   
          {
 104  0
             GraphConsumer consumer = (GraphConsumer) iterator.next();
 105  0
             result.add(consumer);
 106   
          }
 107   
       }
 108  0
       return (GraphConsumer[]) result.toArray(new GraphConsumer[0]);
 109   
    }
 110   
 
 111   
 
 112   
    /**
 113   
     * @param bcs              Description of the Parameter
 114   
     * @param requestor        Description of the Parameter
 115   
     * @param serviceClass     Description of the Parameter
 116   
     * @param serviceSelector  Description of the Parameter
 117   
     * @return                 The service value
 118   
     */
 119  0
    public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector)
 120   
    {
 121  0
       return this.service;
 122   
    }
 123   
 
 124   
 
 125   
    /**
 126   
     * @param bcs        Description of the Parameter
 127   
     * @param requestor  Description of the Parameter
 128   
     * @param service    Description of the Parameter
 129   
     */
 130  0
    public void releaseService(BeanContextServices bcs, Object requestor, Object service) { }
 131   
 
 132   
 
 133   
    /**
 134   
     * @param consumer  Description of the Parameter
 135   
     */
 136  0
    public void removeGraphConsumer(GraphConsumer consumer)
 137   
    {
 138  0
       BeanContext parent = this.getBeanContext();
 139  0
       if (parent != null)
 140   
       {
 141  0
          parent.remove(consumer);
 142  0
          logger.debug("GraphConsumer removed");
 143   
       }
 144   
    }
 145   
 
 146   
 
 147   
    /**
 148   
     * @param producer  Description of the Parameter
 149   
     */
 150  0
    public void removeGraphProducer(GraphProducer producer)
 151   
    {
 152  0
       BeanContext parent = this.getBeanContext();
 153  0
       if (parent != null)
 154   
       {
 155  0
          for (Iterator iterator = Sort.getChildrenByClass(parent.iterator(), GraphConsumer.class); iterator.hasNext(); )
 156   
          {
 157  0
             GraphConsumer consumer = (GraphConsumer) iterator.next();
 158  0
             consumer.removeGraphProducer(producer);
 159   
          }
 160   
       }
 161   
    }
 162   
 
 163   
 
 164   
    /**
 165   
     * @return   The serviceClass value
 166   
     */
 167  0
    protected Class[] getServiceClass()
 168   
    {
 169  0
       return new Class[]{GraphService.class};
 170   
    }
 171   
 }
 172