Package com.alibaba.antx.config

Examples of com.alibaba.antx.config.ConfigException


                username = StringUtil.trimWhitespace(resourceManager.getIn().readLine());
            }

            password = new PasswordField().getPassword(resourceManager.getOut(), "Enter Password: ", message);
        } catch (IOException e) {
            throw new ConfigException(e);
        }

        savePassword(uri, username, password);

        return new UsernamePassword(username, password);
View Full Code Here


        String userPass;

        try {
            userPass = new String(Base64.decodeBase64(encodedPassword.getBytes("8859_1")), "8859_1");
        } catch (Exception e) {
            throw new ConfigException(e);
        }

        int index = userPass.indexOf(":");
        String user = null;
        String pass = null;
View Full Code Here

            passwords.put(key, encodedPassword);

            boolean succ = savePasswordFile(passwords);

            if (!succ) {
                throw new ConfigException("Cannot save file: " + passwordFile.getAbsolutePath());
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new ConfigException(e);
        }
    }
View Full Code Here

        File templateFile = new File(templateBase, base + template);
        File templateFileInPlace = new File(templateBase, template);

        if (!templateFile.exists()) {
            if (!templateFileInPlace.exists()) {
                throw new ConfigException("Could not find template file: " + templateFileInPlace.getAbsolutePath()
                        + " for descriptor: " + descriptor.getURL());
            }

            if (templateFileInPlace.getAbsolutePath().equals(destFile.getAbsolutePath())) {
                templateFile.getParentFile().mkdirs();

                try {
                    StreamUtil.io(new FileInputStream(templateFileInPlace), new FileOutputStream(templateFile), true,
                            true);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            } else {
                templateFile = templateFileInPlace;
            }
        } else {
            template = base + template;
        }

        // ����destFile�ĸ�Ŀ¼
        File destBase = destFile.getParentFile();

        destBase.mkdirs();

        if (!destBase.isDirectory()) {
            throw new ConfigException("Could not create directory: " + destBase.getAbsolutePath());
        }

        try {
            istream = new BufferedInputStream(new FileInputStream(templateFile), 8192);
            ostream = new BufferedOutputStream(new FileOutputStream(destFile), 8192);
        } catch (FileNotFoundException e) {
            throw new ConfigException(e);
        }

        generator.getSession().setInputStream(istream);
        generator.getSession().setOutputStream(ostream);
View Full Code Here

        File logbase = logfile.getParentFile();

        logbase.mkdirs();

        if (!logbase.isDirectory()) {
            throw new ConfigException("Could not create directory: " + logbase.getAbsolutePath());
        }

        try {
            ostream = new BufferedOutputStream(new FileOutputStream(logfile), 8192);
        } catch (FileNotFoundException e) {
            throw new ConfigException(e);
        }

        generator.getSession().setOutputStream(ostream);
    }
View Full Code Here

        String componentName = "";

        try {
            componentNamePattern = new PathNameCompiler().compile("META-INF/**/autoconf/auto-config.xml");
        } catch (MalformedPatternException e) {
            throw new ConfigException(e);
        }

        if (matcher.matches(name.replace('\\', '/'), componentNamePattern)) {
            componentName = matcher.getMatch().group(1);
        }
View Full Code Here

        ExtendedProperties props = new ExtendedProperties();

        try {
            props.load(istream, propsCharset, url);
        } catch (IOException e) {
            throw new ConfigException(e);
        } finally {
            if (istream != null) {
                try {
                    istream.close();
                } catch (IOException e) {
View Full Code Here

        if (propsFile.exists()) {
            try {
                props.load(propsFile.toURI().toURL(), propsCharset);
            } catch (IOException e) {
                throw new ConfigException(e);
            }
        }

        return props;
    }
View Full Code Here

        return -1;
    }

    protected void assertFile() {
        if (isDirectory()) {
            throw new ConfigException("Resource is not a file: " + getURI());
        }
    }
View Full Code Here

        }
    }

    protected void assertDirectory() {
        if (!isDirectory()) {
            throw new ConfigException("Resource is not a directory: " + getURI());
        }
    }
View Full Code Here

TOP

Related Classes of com.alibaba.antx.config.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.