Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 99   Methods: 9
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
QueryService.java - 66.7% 66.7% 66.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: QueryService.java 541508 2007-05-25 01:54:12Z vgritsenko $
 18    */
 19   
 20    package org.apache.xindice.client.xmldb.services;
 21   
 22    import org.apache.xindice.client.xmldb.CommonConfigurable;
 23    import org.apache.xindice.client.xmldb.XindiceCollection;
 24   
 25    import org.xmldb.api.base.Collection;
 26    import org.xmldb.api.base.ResourceSet;
 27    import org.xmldb.api.base.Service;
 28    import org.xmldb.api.base.XMLDBException;
 29   
 30    import java.util.Hashtable;
 31   
 32    /**
 33    * Abstract query service.
 34    *
 35    * Used to implemented both XUpdate and XPath query
 36    * service, as the interface for these queries on the XML-RPC API is more
 37    * or less identical.
 38    *
 39    * @author <a href="mailto:james.bates@amplexor.com">James Bates</a>
 40    * @version $Revision: 541508 $, $Date: 2007-05-24 18:54:12 -0700 (Thu, 24 May 2007) $
 41    */
 42    public abstract class QueryService extends CommonConfigurable implements Service {
 43   
 44    /* XPath or XUpdate. This property should be set by subclasses */
 45    protected String queryLang;
 46   
 47    /* Collection that this query service should query in */
 48    Collection collection;
 49   
 50    /* namespace bindings in use for this query */
 51    Hashtable nsMap = new Hashtable();
 52   
 53  10254 public String getVersion() {
 54   
 55  10254 return "1.0";
 56    }
 57   
 58  10254 public String getName() {
 59   
 60  10254 return queryLang + "QueryService";
 61    }
 62   
 63  10254 public void setCollection(Collection collection) {
 64   
 65  10254 this.collection = collection;
 66    }
 67   
 68  6 public ResourceSet queryResource(String name, String query)
 69    throws XMLDBException {
 70   
 71  6 return ((XindiceCollection) collection).query(name, queryLang, query, nsMap);
 72    }
 73   
 74  0 public void clearNamespaces() {
 75   
 76  0 nsMap.clear();
 77    }
 78   
 79  0 public String getNamespace(String prefix) {
 80   
 81  0 return (String) nsMap.get(prefix);
 82    }
 83   
 84  9 public void setNamespace(String prefix, String namespaceURI) {
 85   
 86  9 nsMap.put(prefix, namespaceURI);
 87    }
 88   
 89  351 public ResourceSet query(String query) throws XMLDBException {
 90   
 91  351 return ((XindiceCollection) collection).query(queryLang, query, nsMap);
 92    }
 93   
 94  0 public void removeNamespace(String prefix) throws XMLDBException {
 95   
 96  0 nsMap.remove(prefix);
 97    }
 98   
 99    }