Package org.apache.ivyde.eclipse

Examples of org.apache.ivyde.eclipse.IvyDEException


    }

    private Ivy getIvy(File file) throws IvyDEException {
        String ivySettingsPath = conf.getInheritedIvySettingsPath();
        if (!file.exists()) {
            IvyDEException ex = new IvyDEException("Ivy settings file not found",
                    "The Ivy settings file '" + ivySettingsPath + "' cannot be found", null);
            setConfStatus(ex);
            throw ex;
        }

        if (file.lastModified() != ivySettingsLastModified
                || !conf.getInheritedLoadSettingsOnDemandPath()) {
            IvySettings ivySettings = createIvySettings();
            if (ivySettingsLastModified == -1) {
                Message.info("\n\n");
            } else {
                Message.info("\n\nIVYDE: ivysettings has changed, configuring ivy again\n");
            }
            try {
                ivySettings.load(file);
            } catch (ParseException e) {
                IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
                        "The ivy settings file '" + ivySettingsPath + "' could not be parsed: "
                                + e.getMessage(), e);
                setConfStatus(ex);
                throw ex;
            } catch (IOException e) {
                IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
                        "The ivy settings file '" + ivySettingsPath + "' could not be read: "
                                + e.getMessage(), e);
                setConfStatus(ex);
                throw ex;
            }
View Full Code Here


                if (conf.getJavaProject() != null && !p.isAbsolute()) {
                    try {
                        is = new FileInputStream(conf.getJavaProject().getProject().getLocation()
                                .append(file).toFile());
                    } catch (FileNotFoundException e) {
                        IvyDEException ex = new IvyDEException("Property file not found",
                                "The property file '" + file + "' could not be found", e);
                        setConfStatus(ex);
                        throw ex;
                    }
                } else {
                    try {
                        is = new FileInputStream(file);
                    } catch (FileNotFoundException e) {
                        IvyDEException ex = new IvyDEException("Property file not found",
                                "The property file '" + file + "' was not found", e);
                        setConfStatus(ex);
                        throw ex;
                    }
                }
                Properties props = new Properties();
                try {
                    props.load(is);
                } catch (IOException e) {
                    IvyDEException ex = new IvyDEException("Not a property file",
                            "The property file '" + file + "' could not be loaded", e);
                    setConfStatus(ex);
                    throw ex;
                }
                try {
View Full Code Here

    }

    public ModuleDescriptor getModuleDescriptor(Ivy i) throws IvyDEException {
        File file = getIvyFile();
        if (!file.exists()) {
            IvyDEException ex = new IvyDEException("Ivy file not found", "The ivy.xml file '"
                    + file.getAbsolutePath() + "' was not found", null);
            setConfStatus(ex);
            throw ex;
        }
        try {
            md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(i.getSettings(),
                file.toURI().toURL(), false);
            setConfStatus(null);
            return md;
        } catch (MalformedURLException e) {
            IvyDEException ex = new IvyDEException("Incorrect URL of the Ivy file",
                    "The URL to the ivy.xml file is incorrect: '" + file.getAbsolutePath()
                    + "'", e);
            setConfStatus(ex);
            throw ex;
        } catch (ParseException e) {
            IvyDEException ex = new IvyDEException("Parsing error of the Ivy file",
                    "The ivy file '" + file.getAbsolutePath() + "' could not be parsed: "
                            + e.getMessage(), e);
            setConfStatus(ex);
            throw ex;
        } catch (IOException e) {
            IvyDEException ex = new IvyDEException("Read error of the Ivy file", "The ivy file '"
                    + file.getAbsolutePath() + "' could not be read: " + e.getMessage(), e);
            setConfStatus(ex);
            throw ex;
        }
    }
