You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC
svn commit: r544459 [7/36] - in /incubator/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver/...
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/FilteredIvyListener.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/FilteredIvyListener.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/FilteredIvyListener.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/FilteredIvyListener.java Tue Jun 5 05:02:27 2007
@@ -20,26 +20,27 @@
import org.apache.ivy.util.filter.Filter;
public class FilteredIvyListener implements IvyListener {
- private IvyListener listener;
- private Filter filter;
+ private IvyListener listener;
- public FilteredIvyListener(IvyListener listener, Filter filter) {
- this.listener = listener;
- this.filter = filter;
- }
+ private Filter filter;
- public IvyListener getIvyListener() {
- return listener;
- }
+ public FilteredIvyListener(IvyListener listener, Filter filter) {
+ this.listener = listener;
+ this.filter = filter;
+ }
- public Filter getFilter() {
- return filter;
- }
+ public IvyListener getIvyListener() {
+ return listener;
+ }
- public void progress(IvyEvent event) {
- if (filter.accept(event)) {
- listener.progress(event);
- }
- }
+ public Filter getFilter() {
+ return filter;
+ }
+
+ public void progress(IvyEvent event) {
+ if (filter.accept(event)) {
+ listener.progress(event);
+ }
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEvent.java Tue Jun 5 05:02:27 2007
@@ -26,107 +26,98 @@
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.util.StringUtils;
-
/**
- * The root of all ivy events
- *
- * Any ivy event knows which ivy instance triggered the event (the source)
- * and also has a name and a map of attributes.
- *
- * The name of the event represents the event type, usually there is a one - one
- * mapping between event names and IvyEvent subclass, even if this is not mandatory.
- * Example:
- * pre-resolve
- * pre-resolve-dependency
- * post-download
- *
- * The map of attributes is a Map from String keys to String values.
- * It is especially useful to filter events, and to get some of their essential data in
- * some context where access to Java types is not easy (in an ant build file, for example),
- * Example:
- * pre-resolve (organisation=foo, module=bar, revision=1.0, conf=default)
- * post-download (organisation=foo, module=bar, revision=1.0, artifact=foo-test, type=jar, ext=jar)
- *
- *
+ * The root of all ivy events Any ivy event knows which ivy instance triggered the event (the
+ * source) and also has a name and a map of attributes. The name of the event represents the event
+ * type, usually there is a one - one mapping between event names and IvyEvent subclass, even if
+ * this is not mandatory. Example: pre-resolve pre-resolve-dependency post-download The map of
+ * attributes is a Map from String keys to String values. It is especially useful to filter events,
+ * and to get some of their essential data in some context where access to Java types is not easy
+ * (in an ant build file, for example), Example: pre-resolve (organisation=foo, module=bar,
+ * revision=1.0, conf=default) post-download (organisation=foo, module=bar, revision=1.0,
+ * artifact=foo-test, type=jar, ext=jar)
*/
public class IvyEvent {
private EventManager source;
+
private String name;
+
private Map attributes = new HashMap();
- protected IvyEvent(String name) {
- this.source = IvyContext.getContext().getEventManager();
- this.name = name;
- }
-
- /**
- * Should only be called during event object construction, since events should be immutable
- * @param key
- * @param value
- */
- protected void addAttribute(String key, String value) {
- attributes.put(key, value);
- }
- protected void addMDAttributes(ModuleDescriptor md) {
- addMridAttributes(md.getResolvedModuleRevisionId());
- }
-
- protected void addMridAttributes(ModuleRevisionId mrid) {
- addModuleIdAttributes(mrid.getModuleId());
- addAttribute("revision", mrid.getRevision());
- addAttributes(mrid.getExtraAttributes());
- }
-
- protected void addModuleIdAttributes(ModuleId moduleId) {
- addAttribute("organisation", moduleId.getOrganisation());
- addAttribute("module", moduleId.getName());
- }
-
- protected void addConfsAttribute(String[] confs) {
- addAttribute("conf", StringUtils.join(confs, ", "));
- }
-
- protected void addAttributes(Map attributes) {
- this.attributes.putAll(attributes);
- }
-
-
- public EventManager getSource() {
- return source;
- }
-
- public String getName() {
- return name;
- }
-
- /**
- * Returns the attributes of this event, as a Map(String->String)
- * @return the attributes of this event, as a Map(String->String)
- */
- public Map getAttributes() {
- return new HashMap(attributes);
- }
-
+ protected IvyEvent(String name) {
+ this.source = IvyContext.getContext().getEventManager();
+ this.name = name;
+ }
+
+ /**
+ * Should only be called during event object construction, since events should be immutable
+ *
+ * @param key
+ * @param value
+ */
+ protected void addAttribute(String key, String value) {
+ attributes.put(key, value);
+ }
+
+ protected void addMDAttributes(ModuleDescriptor md) {
+ addMridAttributes(md.getResolvedModuleRevisionId());
+ }
+
+ protected void addMridAttributes(ModuleRevisionId mrid) {
+ addModuleIdAttributes(mrid.getModuleId());
+ addAttribute("revision", mrid.getRevision());
+ addAttributes(mrid.getExtraAttributes());
+ }
+
+ protected void addModuleIdAttributes(ModuleId moduleId) {
+ addAttribute("organisation", moduleId.getOrganisation());
+ addAttribute("module", moduleId.getName());
+ }
+
+ protected void addConfsAttribute(String[] confs) {
+ addAttribute("conf", StringUtils.join(confs, ", "));
+ }
+
+ protected void addAttributes(Map attributes) {
+ this.attributes.putAll(attributes);
+ }
+
+ public EventManager getSource() {
+ return source;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the attributes of this event, as a Map(String->String)
+ *
+ * @return the attributes of this event, as a Map(String->String)
+ */
+ public Map getAttributes() {
+ return new HashMap(attributes);
+ }
+
public String toString() {
- return getName()+" "+getAttributes();
+ return getName() + " " + getAttributes();
}
-
+
public boolean equals(Object obj) {
- if (! (obj instanceof IvyEvent)) {
- return false;
- }
- IvyEvent e = (IvyEvent) obj;
-
- return getSource().equals(e.getSource())
- && getName().equals(e.getName())
- && attributes.equals(e.attributes);
+ if (!(obj instanceof IvyEvent)) {
+ return false;
+ }
+ IvyEvent e = (IvyEvent) obj;
+
+ return getSource().equals(e.getSource()) && getName().equals(e.getName())
+ && attributes.equals(e.attributes);
}
-
+
public int hashCode() {
- int hash = 37;
- hash = 13 * hash + getSource().hashCode();
- hash = 13 * hash + getName().hashCode();
- hash = 13 * hash + attributes.hashCode();
- return hash;
+ int hash = 37;
+ hash = 13 * hash + getSource().hashCode();
+ hash = 13 * hash + getName().hashCode();
+ hash = 13 * hash + attributes.hashCode();
+ return hash;
}
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEventFilter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEventFilter.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEventFilter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/IvyEventFilter.java Tue Jun 5 05:02:27 2007
@@ -27,116 +27,131 @@
import org.apache.ivy.util.filter.OrFilter;
/**
- * A filter implementation filtering {@link IvyEvent} based upon
- * an event name and a filter expression.
- *
- * The name will be matched against the event name using the
- * {@link PatternMatcher} used to construct this object.
- *
- * The filter expression is a string describing how the event
- * should be filtered according to its attributes values.
- * The matching between the filter values and the event attribute values
- * is done using the {@link PatternMatcher} used to construct this object.
- *
- * Here are some examples:
- * <table>
- * <tr><td>expression</td><td>effect</td></tr>
- * <tr><td>type=zip</td><td>accepts event with a type attribute matching zip</td></tr>
- * <tr><td>type=zip,jar</td><td>accepts event with a type attribute matching zip or jar</td></tr>
- * <tr><td>type=src AND ext=zip</td><td>accepts event with a type attribute matching src AND an ext attribute matching zip</td></tr>
- * <tr><td>type=src OR ext=zip</td><td>accepts event with a type attribute matching src OR an ext attribute matching zip</td></tr>
- * <tr><td>NOT type=src</td><td>accepts event with a type attribute NOT matching src</td></tr>
- * </table>
- *
- * Combination of these can be used, but no parentheses are supported right now, so only the default priority can be used.
- * The priority order is this one: AND OR NOT =
- *
- * This means that artifact=foo AND ext=zip OR type=src will match event with artifact matching foo AND (ext matching zip OR type matching src)
+ * A filter implementation filtering {@link IvyEvent} based upon an event name and a filter
+ * expression. The name will be matched against the event name using the {@link PatternMatcher} used
+ * to construct this object. The filter expression is a string describing how the event should be
+ * filtered according to its attributes values. The matching between the filter values and the event
+ * attribute values is done using the {@link PatternMatcher} used to construct this object. Here are
+ * some examples: <table>
+ * <tr>
+ * <td>expression</td>
+ * <td>effect</td>
+ * </tr>
+ * <tr>
+ * <td>type=zip</td>
+ * <td>accepts event with a type attribute matching zip</td>
+ * </tr>
+ * <tr>
+ * <td>type=zip,jar</td>
+ * <td>accepts event with a type attribute matching zip or jar</td>
+ * </tr>
+ * <tr>
+ * <td>type=src AND ext=zip</td>
+ * <td>accepts event with a type attribute matching src AND an ext attribute matching zip</td>
+ * </tr>
+ * <tr>
+ * <td>type=src OR ext=zip</td>
+ * <td>accepts event with a type attribute matching src OR an ext attribute matching zip</td>
+ * </tr>
+ * <tr>
+ * <td>NOT type=src</td>
+ * <td>accepts event with a type attribute NOT matching src</td>
+ * </tr>
+ * </table> Combination of these can be used, but no parentheses are supported right now, so only
+ * the default priority can be used. The priority order is this one: AND OR NOT = This means that
+ * artifact=foo AND ext=zip OR type=src will match event with artifact matching foo AND (ext
+ * matching zip OR type matching src)
*
* @since 1.4
- *
*/
public class IvyEventFilter implements Filter {
- private static final String NOT = "NOT ";
- private static final String OR = " OR ";
- private static final String AND = " AND ";
- private PatternMatcher matcher;
- private Filter nameFilter;
- private Filter attFilter;
-
- public IvyEventFilter(String event, String filterExpression, PatternMatcher matcher) {
- this.matcher = matcher == null ? ExactPatternMatcher.INSTANCE : matcher;
- if (event == null) {
- nameFilter = NoFilter.INSTANCE;
- } else {
- final Matcher eventNameMatcher = this.matcher.getMatcher(event);
- nameFilter = new Filter() {
- public boolean accept(Object o) {
- IvyEvent e = (IvyEvent) o;
- return eventNameMatcher.matches(e.getName());
- }
- };
- }
- attFilter = filterExpression == null || filterExpression.trim().length() == 0 ?
- NoFilter.INSTANCE
- : parseExpression(filterExpression);
- }
-
- private Filter parseExpression(String filterExpression) {
- // expressions handled for the moment: (informal grammar)
- // EXP := SIMPLE_EXP | AND_EXP | OR_EXP | NOT_EXP
- // AND_EXP := EXP && EXP
- // OR_EXP := EXP || EXP
- // NOT_EXP := ! EXP
- // SIMPLE_EXP := attname = comma, separated, list, of, accepted, values
- // example: organisation = foo && module = bar, baz
- filterExpression = filterExpression.trim();
- int index = filterExpression.indexOf(AND);
- if (index == -1) {
- index = filterExpression.indexOf(OR);
- if (index == -1) {
- if (filterExpression.startsWith(NOT)) {
- return new NotFilter(parseExpression(filterExpression.substring(NOT.length())));
- } else {
- index = filterExpression.indexOf("=");
- if (index == -1) {
- throw new IllegalArgumentException("bad filter expression: "+filterExpression+": no equal sign found");
- }
- final String attname = filterExpression.substring(0, index).trim();
- String[] values = filterExpression.substring(index+1).trim().split(",");
- final Matcher[] matchers = new Matcher[values.length];
- for (int i = 0; i < values.length; i++) {
- matchers[i] = matcher.getMatcher(values[i].trim());
- }
- return new Filter() {
- public boolean accept(Object o) {
- IvyEvent e = (IvyEvent) o;
- String val = (String) e.getAttributes().get(attname);
- if (val == null) {
- return false;
- }
- for (int i = 0; i < matchers.length; i++) {
- if (matchers[i].matches(val)) {
- return true;
- }
- }
- return false;
- }
- };
- }
- } else {
- return new OrFilter(parseExpression(filterExpression.substring(0, index)), parseExpression(filterExpression.substring(index+OR.length())));
- }
- } else {
- return new AndFilter(parseExpression(filterExpression.substring(0, index)), parseExpression(filterExpression.substring(index+AND.length())));
- }
- }
-
- public boolean accept(Object o) {
- if (! (o instanceof IvyEvent)) {
- return false;
- }
- return nameFilter.accept(o) && attFilter.accept(o);
- }
+ private static final String NOT = "NOT ";
+
+ private static final String OR = " OR ";
+
+ private static final String AND = " AND ";
+
+ private PatternMatcher matcher;
+
+ private Filter nameFilter;
+
+ private Filter attFilter;
+
+ public IvyEventFilter(String event, String filterExpression, PatternMatcher matcher) {
+ this.matcher = matcher == null ? ExactPatternMatcher.INSTANCE : matcher;
+ if (event == null) {
+ nameFilter = NoFilter.INSTANCE;
+ } else {
+ final Matcher eventNameMatcher = this.matcher.getMatcher(event);
+ nameFilter = new Filter() {
+ public boolean accept(Object o) {
+ IvyEvent e = (IvyEvent) o;
+ return eventNameMatcher.matches(e.getName());
+ }
+ };
+ }
+ attFilter = filterExpression == null || filterExpression.trim().length() == 0 ? NoFilter.INSTANCE
+ : parseExpression(filterExpression);
+ }
+
+ private Filter parseExpression(String filterExpression) {
+ // expressions handled for the moment: (informal grammar)
+ // EXP := SIMPLE_EXP | AND_EXP | OR_EXP | NOT_EXP
+ // AND_EXP := EXP && EXP
+ // OR_EXP := EXP || EXP
+ // NOT_EXP := ! EXP
+ // SIMPLE_EXP := attname = comma, separated, list, of, accepted, values
+ // example: organisation = foo && module = bar, baz
+ filterExpression = filterExpression.trim();
+ int index = filterExpression.indexOf(AND);
+ if (index == -1) {
+ index = filterExpression.indexOf(OR);
+ if (index == -1) {
+ if (filterExpression.startsWith(NOT)) {
+ return new NotFilter(parseExpression(filterExpression.substring(NOT.length())));
+ } else {
+ index = filterExpression.indexOf("=");
+ if (index == -1) {
+ throw new IllegalArgumentException("bad filter expression: "
+ + filterExpression + ": no equal sign found");
+ }
+ final String attname = filterExpression.substring(0, index).trim();
+ String[] values = filterExpression.substring(index + 1).trim().split(",");
+ final Matcher[] matchers = new Matcher[values.length];
+ for (int i = 0; i < values.length; i++) {
+ matchers[i] = matcher.getMatcher(values[i].trim());
+ }
+ return new Filter() {
+ public boolean accept(Object o) {
+ IvyEvent e = (IvyEvent) o;
+ String val = (String) e.getAttributes().get(attname);
+ if (val == null) {
+ return false;
+ }
+ for (int i = 0; i < matchers.length; i++) {
+ if (matchers[i].matches(val)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+ } else {
+ return new OrFilter(parseExpression(filterExpression.substring(0, index)),
+ parseExpression(filterExpression.substring(index + OR.length())));
+ }
+ } else {
+ return new AndFilter(parseExpression(filterExpression.substring(0, index)),
+ parseExpression(filterExpression.substring(index + AND.length())));
+ }
+ }
+
+ public boolean accept(Object o) {
+ if (!(o instanceof IvyEvent)) {
+ return false;
+ }
+ return nameFilter.accept(o) && attFilter.accept(o);
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/DownloadEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/DownloadEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/DownloadEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/DownloadEvent.java Tue Jun 5 05:02:27 2007
@@ -24,19 +24,18 @@
private Artifact artifact;
public DownloadEvent(String name, Artifact artifact) {
- super(name);
+ super(name);
this.artifact = artifact;
addArtifactAttributes(this.artifact);
}
protected void addArtifactAttributes(Artifact artifact) {
- addMridAttributes(artifact.getModuleRevisionId());
- addAttributes(artifact.getAttributes());
- }
+ addMridAttributes(artifact.getModuleRevisionId());
+ addAttributes(artifact.getAttributes());
+ }
- public Artifact getArtifact() {
+ public Artifact getArtifact() {
return artifact;
}
-
-
+
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/EndArtifactDownloadEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/EndArtifactDownloadEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/EndArtifactDownloadEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/EndArtifactDownloadEvent.java Tue Jun 5 05:02:27 2007
@@ -24,14 +24,15 @@
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.plugins.resolver.DependencyResolver;
-
public class EndArtifactDownloadEvent extends DownloadEvent {
- public static final String NAME = "post-download-artifact";
+ public static final String NAME = "post-download-artifact";
private DependencyResolver resolver;
+
private ArtifactDownloadReport report;
- public EndArtifactDownloadEvent(DependencyResolver resolver, Artifact artifact, ArtifactDownloadReport report, File dest) {
+ public EndArtifactDownloadEvent(DependencyResolver resolver, Artifact artifact,
+ ArtifactDownloadReport report, File dest) {
super(NAME, artifact);
this.resolver = resolver;
this.report = report;
@@ -41,8 +42,8 @@
addAttribute("file", dest.getAbsolutePath());
ArtifactOrigin origin = report.getArtifactOrigin();
if (origin != null) {
- addAttribute("origin", this.report.getArtifactOrigin().getLocation());
- addAttribute("local", String.valueOf(this.report.getArtifactOrigin().isLocal()));
+ addAttribute("origin", this.report.getArtifactOrigin().getLocation());
+ addAttribute("local", String.valueOf(this.report.getArtifactOrigin().isLocal()));
} else {
addAttribute("origin", "");
addAttribute("local", "");
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/NeedArtifactEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/NeedArtifactEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/NeedArtifactEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/NeedArtifactEvent.java Tue Jun 5 05:02:27 2007
@@ -22,8 +22,8 @@
public class NeedArtifactEvent extends DownloadEvent {
public static final String NAME = "need-artifact";
-
- private DependencyResolver resolver;
+
+ private DependencyResolver resolver;
public NeedArtifactEvent(DependencyResolver resolver, Artifact artifact) {
super(NAME, artifact);
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/PrepareDownloadEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/PrepareDownloadEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/PrepareDownloadEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/PrepareDownloadEvent.java Tue Jun 5 05:02:27 2007
@@ -21,14 +21,15 @@
import org.apache.ivy.core.module.descriptor.Artifact;
public class PrepareDownloadEvent extends IvyEvent {
- public static final String NAME = "prepare-download";
+ public static final String NAME = "prepare-download";
+
private Artifact[] artifacts;
-
+
public PrepareDownloadEvent(Artifact[] artifacts) {
- super(NAME);
+ super(NAME);
this.artifacts = artifacts;
}
-
+
public Artifact[] getArtifacts() {
return artifacts;
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/StartArtifactDownloadEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/StartArtifactDownloadEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/StartArtifactDownloadEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/download/StartArtifactDownloadEvent.java Tue Jun 5 05:02:27 2007
@@ -23,11 +23,13 @@
public class StartArtifactDownloadEvent extends DownloadEvent {
public static final String NAME = "pre-download-artifact";
-
- private DependencyResolver resolver;
- private ArtifactOrigin origin;
- public StartArtifactDownloadEvent(DependencyResolver resolver, Artifact artifact, ArtifactOrigin origin) {
+ private DependencyResolver resolver;
+
+ private ArtifactOrigin origin;
+
+ public StartArtifactDownloadEvent(DependencyResolver resolver, Artifact artifact,
+ ArtifactOrigin origin) {
super(NAME, artifact);
this.resolver = resolver;
this.origin = origin;
@@ -40,8 +42,8 @@
return resolver;
}
- public ArtifactOrigin getOrigin() {
- return origin;
- }
+ public ArtifactOrigin getOrigin() {
+ return origin;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveDependencyEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveDependencyEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveDependencyEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveDependencyEvent.java Tue Jun 5 05:02:27 2007
@@ -22,23 +22,26 @@
import org.apache.ivy.plugins.resolver.DependencyResolver;
public class EndResolveDependencyEvent extends ResolveDependencyEvent {
- public static final String NAME = "post-resolve-dependency";
- private ResolvedModuleRevision module;
+ public static final String NAME = "post-resolve-dependency";
- public EndResolveDependencyEvent(DependencyResolver resolver, DependencyDescriptor dd, ResolvedModuleRevision module) {
- super(NAME, resolver, dd);
- this.module = module;
- if (this.module != null) {
- // override revision from the dependency descriptor
- addAttribute("revision", this.module.getDescriptor().getResolvedModuleRevisionId().getRevision());
- addAttribute("resolved", "true");
- } else {
- addAttribute("resolved", "false");
- }
- }
+ private ResolvedModuleRevision module;
- public ResolvedModuleRevision getModule() {
- return module;
- }
+ public EndResolveDependencyEvent(DependencyResolver resolver, DependencyDescriptor dd,
+ ResolvedModuleRevision module) {
+ super(NAME, resolver, dd);
+ this.module = module;
+ if (this.module != null) {
+ // override revision from the dependency descriptor
+ addAttribute("revision", this.module.getDescriptor().getResolvedModuleRevisionId()
+ .getRevision());
+ addAttribute("resolved", "true");
+ } else {
+ addAttribute("resolved", "false");
+ }
+ }
+
+ public ResolvedModuleRevision getModule() {
+ return module;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/EndResolveEvent.java Tue Jun 5 05:02:27 2007
@@ -21,17 +21,17 @@
import org.apache.ivy.core.report.ResolveReport;
public class EndResolveEvent extends ResolveEvent {
- public static final String NAME = "post-resolve";
+ public static final String NAME = "post-resolve";
- private ResolveReport report;
+ private ResolveReport report;
- public EndResolveEvent(ModuleDescriptor md, String[] confs, ResolveReport report) {
- super(NAME, md, confs);
- this.report = report;
- }
+ public EndResolveEvent(ModuleDescriptor md, String[] confs, ResolveReport report) {
+ super(NAME, md, confs);
+ this.report = report;
+ }
- public ResolveReport getReport() {
- return report;
- }
+ public ResolveReport getReport() {
+ return report;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveDependencyEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveDependencyEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveDependencyEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveDependencyEvent.java Tue Jun 5 05:02:27 2007
@@ -22,24 +22,26 @@
import org.apache.ivy.plugins.resolver.DependencyResolver;
public class ResolveDependencyEvent extends IvyEvent {
- private DependencyResolver resolver;
- private DependencyDescriptor dd;
+ private DependencyResolver resolver;
- protected ResolveDependencyEvent(String name, DependencyResolver resolver, DependencyDescriptor dd) {
- super(name);
- this.resolver = resolver;
- this.dd = dd;
- addAttribute("resolver", this.resolver.getName());
- addMridAttributes(this.dd.getDependencyRevisionId());
- addAttributes(this.dd.getExtraAttributes());
- }
+ private DependencyDescriptor dd;
- public DependencyDescriptor getDependencyDescriptor() {
- return dd;
- }
+ protected ResolveDependencyEvent(String name, DependencyResolver resolver,
+ DependencyDescriptor dd) {
+ super(name);
+ this.resolver = resolver;
+ this.dd = dd;
+ addAttribute("resolver", this.resolver.getName());
+ addMridAttributes(this.dd.getDependencyRevisionId());
+ addAttributes(this.dd.getExtraAttributes());
+ }
- public DependencyResolver getResolver() {
- return resolver;
- }
+ public DependencyDescriptor getDependencyDescriptor() {
+ return dd;
+ }
+
+ public DependencyResolver getResolver() {
+ return resolver;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/ResolveEvent.java Tue Jun 5 05:02:27 2007
@@ -21,18 +21,19 @@
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
public class ResolveEvent extends IvyEvent {
- private ModuleDescriptor md;
- private String[] confs;
+ private ModuleDescriptor md;
- protected ResolveEvent(String name, ModuleDescriptor md, String[] confs) {
- super(name);
- this.md = md;
- this.confs = confs;
- addMDAttributes(md);
- addConfsAttribute(confs);
- }
+ private String[] confs;
- public ModuleDescriptor getModuleDescriptor() {
- return md;
- }
+ protected ResolveEvent(String name, ModuleDescriptor md, String[] confs) {
+ super(name);
+ this.md = md;
+ this.confs = confs;
+ addMDAttributes(md);
+ addConfsAttribute(confs);
+ }
+
+ public ModuleDescriptor getModuleDescriptor() {
+ return md;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveDependencyEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveDependencyEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveDependencyEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveDependencyEvent.java Tue Jun 5 05:02:27 2007
@@ -21,10 +21,10 @@
import org.apache.ivy.plugins.resolver.DependencyResolver;
public class StartResolveDependencyEvent extends ResolveDependencyEvent {
- public static final String NAME = "pre-resolve-dependency";
+ public static final String NAME = "pre-resolve-dependency";
- public StartResolveDependencyEvent(DependencyResolver resolver, DependencyDescriptor dd) {
- super(NAME, resolver, dd);
- }
+ public StartResolveDependencyEvent(DependencyResolver resolver, DependencyDescriptor dd) {
+ super(NAME, resolver, dd);
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/event/resolve/StartResolveEvent.java Tue Jun 5 05:02:27 2007
@@ -20,10 +20,10 @@
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
public class StartResolveEvent extends ResolveEvent {
- public static final String NAME = "pre-resolve";
+ public static final String NAME = "pre-resolve";
- public StartResolveEvent(ModuleDescriptor md, String[] confs) {
- super(NAME, md, confs);
- }
+ public StartResolveEvent(ModuleDescriptor md, String[] confs) {
+ super(NAME, md, confs);
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java Tue Jun 5 05:02:27 2007
@@ -50,19 +50,25 @@
import org.apache.ivy.util.filter.FilterHelper;
public class InstallEngine {
- private IvySettings settings;
- private ResolveEngine resolveEngine;
- private PublishEngine publishEngine;
- private SearchEngine searchEngine;
-
- public InstallEngine(IvySettings settings, SearchEngine searchEngine, ResolveEngine resolveEngine, PublishEngine publishEngine) {
- this.settings = settings;
- this.searchEngine = searchEngine;
- this.resolveEngine = resolveEngine;
- this.publishEngine = publishEngine;
- }
+ private IvySettings settings;
- public ResolveReport install(ModuleRevisionId mrid, String from, String to, boolean transitive, boolean validate, boolean overwrite, Filter artifactFilter, File cache, String matcherName) throws IOException {
+ private ResolveEngine resolveEngine;
+
+ private PublishEngine publishEngine;
+
+ private SearchEngine searchEngine;
+
+ public InstallEngine(IvySettings settings, SearchEngine searchEngine,
+ ResolveEngine resolveEngine, PublishEngine publishEngine) {
+ this.settings = settings;
+ this.searchEngine = searchEngine;
+ this.resolveEngine = resolveEngine;
+ this.publishEngine = publishEngine;
+ }
+
+ public ResolveReport install(ModuleRevisionId mrid, String from, String to, boolean transitive,
+ boolean validate, boolean overwrite, Filter artifactFilter, File cache,
+ String matcherName) throws IOException {
if (cache == null) {
cache = settings.getDefaultCache();
}
@@ -72,94 +78,96 @@
DependencyResolver fromResolver = settings.getResolver(from);
DependencyResolver toResolver = settings.getResolver(to);
if (fromResolver == null) {
- throw new IllegalArgumentException("unknown resolver "+from+". Available resolvers are: "+ settings.getResolverNames());
+ throw new IllegalArgumentException("unknown resolver " + from
+ + ". Available resolvers are: " + settings.getResolverNames());
}
if (toResolver == null) {
- throw new IllegalArgumentException("unknown resolver "+to+". Available resolvers are: "+ settings.getResolverNames());
+ throw new IllegalArgumentException("unknown resolver " + to
+ + ". Available resolvers are: " + settings.getResolverNames());
}
PatternMatcher matcher = settings.getMatcher(matcherName);
if (matcher == null) {
- throw new IllegalArgumentException("unknown matcher "+matcherName+". Available matchers are: "+ settings.getMatcherNames());
+ throw new IllegalArgumentException("unknown matcher " + matcherName
+ + ". Available matchers are: " + settings.getMatcherNames());
}
-
+
// build module file declaring the dependency
- Message.info(":: installing "+mrid+" ::");
+ Message.info(":: installing " + mrid + " ::");
DependencyResolver oldDicator = resolveEngine.getDictatorResolver();
boolean log = settings.logNotConvertedExclusionRule();
try {
- settings.setLogNotConvertedExclusionRule(true);
- resolveEngine.setDictatorResolver(fromResolver);
-
- DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("apache", "ivy-install", "1.0"), settings.getStatusManager().getDefaultStatus(), new Date());
+ settings.setLogNotConvertedExclusionRule(true);
+ resolveEngine.setDictatorResolver(fromResolver);
+
+ DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance(
+ "apache", "ivy-install", "1.0"), settings.getStatusManager().getDefaultStatus(),
+ new Date());
String resolveId = ResolveOptions.getDefaultResolveId(md);
md.addConfiguration(new Configuration("default"));
- md.addConflictManager(new ModuleId(ExactPatternMatcher.ANY_EXPRESSION, ExactPatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE, new NoConflictManager());
-
+ md.addConflictManager(new ModuleId(ExactPatternMatcher.ANY_EXPRESSION,
+ ExactPatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE,
+ new NoConflictManager());
+
if (MatcherHelper.isExact(matcher, mrid)) {
- DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid, false, false, transitive);
+ DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid, false,
+ false, transitive);
dd.addDependencyConfiguration("default", "*");
md.addDependency(dd);
} else {
Collection mrids = searchEngine.findModuleRevisionIds(fromResolver, mrid, matcher);
-
+
for (Iterator iter = mrids.iterator(); iter.hasNext();) {
- ModuleRevisionId foundMrid = (ModuleRevisionId)iter.next();
- Message.info("\tfound "+foundMrid+" to install: adding to the list");
- DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, foundMrid, false, false, transitive);
+ ModuleRevisionId foundMrid = (ModuleRevisionId) iter.next();
+ Message.info("\tfound " + foundMrid + " to install: adding to the list");
+ DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, foundMrid,
+ false, false, transitive);
dd.addDependencyConfiguration("default", "*");
md.addDependency(dd);
}
- }
-
+ }
+
// resolve using appropriate resolver
ResolveReport report = new ResolveReport(md, resolveId);
-
+
Message.info(":: resolving dependencies ::");
- IvyNode[] dependencies = resolveEngine.getDependencies(
- md,
- new ResolveOptions()
- .setResolveId(resolveId)
- .setConfs(new String[] {"default"})
- .setCache(CacheManager.getInstance(settings, cache)),
- report);
+ IvyNode[] dependencies = resolveEngine.getDependencies(md, new ResolveOptions()
+ .setResolveId(resolveId).setConfs(new String[] {"default"}).setCache(
+ CacheManager.getInstance(settings, cache)), report);
report.setDependencies(Arrays.asList(dependencies), artifactFilter);
-
+
Message.info(":: downloading artifacts to cache ::");
resolveEngine.downloadArtifacts(report, getCacheManager(cache), false, artifactFilter);
// now that everything is in cache, we can publish all these modules
- Message.info(":: installing in "+to+" ::");
+ Message.info(":: installing in " + to + " ::");
for (int i = 0; i < dependencies.length; i++) {
ModuleDescriptor depmd = dependencies[i].getDescriptor();
if (depmd != null) {
- Message.verbose("installing "+depmd.getModuleRevisionId());
- publishEngine.publish(
- depmd,
- Collections.singleton(cache.getAbsolutePath()+"/"+ settings.getCacheArtifactPattern()),
- toResolver,
- new PublishOptions()
- .setSrcIvyPattern(cache.getAbsolutePath()+"/"+ settings.getCacheIvyPattern())
- .setOverwrite(overwrite));
+ Message.verbose("installing " + depmd.getModuleRevisionId());
+ publishEngine.publish(depmd, Collections.singleton(cache.getAbsolutePath()
+ + "/" + settings.getCacheArtifactPattern()), toResolver,
+ new PublishOptions().setSrcIvyPattern(
+ cache.getAbsolutePath() + "/" + settings.getCacheIvyPattern())
+ .setOverwrite(overwrite));
}
}
Message.info(":: install resolution report ::");
-
+
// output report
report.output(settings.getReportOutputters(), cache);
return report;
} finally {
- resolveEngine.setDictatorResolver(oldDicator);
+ resolveEngine.setDictatorResolver(oldDicator);
settings.setLogNotConvertedExclusionRule(log);
}
}
-
- private CacheManager getCacheManager(File cache) {
- //TODO : reuse instance
- CacheManager cacheManager = new CacheManager(settings, cache);
- return cacheManager;
- }
+ private CacheManager getCacheManager(File cache) {
+ // TODO : reuse instance
+ CacheManager cacheManager = new CacheManager(settings, cache);
+ return cacheManager;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java Tue Jun 5 05:02:27 2007
@@ -30,15 +30,16 @@
if (!(obj instanceof Artifact)) {
return false;
}
- Artifact art = (Artifact)obj;
+ Artifact art = (Artifact) obj;
return getModuleRevisionId().equals(art.getModuleRevisionId())
- && getPublicationDate()==null?true:getPublicationDate().equals(art.getPublicationDate())
- && getName().equals(art.getName())
- && getExt().equals(art.getExt())
- && getType().equals(art.getType())
- && getExtraAttributes().equals(art.getExtraAttributes());
+ && getPublicationDate() == null ? true : getPublicationDate().equals(
+ art.getPublicationDate())
+ && getName().equals(art.getName())
+ && getExt().equals(art.getExt())
+ && getType().equals(art.getType())
+ && getExtraAttributes().equals(art.getExtraAttributes());
}
-
+
public int hashCode() {
int hash = 33;
hash = hash * 17 + getModuleRevisionId().hashCode();
@@ -51,9 +52,9 @@
hash = hash * 17 + getExtraAttributes().hashCode();
return hash;
}
-
+
public String toString() {
- return getModuleRevisionId()+"/"+getName()+"."+getExt()+"["+getType()+"]";
+ return getModuleRevisionId() + "/" + getName() + "." + getExt() + "[" + getType() + "]";
}
public String getAttribute(String attName) {
@@ -79,6 +80,5 @@
public Map getStandardAttributes() {
return getId().getStandardAttributes();
}
-
-
+
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java Tue Jun 5 05:02:27 2007
@@ -29,52 +29,53 @@
/**
* Abstract class used as implementation for both {@link IncludeRule} and {@link ExcludeRule},
* since their contract is almost identical
- *
- *
*/
-public abstract class AbstractIncludeExcludeRule extends UnmodifiableExtendableItem
- implements ConfigurationAware {
+public abstract class AbstractIncludeExcludeRule extends UnmodifiableExtendableItem implements
+ ConfigurationAware {
private ArtifactId id;
+
private Collection confs = new ArrayList();
+
private PatternMatcher patternMatcher;
-
+
public AbstractIncludeExcludeRule(ArtifactId aid, PatternMatcher matcher, Map extraAttributes) {
- super(null, extraAttributes);
+ super(null, extraAttributes);
id = aid;
patternMatcher = matcher;
initStandardAttributes();
}
- private void initStandardAttributes() {
- setStandardAttribute(IvyPatternHelper.ORGANISATION_KEY, id.getModuleId().getOrganisation());
+ private void initStandardAttributes() {
+ setStandardAttribute(IvyPatternHelper.ORGANISATION_KEY, id.getModuleId().getOrganisation());
setStandardAttribute(IvyPatternHelper.MODULE_KEY, id.getModuleId().getName());
setStandardAttribute(IvyPatternHelper.ARTIFACT_KEY, id.getName());
setStandardAttribute(IvyPatternHelper.TYPE_KEY, id.getType());
setStandardAttribute(IvyPatternHelper.EXT_KEY, id.getExt());
setStandardAttribute("matcher", patternMatcher.getName());
- }
-
- public boolean equals(Object obj) {
+ }
+
+ public boolean equals(Object obj) {
if (!(obj instanceof AbstractIncludeExcludeRule)) {
return false;
}
- AbstractIncludeExcludeRule rule = (AbstractIncludeExcludeRule)obj;
+ AbstractIncludeExcludeRule rule = (AbstractIncludeExcludeRule) obj;
return getId().equals(rule.getId());
}
-
+
public int hashCode() {
return getId().hashCode();
}
-
+
/**
* Add a configuration for this rule
+ *
* @param conf
*/
public void addConfiguration(String conf) {
confs.add(conf);
}
-
+
public ArtifactId getId() {
return id;
}
@@ -87,7 +88,7 @@
return patternMatcher;
}
- public String toString() {
- return id +"("+ confs +")";
- }
+ public String toString() {
+ return id + "(" + confs + ")";
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Artifact.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Artifact.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Artifact.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Artifact.java Tue Jun 5 05:02:27 2007
@@ -24,59 +24,67 @@
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.util.extendable.ExtendableItem;
-
-
/**
- * Representation of a published 'file' in the development environment. An artifact is generally a file
- * that is produced by a project build. This is typically a jar, a war, an ear, a zip, a deb, ...
+ * Representation of a published 'file' in the development environment. An artifact is generally a
+ * file that is produced by a project build. This is typically a jar, a war, an ear, a zip, a deb,
+ * ...
*/
public interface Artifact extends ExtendableItem {
/**
* Returns the resolved module revision id for this artifact
+ *
* @return the resolved module revision id.
*/
ModuleRevisionId getModuleRevisionId();
/**
* Returns the resolved publication date for this artifact
+ *
* @return the resolved publication date. Never null.
*/
Date getPublicationDate();
/**
* Return the name of the artifact, generally 'part' of the basename of the file.
+ *
* @return the name of the artifact. Never null.
*/
String getName();
/**
* Returns the type of the artifact, typically 'jar', 'source', 'javadoc', 'debian', ...
+ *
* @return the type of the artifact. Never null.
*/
String getType();
/**
- * Retrieve the extension of the artifact. The extension is without dot (ie. 'jar' and not '.jar')
+ * Retrieve the extension of the artifact. The extension is without dot (ie. 'jar' and not
+ * '.jar')
+ *
* @return the extension of the artifact. Never null.
*/
String getExt();
/**
- * Returns the url at which this artifact can be found independently of ivy configuration.
- * This can be null (and is usually for standard artifacts)
+ * Returns the url at which this artifact can be found independently of ivy configuration. This
+ * can be null (and is usually for standard artifacts)
+ *
* @return url at which this artifact can be found independently of ivy configuration
*/
URL getUrl();
/**
* Returns the list of configurations where this artifact is associated to.
+ *
* @return the list of configuration this artifact is associated to. Never null.
*/
String[] getConfigurations();
/**
* Return the specific identifier of this artifact.
+ *
* @return the id of the artifact
*/
ArtifactRevisionId getId();
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Configuration.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Configuration.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/Configuration.java Tue Jun 5 05:02:27 2007
@@ -22,50 +22,56 @@
import org.apache.ivy.util.extendable.DefaultExtendableItem;
-
-
/**
* Represents a module configuration
*/
public class Configuration extends DefaultExtendableItem {
public static class Visibility {
public static Visibility PUBLIC = new Visibility("public");
+
public static Visibility PRIVATE = new Visibility("private");
+
public static Visibility getVisibility(String name) {
if ("private".equals(name)) {
return PRIVATE;
} else if ("public".equals(name)) {
return PUBLIC;
} else {
- throw new IllegalArgumentException("unknwon visibility "+name);
+ throw new IllegalArgumentException("unknwon visibility " + name);
}
}
+
private String name;
+
private Visibility(String name) {
this.name = name;
}
+
public String toString() {
return name;
}
}
-
+
private String name;
+
private String description;
+
private String[] _extends;
+
private Visibility visibility;
+
private boolean transitive = true;
-
+
/**
* @param name
* @param visibility
* @param description
* @param ext
*/
- public Configuration(String name, Visibility visibility,
- String description, String[] ext) {
+ public Configuration(String name, Visibility visibility, String description, String[] ext) {
this(name, visibility, description, ext, true);
}
-
+
/**
* @param name
* @param visibility
@@ -73,8 +79,8 @@
* @param ext
* @param transitive
*/
- public Configuration(String name, Visibility visibility,
- String description, String[] ext, boolean transitive) {
+ public Configuration(String name, Visibility visibility, String description, String[] ext,
+ boolean transitive) {
if (name == null) {
throw new NullPointerException("null configuration name not allowed");
}
@@ -92,71 +98,74 @@
_extends[i] = ext[i].trim();
}
}
- this.transitive =transitive;
+ this.transitive = transitive;
}
-
+
/**
* @param name
*/
public Configuration(String name) {
this(name, Visibility.PUBLIC, null, null);
}
-
+
/**
* @return Returns the description. It may be null.
*/
public String getDescription() {
return description;
}
+
/**
* @return Returns the extends. May be empty, but never null.
*/
public String[] getExtends() {
return _extends;
}
+
/**
* @return Returns the name. Never null;
*/
public String getName() {
return name;
}
+
/**
* @return Returns the visibility. Never null.
*/
public Visibility getVisibility() {
return visibility;
}
-
+
/**
* @return Returns the transitive.
*/
public final boolean isTransitive() {
return transitive;
}
-
+
public String toString() {
return name;
}
-
+
public boolean equals(Object obj) {
- if (! (obj instanceof Configuration)) {
+ if (!(obj instanceof Configuration)) {
return false;
}
- return ((Configuration)obj).getName().equals(getName());
+ return ((Configuration) obj).getName().equals(getName());
}
-
+
public int hashCode() {
return getName().hashCode();
}
-
+
public void replaceWildcards(ModuleDescriptor md) {
if (this != md.getConfiguration(name)) {
throw new IllegalArgumentException(
- "The given ModuleDescriptor doesn't own this configuration!");
+ "The given ModuleDescriptor doesn't own this configuration!");
}
-
+
Configuration[] configs = md.getConfigurations();
-
+
Set newExtends = new LinkedHashSet();
for (int j = 0; j < _extends.length; j++) {
if ("*".equals(_extends[j])) {
@@ -169,10 +178,10 @@
newExtends.add(_extends[j]);
}
}
-
+
this._extends = (String[]) newExtends.toArray(new String[newExtends.size()]);
}
-
+
private void addOther(Configuration[] allConfigs, Visibility visibility, Set configs) {
for (int i = 0; i < allConfigs.length; i++) {
String currentName = allConfigs[i].getName();
@@ -182,5 +191,5 @@
}
}
}
-
+
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationAware.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationAware.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationAware.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/ConfigurationAware.java Tue Jun 5 05:02:27 2007
@@ -18,20 +18,22 @@
package org.apache.ivy.core.module.descriptor;
/**
- * Objects implementing this interface are aware of module configurations,
- * and can thus be added to configurations, and list their configurations.
- *
+ * Objects implementing this interface are aware of module configurations, and can thus be added to
+ * configurations, and list their configurations.
*/
public interface ConfigurationAware {
/**
* Returns the configurations of the module to which the object is attached
+ *
* @return an array of configuration names to which the object is attached
*/
public String[] getConfigurations();
/**
* Tells this object that it will now be part of the given configuration
- * @param confName the name of the configuration to which the object is now attached
+ *
+ * @param confName
+ * the name of the configuration to which the object is now attached
*/
public void addConfiguration(String confName);
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java Tue Jun 5 05:02:27 2007
@@ -32,35 +32,48 @@
public static Artifact newIvyArtifact(ModuleRevisionId mrid, Date pubDate) {
return new DefaultArtifact(mrid, pubDate, "ivy", "ivy", "xml");
}
-
+
public static Artifact newPomArtifact(ModuleRevisionId mrid, Date pubDate) {
return new DefaultArtifact(mrid, pubDate, mrid.getName(), "pom", "pom");
}
-
+
public static Artifact cloneWithAnotherType(Artifact artifact, String newType) {
- return new DefaultArtifact(artifact.getModuleRevisionId(), artifact.getPublicationDate(), artifact.getName(), newType, artifact.getExt(), artifact.getUrl(), artifact.getExtraAttributes());
+ return new DefaultArtifact(artifact.getModuleRevisionId(), artifact.getPublicationDate(),
+ artifact.getName(), newType, artifact.getExt(), artifact.getUrl(), artifact
+ .getExtraAttributes());
}
-
- public static Artifact cloneWithAnotherTypeAndExt(Artifact artifact, String newType, String newExt) {
- return new DefaultArtifact(artifact.getModuleRevisionId(), artifact.getPublicationDate(), artifact.getName(), newType, newExt, artifact.getUrl(), artifact.getExtraAttributes());
+
+ public static Artifact cloneWithAnotherTypeAndExt(Artifact artifact, String newType,
+ String newExt) {
+ return new DefaultArtifact(artifact.getModuleRevisionId(), artifact.getPublicationDate(),
+ artifact.getName(), newType, newExt, artifact.getUrl(), artifact
+ .getExtraAttributes());
+ }
+
+ public static Artifact cloneWithAnotherMrid(Artifact artifact, ModuleRevisionId mrid) {
+ return new DefaultArtifact(mrid, artifact.getPublicationDate(), artifact.getName(),
+ artifact.getType(), artifact.getExt(), artifact.getUrl(), artifact
+ .getExtraAttributes());
}
- public static Artifact cloneWithAnotherMrid(Artifact artifact, ModuleRevisionId mrid) {
- return new DefaultArtifact(mrid, artifact.getPublicationDate(), artifact.getName(), artifact.getType(), artifact.getExt(), artifact.getUrl(), artifact.getExtraAttributes());
- }
-
Date publicationDate;
+
ArtifactRevisionId arid;
+
URL url;
-
- public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type, String ext) {
+
+ public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type,
+ String ext) {
this(mrid, publicationDate, name, type, ext, null, null);
}
-
- public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type, String ext, Map extraAttributes) {
- this(mrid, publicationDate, name, type, ext, null, extraAttributes);
+
+ public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type,
+ String ext, Map extraAttributes) {
+ this(mrid, publicationDate, name, type, ext, null, extraAttributes);
}
- public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type, String ext, URL url, Map extraAttributes) {
+
+ public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type,
+ String ext, URL url, Map extraAttributes) {
if (mrid == null) {
throw new NullPointerException("null mrid not allowed");
}
@@ -81,22 +94,26 @@
this.url = url;
}
-
- public ModuleRevisionId getModuleRevisionId() {
+ public ModuleRevisionId getModuleRevisionId() {
return arid.getModuleRevisionId();
}
+
public String getName() {
return arid.getName();
}
+
public Date getPublicationDate() {
return publicationDate;
}
+
public String getType() {
return arid.getType();
}
+
public String getExt() {
return arid.getExt();
}
+
public ArtifactRevisionId getId() {
return arid;
}
@@ -105,8 +122,8 @@
return new String[0];
}
- public URL getUrl() {
- return url;
- }
+ public URL getUrl() {
+ return url;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java Tue Jun 5 05:02:27 2007
@@ -25,25 +25,28 @@
import org.apache.ivy.core.IvyPatternHelper;
import org.apache.ivy.util.extendable.UnmodifiableExtendableItem;
-
-public class DefaultDependencyArtifactDescriptor extends UnmodifiableExtendableItem
- implements DependencyArtifactDescriptor, ConfigurationAware {
+public class DefaultDependencyArtifactDescriptor extends UnmodifiableExtendableItem implements
+ DependencyArtifactDescriptor, ConfigurationAware {
private Collection confs = new ArrayList();
- private URL url;
- private String name;
- private String type;
- private String ext;
-
- /**
+
+ private URL url;
+
+ private String name;
+
+ private String type;
+
+ private String ext;
+
+ /**
* @param dd
* @param name
* @param type
- * @param url
+ * @param url
*/
- public DefaultDependencyArtifactDescriptor(
- String name, String type, String ext, URL url, Map extraAttributes) {
- super(null, extraAttributes);
+ public DefaultDependencyArtifactDescriptor(String name, String type, String ext, URL url,
+ Map extraAttributes) {
+ super(null, extraAttributes);
if (name == null) {
throw new NullPointerException("name must not be null");
}
@@ -60,33 +63,34 @@
initStandardAttributes();
}
- private void initStandardAttributes() {
+ private void initStandardAttributes() {
setStandardAttribute(IvyPatternHelper.ARTIFACT_KEY, getName());
setStandardAttribute(IvyPatternHelper.TYPE_KEY, getType());
setStandardAttribute(IvyPatternHelper.EXT_KEY, getExt());
setStandardAttribute("url", url != null ? String.valueOf(url) : "");
- }
-
- public boolean equals(Object obj) {
+ }
+
+ public boolean equals(Object obj) {
if (!(obj instanceof DependencyArtifactDescriptor)) {
return false;
}
- DependencyArtifactDescriptor dad = (DependencyArtifactDescriptor)obj;
+ DependencyArtifactDescriptor dad = (DependencyArtifactDescriptor) obj;
return getAttributes().equals(dad.getAttributes());
}
-
+
public int hashCode() {
return getAttributes().hashCode();
}
-
+
/**
* Add a configuration for this artifact.
+ *
* @param conf
*/
public void addConfiguration(String conf) {
confs.add(conf);
}
-
+
public String getName() {
return name;
}
@@ -94,6 +98,7 @@
public String getType() {
return type;
}
+
public String getExt() {
return ext;
}
@@ -102,12 +107,12 @@
return (String[]) confs.toArray(new String[confs.size()]);
}
+ public URL getUrl() {
+ return url;
+ }
- public URL getUrl() {
- return url;
- }
-
- public String toString() {
- return "DA:"+ name +"."+ ext +"("+ type +") "+"("+ confs +")"+(url ==null?"": url.toString());
- }
+ public String toString() {
+ return "DA:" + name + "." + ext + "(" + type + ") " + "(" + confs + ")"
+ + (url == null ? "" : url.toString());
+ }
}