Package org.apache.easyant.core.descriptor

Examples of org.apache.easyant.core.descriptor.PropertyDescriptor


            }
            getProject().setProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS, buildConfigurations);
            updateMainConfs();

            for (Iterator<PropertyDescriptor> iterator = md.getProperties().values().iterator(); iterator.hasNext();) {
                PropertyDescriptor property = iterator.next();
                if (canInherit(property, currentModule)) {
                    PropertyTask propTask = new PropertyTask();
                    propTask.setName(property.getName());
                    propTask.setValue(property.getValue());
                    propTask.setBuildConfigurations(property.getBuildConfigurations());
                    propTask.setTaskType("antlib:org.apache.easyant:property");
                    getOwningTarget().addTask(propTask);
                    initTask(propTask).execute();
                }
            }
View Full Code Here


                AdvancedInheritableItem parentNode, String buildConf) {
            for (int i = 0; i < attributes.getLength(); i++) {
                if (!ignoredAttributes.contains(attributes.getQName(i))) {
                    String propertyName = attributes.getQName(i);
                    String value = IvyContext.getContext().getSettings().substitute(attributes.getValue(i));
                    PropertyDescriptor property = new PropertyDescriptor(propertyName);
                    property.setValue(value);
                    property.setBuildConfigurations(buildConf);
                    if (parentNode != null) {
                        property.setInheritScope(parentNode.getInheritScope());
                        property.setInheritable(parentNode.isInheritable());
                    }
                    easyAntModuleDescriptor.getProperties().put(propertyName, property);
                }
            }
        }
View Full Code Here

                    String key = (String) enumeration.nextElement();
                    String value = getSettings().substitute(props.getProperty(key));

                    // put this variable on the context
                    IvyContext.getContext().getSettings().getVariableContainer().setVariable(key, value, true);
                    PropertyDescriptor property = new PropertyDescriptor(key);
                    property.setValue(value);
                    property.setBuildConfigurations(conf);

                    applyInheritableItemAttributesFromParentNode(property);
                    // override with explicit inherited scope attributes
                    handleInheritedScopeAttribute(attributes, property);

                    easyAntModuleDescriptor.getProperties().put(key, property);
                }
            } else {
                if (attributes.getValue("name") == null) {
                    throw new SAXException("Can't set a null property!");
                }
                String propertyName = getSettings().substitute(attributes.getValue("name"));
                String value = getSettings().substitute(attributes.getValue("value"));

                // put this variable on the context
                IvyContext.getContext().getSettings().getVariableContainer().setVariable(propertyName, value, true);
                PropertyDescriptor property = new PropertyDescriptor(propertyName, getMd().getModuleRevisionId());
                property.setValue(value);
                property.setBuildConfigurations(conf);

                applyInheritableItemAttributesFromParentNode(property);
                // override with explicit inherited scope attributes
                handleInheritedScopeAttribute(attributes, property);
View Full Code Here

         * @param properties
         *            a map of properties that will be merged with current one
         */
        protected void mergeEasyantProperties(Map<String, PropertyDescriptor> properties) {
            for (Iterator<PropertyDescriptor> iterator = properties.values().iterator(); iterator.hasNext();) {
                PropertyDescriptor prop = iterator.next();
                if (prop.isInheritable()) {
                    IvyContext.getContext().getSettings().getVariableContainer()
                            .setVariable(prop.getName(), prop.getValue(), true);
                    StringBuilder sb = new StringBuilder("Merging property");
                    sb.append(prop.getName());
                    if (prop.getSourceModule() != null) {
                        sb.append(" from ").append(prop.getSourceModule().toString());
                    }
                    Message.debug(sb.toString());
                    easyAntModuleDescriptor.getProperties().put(prop.getName(), prop);
                }
            }
        }
View Full Code Here

    }

    private void printProperties(Map<String, PropertyDescriptor> allProjectProps) {
        for (Iterator<Entry<String, PropertyDescriptor>> it = allProjectProps.entrySet().iterator(); it.hasNext();) {
            Entry<String, PropertyDescriptor> entry = it.next();
            PropertyDescriptor prop = entry.getValue();
            getProject().log("\tProperty: " + prop.getName() );
           
        }
    }
View Full Code Here

            getProject().log("\t\tIF: " + (targetRep.getIfCase() == null ? NONE : targetRep.getIfCase()));
            getProject().log("\t\tUNLESS: " + (targetRep.getUnlessCase() == null ? NONE : targetRep.getUnlessCase()));
        } else {
            getProject().log("\tNo Target found for name: " + target);
        }
        PropertyDescriptor prop = getEareport().getAvailableProperties().get(target);
        if (prop != null) {
            getProject().log("\tProperty: " + target);
            getProject().log("\t\tDescription: " + (prop.getDescription() == null ? NONE : prop.getDescription()));
            String defaultValue = prop.getDefaultValue() == null ? NONE : prop.getDefaultValue();
            getProject().log("\t\tDefault: " + defaultValue);
            getProject().log("\t\tRequired: " + prop.isRequired());
            String currentValue = prop.getValue() == null ? defaultValue : prop.getValue();
            getProject().log("\t\tCurrent value: " + currentValue);
            if (prop.getOwningTarget() != null) {
                getProject().log("\t\tDefined in: " + prop.getOwningTarget());
            }
        } else {
            getProject().log("\tNo Property found for name: " + target);
        }
        ParameterReport parameter = getEareport().getParameterReport(target);