View Full Code Here

        String url;
        IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
        try {
            url = manager.performStringSubstitution(ivySettingsPath, false);
        } catch (CoreException e) {
            throw new IvyDEException("Unrecognized variables",
                    "Unrecognized variables in the Ivy settings file " + ivySettingsPath, e);
        }
        if (ivySettingsPath.trim().startsWith("$")) {
            // it starts with a variable, let's add the file protocol.
            try {
View Full Code Here

                String propFile = (String) it.next();
                String resolvedProp = manager.performStringSubstitution(propFile, false);
                resolvedProps.add(resolvedProp);
            }
        } catch (CoreException e) {
            throw new IvyDEException("Unrecognized variables",
                    "Unrecognized variables in the Ivy settings file " + ivySettingsPath, e);
        }
        return resolvedProps;
    }
View Full Code Here

                if (javaProject != null && !p.isAbsolute()) {
                    try {
                        is = new FileInputStream(javaProject.getProject().getFile(file)
                                .getFullPath().toFile());
                    } catch (FileNotFoundException e) {
                        IvyDEException ex = new IvyDEException("Property file not found",
                                "The property file '" + file + "' could not be found", e);
                        setConfStatus(ex);
                        throw ex;
                    }
                } else {
                    try {
                        is = new FileInputStream(file);
                    } catch (FileNotFoundException e) {
                        IvyDEException ex = new IvyDEException("Property file not found",
                                "The property file '" + file + "' was not found", e);
                        setConfStatus(ex);
                        throw ex;
                    }
                }
                Properties props = new Properties();
                try {
                    props.load(is);
                } catch (IOException e) {
                    IvyDEException ex = new IvyDEException("Not a property file",
                            "The property file '" + file + "' could not be loaded", e);
                    setConfStatus(ex);
                    throw ex;
                }
                try {
View Full Code Here

    }

    public ModuleDescriptor getModuleDescriptor(Ivy i) throws IvyDEException {
        File file = getIvyFile();
        if (!file.exists()) {
            IvyDEException ex = new IvyDEException("Ivy file not found", "The ivy.xml file '"
                    + file.getAbsolutePath() + "' was not found", null);
            setConfStatus(ex);
            throw ex;
        }
        try {
            md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
                i.getSettings(), file.toURL(), false);
            setConfStatus(null);
            return md;
        } catch (MalformedURLException e) {
            IvyDEException ex = new IvyDEException("Incorrect URL of the Ivy file",
                    "The URL to the ivy.xml file is incorrect: '" + file.getAbsolutePath() + "'", e);
            setConfStatus(ex);
            throw ex;
        } catch (ParseException e) {
            IvyDEException ex = new IvyDEException("Parsing error of the Ivy file",
                    "The ivy file '" + file.getAbsolutePath() + "' could not be parsed: "
                                + e.getMessage(), e);
            setConfStatus(ex);
            throw ex;
        } catch (IOException e) {
            IvyDEException ex = new IvyDEException("Read error of the Ivy file", "The ivy file '"
                    + file.getAbsolutePath() + "' could not be read: "
                                + e.getMessage(), e);
            setConfStatus(ex);
            throw ex;
        }
