incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1071697 [20/42] - in /incubator/easyant: buildtypes/ buildtypes/trunk/ buildtypes/trunk/build-osgi-bundle-java/ buildtypes/trunk/build-osgi-bundle-java/src/ buildtypes/trunk/build-osgi-bundle-java/src/main/ buildtypes/trunk/build-osgi-bund...
Date Thu, 17 Feb 2011 17:01:56 GMT
Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,586 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+
+package org.apache.easyant.core.report;
+
+import java.io.BufferedWriter;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.easyant.core.descriptor.PropertyDescriptor;
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.ArtifactOrigin;
+import org.apache.ivy.core.module.descriptor.License;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleId;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.report.ConfigurationResolveReport;
+import org.apache.ivy.core.report.MetadataArtifactDownloadReport;
+import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.core.resolve.IvyNodeCallers.Caller;
+import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.StringUtils;
+import org.apache.ivy.util.XMLHelper;
+
+/**
+ * XmlReportWriter allows to write ResolveReport in an xml format.
+ */
+public class XMLEasyAntReportWriter {
+
+	static final String REPORT_ENCODING = "UTF-8";
+	private boolean displaySubProperties;
+
+	public void output(ConfigurationResolveReport report, OutputStream stream,
+			EasyAntReport easyAntReport) {
+		output(report, new String[] { report.getConfiguration() }, stream,
+				easyAntReport);
+	}
+
+	public void output(ConfigurationResolveReport report, String[] confs,
+			OutputStream stream, EasyAntReport easyAntReport) {
+		OutputStreamWriter encodedOutStream;
+		try {
+			encodedOutStream = new OutputStreamWriter(stream, REPORT_ENCODING);
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException(REPORT_ENCODING
+					+ " is not known on your jvm", e);
+		}
+		PrintWriter out = new PrintWriter(new BufferedWriter(encodedOutStream));
+		ModuleRevisionId mrid = report.getModuleDescriptor()
+				.getModuleRevisionId();
+		// out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
+		out.println("<?xml version=\"1.0\" encoding=\"" + REPORT_ENCODING
+				+ "\"?>");
+		out
+				.println("<?xml-stylesheet type=\"text/xsl\" href=\"easyant-report.xsl\"?>");
+		out.println("<ivy-report version=\"1.0\">");
+		out.println("\t<info");
+		out.println("\t\torganisation=\""
+				+ XMLHelper.escape(mrid.getOrganisation()) + "\"");
+		out.println("\t\tmodule=\"" + XMLHelper.escape(mrid.getName()) + "\"");
+		out.println("\t\trevision=\"" + XMLHelper.escape(mrid.getRevision())
+				+ "\"");
+		if (mrid.getBranch() != null) {
+			out.println("\t\tbranch=\"" + XMLHelper.escape(mrid.getBranch())
+					+ "\"");
+		}
+		Map extraAttributes = mrid.getExtraAttributes();
+		for (Iterator it = extraAttributes.entrySet().iterator(); it.hasNext();) {
+			Map.Entry entry = (Entry) it.next();
+			out.println("\t\textra-" + entry.getKey() + "=\""
+					+ XMLHelper.escape(entry.getValue().toString()) + "\"");
+		}
+		out.println("\t\tconf=\"" + XMLHelper.escape(report.getConfiguration())
+				+ "\"");
+		out.println("\t\tconfs=\""
+				+ XMLHelper.escape(StringUtils.join(confs, ", ")) + "\"");
+		out.println("\t\tdate=\"" + Ivy.DATE_FORMAT.format(report.getDate())
+				+ "\"/>");
+
+		out.println("\t<dependencies>");
+
+		// create a list of ModuleRevisionIds indicating the position for each
+		// dependency
+		List dependencies = new ArrayList(report.getModuleRevisionIds());
+
+		for (Iterator iter = report.getModuleIds().iterator(); iter.hasNext();) {
+			ModuleId mid = (ModuleId) iter.next();
+			out.println("\t\t<module organisation=\""
+					+ XMLHelper.escape(mid.getOrganisation()) + "\""
+					+ " name=\"" + XMLHelper.escape(mid.getName()) + "\" >");
+			for (Iterator it2 = report.getNodes(mid).iterator(); it2.hasNext();) {
+				IvyNode dep = (IvyNode) it2.next();
+				ouputRevision(report, out, dependencies, dep, easyAntReport);
+			}
+			out.println("\t\t</module>");
+		}
+		out.println("\t</dependencies>");
+		out.println("</ivy-report>");
+		out.flush();
+	}
+
+	private void ouputRevision(ConfigurationResolveReport report,
+			PrintWriter out, List dependencies, IvyNode dep,
+			EasyAntReport easyAntReport) {
+		Map extraAttributes;
+		ModuleDescriptor md = null;
+		if (dep.getModuleRevision() != null) {
+			md = dep.getModuleRevision().getDescriptor();
+		}
+		StringBuffer details = new StringBuffer();
+		if (dep.isLoaded()) {
+			details.append(" status=\"");
+			details.append(XMLHelper.escape(dep.getDescriptor().getStatus()));
+			details.append("\" pubdate=\"");
+			details.append(Ivy.DATE_FORMAT
+					.format(new Date(dep.getPublication())));
+			details.append("\" resolver=\"");
+			details.append(XMLHelper.escape(dep.getModuleRevision()
+					.getResolver().getName()));
+			details.append("\" artresolver=\"");
+			details.append(XMLHelper.escape(dep.getModuleRevision()
+					.getArtifactResolver().getName()));
+			details.append("\"");
+		}
+		if (dep.isEvicted(report.getConfiguration())) {
+			EvictionData ed = dep.getEvictedData(report.getConfiguration());
+			if (ed.getConflictManager() != null) {
+				details.append(" evicted=\"").append(
+						XMLHelper.escape(ed.getConflictManager().toString()))
+						.append("\"");
+			} else {
+				details.append(" evicted=\"transitive\"");
+			}
+			details.append(" evicted-reason=\"").append(
+					XMLHelper.escape(ed.getDetail() == null ? "" : ed
+							.getDetail())).append("\"");
+		}
+		if (dep.hasProblem()) {
+			details.append(" error=\"").append(
+					XMLHelper.escape(dep.getProblem().getMessage())).append(
+					"\"");
+		}
+		if (md != null && md.getHomePage() != null) {
+			details.append(" homepage=\"").append(
+					XMLHelper.escape(md.getHomePage())).append("\"");
+		}
+		extraAttributes = md != null ? md.getExtraAttributes() : dep
+				.getResolvedId().getExtraAttributes();
+		for (Iterator iterator = extraAttributes.keySet().iterator(); iterator
+				.hasNext();) {
+			String attName = (String) iterator.next();
+			details.append(" extra-").append(attName).append("=\"").append(
+					XMLHelper.escape(extraAttributes.get(attName).toString()))
+					.append("\"");
+		}
+		String defaultValue = dep.getDescriptor() != null ? " default=\""
+				+ dep.getDescriptor().isDefault() + "\"" : "";
+		int position = dependencies.indexOf(dep.getResolvedId());
+		out.println("\t\t\t<revision name=\""
+				+ XMLHelper.escape(dep.getResolvedId().getRevision())
+				+ "\""
+				+ (dep.getResolvedId().getBranch() == null ? "" : " branch=\""
+						+ XMLHelper.escape(dep.getResolvedId().getBranch())
+						+ "\"") + details + " downloaded=\""
+				+ dep.isDownloaded() + "\"" + " searched=\"" + dep.isSearched()
+				+ "\"" + defaultValue + " conf=\""
+				+ toString(dep.getConfigurations(report.getConfiguration()))
+				+ "\"" + " position=\"" + position + "\">");
+		if (md != null) {
+			License[] licenses = md.getLicenses();
+			for (int i = 0; i < licenses.length; i++) {
+				String lurl;
+				if (licenses[i].getUrl() != null) {
+					lurl = " url=\"" + XMLHelper.escape(licenses[i].getUrl())
+							+ "\"";
+				} else {
+					lurl = "";
+				}
+				out.println("\t\t\t\t<license name=\""
+						+ XMLHelper.escape(licenses[i].getName()) + "\"" + lurl
+						+ "/>");
+			}
+		}
+		if (md != null && md.getDescription() != null) {
+			out.println("\t\t\t\t<description>" + md.getDescription()
+					+ "\t\t\t\t</description>");
+		}
+		outputMetadataArtifact(out, dep);
+		outputEvictionInformation(report, out, dep);
+		outputCallers(report, out, dep);
+		outputArtifacts(report, out, dep);
+		outputEasyAntModuleInfos(report, out, dep, easyAntReport);
+		out.println("\t\t\t</revision>");
+	}
+
+	private void outputEasyAntModuleInfos(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep, EasyAntReport easyAntReport) {
+		out.println("\t\t\t\t<easyant>");
+		// targets
+		outputTargets(report, out, dep, easyAntReport);
+		outputPhases(report, out, dep, easyAntReport);
+		outputImportedModules(report, out, dep, easyAntReport);
+		outputParameters(report, out, dep, easyAntReport);
+		outputProperties(report, out, dep, easyAntReport);
+		out.println("\t\t\t\t</easyant>");
+
+	}
+	private void outputProperties(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep, EasyAntReport easyAntReport) {
+		out.println("\t\t\t\t\t<properties>");
+		Map<String, PropertyDescriptor> properties;
+		if (displaySubProperties)  {
+			properties = easyAntReport.getAvailableProperties();
+		} else {
+			properties = easyAntReport.getPropertyDescriptors();
+		}
+			
+		for (Entry<String, PropertyDescriptor> entry : properties.entrySet()) {
+			PropertyDescriptor propertyDescriptor = entry.getValue();
+			
+			StringBuffer param= new StringBuffer();
+			param.append("\t\t\t\t\t\t<property name=\"");
+			param.append(propertyDescriptor.getName());
+			param.append("\"");
+			if (propertyDescriptor.getDescription() != null) {
+				param.append(" description=\"");
+				param.append(propertyDescriptor.getDescription());
+				param.append("\"");
+			}
+			param.append(" required=\"");
+			param.append(propertyDescriptor.isRequired());
+			param.append("\"");
+			if (propertyDescriptor.getDefaultValue() != null) {
+				param.append(" default=\"");
+				param.append(propertyDescriptor.getDefaultValue());
+				param.append("\"");
+			}
+			if (propertyDescriptor.getValue() != null ) {
+				param.append(" value=\"");
+				param.append(propertyDescriptor.getValue());
+				param.append("\"");
+			}
+			param.append("/>");
+			out.println(param.toString());
+
+		}
+		out.println("\t\t\t\t\t</properties>");
+	}
+
+	private void outputParameters(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep, EasyAntReport easyAntReport) {
+		out.println("\t\t\t\t\t<parameters>");
+		for (ParameterReport paramReport : easyAntReport.getParameterReports()) {
+			StringBuffer param = new StringBuffer();
+
+			if (ParameterType.PHASE.equals(paramReport.getType())) {
+				param.append("\t\t\t\t\t\t<phase name=\"");
+				param.append(paramReport.getName());
+				param.append("\"");
+				if (paramReport.getDescription() != null) {
+					param.append(" description=\"");
+					param.append(paramReport.getDescription());
+					param.append("\"");
+				}
+				param.append("/>");
+			} else if (ParameterType.PATH.equals(paramReport.getType())) {
+				param.append("\t\t\t\t\t\t<path name=\"");
+				param.append(paramReport.getName());
+				param.append("\"");
+				if (paramReport.getDescription() != null) {
+					param.append(" description=\"");
+					param.append(paramReport.getDescription());
+					param.append("\"");
+				}
+				if (paramReport.isRequired()) {
+					param.append(" required=\"");
+					param.append(paramReport.isRequired());
+					param.append("\"");
+				}
+				param.append("/>");
+			}
+			out.println(param);
+		}
+
+		out.println("\t\t\t\t\t</parameters>");
+	}
+
+	private void outputImportedModules(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep, EasyAntReport easyAntReport) {
+		out.println("\t\t\t\t\t<imports>");
+		for (ImportedModuleReport importedModuleReport : easyAntReport.getImportedModuleReports()) {
+			StringBuffer importedModule = new StringBuffer();
+			try {
+				ModuleRevisionId mrid = ModuleRevisionId
+						.parse(importedModuleReport.getModuleMrid());
+				importedModule.append("\t\t\t\t\t\t<import organisation=\"")
+						.append(mrid.getOrganisation()).append("\" name=\"")
+						.append(mrid.getName()).append("\" revision=\"")
+						.append(mrid.getRevision()).append("\" type=\"")
+						.append(importedModuleReport.getType()).append("\"");
+
+			} catch (IllegalArgumentException e) {
+				Message.debug("Unable to parse "
+						+ importedModuleReport.getModuleMrid());
+				importedModule.append("\t\t\t\t\t\t<import organisation=\"")
+						.append(importedModuleReport.getModuleMrid()).append(
+								"\" name=\"").append("null").append(
+								"\" revision=\"").append("null").append(
+								"\" type=\"").append(
+								importedModuleReport.getType()).append("\"");
+
+			}
+			importedModule.append(" mandatory=\"");
+			importedModule.append(importedModuleReport.isMandatory());
+			importedModule.append("\"");
+			if (importedModuleReport.getAs() != null) {
+				importedModule.append(" as=\"");
+				importedModule.append(importedModuleReport.getAs());
+				importedModule.append("\"");
+			}
+			importedModule.append(">");
+			out.println(importedModule.toString());
+			if (importedModuleReport.getEasyantReport() != null) {
+				outputEasyAntModuleInfos(report, out, dep, importedModuleReport
+						.getEasyantReport());
+			}
+			out.println("\t\t\t\t\t\t</import>");
+
+		}
+		out.println("\t\t\t\t\t</imports>");
+
+	}
+
+	private void outputPhases(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep, EasyAntReport easyAntReport) {
+		out.println("\t\t\t\t\t<phases>");
+		for (PhaseReport phaseReport : easyAntReport.getPhaseReports()) {
+			StringBuffer phase = new StringBuffer();
+			phase.append("\t\t\t\t\t\t<phase name=\"").append(
+					phaseReport.getName()).append("\"");
+			if (phaseReport.getDescription() != null) {
+				phase.append(" description=\"");
+				phase.append(phaseReport.getDescription());
+				phase.append("\"");
+			}
+			if (phaseReport.getDepends() != null) {
+				phase.append(" depends=\"");
+				phase.append(phaseReport.getDepends());
+				phase.append("\"");
+			}
+			phase.append("/>");
+			out.println(phase.toString());
+		}
+		out.println("\t\t\t\t\t</phases>");
+	}
+
+	private void outputTargets(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep, EasyAntReport easyAntReport) {
+		out.println("\t\t\t\t\t<targets>");
+		for (TargetReport targetReport : easyAntReport.getTargetReports()) {
+			StringBuffer target = new StringBuffer();
+			target.append("\t\t\t\t\t\t<target name=\"").append(
+					targetReport.getName()).append("\"");
+			if (targetReport.getDescription() != null) {
+				target.append(" description=\"");
+				target.append(targetReport.getDescription());
+				target.append("\"");
+			}
+			if (targetReport.getDepends() != null) {
+				target.append(" depends=\"");
+				target.append(targetReport.getDepends());
+				target.append("\"");
+			}
+			if (targetReport.getIfCase() != null) {
+				target.append(" if=\"");
+				target.append(targetReport.getIfCase());
+				target.append("\"");
+			}
+			if (targetReport.getPhase() != null) {
+				target.append(" phase=\"");
+				target.append(targetReport.getPhase());
+				target.append("\"");
+			}
+			if (targetReport.getUnlessCase() != null) {
+				target.append(" unless=\"");
+				target.append(targetReport.getUnlessCase());
+				target.append("\"");
+			}
+			target.append("/>");
+			out.println(target.toString());
+		}
+		out.println("\t\t\t\t\t</targets>");
+	}
+
+	private void outputEvictionInformation(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep) {
+		if (dep.isEvicted(report.getConfiguration())) {
+			EvictionData ed = dep.getEvictedData(report.getConfiguration());
+			Collection selected = ed.getSelected();
+			if (selected != null) {
+				for (Iterator it3 = selected.iterator(); it3.hasNext();) {
+					IvyNode sel = (IvyNode) it3.next();
+					out.println("\t\t\t\t<evicted-by rev=\""
+							+ XMLHelper.escape(sel.getResolvedId()
+									.getRevision()) + "\"/>");
+				}
+			}
+		}
+	}
+
+	private void outputMetadataArtifact(PrintWriter out, IvyNode dep) {
+		if (dep.getModuleRevision() != null) {
+			MetadataArtifactDownloadReport madr = dep.getModuleRevision()
+					.getReport();
+			out.print("\t\t\t\t<metadata-artifact");
+			out.print(" status=\""
+					+ XMLHelper.escape(madr.getDownloadStatus().toString())
+					+ "\"");
+			out.print(" details=\""
+					+ XMLHelper.escape(madr.getDownloadDetails()) + "\"");
+			out.print(" size=\"" + madr.getSize() + "\"");
+			out.print(" time=\"" + madr.getDownloadTimeMillis() + "\"");
+			if (madr.getLocalFile() != null) {
+				out.print(" location=\""
+						+ XMLHelper.escape(madr.getLocalFile()
+								.getAbsolutePath()) + "\"");
+			}
+
+			out.print(" searched=\"" + madr.isSearched() + "\"");
+			if (madr.getOriginalLocalFile() != null) {
+				out.print(" original-local-location=\""
+						+ XMLHelper.escape(madr.getOriginalLocalFile()
+								.getAbsolutePath()) + "\"");
+			}
+
+			ArtifactOrigin origin = madr.getArtifactOrigin();
+			if (origin != null) {
+				out.print(" origin-is-local=\""
+						+ String.valueOf(origin.isLocal()) + "\"");
+				out.print(" origin-location=\""
+						+ XMLHelper.escape(origin.getLocation()) + "\"");
+			}
+			out.println("/>");
+
+		}
+	}
+
+	private void outputCallers(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep) {
+		Caller[] callers = dep.getCallers(report.getConfiguration());
+		for (int i = 0; i < callers.length; i++) {
+			StringBuffer callerDetails = new StringBuffer();
+			Map callerExtraAttributes = callers[i].getDependencyDescriptor()
+					.getExtraAttributes();
+			for (Iterator iterator = callerExtraAttributes.keySet().iterator(); iterator
+					.hasNext();) {
+				String attName = (String) iterator.next();
+				callerDetails.append(" extra-").append(attName).append("=\"")
+						.append(
+								XMLHelper.escape(callerExtraAttributes.get(
+										attName).toString())).append("\"");
+			}
+
+			out.println("\t\t\t\t<caller organisation=\""
+					+ XMLHelper.escape(callers[i].getModuleRevisionId()
+							.getOrganisation())
+					+ "\""
+					+ " name=\""
+					+ XMLHelper.escape(callers[i].getModuleRevisionId()
+							.getName())
+					+ "\""
+					+ " conf=\""
+					+ XMLHelper.escape(toString(callers[i]
+							.getCallerConfigurations()))
+					+ "\""
+					+ " rev=\""
+					+ XMLHelper.escape(callers[i].getAskedDependencyId(
+							dep.getData()).getRevision())
+					+ "\""
+					+ " rev-constraint-default=\""
+					+ XMLHelper.escape(callers[i].getDependencyDescriptor()
+							.getDependencyRevisionId().getRevision())
+					+ "\""
+					+ " rev-constraint-dynamic=\""
+					+ XMLHelper.escape(callers[i].getDependencyDescriptor()
+							.getDynamicConstraintDependencyRevisionId()
+							.getRevision())
+					+ "\""
+					+ " callerrev=\""
+					+ XMLHelper.escape(callers[i].getModuleRevisionId()
+							.getRevision()) + "\"" + callerDetails + "/>");
+		}
+	}
+
+	private void outputArtifacts(ConfigurationResolveReport report,
+			PrintWriter out, IvyNode dep) {
+		Map extraAttributes;
+		ArtifactDownloadReport[] adr = report.getDownloadReports(dep
+				.getResolvedId());
+		out.println("\t\t\t\t<artifacts>");
+		for (int i = 0; i < adr.length; i++) {
+			out.print("\t\t\t\t\t<artifact name=\""
+					+ XMLHelper.escape(adr[i].getName()) + "\" type=\""
+					+ XMLHelper.escape(adr[i].getType()) + "\" ext=\""
+					+ XMLHelper.escape(adr[i].getExt()) + "\"");
+			extraAttributes = adr[i].getArtifact().getExtraAttributes();
+			for (Iterator iterator = extraAttributes.keySet().iterator(); iterator
+					.hasNext();) {
+				String attName = (String) iterator.next();
+				out.print(" extra-"
+						+ attName
+						+ "=\""
+						+ XMLHelper.escape(extraAttributes.get(attName)
+								.toString()) + "\"");
+			}
+			out.print(" status=\""
+					+ XMLHelper.escape(adr[i].getDownloadStatus().toString())
+					+ "\"");
+			out.print(" details=\""
+					+ XMLHelper.escape(adr[i].getDownloadDetails()) + "\"");
+			out.print(" size=\"" + adr[i].getSize() + "\"");
+			out.print(" time=\"" + adr[i].getDownloadTimeMillis() + "\"");
+			if (adr[i].getLocalFile() != null) {
+				out.print(" location=\""
+						+ XMLHelper.escape(adr[i].getLocalFile()
+								.getAbsolutePath()) + "\"");
+			}
+
+			ArtifactOrigin origin = adr[i].getArtifactOrigin();
+			if (origin != null) {
+				out.println(">");
+				out.println("\t\t\t\t\t\t<origin-location is-local=\""
+						+ String.valueOf(origin.isLocal()) + "\""
+						+ " location=\""
+						+ XMLHelper.escape(origin.getLocation()) + "\"/>");
+				out.println("\t\t\t\t\t</artifact>");
+			} else {
+				out.println("/>");
+			}
+		}
+		out.println("\t\t\t\t</artifacts>");
+	}
+
+	private String toString(String[] strs) {
+		StringBuffer buf = new StringBuffer();
+		for (int i = 0; i < strs.length; i++) {
+			buf.append(strs[i]);
+			if (i + 1 < strs.length) {
+				buf.append(", ");
+			}
+		}
+		return XMLHelper.escape(buf.toString());
+	}
+
+	public void setDisplaySubProperties(boolean displaySubProperties) {
+		this.displaySubProperties= displaySubProperties;
+		
+	}
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,87 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+
+package org.apache.easyant.core.report;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.ivy.core.cache.ResolutionCacheManager;
+import org.apache.ivy.core.report.ConfigurationResolveReport;
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.plugins.report.XmlReportWriter;
+import org.apache.ivy.util.FileUtil;
+import org.apache.ivy.util.Message;
+
+/**
+ * A Report outputter implementation using {@link XmlReportWriter} to write xml reports to the
+ * resolution cache.
+ */
+public class XmlEasyAntReportOutputter {
+	
+    public static final String CONSOLE = "console";
+
+    public static final String XML = "xml";
+
+    private XMLEasyAntReportWriter writer = new XMLEasyAntReportWriter();
+    
+    public String getName() {
+        return XML;
+    }
+
+    public void output(
+            ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options,EasyAntReport easyAntReport, boolean displaySubProperties) 
+            throws IOException {
+        String[] confs = report.getConfigurations();
+        for (int i = 0; i < confs.length; i++) {
+            output(report.getConfigurationReport(confs[i]), report.getResolveId(), confs, cacheMgr,easyAntReport,displaySubProperties);
+        }
+    }
+
+    public void output(ConfigurationResolveReport report, String resolveId, 
+            String[] confs, ResolutionCacheManager cacheMgr, EasyAntReport easyAntReport , boolean displaySubProperties) 
+            throws IOException {
+    	writer.setDisplaySubProperties(displaySubProperties);
+        File reportFile = cacheMgr.getConfigurationResolveReportInCache(
+            resolveId, report.getConfiguration());
+        File reportParentDir = reportFile.getParentFile();
+        reportParentDir.mkdirs();
+        OutputStream stream = new FileOutputStream(reportFile);
+        writer.output(report, confs, stream,easyAntReport);
+        stream.close();
+
+        Message.verbose("\treport for " + report.getModuleDescriptor().getModuleRevisionId()
+            + " " + report.getConfiguration() + " produced in " + reportFile);
+
+        File reportXsl = new File(reportParentDir, "ivy-report.xsl");
+        File reportCss = new File(reportParentDir, "ivy-report.css");
+        if (!reportXsl.exists()) {
+            FileUtil.copy(XmlEasyAntReportOutputter.class.getResource("ivy-report.xsl"), reportXsl,
+                null);
+        }
+        if (!reportCss.exists()) {
+            FileUtil.copy(XmlEasyAntReportOutputter.class.getResource("ivy-report.css"), reportCss,
+                null);
+        }
+    }
+}
+

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XmlEasyAntReportOutputter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,188 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.core.services;
+
+import java.io.File;
+
+import org.apache.easyant.core.descriptor.EasyAntModuleDescriptor;
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+
+public interface PluginService {
+
+	/**
+	 * Generate an easyantReport for a given moduleRevisionID
+	 * 
+	 * @param moduleRevisionId
+	 *            a given moduleRevisionID
+	 * @return an easyantReport an easyantReport
+	 * @throws Exception
+	 */
+	EasyAntReport getPluginInfo(ModuleRevisionId moduleRevisionId)
+			throws Exception;
+
+	/**
+	 * Generate an easyantReport for a given string representing a plugin
+	 * moduleRevisionID mrid should be with the following format :
+	 * organisation#moduleName;revision If no organisation is specified, this
+	 * method will use the default one, then you could use the shorter form like
+	 * myPlugin;0.1
+	 * 
+	 * @param moduleRevisionId
+	 *            a given moduleRevisionID
+	 * @return an easyantReport an easyantReport
+	 * @throws Exception
+	 */
+	EasyAntReport getPluginInfo(String moduleRevisionId) throws Exception;
+
+	/**
+	 * Generate an easyantReport for a given string representing a buildtype
+	 * moduleRevisionID mrid should be with the following format :
+	 * organisation#moduleName;revision If no organisation is specified, this
+	 * method will use the default one, then you could use the shorter form like
+	 * myPlugin;0.1
+	 * 
+	 * @param moduleRevisionId
+	 *            a given moduleRevisionID
+	 * @return an easyantReport an easyantReport
+	 * @throws Exception
+	 */
+	EasyAntReport getBuildTypeInfo(String moduleRevisionId) throws Exception;
+
+	/**
+	 * Generate an easyantReport for a given moduleRevisionID
+	 * 
+	 * @param moduleRevisionId
+	 *            a given moduleRevisionID
+	 * @param conf
+	 *            a configuration name
+	 * @return an easyantReport an easyantReport
+	 * @throws Exception
+	 */
+	EasyAntReport getPluginInfo(ModuleRevisionId moduleRevisionId, String conf)
+			throws Exception;
+
+	/**
+	 * Return an array of moduleRevisionId that match with given criteria.
+	 * Equivalent to {@link #search(String, String, String, String, String, String)
+	 *   search(organisation, moduleName, null, null, PatternMatcher.EXACT_OR_REGEXP, null)}
+	 * 
+	 * @param organisation
+	 *            the organisation name
+	 * @param moduleName
+	 *            the module name
+	 * @return an array of moduleRevisionId
+	 * @throws Exception
+	 * @see org.apache.ivy.plugins.matcher.PatternMatcher
+	 */
+	ModuleRevisionId[] search(String organisation, String moduleName)
+			throws Exception;
+
+	/**
+	 * Return an array of moduleRevisionId that match with given criteria.  Null values are unconstrained
+	 * (any value is matched).
+	 * 
+	 * @param organisation
+	 *            the organisation name as it appears in the module descriptor
+	 * @param moduleName
+	 *            the module name as it appears in the module descriptor
+	 * @param revision
+	 *            the revision as it appears in the module descriptor
+	 * @param branch
+	 *            the branch as it appears in the module descriptor
+	 * @param matcher
+	 *            an Ivy pattern matcher types, see {@link org.apache.ivy.plugins.matcher.PatternMatcher}
+     * @param resolver
+	 *            the name of the Ivy resolver.  null matches the default resolver; "*" searches all resolvers.
+	 * @return an array of matching moduleRevisionId
+	 * @throws Exception
+	 */
+	ModuleRevisionId[] search(String organisation, String moduleName,
+			String revision, String branch, String matcher, String resolver) throws Exception;
+
+	/**
+	 * Generate an easyantReport for a given moduleDescriptor. Using this report
+	 * you should have all properties / plugins / targets loaded in your module
+	 * descriptor
+	 * 
+	 * @param moduleDescriptor
+	 *            a file that represent the module descriptor
+	 * @return an easyantReport for a given moduleDescriptor
+	 * @throws Exception
+	 */
+	EasyAntReport generateEasyAntReport(File moduleDescriptor) throws Exception;
+
+	/**
+	 * Return the EasyAnt model containing all data of the module described in
+	 * given file.
+	 * 
+	 * @param moduleDescriptor
+	 *            a file that represent the module descriptor
+	 * @return an EasyAnt module descriptor
+	 * @throws Exception
+	 */
+	EasyAntModuleDescriptor getEasyAntModuleDescriptor(File moduleDescriptor)
+			throws Exception;
+
+	/**
+	 * Return an array of string representing the fully qualified named matching
+	 * with given criterias
+	 * 
+	 * @param organisation
+	 *            the organisation name
+	 * @param moduleName
+	 *            the module name
+	 * @return an array of moduleRevisionId
+	 * @throws Exception
+	 */
+	String[] searchModule(String organisation, String moduleName)
+			throws Exception;
+	
+	/**
+	 * Return the description of a module descriptor 
+	 * Useful for IDE's integration
+	 * @param mrid the module revision id to check
+	 * @return a string representing the description of the module descriptor
+	 */
+	String getDescription(ModuleRevisionId mrid);
+	
+	/**
+	 * Return the description of a module descriptor 
+	 * Useful for IDE's integration
+	 * The module revision id parameter should be with the following format 
+	 * organisation#moduleName;revision 
+	 * If no organisation is specified, this method will use the default one, 
+	 * then you could use the shorter form like myPlugin;0.1
+	 * @param moduleRevisionId a string representing a buildtype
+	 * @return a string representing the description of the module descriptor
+	 */
+	String getPluginDescription(String moduleRevisionId);
+	
+	/**
+	 * Return the description of a module descriptor 
+	 * Useful for IDE's integration
+	 * The module revision id parameter should be with the following format 
+	 * organisation#moduleName;revision 
+	 * If no organisation is specified, this method will use the default one, 
+	 * then you could use the shorter form like myBuildType;0.1
+	 * @param moduleRevisionId a string representing a buildtype 
+	 * @return a string representing the description of the module descriptor
+	 */
+	public String getBuildTypeDescription(String moduleRevisionId);
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/PluginService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,285 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+
+package org.apache.easyant.core.services.impl;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.apache.easyant.core.EasyAntConstants;
+import org.apache.easyant.core.descriptor.EasyAntModuleDescriptor;
+import org.apache.easyant.core.descriptor.PluginDescriptor;
+import org.apache.easyant.core.descriptor.PropertyDescriptor;
+import org.apache.easyant.core.parser.DefaultEasyAntXmlModuleDescriptorParser;
+import org.apache.easyant.core.parser.EasyAntModuleDescriptorParser;
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.report.EasyAntReportModuleParser;
+import org.apache.easyant.core.report.ImportedModuleReport;
+import org.apache.easyant.core.services.PluginService;
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.module.id.ModuleId;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.matcher.PatternMatcher;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
+import org.apache.ivy.plugins.repository.url.URLResource;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.util.Message;
+import org.xml.sax.SAXException;
+
+public class DefaultPluginServiceImpl implements PluginService {
+
+	private final EasyAntModuleDescriptorParser parser;
+
+	private final Ivy ivyInstance;
+
+	/**
+	 * This is the default constructor, the IvyContext should be the IvyContext
+	 * configured to the easyant ivy instance
+	 * @param ivyInstance the easyant ivy instance
+	 */
+	public DefaultPluginServiceImpl(final Ivy ivyInstance) {
+		this(ivyInstance, new DefaultEasyAntXmlModuleDescriptorParser());
+	}
+
+	/**
+	 * A custom constructor if you want to specify your own parser /
+	 * configuration service, you should use this constructor
+	 * the IvyContext should be the IvyContext
+	 * configured to the easyant ivy instance
+	 * @param ivyInstance the easyant ivy instance
+	 * @param parser
+	 *            a valid easyantModuleDescriptor
+	 */
+	public DefaultPluginServiceImpl(final Ivy ivyInstance,
+			EasyAntModuleDescriptorParser parser) {
+		this.ivyInstance = ivyInstance;
+		if (parser == null) {
+			throw new IllegalArgumentException(
+					"You must set a valid easyant module descriptor parser");
+		}
+		this.parser = parser;
+		ModuleDescriptorParserRegistry.getInstance().addParser(parser);
+	}
+
+	public EasyAntReport getPluginInfo(ModuleRevisionId moduleRevisionId,
+			String conf) throws Exception {
+		try {
+			
+			IvyContext.pushNewContext().setIvy(ivyInstance);
+			EasyAntReport eaReport = EasyAntReportModuleParser.parseEasyAntModule(
+					moduleRevisionId, conf);
+			
+			IvyContext.popContext();
+			return eaReport;
+		} catch (SAXException e) {
+			throw new Exception("Impossible to parse " + moduleRevisionId, e);
+		}
+	}
+
+	public EasyAntReport getPluginInfo(ModuleRevisionId moduleRevisionId)
+			throws Exception {
+		return getPluginInfo(moduleRevisionId, "default");
+	}
+
+	public EasyAntReport getPluginInfo(String moduleRevisionId)
+			throws Exception {
+		String mrid = moduleRevisionId;
+		if (!mrid.matches(".*#.*")) {
+			Message.debug("No organisation specified for plugin " + mrid
+					+ " using the default one");
+			mrid = EasyAntConstants.EASYANT_PLUGIN_ORGANISATION + "#" + mrid;
+		}
+		ModuleRevisionId module = ModuleRevisionId.parse(mrid);
+		return getPluginInfo(module);
+	}
+
+	public EasyAntReport getBuildTypeInfo(String moduleRevisionId)
+			throws Exception {
+		String mrid = moduleRevisionId;
+		if (!mrid.matches(".*#.*")) {
+			Message.debug("No organisation specified for buildtype " + mrid
+					+ " using the default one");
+			mrid = EasyAntConstants.EASYANT_BUILDTYPES_ORGANISATION + "#"
+					+ mrid;
+		}
+		ModuleRevisionId module = ModuleRevisionId.parse(mrid);
+		return getPluginInfo(module);
+	}
+
+	public EasyAntModuleDescriptor getEasyAntModuleDescriptor(
+			File moduleDescriptor) throws Exception {
+		if (moduleDescriptor == null)
+			throw new Exception("moduleDescriptor cannot be null");
+		if (!moduleDescriptor.exists()) {
+			throw new Exception(
+					"imposible to find the specified module descriptor"
+							+ moduleDescriptor.getAbsolutePath());
+		}
+		IvyContext.pushNewContext().setIvy(ivyInstance);
+		// First we need to parse the specified file to retrieve all the easyant
+		// stuff
+		parser.parseDescriptor(ivyInstance.getSettings(),
+				moduleDescriptor.toURL(), new URLResource(moduleDescriptor
+						.toURL()), true);
+		EasyAntModuleDescriptor md = parser.getEasyAntModuleDescriptor();
+		IvyContext.popContext();
+		return md;
+	}
+
+	public EasyAntReport generateEasyAntReport(File moduleDescriptor)
+			throws Exception {
+		EasyAntReport eaReport = new EasyAntReport();
+		try {
+			EasyAntModuleDescriptor md = getEasyAntModuleDescriptor(moduleDescriptor);
+
+			// Then we can Store properties
+			for (Iterator<PropertyDescriptor> iterator = md.getProperties()
+					.values().iterator(); iterator.hasNext();) {
+				PropertyDescriptor property = iterator.next();
+				eaReport.addPropertyDescriptor(property.getName(), property);
+			}
+
+			// Store infos on the buildtype
+			if (md.getBuildType() != null) {
+				ImportedModuleReport buildType = new ImportedModuleReport();
+				buildType.setModuleMrid(md.getBuildType());
+				buildType.setEasyantReport(getPluginInfo(ModuleRevisionId
+						.parse(md.getBuildType())));
+				eaReport.addImportedModuleReport(buildType);
+				// Store infos on plugins
+				for (Iterator iterator = md.getPlugins().iterator(); iterator
+						.hasNext();) {
+					PluginDescriptor plugin = (PluginDescriptor) iterator
+							.next();
+					ImportedModuleReport pluginReport = new ImportedModuleReport();
+					pluginReport.setModuleMrid(plugin.getMrid());
+					pluginReport.setAs(plugin.getAs());
+					pluginReport.setType(plugin.getMode());
+					pluginReport
+							.setEasyantReport(getPluginInfo(ModuleRevisionId
+									.parse(plugin.getMrid())));
+					eaReport.addImportedModuleReport(pluginReport);
+				}
+			}
+
+		} catch (Exception e) {
+			throw new Exception("problem while parsing Ivy module file: "
+					+ e.getMessage(), e);
+		}
+		return eaReport;
+	}
+
+	public ModuleRevisionId[] search(String organisation, String moduleName,
+			String revision, String branch, String matcher, String resolver) throws Exception {
+		IvySettings settings = ivyInstance.getSettings();
+
+		if (moduleName == null && PatternMatcher.EXACT.equals(matcher)) {
+			throw new Exception(
+					"no module name provided for ivy repository graph task: "
+							+ "It can either be set explicitely via the attribute 'module' or "
+							+ "via 'ivy.module' property or a prior call to <resolve/>");
+		} else if (moduleName == null && !PatternMatcher.EXACT.equals(matcher)) {
+			moduleName = PatternMatcher.ANY_EXPRESSION;
+		}
+		ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation,
+				moduleName, revision);
+
+		ModuleRevisionId criteria = null;
+
+		if ((revision == null) || settings.getVersionMatcher().isDynamic(mrid)) {
+			criteria = new ModuleRevisionId(new ModuleId(organisation,
+					moduleName), branch, "*");
+		} else {
+			criteria = new ModuleRevisionId(new ModuleId(organisation,
+					moduleName), branch, revision);
+		}
+
+		PatternMatcher patternMatcher = settings.getMatcher(matcher);
+		if ("*".equals(resolver)) {
+			//search in all resolvers.  this can be quite slow for complex repository configurations
+			//with ChainResolvers, since resolvers in chains will be searched multiple times.
+			return ivyInstance.listModules(criteria, patternMatcher);
+		} else {
+			//limit search to the specified resolver.
+			DependencyResolver dependencyResolver =
+					resolver == null ? settings.getDefaultResolver()
+									 : settings.getResolver(resolver);
+			if (dependencyResolver == null) {
+				throw new IllegalArgumentException("Unknown dependency resolver for search: " + resolver);
+			}
+
+			ivyInstance.pushContext();
+			try {
+				return ivyInstance.getSearchEngine().listModules(dependencyResolver, criteria, patternMatcher);
+			} finally {
+				ivyInstance.popContext();
+			}
+		}
+	}
+
+	public ModuleRevisionId[] search(String organisation, String moduleName)
+			throws Exception {
+		return search(organisation, moduleName, null, null,
+				PatternMatcher.EXACT_OR_REGEXP, null);
+	}
+
+	public String[] searchModule(String organisation, String moduleName)
+			throws Exception {
+		ModuleRevisionId[] mrids = search(organisation, moduleName);
+		String[] result = new String[mrids.length];
+		for (int i = 0; i < mrids.length; i++) {
+			result[i] = mrids[i].toString();
+		}
+		return result;
+	}
+	
+	public String getDescription(ModuleRevisionId mrid) {
+		ResolvedModuleRevision rmr = ivyInstance.findModule(mrid);
+		return rmr.getDescriptor().getDescription();
+	}
+	
+	
+	public String getPluginDescription(String moduleRevisionId) {
+		String mrid = moduleRevisionId;
+		if (!mrid.matches(".*#.*")) {
+			Message.debug("No organisation specified for plugin " + mrid
+					+ " using the default one");
+			mrid = EasyAntConstants.EASYANT_PLUGIN_ORGANISATION + "#" + mrid;
+		}
+		ModuleRevisionId module = ModuleRevisionId.parse(mrid);
+
+		return getDescription(module);
+	}
+	
+	public String getBuildTypeDescription(String moduleRevisionId) {
+		String mrid = moduleRevisionId;
+		if (!mrid.matches(".*#.*")) {
+			Message.debug("No organisation specified for buildtype " + mrid
+					+ " using the default one");
+			mrid = EasyAntConstants.EASYANT_BUILDTYPES_ORGANISATION + "#" + mrid;
+		}
+		ModuleRevisionId module = ModuleRevisionId.parse(mrid);
+
+		return getDescription(module);
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,91 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import org.apache.easyant.core.descriptor.PropertyDescriptor;
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.report.PhaseReport;
+import org.apache.easyant.core.report.TargetReport;
+import org.apache.tools.ant.Project;
+
+/**
+ * Implements support for -describe easyant switch.
+ * 
+ * This command searches for a phase, target, and properties by the 
+ * supplied search name and returns result for each of these sequentially. 
+ */
+public class Describe implements ManCommand {
+	private String target;
+	
+	// convenient string constants
+	private static final String TAB = "\t";
+	private static final String NONE = "NONE";
+	
+	public void addParam(String param) {
+		this.target = param;
+	}
+
+	public void execute(EasyAntReport earep, Project project) {
+		String lineSep = System.getProperty("line.separator");
+		
+		if(target == null || target.length() == 0) {
+			throw new IllegalArgumentException("No parameter specified for -describe parameter.");
+		}
+		
+		project.log(lineSep + "--- Available references for: " + target +
+				" in current project: " + project.getName() + " ---" + lineSep);
+		
+		PhaseReport phaseRep = earep.getPhaseReport(target, true);
+		if(phaseRep != null) {
+			project.log(TAB + "Phase: " + target);
+			project.log(TAB + TAB + "Description: " + (phaseRep.getDescription() == null ? NONE : phaseRep.getDescription()));
+			project.log(TAB + TAB + "Depends: " + (phaseRep.getDepends() == null ? NONE : phaseRep.getDepends()));
+			project.log(lineSep + TAB + TAB + "For information on targets attached to this phase, run:");
+			project.log(TAB + TAB + "easyant -listTargets " + target);
+		} else {
+			project.log(TAB + "No Phase found for name: " + target);
+		}
+		TargetReport targetRep = earep.getTargetReport(target, true);
+		if(targetRep != null) {
+			project.log(TAB + "Target: " + target);
+			project.log(TAB + TAB + "Phase: " + (targetRep.getPhase() == null ? NONE : targetRep.getPhase()));
+			project.log(TAB + TAB + "Description: " + (targetRep.getDescription() == null ? NONE : targetRep.getDescription()));
+			project.log(TAB + TAB + "Depends: " + (targetRep.getDepends() == null ? NONE : targetRep.getDepends()));
+			project.log(TAB + TAB + "IF: " + (targetRep.getIfCase() == null ? NONE : targetRep.getIfCase()));
+			project.log(TAB + TAB + "UNLESS: " + (targetRep.getUnlessCase() == null ? NONE : targetRep.getUnlessCase()));
+		} else {
+			project.log(TAB + "No Target found for name: " + target);
+		}
+		PropertyDescriptor prop = earep.getAvailableProperties().get(target);
+		if(prop != null) {
+			project.log(TAB + "Property: " + target);
+			project.log(TAB + TAB + "Description: " + (prop.getDescription() == null ? NONE : prop.getDescription()));
+			String defaultValue = prop.getDefaultValue() == null ? NONE : prop.getDefaultValue();
+			project.log(TAB + TAB + "Default: " + defaultValue);
+			project.log(TAB + TAB + "Required: " + prop.isRequired());
+			String currentValue = prop.getValue() == null ? defaultValue : prop.getValue();
+			project.log(TAB + TAB + "Current value: " + currentValue);
+		} else {
+			project.log(TAB + "No Property found for name: " + target);
+		}
+		
+		project.log(lineSep + "--- End Of (Describe) ---");
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/Describe.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,54 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import java.util.List;
+
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.report.PhaseReport;
+import org.apache.tools.ant.Project;
+
+/**
+ * ManCommand implementation to list all phases associated with specified 
+ * build module.
+ * 
+ * Supports the -listPhases switch.
+ */
+public class ListPhases implements ManCommand {
+	// convenient string constant for formatting
+	private static String TAB = "\t";
+	
+	public void addParam(String param) {
+		// this command does not make use of params
+	}
+
+	public void execute(EasyAntReport earep, Project project) {
+		String lineSep = System.getProperty("line.separator");
+		project.log(lineSep + "--- Available Phases for current project: " + project.getName() + " ---" + lineSep);
+		
+		List<PhaseReport> phases = earep.getAvailablePhases();
+		for(int i = 0; i<phases.size(); i++) {
+			project.log(TAB + phases.get(i).getName());
+		}
+		
+		project.log(lineSep + lineSep + "For more information on a Phase, run:" + lineSep + "\t easyant -describe <PHASE>");
+		project.log(lineSep + "--- End Of (Phases Listing) ---");
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPhases.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,52 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import java.util.List;
+
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.report.ImportedModuleReport;
+import org.apache.tools.ant.Project;
+
+/**
+ * Lists all available plugins (imported modules) for the specified 
+ * build module.
+ */
+public class ListPlugins implements ManCommand {
+	private static String TAB = "\t";
+
+	public void addParam(String param) {
+		// DO NOTHING - NOT REQUIRED, SINCE THIS IS A 'LIST-ALL' COMMAND
+	}
+
+	public void execute(EasyAntReport earep, Project project) {
+		String lineSep = System.getProperty("line.separator");
+		project.log(lineSep + "--- Available Plugins for current project: " + project.getName() + " ---" + lineSep);
+		
+		List<ImportedModuleReport> moduleReps = earep.getImportedModuleReports();
+		for(int i = 0; i<moduleReps.size(); i++) {
+			project.log(TAB + moduleReps.get(i).getModuleMrid() + (moduleReps.get(i).getAs() == null ? 
+					"" : ": Known as " + moduleReps.get(i).getAs()));
+		}
+		
+		project.log(lineSep + lineSep + "For more information on a Plugin, run:" + lineSep + "\t easyant -describe <PLUGIN>");
+		project.log(lineSep + "--- End Of (Plugins Listing) ---");
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListPlugins.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,84 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.easyant.core.descriptor.PropertyDescriptor;
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.report.ImportedModuleReport;
+import org.apache.tools.ant.Project;
+
+/**
+ * Lists all properties (deep search - includes all imported modules)
+ * available in the specified build module.
+ */
+public class ListProps implements ManCommand {
+	private String plugin = null;
+	
+	/*
+	 * defining some convenient string constants
+	 */
+	private static final String TAB = "\t";
+
+	public void addParam(String param) {
+		this.plugin = param;
+	}
+
+	public void execute(EasyAntReport earep, Project project) {
+		String lineSep = System.getProperty("line.separator");
+
+		/*
+		 * the plugin specified to this class through the addParam method
+		 * needs to be searched for all properties, and those
+		 * properties will be displayed by this class.
+		 */
+		
+		if(plugin == null || plugin.trim().length() == 0) {
+			throw new IllegalArgumentException("No plugin found to list properties for.");
+		}
+
+		project.log(lineSep + "--- Available Properties for current project: " + project.getName() + 
+				":: Plugin: " + plugin + " ---" + lineSep);
+
+		ImportedModuleReport moduleRep = earep.getImportedModuleReport(plugin);
+		if(moduleRep == null) {
+			project.log(TAB + "No Module / Plugin found by given name: " + plugin);
+		} else {
+			Map<String, PropertyDescriptor> allprops = moduleRep.getEasyantReport().getPropertyDescriptors();
+			
+			if(allprops.size() > 0) {
+				for(Iterator<Entry<String, PropertyDescriptor>> it = allprops.entrySet().iterator(); it.hasNext(); ) {
+					Entry<String, PropertyDescriptor> entry = it.next();
+					PropertyDescriptor prop = entry.getValue();
+					project.log(TAB + "Property: " + prop.getName());
+				}
+		
+				project.log(lineSep + lineSep + "For more information on a Property, run:" + lineSep 
+						+ "\t easyant -describe <PROPERTY>");
+			} else {
+				project.log(lineSep + "No property found in the plugin: " + plugin);
+			}
+		}
+		project.log(lineSep + "--- End Of (Properties Listing) ---");
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListProps.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,125 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import java.util.List;
+
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.report.ImportedModuleReport;
+import org.apache.easyant.core.report.PhaseReport;
+import org.apache.easyant.core.report.TargetReport;
+import org.apache.tools.ant.Project;
+
+/**
+ * Implements the '-listTargets' switch for project Manual.
+ * 
+ * This command lists all targets belonging to the specified 
+ * phase / plugin. 
+ * 
+ * If no phase / plugin name is specified, then this command
+ * lists all targets available in the project (module.ivy)
+ */
+public class ListTargets implements ManCommand {
+	/*
+	 * name of the phase or plugin for which the targets 
+	 * have been requested for.
+	 */
+	private String container = null;
+	
+	/*
+	 * defining some convenient string constants
+	 */
+	private static final String TAB = "\t";
+	private static final String NONE = "NONE";
+	
+	public void addParam(String param) {
+		this.container = param;
+	}
+
+	/*
+	 * simply look up for all targets belonging to a phase named <container>, is such
+	 * a phase exists. then list all targets listed in a module named <container>, is
+	 * such a module exists.
+	 * 
+	 * however, if the this.container variable has not been initialized then simply list
+	 * down all targets in the current module and all imported sub-modules.
+	 */
+	public void execute(EasyAntReport earep, Project project) {
+		String lineSep = System.getProperty("line.separator");
+		
+		project.log(lineSep + "--- Available Targets for current project: " + project.getName() + " ---" + lineSep);
+		
+		if(this.container == null || this.container.trim().length() == 0) {
+			project.log(lineSep + "No Phase / Plugin specified. Listing all targets available in the project.");
+			
+			List<TargetReport> targets = earep.getAvailableTargets();
+			printTargets(targets, project);
+		} else {
+			PhaseReport phase = earep.getPhaseReport(this.container, true);
+			
+			if(phase != null) {
+				project.log("Targets for Phase: " + this.container);
+				List<TargetReport> targets = phase.getTargetReports();
+				printTargets(targets, project);
+			} else {
+				project.log(TAB + "No Phase found by name: " + this.container);
+			}
+			
+			List<ImportedModuleReport> modules = earep.getImportedModuleReports();
+			ImportedModuleReport selected = null;
+			for(int i = 0; i<modules.size(); i++) {
+				selected = modules.get(i);
+				if(container.equals(selected.getModuleMrid())) {
+					break;
+				}
+			}
+			if(selected != null) {
+				project.log(lineSep + "Targets for Module: " + this.container);
+				List<TargetReport> targets = selected.getEasyantReport().getTargetReports();
+				printTargets(targets, project);
+			} else {
+				project.log(lineSep + TAB + "No Module / Plugin found by name: " + this.container);
+			}
+				
+			project.log(lineSep + lineSep + "For more information on a Phase, run:" + lineSep + "\t easyant -describe <PHASE>");
+		}
+		project.log(lineSep + "--- End Of (Phases Listing) ---");
+	}
+
+	/*
+	 * common method to output a list of targets.
+	 * 
+	 * re-used multiple times in this class.
+	 */
+	private void printTargets(List<TargetReport> targets, Project project) {
+		if(targets.size() == 0) {
+			project.log(TAB + "No targets found.");
+			return;
+		}
+		for(int i = 0; i<targets.size(); i++) {
+			TargetReport targetRep = targets.get(i);
+			project.log(TAB + "Target: " + targetRep.getName());
+			project.log(TAB + TAB + "Phase: " + (targetRep.getPhase() == null ? NONE : targetRep.getPhase()));
+			project.log(TAB + TAB + "Description: " + (targetRep.getDescription() == null ? NONE : targetRep.getDescription()));
+			project.log(TAB + TAB + "Depends: " + (targetRep.getDepends() == null ? NONE : targetRep.getDepends()));
+			project.log(TAB + TAB + "IF: " + (targetRep.getIfCase() == null ? NONE : targetRep.getIfCase()));
+			project.log(TAB + TAB + "UNLESS: " + (targetRep.getUnlessCase() == null ? NONE : targetRep.getUnlessCase()));
+		}
+	}
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ListTargets.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,64 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.tools.ant.Project;
+
+/**
+ * Generic interface for all classes implementing functionality
+ * for all project manual switches that are accepted on command
+ * line when invoking easyant.
+ * 
+ * For example,
+ * <br>
+ * 		easyant -listTargets
+ * 
+ * <p />
+ * The -listTargets and similar switches (like -describe etc.) are
+ * all implemented by classes implementing this interface.
+ * 
+ * For each manual switch that is intended to be supported by easyant,
+ * a new implementing class for this interface must be added that
+ * implements the switch functionality.
+ * 
+ * Additionally, for the addition of any new switch, EasyAntMain needs
+ * to be modified to add the new switch for the new manual functionality.
+ */
+public interface ManCommand {
+	/**
+	 * Add a parameter to the ManCommand instance. The implementing
+	 * class may choose to process or ignore the parameter as need
+	 * may be.
+	 * @param param
+	 */
+	public void addParam(String param);
+	
+	/**
+	 * Provides the ManCommand instance with a context to execute the
+	 * command in.
+	 * 
+	 * The command is provided with an instance of generated EasyAntReport
+	 * with which relevant manual information may be retrieved for implementing
+	 * the switch functionality.
+	 * @param earep
+	 * @param project
+	 */
+	public void execute(EasyAntReport earep, Project project);
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ManCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,143 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.man;
+
+import java.io.File;
+
+import org.apache.easyant.core.EasyAntMagicNames;
+import org.apache.easyant.core.report.EasyAntReport;
+import org.apache.easyant.core.services.PluginService;
+import org.apache.tools.ant.Project;
+
+// TODO: move the list of supported switches and their implementation
+// classes to easyant-conf.xml
+
+/**
+ * This class controls the Project specific manual / documentation / help
+ * functionality.
+ * 
+ * The getCommand method supports a set of switches, that may be added to.
+ * Each switch must also have a corresponding implementation class, that
+ * is expected to implement the ManCommand interface.
+ */
+public class ProjectMan {
+	private boolean inited = false;
+	private Throwable initErr = null;
+	
+	private Project project = null;
+	private EasyAntReport earep = null;
+	private ManCommand command = null;
+	
+	/**
+	 * Factory method that returns an appropriate ManCommand implementation
+	 * depending on the parameter passed to it.
+	 * 
+	 * @param cmd
+	 * 			Switch name for which ManCommand implementation is required.
+	 * 			Example, -describe etc.
+	 * @return
+	 */
+	private ManCommand getCommand(String cmd) {
+		if("-listPhases".equals(cmd)) {
+			return new ListPhases();
+		} else if("-describe".equals(cmd)) {
+			return new Describe();
+		} else if("-listTargets".equals(cmd)) {
+			return new ListTargets();
+		} else if("-listProps".equals(cmd)) {
+			return new ListProps();
+		} else if("-listPlugins".equals(cmd)) {
+			return new ListPlugins();
+		}
+		throw new IllegalArgumentException("Unknown Manual Command.");
+	}
+	
+	/**
+	 * Sets the context for this ProjectMan instance. Once a coxtext is provided
+	 * this object is in a state to support manual commands / switches.
+	 * 
+	 * The context essentially comprises of:
+	 * <ol>
+	 * 	<li>Configured Project instance</li>
+	 *  <li>The build module itself.</li>
+	 * Assumes the passed project object to be a 
+	 * configured project.
+	 * 
+	 * @param p
+	 * 			Configured project instance.
+	 * @param moduleDescriptor
+	 * 			The build module file. This MUST not be left unspecified. 
+	 * 			This value does not default to module.ivy in current directory.
+	 */
+	public boolean setContext(Project p, File moduleDescriptor) {
+		project = p;
+		try {
+			PluginService pluginService = (PluginService)project.getReference(EasyAntMagicNames.PLUGIN_SERVICE_INSTANCE);
+			earep = pluginService.generateEasyAntReport(moduleDescriptor);
+			inited = true;
+		} catch (Throwable t) {
+			project.log("EasyAntMan could not be initialized. Details: " + t.getMessage());
+			initErr = t;
+		}
+		return inited;
+	}
+
+	/**
+	 * Sets the command to be executed by ProjectMan. ProjectMan only keeps
+	 * track of the last command supplied to it through this method.
+	 * 
+	 * @param command
+	 * 			The switch (e.g. -listTargets) with which easyant was invoked.
+	 */
+	public void setCommand(String command) {
+		// if there are multiple commands specified the last one overrides all the previous ones
+		this.command = getCommand(command);
+	}
+	
+	/**
+	 * Used to add a parameter to ManCommand instance. The ManCommand instance
+	 * will decide how to handle the object.
+	 * 
+	 * @param param
+	 * 			Additional input to the ManCommand. This may be specify the plugin
+	 * 			name if the the command is -listProps, or the phase name if the 
+	 * 			command is -describe.
+	 */
+	public void addParam(String param) {
+		command.addParam(param);
+	}
+	
+	/**
+	 * Executes the Project Manual with the given command name, and supplied
+	 * parameters.
+	 */
+	public void execute() {
+		if(!inited)
+			throw new RuntimeException(initErr);
+		
+		if(command == null)
+			throw new RuntimeException("Available options: -listAll, -describe, -listTargets, -listProps. " +
+					"ProjectHelp can not be run without one of these.");
+		String lineSep = System.getProperty("line.separator");
+		
+		project.log(lineSep + "Project Manual");
+		project.log("--------------");
+		command.execute(earep, project);
+	}
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/man/ProjectMan.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,71 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.tasks;
+
+import org.apache.easyant.core.ivy.IvyInstanceHelper;
+import org.apache.ivy.Ivy;
+import org.apache.ivy.ant.IvyAntSettings;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ * Base class for easyant tasks
+ * 
+ */
+public class AbstractEasyAntTask extends Task {
+
+	/**
+	 * Get the easyant ivy ant settings.
+	 * Usefull if you want to bind a subtask to easyant ivy instance
+	 * @return an ivyAntSettings
+	 */
+	protected IvyAntSettings getEasyAntIvyAntSettings() {
+		return IvyInstanceHelper.getEasyAntIvyAntSettings(getProject());
+	}
+	
+	/**
+	 * Get the configured ivy instance
+	 * @return a configured ivy instance
+	 */
+	protected Ivy getEasyAntIvyInstance() {
+		return getEasyAntIvyAntSettings().getConfiguredIvyInstance(this);
+	}
+	
+	/**
+	 * Utilitary method to configure a task with the current one
+	 * @param task task to configure
+	 * @return the configured task
+	 */
+	protected Task initTask(Task task) {
+		task.setLocation(getLocation());
+		task.setProject(getProject());
+		task.setTaskName(getTaskName());
+		task.setOwningTarget(getOwningTarget());
+		return task;
+	}
+
+	/**
+	 * Get a reference of the project ivy instance
+	 * @return a reference of the project ivy instance
+	 */
+	protected Reference getProjectIvyReference() {
+		return IvyInstanceHelper.buildProjectIvyReference(getProject());
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractEasyAntTask.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java?rev=1071697&view=auto
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java (added)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java Thu Feb 17 17:01:07 2011
@@ -0,0 +1,140 @@
+/* 
+ *  Copyright 2008-2010 the EasyAnt project
+ * 
+ *  See the NOTICE file distributed with this work for additional information
+ *  regarding copyright ownership. 
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License.
+ */
+package org.apache.easyant.tasks;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.apache.easyant.core.BuildConfigurationHelper;
+import org.apache.easyant.core.ant.Phase;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+
+public class BindTarget extends Task {
+
+	private String target;
+	private String toPhase;
+
+	private String buildConfigurations;
+
+	public void execute() throws BuildException {
+		StringBuilder message = new StringBuilder();
+		message.append("Phase mapping for target ").append(getTarget()).append(
+				" ");
+		if (!BuildConfigurationHelper.isBuildConfigurationActive(
+				getBuildConfigurations(), getProject(), message.toString())) {
+			log(
+					"no matching build configuration for this phase mapping, this mapping will be ignored",
+					Project.MSG_DEBUG);
+			return;
+		}
+		Target t = (Target) getProject().getTargets().get(getTarget());
+		if (t == null) {
+			throw new BuildException("unable to find target " + getTarget());
+		}
+
+		// unbind current mapping
+		for (Iterator iterator = getProject().getTargets().values().iterator(); iterator
+				.hasNext();) {
+			Target current = (Target) iterator.next();
+			if (current instanceof Phase) {
+				Enumeration dependencies = current.getDependencies();
+				StringBuilder dependsOn = new StringBuilder();
+				boolean requiresUpdates = false;
+				while (dependencies.hasMoreElements()) {
+					String dep = (String) dependencies.nextElement();
+					if (dep.equals(getTarget())) {
+						log("target" + getTarget() + " is registred in phase"
+								+ current.getName(), Project.MSG_VERBOSE);
+						requiresUpdates = true;
+					} else {
+						dependsOn.append(dep);
+						dependsOn.append(",");
+					}
+				}
+				if (requiresUpdates) {
+					log("removing target" + getTarget() + " from phase"
+							+ current.getName(), Project.MSG_VERBOSE);
+
+					Phase p = new Phase();
+					p.setDescription(current.getDescription());
+					p.setIf(current.getIf());
+					p.setLocation(current.getLocation());
+					p.setName(current.getName());
+					p.setProject(current.getProject());
+					p.setUnless(current.getUnless());
+					String depends = dependsOn.toString();
+					if (depends.endsWith(",")) {
+						depends = depends.substring(0, depends.length() - 1);
+					}
+					p.setDepends(depends);
+					getProject().addOrReplaceTarget(p);
+				}
+
+			}
+		}
+
+		if (getToPhase() != null && !getToPhase().equals("")) {
+			if (!getProject().getTargets().containsKey(getToPhase())) {
+				throw new BuildException("can't add target " + getTarget()
+						+ " to phase " + getToPhase() + " because the phase"
+						+ " is unknown.");
+			}
+			Target p = (Target) getProject().getTargets().get(getToPhase());
+
+			if (!(p instanceof Phase)) {
+				throw new BuildException("referenced target " + getToPhase()
+						+ " is not a phase");
+			}
+			p.addDependency(getTarget());
+		}
+
+	}
+
+	public String getToPhase() {
+		return toPhase;
+	}
+
+	public void setToPhase(String toPhase) {
+		this.toPhase = toPhase;
+	}
+
+	public String getTarget() {
+		return target;
+	}
+
+	public void setTarget(String target) {
+		this.target = target;
+	}
+
+	public String getBuildConfigurations() {
+		return buildConfigurations;
+	}
+
+	public void setBuildConfigurations(String buildConfigurations) {
+		this.buildConfigurations = buildConfigurations;
+	}
+
+	public void setConf(String conf) {
+		this.buildConfigurations = conf;
+	}
+
+}

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/BindTarget.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message