Examples of Augeas


Examples of net.augeas.Augeas

        return resourceName;
    }

    protected void updateCrontab(String crontabPath, ConfigurationDefinition crontabConfigurationDefinition,
        Configuration crontabConfiguration) {
        Augeas augeas = null;
        try {
            augeas = getAugeas();

            File crontabFile = new File(crontabPath);
            String basePath = AUGEAS_FILES_PREFIX + crontabFile.getAbsolutePath();
            AugeasNode baseNode = new AugeasNode(basePath);

            PropertyList entries = crontabConfiguration.getList(CronTabComponent.ENTRIES_PROP);
            PropertyDefinitionList entriesDef = crontabConfigurationDefinition
                .getPropertyDefinitionList(CronTabComponent.ENTRIES_PROP);
            setNodeFromPropertyList(entriesDef, entries, augeas, baseNode);

            PropertyList settings = crontabConfiguration.getList(CronTabComponent.ENVIRONMENT_SETTINGS_PROP);
            if (settings != null) {
                for (Property p : settings.getList()) {
                    PropertyMap setting = (PropertyMap) p;
                    String name = setting.getSimpleValue(CronTabComponent.NAME_PROP, null);
                    String value = setting.getSimpleValue(CronTabComponent.VALUE_PROP, "");
                    if (name != null) {
                        String settingPath = basePath + AugeasNode.SEPARATOR + name;
                        augeas.set(settingPath, value);
                    }
                }
            }

            augeas.save();
        } catch (AugeasException e) {
            if (augeas != null)
                throw new RuntimeException(summarizeAugeasError(augeas), e);
            else
                throw new RuntimeException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.