You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/07/12 19:36:44 UTC
svn commit: r1360879 - in /incubator/easyant/core/trunk/src/main:
java/org/apache/easyant/core/parser/DefaultEasyAntXmlModuleDescriptorParser.java
java/org/apache/easyant/core/parser/EasyAntConfigParser.java
resources/org/apache/easyant/antlib.xml
Author: jlboudart
Date: Thu Jul 12 19:36:44 2012
New Revision: 1360879
URL: http://svn.apache.org/viewvc?rev=1360879&view=rev
Log:
use import by default instead of include
Modified:
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/DefaultEasyAntXmlModuleDescriptorParser.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java
incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/DefaultEasyAntXmlModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/DefaultEasyAntXmlModuleDescriptorParser.java?rev=1360879&r1=1360878&r2=1360879&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/DefaultEasyAntXmlModuleDescriptorParser.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/DefaultEasyAntXmlModuleDescriptorParser.java Thu Jul 12 19:36:44 2012
@@ -53,12 +53,11 @@ import org.xml.sax.SAXException;
/**
* Parses an easyant module descriptor and output an EasyAntModuleDescriptor
*/
-public class DefaultEasyAntXmlModuleDescriptorParser extends
- XmlModuleDescriptorParser implements EasyAntModuleDescriptorParser {
+public class DefaultEasyAntXmlModuleDescriptorParser extends XmlModuleDescriptorParser implements
+ EasyAntModuleDescriptorParser {
- static final String[] PLUGIN_REGULAR_ATTRIBUTES = new String[] {
- "organisation", "org", "module", "revision", "rev", "mrid", "conf",
- "mode", "as", "inheritable", "inherit-scope" };
+ static final String[] PLUGIN_REGULAR_ATTRIBUTES = new String[] { "organisation", "org", "module", "revision",
+ "rev", "mrid", "conf", "mode", "as", "inheritable", "inherit-scope" };
public boolean accept(Resource res) {
return res.getName().endsWith(".ivy");
@@ -81,9 +80,8 @@ public class DefaultEasyAntXmlModuleDesc
return easyAntModuleDescriptor;
}
- public ModuleDescriptor parseDescriptor(ParserSettings ivySettings,
- URL xmlURL, Resource res, boolean validate) throws ParseException,
- IOException {
+ public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL xmlURL, Resource res, boolean validate)
+ throws ParseException, IOException {
EasyAntParser parser = (EasyAntParser) newParser(ivySettings);
parser.setValidate(validate);
@@ -115,61 +113,50 @@ public class DefaultEasyAntXmlModuleDesc
private PluginDescriptor currentPluginDescriptor;
- public EasyAntParser(ModuleDescriptorParser parser,
- ParserSettings ivySettings) {
+ public EasyAntParser(ModuleDescriptorParser parser, ParserSettings ivySettings) {
super(parser, ivySettings);
easyAntState = EasyAntState.NONE;
easyAntModuleDescriptor = new DefaultEasyAntDescriptor();
easyantPrefix = "";
}
- public void startElement(String uri, String localName, String name,
- Attributes attributes) throws SAXException {
+ public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
super.startElement(uri, localName, name, attributes);
- if (name.equals(easyantPrefix + ":build")
- && State.EXTRA_INFO == getState()) {
+ if (name.equals(easyantPrefix + ":build") && State.EXTRA_INFO == getState()) {
eaBuildStarted(attributes);
}
- if (name.equals(easyantPrefix + ":plugin")
- && State.EXTRA_INFO == getState()) {
+ if (name.equals(easyantPrefix + ":plugin") && State.EXTRA_INFO == getState()) {
pluginStarted(attributes);
}
- if (name.equals(easyantPrefix + ":property")
- && State.EXTRA_INFO == getState()) {
+ if (name.equals(easyantPrefix + ":property") && State.EXTRA_INFO == getState()) {
easyantPropertyStarted(attributes);
}
- if (name.equals(easyantPrefix + ":bindtarget")
- && State.EXTRA_INFO == getState()) {
+ if (name.equals(easyantPrefix + ":bindtarget") && State.EXTRA_INFO == getState()) {
bindTargetStarted(attributes);
}
if ("easyant".equals(name)) {
// TODO: add a reference to the documentation
- Message
- .warn("<easyant> tag is deprecated since easyant 0.6, we strongly recommend you to use <ea:build> instead");
+ Message.warn("<easyant> tag is deprecated since easyant 0.6, we strongly recommend you to use <ea:build> instead");
eaBuildStarted(attributes);
}
if (easyAntState == EasyAntState.EASYANT && "property".equals(name)) {
// TODO: add a reference to the documentation
- Message
- .warn("<property> tag is deprecated since easyant 0.6, we strongly recommend you to use <ea:property> instead");
+ Message.warn("<property> tag is deprecated since easyant 0.6, we strongly recommend you to use <ea:property> instead");
easyantPropertyStarted(attributes);
}
if (easyAntState == EasyAntState.EASYANT && "plugin".equals(name)) {
// TODO: add a reference to the documentation
- Message
- .warn("<plugin> tag is deprecated since easyant 0.6, we strongly recommend you to use <ea:plugin> instead");
+ Message.warn("<plugin> tag is deprecated since easyant 0.6, we strongly recommend you to use <ea:plugin> instead");
pluginStarted(attributes);
}
}
@Override
- public void endElement(String uri, String localName, String name)
- throws SAXException {
+ public void endElement(String uri, String localName, String name) throws SAXException {
super.endElement(uri, localName, name);
- if (name.equals(easyantPrefix + ":plugin")
- && easyAntState == EasyAntState.PLUGIN) {
+ if (name.equals(easyantPrefix + ":plugin") && easyAntState == EasyAntState.PLUGIN) {
endPlugin();
}
}
@@ -180,15 +167,12 @@ public class DefaultEasyAntXmlModuleDesc
}
@Override
- protected void ivyModuleStarted(Attributes attributes)
- throws SAXException {
+ protected void ivyModuleStarted(Attributes attributes) throws SAXException {
super.ivyModuleStarted(attributes);
// lookup easyant namespace
- for (Iterator iterator = getMd().getExtraAttributesNamespaces()
- .entrySet().iterator(); iterator.hasNext();) {
+ for (Iterator iterator = getMd().getExtraAttributesNamespaces().entrySet().iterator(); iterator.hasNext();) {
Entry namespace = (Entry) iterator.next();
- if (EasyAntConstants.EASYANT_MD_NAMESPACE.equals(namespace
- .getValue())) {
+ if (EasyAntConstants.EASYANT_MD_NAMESPACE.equals(namespace.getValue())) {
easyantPrefix = (String) namespace.getKey();
}
}
@@ -200,17 +184,13 @@ public class DefaultEasyAntXmlModuleDesc
super.endDocument();
for (Configuration conf : getMd().getConfigurations()) {
- if ("profile".equals(conf.getExtraAttribute(easyantPrefix
- + ":type"))) {
- Message.debug("Adding build configuration named "
- + conf.getName());
- easyAntModuleDescriptor.addBuildConfiguration(conf
- .getName());
+ if ("profile".equals(conf.getExtraAttribute(easyantPrefix + ":type"))) {
+ Message.debug("Adding build configuration named " + conf.getName());
+ easyAntModuleDescriptor.addBuildConfiguration(conf.getName());
}
}
try {
- easyAntModuleDescriptor.setIvyModuleDescriptor(super
- .getModuleDescriptor());
+ easyAntModuleDescriptor.setIvyModuleDescriptor(super.getModuleDescriptor());
} catch (ParseException e) {
throw new SAXException(e);
}
@@ -225,55 +205,41 @@ public class DefaultEasyAntXmlModuleDesc
protected void pluginStarted(Attributes attributes) {
boolean mandatory = false;
- String mandatoryValue = getSettings().substitute(
- attributes.getValue("mandatory"));
+ String mandatoryValue = getSettings().substitute(attributes.getValue("mandatory"));
if (mandatoryValue != null && "true".equals(mandatoryValue)) {
mandatory = true;
}
String conf = getSettings().substitute(attributes.getValue("conf"));
easyAntState = EasyAntState.PLUGIN;
- PluginDescriptor plugin = new PluginDescriptor(getMd()
- .getModuleRevisionId());
+ PluginDescriptor plugin = new PluginDescriptor(getMd().getModuleRevisionId());
String mrid = getSettings().substitute(attributes.getValue("mrid"));
if (mrid != null) {
if (!mrid.matches(".*#.*")) {
- Message.debug("No organisation specified for plugin "
- + mrid + " using the default one");
- mrid = EasyAntConstants.EASYANT_PLUGIN_ORGANISATION + "#"
- + mrid;
+ Message.debug("No organisation specified for plugin " + mrid + " using the default one");
+ mrid = EasyAntConstants.EASYANT_PLUGIN_ORGANISATION + "#" + mrid;
}
plugin.setMrid(mrid);
} else {
- String org = attributes.getValue("org") != null ? attributes
- .getValue("org") : attributes.getValue("organisation");
+ String org = attributes.getValue("org") != null ? attributes.getValue("org") : attributes
+ .getValue("organisation");
org = getSettings().substitute(org);
if (org == null) {
- Message.debug("No organisation specified for plugin "
- + mrid + " using the default one");
+ Message.debug("No organisation specified for plugin " + mrid + " using the default one");
org = EasyAntConstants.EASYANT_PLUGIN_ORGANISATION;
}
- String module = getSettings().substitute(
- attributes.getValue("module"));
- String revision = attributes.getValue("rev") != null ? attributes
- .getValue("rev")
- : attributes.getValue("revision");
+ String module = getSettings().substitute(attributes.getValue("module"));
+ String revision = attributes.getValue("rev") != null ? attributes.getValue("rev") : attributes
+ .getValue("revision");
revision = getSettings().substitute(revision);
plugin.setOrganisation(org);
plugin.setModule(module);
plugin.setRevision(revision);
}
- String mode = getSettings().substitute(attributes.getValue("mode"));
- // If no mode is defined in the module descriptor we use include
- // by default
- if (mode == null) {
- plugin.setMode("include");
- } else {
- plugin.setMode(mode);
- }
+ plugin.setMode(getSettings().substitute(attributes.getValue("mode")));
plugin.setMandatory(mandatory);
plugin.setAs(getSettings().substitute(attributes.getValue("as")));
@@ -282,8 +248,7 @@ public class DefaultEasyAntXmlModuleDesc
handleInheritedScopeAttribute(attributes, plugin);
currentPluginDescriptor = plugin;
- if (BuildConfigurationHelper.contains(conf,
- activeBuildConfigurations)) {
+ if (BuildConfigurationHelper.contains(conf, activeBuildConfigurations)) {
easyAntModuleDescriptor.addPlugin(plugin);
}
@@ -296,44 +261,39 @@ public class DefaultEasyAntXmlModuleDesc
* @param attributes
* a set of attributes
* @param conf
- * build configurations where this property should be applied
- * (can be null)
+ * build configurations where this property should be applied (can be null)
*/
- protected void handlePropertyAsAttribute(Attributes attributes,
- String conf) {
+ protected void handlePropertyAsAttribute(Attributes attributes, String conf) {
List<String> ignored = Arrays.asList(PLUGIN_REGULAR_ATTRIBUTES);
for (int i = 0; i < attributes.getLength(); i++) {
if (!ignored.contains(attributes.getQName(i))) {
String propertyName = attributes.getQName(i);
- String value = IvyContext.getContext().getSettings()
- .substitute(attributes.getValue(i));
- PropertyDescriptor property = new PropertyDescriptor(
- propertyName);
+ String value = IvyContext.getContext().getSettings().substitute(attributes.getValue(i));
+ PropertyDescriptor property = new PropertyDescriptor(propertyName);
property.setValue(value);
property.setBuildConfigurations(conf);
applyInheritableItemAttributesFromPlugin(property);
- easyAntModuleDescriptor.getProperties().put(propertyName,
- property);
+ easyAntModuleDescriptor.getProperties().put(propertyName, property);
}
}
}
/**
* Handle inherited scope specific attributes
- * @param attributes a set of attributes
- * @param inheritScopeElement an element supporting inherit scope attributes
+ *
+ * @param attributes
+ * a set of attributes
+ * @param inheritScopeElement
+ * an element supporting inherit scope attributes
*/
- private void handleInheritedScopeAttribute(Attributes attributes,
- AdvancedInheritableItem inheritScopeElement) {
- String inheritScopeValue=getSettings().substitute(
- attributes.getValue("inherit-scope"));
+ private void handleInheritedScopeAttribute(Attributes attributes, AdvancedInheritableItem inheritScopeElement) {
+ String inheritScopeValue = getSettings().substitute(attributes.getValue("inherit-scope"));
if (inheritScopeValue != null) {
InheritableScope scope = InheritableScope.valueOf(inheritScopeValue.toUpperCase());
inheritScopeElement.setInheritScope(scope);
}
-
- String inheritableValue = getSettings().substitute(
- attributes.getValue("inheritable"));
+
+ String inheritableValue = getSettings().substitute(attributes.getValue("inheritable"));
if (inheritableValue != null) {
inheritScopeElement.setInheritable("true".equalsIgnoreCase(inheritableValue));
}
@@ -351,33 +311,26 @@ public class DefaultEasyAntXmlModuleDesc
String mrid = getSettings().substitute(attributes.getValue("mrid"));
if (mrid != null) {
if (!mrid.matches(".*#.*")) {
- Message.debug("No organisation specified for buildtype "
- + mrid + " using the default one");
- mrid = EasyAntConstants.EASYANT_BUILDTYPES_ORGANISATION
- + "#" + mrid;
+ Message.debug("No organisation specified for buildtype " + mrid + " using the default one");
+ mrid = EasyAntConstants.EASYANT_BUILDTYPES_ORGANISATION + "#" + mrid;
}
easyAntModuleDescriptor.setBuildType(mrid);
} else {
- String org = attributes.getValue("org") != null ? attributes
- .getValue("org") : attributes.getValue("organisation");
+ String org = attributes.getValue("org") != null ? attributes.getValue("org") : attributes
+ .getValue("organisation");
org = getSettings().substitute(org);
if (org == null) {
- Message.debug("No organisation specified for buildtype "
- + mrid + " using the default one");
+ Message.debug("No organisation specified for buildtype " + mrid + " using the default one");
org = EasyAntConstants.EASYANT_BUILDTYPES_ORGANISATION;
}
- String module = getSettings().substitute(
- attributes.getValue("module"));
- String revision = attributes.getValue("rev") != null ? attributes
- .getValue("rev")
- : attributes.getValue("revision");
+ String module = getSettings().substitute(attributes.getValue("module"));
+ String revision = attributes.getValue("rev") != null ? attributes.getValue("rev") : attributes
+ .getValue("revision");
revision = getSettings().substitute(revision);
- ModuleRevisionId moduleRevisionId = ModuleRevisionId
- .newInstance(org, module, revision);
+ ModuleRevisionId moduleRevisionId = ModuleRevisionId.newInstance(org, module, revision);
- easyAntModuleDescriptor.setBuildType(moduleRevisionId
- .toString());
+ easyAntModuleDescriptor.setBuildType(moduleRevisionId.toString());
}
handlePropertyAsAttribute(attributes, null);
@@ -390,21 +343,17 @@ public class DefaultEasyAntXmlModuleDesc
* reprensents the bindtarget attributes
*/
protected void bindTargetStarted(Attributes attributes) {
- String target = getSettings().substitute(
- attributes.getValue("target"));
- String toExtensionPoint = getSettings().substitute(
- attributes.getValue("extensionOf"));
+ String target = getSettings().substitute(attributes.getValue("target"));
+ String toExtensionPoint = getSettings().substitute(attributes.getValue("extensionOf"));
String conf = getSettings().substitute(attributes.getValue("conf"));
if (EasyAntState.PLUGIN == easyAntState && conf == null) {
conf = currentPluginDescriptor.getBuildConfigurations();
}
- if (BuildConfigurationHelper.contains(conf,
- activeBuildConfigurations)) {
+ if (BuildConfigurationHelper.contains(conf, activeBuildConfigurations)) {
// if bindtarget tag is a subelement and look if an alias was
// defined on the plugin
- if (EasyAntState.PLUGIN == easyAntState
- && currentPluginDescriptor.getAs() != null) {
+ if (EasyAntState.PLUGIN == easyAntState && currentPluginDescriptor.getAs() != null) {
// check if the fully qualified name was defined, if not get
// the alias defined on the plugin
if (!target.startsWith(currentPluginDescriptor.getAs())) {
@@ -435,8 +384,7 @@ public class DefaultEasyAntXmlModuleDesc
* reprensents the plugins attributes
* @throws SAXException
*/
- protected void easyantPropertyStarted(Attributes attributes)
- throws SAXException {
+ protected void easyantPropertyStarted(Attributes attributes) throws SAXException {
String conf = getSettings().substitute(attributes.getValue("conf"));
// if property tag is a subelement and
// no build configuration was defined looked at plugin build
@@ -446,37 +394,29 @@ public class DefaultEasyAntXmlModuleDesc
}
if (attributes.getValue("file") != null) {
- String fileName = getSettings().substitute(
- attributes.getValue("file"));
+ String fileName = getSettings().substitute(attributes.getValue("file"));
File file = new File(fileName);
if (!file.exists()) {
throw new SAXException(fileName + " doesn't exists !");
}
- PropertiesFile props = new PropertiesFile(file,
- "project properties");
+ PropertiesFile props = new PropertiesFile(file, "project properties");
Enumeration enumeration = props.propertyNames();
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
- String value = getSettings().substitute(
- props.getProperty(key));
+ String value = getSettings().substitute(props.getProperty(key));
- if (BuildConfigurationHelper.contains(conf,
- activeBuildConfigurations)) {
+ if (BuildConfigurationHelper.contains(conf, activeBuildConfigurations)) {
// put this variable on the context
- IvyContext.getContext().getSettings()
- .getVariableContainer().setVariable(key, value,
- true);
- PropertyDescriptor property = new PropertyDescriptor(
- key);
+ IvyContext.getContext().getSettings().getVariableContainer().setVariable(key, value, true);
+ PropertyDescriptor property = new PropertyDescriptor(key);
property.setValue(value);
property.setBuildConfigurations(conf);
-
+
applyInheritableItemAttributesFromPlugin(property);
- //override with explicit inherited scope attributes
+ // override with explicit inherited scope attributes
handleInheritedScopeAttribute(attributes, property);
-
- easyAntModuleDescriptor.getProperties().put(key,
- property);
+
+ easyAntModuleDescriptor.getProperties().put(key, property);
}
}
@@ -484,28 +424,21 @@ public class DefaultEasyAntXmlModuleDesc
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"));
+ String propertyName = getSettings().substitute(attributes.getValue("name"));
+ String value = getSettings().substitute(attributes.getValue("value"));
- if (BuildConfigurationHelper.contains(conf,
- activeBuildConfigurations)) {
+ if (BuildConfigurationHelper.contains(conf, activeBuildConfigurations)) {
// put this variable on the context
- IvyContext.getContext().getSettings()
- .getVariableContainer().setVariable(propertyName,
- value, true);
- PropertyDescriptor property = new PropertyDescriptor(
- propertyName, getMd().getModuleRevisionId());
+ IvyContext.getContext().getSettings().getVariableContainer().setVariable(propertyName, value, true);
+ PropertyDescriptor property = new PropertyDescriptor(propertyName, getMd().getModuleRevisionId());
property.setValue(value);
property.setBuildConfigurations(conf);
-
+
applyInheritableItemAttributesFromPlugin(property);
- //override with explicit inherited scope attributes
+ // override with explicit inherited scope attributes
handleInheritedScopeAttribute(attributes, property);
-
- easyAntModuleDescriptor.getProperties().put(propertyName,
- property);
+
+ easyAntModuleDescriptor.getProperties().put(propertyName, property);
}
@@ -514,10 +447,10 @@ public class DefaultEasyAntXmlModuleDesc
/**
* Apply {@link AdvancedInheritableItem} attributes from current plugin
+ *
* @param property
*/
- private void applyInheritableItemAttributesFromPlugin(
- PropertyDescriptor property) {
+ private void applyInheritableItemAttributesFromPlugin(PropertyDescriptor property) {
if (EasyAntState.PLUGIN == easyAntState) {
property.setInheritable(currentPluginDescriptor.isInheritable());
property.setInheritScope(currentPluginDescriptor.getInheritScope());
@@ -535,10 +468,8 @@ public class DefaultEasyAntXmlModuleDesc
if (parent.getParser() instanceof DefaultEasyAntXmlModuleDescriptorParser) {
DefaultEasyAntXmlModuleDescriptorParser parser = (DefaultEasyAntXmlModuleDescriptorParser) parent
.getParser();
- mergeEasyantProperties(parser.getEasyAntModuleDescriptor()
- .getProperties());
- mergeEasyantPlugins(parser.getEasyAntModuleDescriptor()
- .getPlugins());
+ mergeEasyantProperties(parser.getEasyAntModuleDescriptor().getProperties());
+ mergeEasyantPlugins(parser.getEasyAntModuleDescriptor().getPlugins());
}
}
@@ -550,8 +481,7 @@ public class DefaultEasyAntXmlModuleDesc
* @param parent
* an other module descriptor
*/
- protected void mergeWithOtherModuleDescriptor(List extendTypes,
- ModuleDescriptor parent) {
+ protected void mergeWithOtherModuleDescriptor(List extendTypes, ModuleDescriptor parent) {
super.mergeWithOtherModuleDescriptor(extendTypes, parent);
if (parent.getParser() instanceof DefaultEasyAntXmlModuleDescriptorParser) {
DefaultEasyAntXmlModuleDescriptorParser parser = (DefaultEasyAntXmlModuleDescriptorParser) parent
@@ -559,13 +489,11 @@ public class DefaultEasyAntXmlModuleDesc
if (extendTypes.contains("properties")) {
- mergeEasyantProperties(parser.getEasyAntModuleDescriptor()
- .getProperties());
+ mergeEasyantProperties(parser.getEasyAntModuleDescriptor().getProperties());
}
if (extendTypes.contains("plugins")) {
- mergeEasyantPlugins(parser.getEasyAntModuleDescriptor()
- .getPlugins());
+ mergeEasyantPlugins(parser.getEasyAntModuleDescriptor().getPlugins());
}
}
@@ -582,14 +510,12 @@ public class DefaultEasyAntXmlModuleDesc
PluginDescriptor plugin = (PluginDescriptor) iterator.next();
if (plugin.isInheritable()
- && BuildConfigurationHelper.contains(plugin
- .getBuildConfigurations(),
- activeBuildConfigurations)) {
+ && BuildConfigurationHelper
+ .contains(plugin.getBuildConfigurations(), activeBuildConfigurations)) {
StringBuilder sb = new StringBuilder("Merging plugin : ");
sb.append(plugin.toString());
if (plugin.getSourceModule() != null) {
- sb.append(" from ").append(
- plugin.getSourceModule().toString());
+ sb.append(" from ").append(plugin.getSourceModule().toString());
}
Message.debug(sb.toString());
@@ -604,27 +530,20 @@ public class DefaultEasyAntXmlModuleDesc
* @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();) {
+ protected void mergeEasyantProperties(Map<String, PropertyDescriptor> properties) {
+ for (Iterator<PropertyDescriptor> iterator = properties.values().iterator(); iterator.hasNext();) {
PropertyDescriptor prop = iterator.next();
if (prop.isInheritable()
- && BuildConfigurationHelper.contains(prop
- .getBuildConfigurations(),
- activeBuildConfigurations)) {
- IvyContext.getContext().getSettings()
- .getVariableContainer().setVariable(prop.getName(),
- prop.getValue(), true);
+ && BuildConfigurationHelper.contains(prop.getBuildConfigurations(), activeBuildConfigurations)) {
+ 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());
+ sb.append(" from ").append(prop.getSourceModule().toString());
}
Message.debug(sb.toString());
- easyAntModuleDescriptor.getProperties().put(prop.getName(),
- prop);
+ easyAntModuleDescriptor.getProperties().put(prop.getName(), prop);
}
}
}
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java?rev=1360879&r1=1360878&r2=1360879&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/parser/EasyAntConfigParser.java Thu Jul 12 19:36:44 2012
@@ -51,12 +51,11 @@ public class EasyAntConfigParser {
}
public URL getEasyAntConfigSchema() {
- return getClass().getResource(
- "/org/apache/easyant/core/easyant-config.xsd");
+ return getClass().getResource("/org/apache/easyant/core/easyant-config.xsd");
}
- public EasyAntConfiguration parseAndMerge(final URL configUrl,
- final EasyAntConfiguration easyAntConfiguration) throws Exception {
+ public EasyAntConfiguration parseAndMerge(final URL configUrl, final EasyAntConfiguration easyAntConfiguration)
+ throws Exception {
ConfigParser parser = new ConfigParser();
URL schemaURL = null;
@@ -70,9 +69,7 @@ public class EasyAntConfigParser {
XMLHelper.parse(configUrl, schemaURL, parser, null);
parser.checkErrors();
} catch (ParserConfigurationException ex) {
- IllegalStateException ise = new IllegalStateException(ex
- .getMessage()
- + " in " + configUrl);
+ IllegalStateException ise = new IllegalStateException(ex.getMessage() + " in " + configUrl);
ise.initCause(ex);
throw ise;
@@ -89,7 +86,7 @@ public class EasyAntConfigParser {
}
public static class ConfigParser extends ContextualSAXHandler {
- private List errors = new ArrayList();
+ private List<String> errors = new ArrayList<String>();
private URL configUrl;
private EasyAntConfiguration easyAntConfiguration;
@@ -105,8 +102,7 @@ public class EasyAntConfigParser {
return easyAntConfiguration;
}
- public void setEasyAntConfiguration(
- EasyAntConfiguration easyAntConfiguration) {
+ public void setEasyAntConfiguration(EasyAntConfiguration easyAntConfiguration) {
this.easyAntConfiguration = easyAntConfiguration;
}
@@ -147,63 +143,49 @@ public class EasyAntConfigParser {
}
public void warning(SAXParseException ex) {
- Message.warn("xml parsing: " + getLocationString(ex) + ": "
- + ex.getMessage());
+ Message.warn("xml parsing: " + getLocationString(ex) + ": " + ex.getMessage());
}
public void error(SAXParseException ex) {
- addError("xml parsing: " + getLocationString(ex) + ": "
- + ex.getMessage());
+ addError("xml parsing: " + getLocationString(ex) + ": " + ex.getMessage());
}
public void fatalError(SAXParseException ex) throws SAXException {
- addError("[Fatal Error] " + getLocationString(ex) + ": "
- + ex.getMessage());
+ addError("[Fatal Error] " + getLocationString(ex) + ": " + ex.getMessage());
}
- public void startElement(String uri, String localName, String name,
- Attributes attributes) throws SAXException {
+ public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
super.startElement(uri, localName, name, attributes);
if ("easyant-config/ivysettings".equals(getContext())) {
- if (attributes.getValue("url") != null
- && !attributes.getValue("url").equals("")) {
- easyAntConfiguration.setEasyantIvySettingsUrl(attributes
- .getValue("url"));
+ if (attributes.getValue("url") != null && !attributes.getValue("url").equals("")) {
+ easyAntConfiguration.setEasyantIvySettingsUrl(attributes.getValue("url"));
}
- if (attributes.getValue("file") != null
- && !attributes.getValue("file").equals("")) {
- easyAntConfiguration.setEasyantIvySettingsFile(attributes
- .getValue("file"));
+ if (attributes.getValue("file") != null && !attributes.getValue("file").equals("")) {
+ easyAntConfiguration.setEasyantIvySettingsFile(attributes.getValue("file"));
}
}
if ("easyant-config/system-plugins/plugin".equals(getContext())) {
PluginDescriptor pluginDescriptor = new PluginDescriptor();
- String org = attributes.getValue("org") != null ? attributes
- .getValue("org") : attributes.getValue("organisation");
+ String org = attributes.getValue("org") != null ? attributes.getValue("org") : attributes
+ .getValue("organisation");
pluginDescriptor.setOrganisation(org);
pluginDescriptor.setModule(attributes.getValue("module"));
- String rev = attributes.getValue("rev") != null ? attributes
- .getValue("rev") : attributes.getValue("revision");
+ String rev = attributes.getValue("rev") != null ? attributes.getValue("rev") : attributes
+ .getValue("revision");
pluginDescriptor.setRevision(rev);
pluginDescriptor.setMrid(attributes.getValue("mrid"));
pluginDescriptor.setAs(attributes.getValue("as"));
boolean mandatory = false;
- if (attributes.getValue("mandatory") != null
- && attributes.getValue("mandatory").equals("true"))
+ if (attributes.getValue("mandatory") != null && attributes.getValue("mandatory").equals("true"))
mandatory = true;
;
pluginDescriptor.setMandatory(mandatory);
- String mode = attributes.getValue("mode");
- if (mode != null) {
- pluginDescriptor.setMode(mode);
- } else
- pluginDescriptor.setMode("include");
+ pluginDescriptor.setMode(attributes.getValue("mode"));
easyAntConfiguration.addSystemPlugin(pluginDescriptor);
}
if ("easyant-config/properties/property".equals(getContext())) {
- if (attributes.getValue("file") != null
- || attributes.getValue("url") != null) {
+ if (attributes.getValue("file") != null || attributes.getValue("url") != null) {
Properties properties = new Properties();
try {
@@ -219,28 +201,21 @@ public class EasyAntConfigParser {
properties.load(is);
is.close();
}
- for (Iterator iterator = properties.keySet().iterator(); iterator
- .hasNext();) {
+ for (Iterator iterator = properties.keySet().iterator(); iterator.hasNext();) {
String key = (String) iterator.next();
- easyAntConfiguration.getDefinedProps().put(key,
- properties.get(key));
+ easyAntConfiguration.getDefinedProps().put(key, properties.get(key));
}
} catch (Exception e) {
if (attributes.getValue("file") != null) {
- throw new SAXException(
- "can't read property file at : "
- + attributes.getValue("file"));
+ throw new SAXException("can't read property file at : " + attributes.getValue("file"));
} else if (attributes.getValue("url") != null) {
- throw new SAXException(
- "can't read property file at : "
- + attributes.getValue("url"));
+ throw new SAXException("can't read property file at : " + attributes.getValue("url"));
}
}
} else if (attributes.getValue("name") != null) {
- easyAntConfiguration.getDefinedProps().put(
- attributes.getValue("name"),
+ easyAntConfiguration.getDefinedProps().put(attributes.getValue("name"),
attributes.getValue("value"));
}
Modified: incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml?rev=1360879&r1=1360878&r2=1360879&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml (original)
+++ incubator/easyant/core/trunk/src/main/resources/org/apache/easyant/antlib.xml Thu Jul 12 19:36:44 2012
@@ -51,6 +51,6 @@
</presetdef>
<presetdef name="plugin">
- <current:import mode="include" organisation="org.apache.easyant.plugins"/>
+ <current:import organisation="org.apache.easyant.plugins"/>
</presetdef>
</antlib>