Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 118   Methods: 10
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DBObserver.java 50% 100% 20% 35.7%
coverage coverage
 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    * $Id: DBObserver.java 541508 2007-05-25 01:54:12Z vgritsenko $
 18    */
 19   
 20    package org.apache.xindice.core;
 21   
 22    import org.apache.xindice.core.data.Key;
 23    import org.apache.xindice.core.data.Record;
 24    import org.apache.xindice.util.Configuration;
 25   
 26    import org.w3c.dom.Document;
 27   
 28    import java.util.Map;
 29   
 30    /**
 31    * Observer for Xindice DB activities
 32    *
 33    * @version $Revision: 541508 $, $Date: 2007-05-24 18:54:12 -0700 (Thu, 24 May 2007) $
 34    */
 35    public abstract class DBObserver {
 36   
 37    private static final DBObserver NOOP = new DBObserver() {
 38  0 public void setDatabaseConfig(Database db, Map collections, Configuration cfg) {
 39    }
 40   
 41  0 public void setCollectionConfig(Collection col, Configuration cfg) {
 42    }
 43   
 44  0 public void flushDatabaseConfig(Database db, Configuration cfg) {
 45    }
 46   
 47  0 public void dropCollection(Collection col) {
 48    }
 49   
 50  0 public void createCollection(Collection col) {
 51    }
 52   
 53  0 public void putDocument(Collection col, Key key, Document document, boolean create) {
 54    }
 55   
 56  0 public void loadDocument(Collection col, Record record, Document document) {
 57    }
 58   
 59  0 public void dropDocument(Collection col, Key key) {
 60    }
 61    };
 62   
 63    private static DBObserver instance = NOOP;
 64   
 65    /**
 66    * Sets the default observer instance
 67    */
 68  19 public static void setInstance(DBObserver obs) {
 69  19 instance = (null == obs) ? NOOP : obs;
 70    }
 71   
 72    /**
 73    * Returns the observer instance, must be non-null
 74    */
 75  52561 public static DBObserver getInstance() {
 76  52561 return instance;
 77    }
 78   
 79    /**
 80    * Called after Database.setConfig()
 81    */
 82    public abstract void setDatabaseConfig(Database db, Map collections, Configuration cfg);
 83   
 84    /**
 85    * Called after Collection.setConfig()
 86    */
 87    public abstract void setCollectionConfig(Collection col, Configuration cfg);
 88   
 89    /**
 90    * Called after Database.flushConfig()
 91    */
 92    public abstract void flushDatabaseConfig(Database db, Configuration cfg);
 93   
 94    /**
 95    * Called before Collection.drop()
 96    */
 97    public abstract void dropCollection(Collection col) throws DBException;
 98   
 99    /**
 100    * Called after Collection.create()
 101    */
 102    public abstract void createCollection(Collection col) throws DBException;
 103   
 104    /**
 105    * Called after Collection.putDocument()
 106    */
 107    public abstract void putDocument(Collection col, Key key, Document document, boolean create) throws DBException;
 108   
 109    /**
 110    * Called after Collection.getDocument()
 111    */
 112    public abstract void loadDocument(Collection col, Record record, Document document) throws DBException;
 113   
 114    /**
 115    * Called before Collection.remove(key)
 116    */
 117    public abstract void dropDocument(Collection col, Key key) throws DBException;
 118    }