View Full Code Here

            if (ivy == null) {
                IvySettings ivySettings = createIvySettings();
                try {
                    ivySettings.loadDefault();
                } catch (ParseException e) {
                    IvyDEException ex = new IvyDEException(
                            "Parsing error of the default Ivy settings",
                            "The default Ivy settings file could not be parsed: "
                                + e.getMessage(), e);
                    setConfStatus(ex);
                    throw ex;
                } catch (IOException e) {
                    IvyDEException ex = new IvyDEException(
                            "Read error of the default Ivy settings",
                            "The default Ivy settings file could not be read: "
                                + e.getMessage(), e);
                    setConfStatus(ex);
                    throw ex;
                }
                ivy = Ivy.newInstance(ivySettings);
            }
            setConfStatus(null);
            return ivy;
        }

        if (settingsPath.startsWith(PROJECT_SCHEME_PREFIX)) {
            int pathIndex = settingsPath.indexOf("/", PROJECT_SCHEME_PREFIX_LENGTH);
            String projectName = settingsPath.substring(PROJECT_SCHEME_PREFIX_LENGTH, pathIndex);
            String path = settingsPath.substring(pathIndex + 1);
            if (projectName.equals("")) {
                File file = javaProject.getProject().getFile(path).getLocation().toFile();
                if (!file.exists()) {
                    IvyDEException ex = new IvyDEException("Ivy settings file not found",
                            "The Ivy settings file '" + settingsPath + "' cannot be found", null);
                    setConfStatus(ex);
                    throw ex;
                }
                return getIvy(file);
            } else {
                IResource p = ResourcesPlugin.getWorkspace().getRoot().findMember(projectName);
                if (p == null) {
                    IvyDEException ex = new IvyDEException("Project '" + projectName
                            + "' not found", "The project name '" + projectName + "' from '"
                            + settingsPath + "' was not found", null);
                    setConfStatus(ex);
                    throw ex;
                }
                File file = p.getProject().getFile(path).getLocation().toFile();
                if (!file.exists()) {
                    IvyDEException ex = new IvyDEException("Ivy settings file not found",
                            "The Ivy settings file '" + path + "' cannot be found in project '"
                                    + projectName + "'", null);
                    setConfStatus(ex);
                    throw ex;
                }
                return getIvy(file);
            }
        }
        // before returning the found ivy, try to refresh it if the settings changed
        URL url;
        try {
            url = new URL(settingsPath);
        } catch (MalformedURLException e) {
            IvyDEException ex = new IvyDEException("Incorrect url of the Ivy settings",
                    "The Ivy settings url '" + settingsPath + "' is incorrect: "
                                + e.getMessage(), e);
            setConfStatus(ex);
            throw ex;
        }
        if (url.getProtocol().startsWith("file")) {
            File file = new File(url.getPath());
            return getIvy(file);
        } else {
            // an URL but not a file
            if (ivy == null || ivySettingsLastModified == -1) {
                IvySettings ivySettings = createIvySettings();
                try {
                    ivySettings.load(url);
                    ivySettingsLastModified = 0;
                } catch (ParseException e) {
                    IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
                            "The ivy settings file '" + settingsPath + "' could not be parsed: "
                                + e.getMessage(), e);
                    setConfStatus(ex);
                    throw ex;
                } catch (IOException e) {
                    IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
                            "The ivy settings file '" + settingsPath + "' could not be read: "
                                + e.getMessage(), e);
                    setConfStatus(ex);
                    throw ex;
                }
View Full Code Here

        return ivy;
    }

    private Ivy getIvy(File file) throws IvyDEException {
        if (!file.exists()) {
            IvyDEException ex = new IvyDEException("Ivy settings file not found",
                    "The Ivy settings file '" + ivySettingsPath + "' cannot be found", null);
            setConfStatus(ex);
            throw ex;
        }

        if (file.lastModified() != ivySettingsLastModified
                || !getInheritedLoadSettingsOnDemandPath()) {
            IvySettings ivySettings = createIvySettings();
            if (ivySettingsLastModified == -1) {
                Message.info("\n\n");
            } else {
                Message.info("\n\nIVYDE: ivysettings has changed, configuring ivy again\n");
            }
            try {
                ivySettings.load(file);
            } catch (ParseException e) {
                IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
                        "The ivy settings file '" + ivySettingsPath + "' could not be parsed: "
                                + e.getMessage(), e);
                setConfStatus(ex);
                throw ex;
            } catch (IOException e) {
                IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
                        "The ivy settings file '" + ivySettingsPath + "' could not be read: "
                                + e.getMessage(), e);
                setConfStatus(ex);
                throw ex;
            }
View Full Code Here

            path = ivySettingsPath;           
        }
        try {
            url = manager.performStringSubstitution(path, false);
        } catch (CoreException e) {
            throw new IvyDEException("Unrecognized variables",
                    "Unrecognized variables in the Ivy settings file " + ivySettingsPath, e);
        }
        if (ivySettingsPath.trim().startsWith("$")) {
            // it starts with a variable, let's add the file protocol.
            try {
View Full Code Here

TOP

Related Classes of org.apache.ivyde.eclipse.IvyDEException

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.