Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 98   Methods: 2
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
HelpCommand.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: HelpCommand.java 578602 2007-09-23 20:33:31Z natalia $
 18    */
 19    package org.apache.xindice.tools.command;
 20   
 21    import org.apache.xindice.server.Xindice;
 22    import org.apache.xindice.util.StringUtilities;
 23    import org.apache.xindice.tools.XMLTools;
 24   
 25    import java.util.List;
 26   
 27    /**
 28    *
 29    * @author <a href="mailto:byrne@apache.org">Todd Byrne</a>
 30    * @version $Revision: 578602 $, $Date: 2007-09-23 13:33:31 -0700 (Sun, 23 Sep 2007) $
 31    */
 32    public class HelpCommand extends Command {
 33   
 34  0 public boolean execute(XMLTools.Config table) throws Exception {
 35  0 List list = table.getActions();
 36   
 37    // This method relies on XML file Commands.xml attribute "helpclass" -
 38    // used to order output
 39   
 40    // Show the header and general switches
 41  0 System.out.println();
 42  0 System.out.println("Xindice Command Tools v" + Xindice.Version);
 43  0 System.out.println();
 44  0 System.out.println("Format: xindice <action> [parameters]");
 45  0 System.out.println();
 46  0 System.out.println("General purpose switches:");
 47  0 System.out.println(" -c|--collection <context>");
 48  0 System.out.println(" Collection context (must always be specified), can be either");
 49  0 System.out.println(" canonical name of the collection or complete xmldb URL");
 50  0 System.out.println(" -l|--localdb");
 51  0 System.out.println(" Use a local database rather then going over the network.");
 52  0 System.out.println(" Should be combined with -d to specify the configuration to use");
 53  0 System.out.println(" -d|--dbconfig <path>");
 54  0 System.out.println(" Path to the database configuration to use for the local ");
 55  0 System.out.println(" database. Only applies if -l is specified.");
 56  0 System.out.println(" -v|--verbose");
 57  0 System.out.println(" Verbose. Outputs additional information and exceptions");
 58  0 System.out.println(" -h|--help");
 59  0 System.out.println(" Print help screen for an action");
 60  0 System.out.println();
 61  0 System.out.println("Actions:");
 62   
 63  0 String helpClass; // Holds the helpclass for the current <command> node
 64   
 65    // Show all elements with helpclass=document
 66    // Loop over the commands, printing test from description attribute
 67  0 for (int i = 0; i < list.size(); i++) {
 68  0 XMLTools.Action action = (XMLTools.Action) list.get(i);
 69  0 helpClass = action.helpclass;
 70   
 71  0 if (helpClass.equals("document")) {
 72  0 System.out.println(" " + StringUtilities.leftJustify(action.switchName, 13) + action.description);
 73    }
 74    }
 75   
 76    // Loop over the commands, printing text from description attribute
 77  0 for (int i = 0; i < list.size(); i++) {
 78  0 XMLTools.Action action = (XMLTools.Action) list.get(i);
 79  0 helpClass = action.helpclass;
 80   
 81  0 if (helpClass.equals("security")) {
 82  0 System.out.println(" " + StringUtilities.leftJustify(action.switchName, 13) + action.description);
 83    }
 84    }
 85   
 86  0 System.out.println();
 87  0 System.out.println("For more information, please read the Xindice - Tools Reference Guide");
 88  0 System.out.println();
 89  0 return true;
 90    }
 91   
 92  0 public void usage() {
 93  0 System.out.println("Format: xindice help");
 94  0 System.out.println();
 95  0 System.out.println("Describes usage of Xindice Command Tools");
 96  0 System.out.println();
 97    }
 98    }