Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.geoserver.catalog.util;
import org.geoserver.ows.util.XmlCharsetDetector;
import org.geotools.util.logging.Logging;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Reads the GeoServer catalog.xml file.
*
* Usage:
*
*
*
* File catalog = new File( ".../catalog.xml" );
* LegacygCatalogReader reader = new LegacygCatalogReader();
* reader.read( catalog );
* List dataStores = reader.dataStores();
* List nameSpaces = reader.nameSpaces();
*
*
*
*
* @author Justin Deoliveira, The Open Planning Project, [email protected]
*
*/
public class LegacyCatalogReader {
/**
* logger
*/
static Logger LOGGER = Logging.getLogger("org.geoserver.catalog");
/**
* Root catalog element.
*/
Element catalog;
/**
* Parses the catalog.xml file into a DOM.
*
* This method *must* be called before any other methods.
*
*
* @param file The catalog.xml file.
*
* @throws IOException In event of a parser error.
*/
public void read(File file) throws IOException {
Reader reader = XmlCharsetDetector.getCharsetAwareReader(new FileInputStream(file));
try {
catalog = ReaderUtils.parse(reader);
} finally {
reader.close();
}
}
/**
* Reads "datastore" elements from the catalog.xml file.
*
* For each datastore element read, a map is returned which contains the
* following key / values:
*
*
"id": data store id (String)
*
"namespace": namespace prefix of datastore (String) *
*
"enabled": wether the format is enabled or not (Boolean) *
*
"connectionParams": data store connection parameters (Map)
*
* * indicates that the parameter is optional and may be null
*
*
*
* @return A list of Map objects containing datastore information.
*
* @throws Exception If error processing "datastores" element.
*/
public List