|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Command.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 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: Command.java 578602 2007-09-23 20:33:31Z natalia $ | |
| 18 | */ | |
| 19 | ||
| 20 | package org.apache.xindice.tools.command; | |
| 21 | ||
| 22 | import org.apache.xindice.tools.XMLTools; | |
| 23 | ||
| 24 | /** | |
| 25 | * Command is the standard interface command line arguments | |
| 26 | * | |
| 27 | * @version $Revision: 578602 $, $Date: 2007-09-23 13:33:31 -0700 (Sun, 23 Sep 2007) $ | |
| 28 | */ | |
| 29 | public abstract class Command { | |
| 30 | ||
| 31 | // Collection manager path to instantiate | |
| 32 | public static final String XINDICEURI = "xindice://"; | |
| 33 | public static final String XINDICELOCALURI = "xindice-embed://"; | |
| 34 | public static final String XMLDBURI = "xmldb:"; | |
| 35 | ||
| 36 | // Version of the XML:DB API that we are using | |
| 37 | public static final String XMLDBAPIVERSION = "1.0"; | |
| 38 | ||
| 39 | // Class name of the Standard Xindice Indexer | |
| 40 | public static final String XINDICE_VAL_INDEXER = "org.apache.xindice.core.indexer.ValueIndexer"; | |
| 41 | public static final String XINDICE_NAME_INDEXER = "org.apache.xindice.core.indexer.NameIndexer"; | |
| 42 | public static final String XINDICE_TEXT_INDEXER = "org.apache.xindice.core.indexer.LuceneIndexer"; | |
| 43 | ||
| 44 | public abstract boolean execute(XMLTools.Config table) throws Exception; | |
| 45 | ||
| 46 | public abstract void usage(); | |
| 47 | ||
| 48 | // public class to return normalized CollectionURI for creation of a Collection object | |
| 49 | 0 | public String normalizeCollectionURI(String uri, boolean local) { |
| 50 | // Check to see if this uri starts with "xmldb:" , if so treat as absolute | |
| 51 | 0 | if (uri.startsWith("xmldb:")) { |
| 52 | // URI is absolute, leave alone | |
| 53 | 0 | return uri; |
| 54 | 0 | } else if (uri.startsWith("xindice:") || uri.startsWith("xindice-embed:")) { |
| 55 | 0 | return (XMLDBURI + uri); |
| 56 | } else { | |
| 57 | // URI passed in is not absoulte, build the full URI | |
| 58 | 0 | if (local) { |
| 59 | 0 | return (XMLDBURI + XINDICELOCALURI + uri); |
| 60 | } else { | |
| 61 | 0 | return (XMLDBURI + XINDICEURI + uri); |
| 62 | } | |
| 63 | } | |
| 64 | } | |
| 65 | } |
|
||||||||||