Package org.locationtech.geogig.api.porcelain

Examples of org.locationtech.geogig.api.porcelain.ConfigException


        if (get) {
            action = ConfigAction.CONFIG_GET;
        }
        if (unset) {
            if (action != ConfigAction.CONFIG_NO_ACTION)
                throw new ConfigException(StatusCode.TOO_MANY_ACTIONS);
            action = ConfigAction.CONFIG_UNSET;
        }
        if (remove_section) {
            if (action != ConfigAction.CONFIG_NO_ACTION)
                throw new ConfigException(StatusCode.TOO_MANY_ACTIONS);
            action = ConfigAction.CONFIG_REMOVE_SECTION;
        }
        if (list) {
            if (action != ConfigAction.CONFIG_NO_ACTION)
                throw new ConfigException(StatusCode.TOO_MANY_ACTIONS);
            action = ConfigAction.CONFIG_LIST;
        }
        if (action == ConfigAction.CONFIG_NO_ACTION && nameValuePair != null) {
            if (nameValuePair.size() == 1) {
                action = ConfigAction.CONFIG_GET;
View Full Code Here


            @Override
            public File iniFile() {
                final Optional<URL> url = new ResolveGeogigDir(platform).call();

                if (!url.isPresent()) {
                    throw new ConfigException(StatusCode.INVALID_LOCATION);
                }

                /*
                 * See http://weblogs.java.net/blog/kohsuke/archive/2007/04/how_to_convert.html for
                 * explanation on this idiom.
                 */
                File localConfigFile;
                try {
                    localConfigFile = new File(new File(url.get().toURI()), "config");
                } catch (URISyntaxException e) {
                    localConfigFile = new File(url.get().getPath(), "config");
                }

                return localConfigFile;
            }
        };
        this.global = new INIFile() {
            @Override
            public File iniFile() {
                File home = platform.getUserHome();

                if (home == null) {
                    throw new ConfigException(StatusCode.USERHOME_NOT_SET);
                }

                File globalConfig = new File(home.getPath(), ".geogigconfig");
                try {
                    globalConfig.createNewFile();
                } catch (IOException e) {
                    throw new ConfigException(e, StatusCode.CANNOT_WRITE);
                }
                return globalConfig;
            }
        };
    }
View Full Code Here

                return result;
            } else {
                return Optional.absent();
            }
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

                return result;
            } else {
                return Optional.absent();
            }
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

    public Map<String, String> getAll() {
        try {
            return local.getAll();
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

    public Map<String, String> getAllGlobal() {
        try {
            return global.getAll();
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

    public Map<String, String> getAllSection(String section) {
        try {
            return local.getSection(section);
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

    public Map<String, String> getAllSectionGlobal(String section) {
        try {
            return global.getSection(section);
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

    public List<String> getAllSubsections(String section) {
        try {
            return local.listSubsections(section);
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

    public List<String> getAllSubsectionsGlobal(String section) {
        try {
            return global.listSubsections(section);
        } catch (StringIndexOutOfBoundsException e) {
            throw new ConfigException(e, StatusCode.SECTION_OR_KEY_INVALID);
        } catch (IllegalArgumentException e) {
            throw new ConfigException(e, null);
        } catch (IOException e) {
            throw new ConfigException(e, null);
        }
    }
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.porcelain.ConfigException

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.