Package com.alibaba.antx.config

Examples of com.alibaba.antx.config.ConfigException


            return new SshResource(this, channel, uri, stat);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new ConfigException(e);
        }
    }
View Full Code Here


                    // 成功就清除,以避免重复提示输入密码
                    ResourceContext.get().getVisitedURIs().remove(new ResourceKey(new ResourceURI(uri.getURI())));
                } catch (RuntimeException e) {
                    throw e;
                } catch (Exception e) {
                    throw new ConfigException(e);
                } finally {
                    ResourceContext.get().setCurrentURI(null);
                }
            }
        }
View Full Code Here

    private Session getSession(String type) {
        ResourceDriver driver = (ResourceDriver) drivers.get(type);

        if (driver == null) {
            throw new ConfigException("No drivers for resource type: " + type);
        }

        Session session;

        synchronized (sessions) {
View Full Code Here

            Header contentTypeHeader = httpget.getResponseHeader("Content-Type");
            contentType = contentTypeHeader == null ? null : contentTypeHeader.getValue();
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new ConfigException(e);
        } finally {
            ResourceContext.get().setCurrentURI(null);

            if (stream != null) {
                try {
View Full Code Here

    /** 根据指定的template,生成相应的文件。 */
    public boolean generate(String template, ConfigGeneratorCallback callback) {
        List<ConfigGenerate> generates = generator.generateTemplateFilesIncludingMetaInfos.get(template);

        if (generates == null || generates.isEmpty()) {
            throw new ConfigException("No defined template " + template);
        }

        boolean allSuccess = true;

        for (ConfigGenerate generate : generates) {
View Full Code Here

                                                               generate.getConfigDescriptor().getName(), generate.getConfigDescriptor().getBaseURL());
        } catch (Exception e) {
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            } else {
                throw new ConfigException(e);
            }
        } finally {
            if (writer != null) {
                try {
                    writer.flush();
View Full Code Here

                    generator.logger.info("<" + descriptor.getBaseURL() + ">\n    Generating log file: " + logfile
                                          + "\n");

                    writer.write(logContent);
                } catch (IOException e) {
                    throw new ConfigException(e);
                } finally {
                    if (writer != null) {
                        try {
                            writer.flush();
                        } catch (IOException e) {
View Full Code Here

        for (String destfile : generator.generateDestFiles.keySet()) {
            if (!processedDestfiles.contains(destfile)) {
                ConfigGenerate generate = generator.generateDestFiles.get(destfile);
                String template = generate.getTemplate();

                throw new ConfigException("Could not find template file: " + template + " for descriptor: "
                                          + generate.getConfigDescriptor().getURL());
            }
        }
    }
View Full Code Here

                try {
                    key = StringUtil.trimWhitespace(URLDecoder.decode(key, "UTF-8"));
                    value = StringUtil.trimWhitespace(URLDecoder.decode(value, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    throw new ConfigException(e);
                }

                if (!StringUtil.isEmpty(key) && session != null && session.acceptOption(key)) {
                    options.put(key, value);
                } else {
                    if (newQuery.length() > 0) {
                        newQuery.append("&");
                    }

                    newQuery.append(token);
                }
            }
        }

        String newQueryStr = newQuery.length() > 0 ? newQuery.toString() : "";

        try {
            this.uri = new URI(replace(uri.toString(), query, newQueryStr));
        } catch (URISyntaxException e) {
            throw new ConfigException(e);
        }

        this.options = options;
    }
View Full Code Here

        try {
            suburi = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), subpath, uri.getQuery(),
                             uri.getFragment()).normalize();
        } catch (URISyntaxException e) {
            throw new ConfigException(e);
        }

        return new ResourceURI(suburi, options);
    }
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.