Package org.vfny.geoserver.global

Examples of org.vfny.geoserver.global.ConfigurationException


    public static File initWriteFile(File f, boolean isDir)
        throws ConfigurationException {
        initFile(f, isDir);

        if (!f.canWrite()) {
            throw new ConfigurationException("Cannot Write to file: "
                + f.toString());
        }

        return f;
    }
View Full Code Here


    public void write(String s) throws ConfigurationException {
        try {
            writer.write(s);
            writer.flush();
        } catch (IOException e) {
            throw new ConfigurationException("Write" + writer, e);
        }
    }
View Full Code Here

    public void writeln(String s) throws ConfigurationException {
        try {
            writer.write(s + "\n");
            writer.flush();
        } catch (IOException e) {
            throw new ConfigurationException("Writeln" + writer, e);
        }
    }
View Full Code Here

    public static void store(DataDTO data, File root)
        throws ConfigurationException {
        LOGGER.fine("In method store DataDTO");

        if (data == null) {
            throw new ConfigurationException("DataDTO is null: cannot write.");
        }

        WriterUtils.initFile(root, true);
  boolean inDataDir = GeoserverDataDirectory.isTrueDataDir();
  //We're just checking if it's actually a data_dir, not trying to
  //to do backwards compatibility.  So if an old data_dir is made in
  //the old way, on save it'll come to the new way.
  File fileDir = inDataDir ? root : new File(root, "WEB-INF/");
        File configDir = WriterUtils.initFile(fileDir, true);

        File catalogFile = WriterUtils.initWriteFile(new File(configDir,
                    "catalog.xml"), false);

        try {
            FileWriter fw = new FileWriter(catalogFile);
            storeCatalog(new WriterHelper(fw), data);
            fw.close();
        } catch (IOException e) {
            throw new ConfigurationException("Store" + root, e);
        }
  File dataDir;
  if (!inDataDir) {
      dataDir = WriterUtils.initFile(new File(root, "data/"), true);
  } else {
View Full Code Here

    public static void store(WMSDTO wms, WFSDTO wfs, GeoServerDTO geoServer,
        File root) throws ConfigurationException {
        LOGGER.finest("In method store WMSDTO,WFSDTO, GeoServerDTO");

        if (geoServer == null) {
            throw new ConfigurationException(
                "null parameter in store(WFSDTO,WMSDTO, GeoServerDTO): cannot write.");
        }

        WriterUtils.initFile(root, true);

  boolean inDataDir = GeoserverDataDirectory.isTrueDataDir();
  //We're just checking if it's actually a data_dir, not trying to
  //to do backwards compatibility.  So if an old data_dir is made in
  //the old way, on save it'll come to the new way.
  File fileDir = inDataDir ? root : new File(root, "WEB-INF/");
        File configDir = WriterUtils.initFile(fileDir, true);
        File configFile = WriterUtils.initWriteFile(new File(configDir,
                    "services.xml"), false);

        try {
            FileWriter fw = new FileWriter(configFile);
            storeServices(new WriterHelper(fw), wms, wfs, geoServer);
            fw.close();
        } catch (IOException e) {
            throw new ConfigurationException("Store" + root, e);
        }
    }
View Full Code Here

            s = w.getService();
            t = "WMS";
            svgRenderer = w.getSvgRenderer();
            svgAntiAlias = w.getSvgAntiAlias();
        } else {
            throw new ConfigurationException("Invalid object: not WMS of WFS");
        }

        Map atrs = new HashMap();
        atrs.put("type", t);
        atrs.put("enabled", s.isEnabled() + "");
View Full Code Here

            }

            cw.closeTag("featureType");
            fw.close();
        } catch (IOException e) {
            throw new ConfigurationException(e);
        } catch (TransformerException e) {
            throw new ConfigurationException(e);
        }
    }
View Full Code Here

        try {
            FileWriter fw = new FileWriter(f);
            storeFeatureSchema(fs, fw);
            fw.close();
        } catch (IOException e) {
            throw new ConfigurationException(e);
        }
    }
View Full Code Here

        try {
            FileReader fr = new FileReader(configFile);
            configElem = ReaderUtils.loadConfig(fr);
            fr.close();
        } catch (FileNotFoundException e) {
            throw new ConfigurationException(e);
        } catch (IOException e) {
            throw new ConfigurationException(e);
        }

        LOGGER.config("parsing configuration documents");

        Element elem = (Element) configElem.getElementsByTagName("global").item(0);
        loadGlobal(elem);

        NodeList configuredServices = configElem.getElementsByTagName("service");
        int nServices = configuredServices.getLength();

        for (int i = 0; i < nServices; i++) {
            elem = (Element) configuredServices.item(i);

            String serviceType = elem.getAttribute("type");

            if ("WFS".equalsIgnoreCase(serviceType)) {
                loadWFS(elem);
            } else if ("WMS".equalsIgnoreCase(serviceType)) {
                loadWMS(elem);
            } else if ("Z39.50".equalsIgnoreCase(serviceType)) {
                //...
            } else {
                throw new ConfigurationException("Unknown service type: "
                    + serviceType);
            }
        }
    }
View Full Code Here

          LOGGER.config("Loading configuration file: " + catalogFile);
            FileReader fr = new FileReader(catalogFile);
            catalogElem = ReaderUtils.loadConfig(fr);
            fr.close();
        } catch (FileNotFoundException e) {
            throw new ConfigurationException(e);
        } catch (IOException e) {
            throw new ConfigurationException(e);
        }

        data.setNameSpaces(loadNameSpaces(ReaderUtils.getChildElement(
                    catalogElem, "namespaces", true)));
        setDefaultNS();
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.global.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.