View Full Code Here

        }
        Assert.assertTrue(containsBuildType);
        Assert.assertTrue(containsPlugin);

        // be sure that the property exist
        PropertyDescriptor property = eaReport.getPropertyDescriptors().get("run.main.classname");
        Assert.assertNotNull(property);
        // check the value of the property
        Assert.assertEquals("org.apache.easyant.example.Example", property.getValue());

        // be sure that the property exist
        PropertyDescriptor srcMainJava = eaReport.getAvailableProperties().get("src.main.java");
        Assert.assertNotNull(srcMainJava);
        // check the value of the property
        Assert.assertEquals("${basedir}/src/main/java", srcMainJava.getValue());

        // the property should also be contained in getAvailableProperties which
        // list all properties (those for the current module and those in
        // imported modules)
        property = eaReport.getAvailableProperties().get("run.main.classname");
View Full Code Here

        return availableProperties;
    }

    private void addProperty(PropertyDescriptor propertyDescriptor, Map<String, PropertyDescriptor> availableProperties) {
        if (availableProperties.containsKey(propertyDescriptor.getName())) {
            PropertyDescriptor existingProperty = availableProperties.get(propertyDescriptor.getName());
            if (existingProperty.getDescription() == null) {
                existingProperty.setDescription(propertyDescriptor.getDescription());
            }
            if (existingProperty.getBuildConfigurations() == null) {
                existingProperty.setBuildConfigurations(propertyDescriptor.getBuildConfigurations());
            }
            if (existingProperty.getDefaultValue() == null) {
                existingProperty.setDefaultValue(propertyDescriptor.getDefaultValue());
            }
            if (existingProperty.getValue() == null) {
                existingProperty.setValue(propertyDescriptor.getValue());
            }
            availableProperties.put(propertyDescriptor.getName(), existingProperty);
        } else {
            availableProperties.put(propertyDescriptor.getName(), propertyDescriptor);
        }
View Full Code Here

            if (f.exists()) {
                try {
                    propToLoad.load(new FileInputStream(f));
                    for (Iterator<?> iter = propToLoad.keySet().iterator(); iter.hasNext();) {
                        String key = (String) iter.next();
                        PropertyDescriptor propertyDescriptor = new PropertyDescriptor(key);
                        propertyDescriptor.setValue(propToLoad.getProperty(key));
                        if (property.getOwningTarget() != null) {
                            propertyDescriptor.setOwningTarget(property.getOwningTarget().getName());
                        }
                        eaReport.addPropertyDescriptor(propertyDescriptor.getName(), propertyDescriptor);
                    }

                } catch (IOException e) {
                    IOException ioe = new IOException("Unable to parse the property file :" + property.getFile());
                    ioe.initCause(e);
                    throw ioe;
                }
            }
        }
        if (property.getName() != null) {
            PropertyDescriptor propertyDescriptor = new PropertyDescriptor(property.getName());
            propertyDescriptor.setValue(property.getValue());
            if (property.getOwningTarget() != null) {
                propertyDescriptor.setOwningTarget(property.getOwningTarget().getName());
            }
            eaReport.addPropertyDescriptor(property.getName(), propertyDescriptor);
        }
    }
View Full Code Here

        }
    }

    private void handleParameterTask(ParameterTask parameterTask, EasyAntReport eaReport) {
        if (parameterTask.getProperty() != null) {
            PropertyDescriptor propertyDescriptor = new PropertyDescriptor(parameterTask.getProperty());
            propertyDescriptor.setDefaultValue(parameterTask.getDefault());
            propertyDescriptor.setRequired(parameterTask.isRequired());
            propertyDescriptor.setDescription(parameterTask.getDescription());
            if (parameterTask.getOwningTarget() != null) {
                propertyDescriptor.setOwningTarget(parameterTask.getOwningTarget().getName());
            }
            Message.debug("Ant file has a property called : " + propertyDescriptor.getName());
            eaReport.addPropertyDescriptor(propertyDescriptor.getName(), propertyDescriptor);
        } else if (parameterTask.getPath() != null) {
            ParameterReport parameterReport = new ParameterReport(ParameterType.PATH);
            parameterReport.setName(parameterTask.getPath());
            parameterReport.setRequired(parameterTask.isRequired());
            parameterReport.setDescription(parameterTask.getDescription());
View Full Code Here

TOP

Related Classes of org.apache.easyant.core.descriptor.PropertyDescriptor

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.