Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 166   Methods: 13
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DeploymentTask.java 0% 0% 0% 0%
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: DeploymentTask.java 578602 2007-09-23 20:33:31Z natalia $
 18    */
 19   
 20    package org.apache.xindice.tools;
 21   
 22    import org.apache.tools.ant.BuildException;
 23    import org.apache.tools.ant.Task;
 24    import org.apache.xindice.server.Xindice;
 25   
 26    /**
 27    * Handles basic deployment of Xindice services using ant.
 28    *
 29    * @author <a href="mailto:kstaken@xmldatabases.org">Kimbro Staken</a>
 30    * @version $Revision: 578602 $, $Date: 2007-09-23 13:33:31 -0700 (Sun, 23 Sep 2007) $
 31    */
 32    public class DeploymentTask extends Task {
 33    private String home = "";
 34    private XMLTools.Config config = null;
 35   
 36    /**
 37    * Constructor for creating a new DeploymentTask.
 38    */
 39  0 public DeploymentTask() {
 40  0 config = new XMLTools.Config();
 41    }
 42   
 43    /**
 44    * Sets the action name to be performed.
 45    *
 46    * @param action The name of the action
 47    */
 48  0 public void setAction(String action) {
 49  0 config.setString(XMLTools.ACTION, action);
 50    }
 51   
 52    /**
 53    * Sets collection context.
 54    *
 55    * @param context Target collection URL
 56    */
 57  0 public void setCollection(String context) {
 58  0 config.setString(XMLTools.COLLECTION, context);
 59    }
 60   
 61    /**
 62    * Sets the Name to use for the document or collection.
 63    *
 64    * @param name The new Name value
 65    */
 66  0 public void setName(String name) {
 67  0 config.setString(XMLTools.NAME_OF, name);
 68    }
 69   
 70    /**
 71    * Sets the filer to use for the collection.
 72    *
 73    * @param filer The new Name value
 74    */
 75  0 public void setFiler(String filer) {
 76  0 config.setString(XMLTools.FILER, filer);
 77    }
 78   
 79    /**
 80    * Sets the page size attribute for collection.
 81    *
 82    * @param pageSize The new Name value
 83    */
 84  0 public void setPageSize(String pageSize) {
 85  0 config.setString(XMLTools.PAGE_SIZE, pageSize);
 86    }
 87   
 88    /**
 89    * Sets the page count attribute for collection.
 90    *
 91    * @param pageCount The new Name value
 92    */
 93  0 public void setPageCount(String pageCount) {
 94  0 config.setString(XMLTools.PAGE_COUNT, pageCount);
 95    }
 96   
 97    /**
 98    * Sets index pattern.
 99    *
 100    * @param pattern The new Name value
 101    */
 102  0 public void setPattern(String pattern) {
 103  0 config.setString(XMLTools.PATTERN, pattern);
 104    }
 105   
 106    /**
 107    * Sets index type.
 108    *
 109    * @param type The new Name value
 110    */
 111  0 public void setType(String type) {
 112  0 config.setString(XMLTools.PATTERN, type);
 113    }
 114   
 115    /**
 116    * Sets the Home attribute of the DeploymentTask object
 117    *
 118    * @param name The new Home value
 119    */
 120  0 public void setHome(String name) {
 121  0 this.home = name;
 122    }
 123   
 124    /**
 125    * Sets the Path attribute of the DeploymentTask object
 126    *
 127    * @param name The new Path value
 128    */
 129  0 public void setPath(String name) {
 130  0 config.setString(XMLTools.FILE_PATH, name);
 131    }
 132   
 133    /**
 134    * Sets the Activity attribute of the DeploymentTask object
 135    *
 136    * @param name The new Activity value
 137    * @deprecated
 138    */
 139  0 public void setActivity(String name) {
 140  0 config.setString(XMLTools.ACTION, name);
 141    }
 142   
 143    /**
 144    * Executes the task.
 145    *
 146    * @exception BuildException Description of Exception
 147    */
 148  0 public void execute() throws BuildException {
 149  0 if (this.home.equals("")) {
 150  0 throw new BuildException("You must specify the home attribute for deployment");
 151    }
 152   
 153    // Set the home directory so the XMLAdmin object can find its configuration.
 154  0 System.getProperties().put(Xindice.PROP_XINDICE_HOME, home);
 155   
 156    // Run the task.
 157  0 try {
 158  0 new XMLTools(config).execute();
 159    } catch (Exception e) {
 160  0 e.printStackTrace();
 161  0 throw new BuildException("Error executing deployment task", e);
 162    }
 163    }
 164   
 165    }
 166