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 [23/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/plugins/resolver/ChainResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java Tue Jun 5 05:02:27 2007
@@ -40,7 +40,6 @@
import org.apache.ivy.plugins.resolver.util.ResolvedModuleRevisionProxy;
import org.apache.ivy.util.Message;
-
/**
*
*/
@@ -63,19 +62,22 @@
}
private boolean _returnFirst = false;
+
private List _chain = new ArrayList();
+
private boolean _dual;
public void add(DependencyResolver resolver) {
_chain.add(resolver);
}
-
- public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
+
+ public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
+ throws ParseException {
data = new ResolveData(data, doValidate(data));
ResolvedModuleRevision ret = null;
-
+
List errors = new ArrayList();
-
+
for (Iterator iter = _chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
LatestStrategy oldLatest = setLatestIfRequired(resolver, getLatestStrategy());
@@ -83,8 +85,9 @@
try {
mr = resolver.getDependency(dd, data);
} catch (Exception ex) {
- Message.verbose("problem occured while resolving "+dd+" with "+resolver+": "+ex);
- errors.add(ex);
+ Message.verbose("problem occured while resolving " + dd + " with " + resolver
+ + ": " + ex);
+ errors.add(ex);
} finally {
if (oldLatest != null) {
setLatest(resolver, oldLatest);
@@ -93,25 +96,31 @@
checkInterrupted();
if (mr != null) {
boolean shouldReturn = _returnFirst;
- shouldReturn |= !getSettings().getVersionMatcher().isDynamic(dd.getDependencyRevisionId()) && ret != null && !ret.getDescriptor().isDefault();
+ shouldReturn |= !getSettings().getVersionMatcher().isDynamic(
+ dd.getDependencyRevisionId())
+ && ret != null && !ret.getDescriptor().isDefault();
if (!shouldReturn) {
// check if latest is asked and compare to return the most recent
- String mrDesc = mr.getId()+(mr.getDescriptor().isDefault()?"[default]":"")+" from "+mr.getResolver().getName();
- Message.debug("\tchecking "+mrDesc+" against "+ret);
+ String mrDesc = mr.getId()
+ + (mr.getDescriptor().isDefault() ? "[default]" : "") + " from "
+ + mr.getResolver().getName();
+ Message.debug("\tchecking " + mrDesc + " against " + ret);
if (ret == null) {
- Message.debug("\tmodule revision kept as first found: "+mrDesc);
+ Message.debug("\tmodule revision kept as first found: " + mrDesc);
ret = mr;
} else if (isAfter(mr, ret, data.getDate())) {
- Message.debug("\tmodule revision kept as younger: "+mrDesc);
+ Message.debug("\tmodule revision kept as younger: " + mrDesc);
ret = mr;
} else if (!mr.getDescriptor().isDefault() && ret.getDescriptor().isDefault()) {
- Message.debug("\tmodule revision kept as better (not default): "+mrDesc);
- ret = mr;
+ Message.debug("\tmodule revision kept as better (not default): " + mrDesc);
+ ret = mr;
} else {
- Message.debug("\tmodule revision discarded as older: "+mrDesc);
+ Message.debug("\tmodule revision discarded as older: " + mrDesc);
}
- if (!getSettings().getVersionMatcher().isDynamic(dd.getDependencyRevisionId()) && !ret.getDescriptor().isDefault()) {
- Message.debug("\tmodule revision found and is not default: returning "+mrDesc);
+ if (!getSettings().getVersionMatcher().isDynamic(dd.getDependencyRevisionId())
+ && !ret.getDescriptor().isDefault()) {
+ Message.debug("\tmodule revision found and is not default: returning "
+ + mrDesc);
return resolvedRevision(mr);
}
} else {
@@ -120,28 +129,29 @@
}
}
if (ret == null && !errors.isEmpty()) {
- if (errors.size() == 1) {
- Exception ex = (Exception) errors.get(0);
- if (ex instanceof RuntimeException) {
- throw (RuntimeException)ex;
- } else if (ex instanceof ParseException) {
- throw (ParseException)ex;
- } else {
- throw new RuntimeException(ex.toString(), ex);
- }
- } else {
- StringBuffer err = new StringBuffer();
- for (Iterator iter = errors.iterator(); iter.hasNext();) {
- Exception ex = (Exception) iter.next();
- err.append(ex).append("\n");
- }
- err.setLength(err.length() - 1);
- throw new RuntimeException("several problems occured while resolving "+dd+":\n"+err);
- }
+ if (errors.size() == 1) {
+ Exception ex = (Exception) errors.get(0);
+ if (ex instanceof RuntimeException) {
+ throw (RuntimeException) ex;
+ } else if (ex instanceof ParseException) {
+ throw (ParseException) ex;
+ } else {
+ throw new RuntimeException(ex.toString(), ex);
+ }
+ } else {
+ StringBuffer err = new StringBuffer();
+ for (Iterator iter = errors.iterator(); iter.hasNext();) {
+ Exception ex = (Exception) iter.next();
+ err.append(ex).append("\n");
+ }
+ err.setLength(err.length() - 1);
+ throw new RuntimeException("several problems occured while resolving " + dd + ":\n"
+ + err);
+ }
}
return resolvedRevision(ret);
}
-
+
private ResolvedModuleRevision resolvedRevision(ResolvedModuleRevision mr) {
if (isDual() && mr != null) {
return new ResolvedModuleRevisionProxy(mr, this);
@@ -149,9 +159,9 @@
return mr;
}
}
-
- private LatestStrategy setLatestIfRequired(DependencyResolver resolver, LatestStrategy latestStrategy) {
+ private LatestStrategy setLatestIfRequired(DependencyResolver resolver,
+ LatestStrategy latestStrategy) {
String latestName = getLatestStrategyName(resolver);
if (latestName != null && !"default".equals(latestName)) {
LatestStrategy oldLatest = getLatest(resolver);
@@ -163,17 +173,16 @@
}
/**
- * Returns true if rmr1 is after rmr2, using the latest strategy to determine
- * which is the latest
+ * Returns true if rmr1 is after rmr2, using the latest strategy to determine which is the
+ * latest
+ *
* @param rmr1
* @param rmr2
* @return
*/
private boolean isAfter(ResolvedModuleRevision rmr1, ResolvedModuleRevision rmr2, Date date) {
- ArtifactInfo[] ais = new ArtifactInfo[] {
- new ResolvedModuleRevisionArtifactInfo(rmr2),
- new ResolvedModuleRevisionArtifactInfo(rmr1)
- };
+ ArtifactInfo[] ais = new ArtifactInfo[] {new ResolvedModuleRevisionArtifactInfo(rmr2),
+ new ResolvedModuleRevisionArtifactInfo(rmr1)};
return getLatestStrategy().findLatest(ais, date) != ais[0];
}
@@ -196,7 +205,8 @@
DownloadReport report = new DownloadReport();
for (Iterator iter = _chain.iterator(); iter.hasNext() && !artifactsToDownload.isEmpty();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
- DownloadReport r = resolver.download((Artifact[])artifactsToDownload.toArray(new Artifact[artifactsToDownload.size()]), options);
+ DownloadReport r = resolver.download((Artifact[]) artifactsToDownload
+ .toArray(new Artifact[artifactsToDownload.size()]), options);
ArtifactDownloadReport[] adr = r.getArtifactsReports();
for (int i = 0; i < adr.length; i++) {
if (adr[i].getDownloadStatus() != DownloadStatus.FAILED) {
@@ -206,43 +216,46 @@
}
}
for (Iterator iter = artifactsToDownload.iterator(); iter.hasNext();) {
- Artifact art = (Artifact)iter.next();
+ Artifact art = (Artifact) iter.next();
ArtifactDownloadReport adr = new ArtifactDownloadReport(art);
adr.setDownloadStatus(DownloadStatus.FAILED);
report.addArtifactReport(adr);
}
return report;
}
+
public List getResolvers() {
return _chain;
}
+
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
if (_chain.isEmpty()) {
throw new IllegalStateException("invalid chain resolver with no sub resolver");
}
- ((DependencyResolver)_chain.get(0)).publish(artifact, src, overwrite);
+ ((DependencyResolver) _chain.get(0)).publish(artifact, src, overwrite);
}
+
public boolean isReturnFirst() {
return _returnFirst;
}
-
+
public void setReturnFirst(boolean returnFirst) {
_returnFirst = returnFirst;
}
-
+
public void dumpSettings() {
- Message.verbose("\t"+getName()+" [chain] "+_chain);
- Message.debug("\t\treturn first: "+isReturnFirst());
- Message.debug("\t\tdual: "+isDual());
+ Message.verbose("\t" + getName() + " [chain] " + _chain);
+ Message.debug("\t\treturn first: " + isReturnFirst());
+ Message.debug("\t\tdual: " + isDual());
for (Iterator iter = _chain.iterator(); iter.hasNext();) {
- DependencyResolver r = (DependencyResolver)iter.next();
- Message.debug("\t\t-> "+r.getName());
+ DependencyResolver r = (DependencyResolver) iter.next();
+ Message.debug("\t\t-> " + r.getName());
}
}
-
+
public boolean exists(Artifact artifact) {
for (Iterator iter = _chain.iterator(); iter.hasNext();) {
- DependencyResolver resolver = (DependencyResolver)iter.next();
+ DependencyResolver resolver = (DependencyResolver) iter.next();
if (resolver.exists(artifact)) {
return true;
}
@@ -250,17 +263,16 @@
return false;
}
-
private static void setLatest(DependencyResolver resolver, LatestStrategy latest) {
if (resolver instanceof HasLatestStrategy) {
- HasLatestStrategy r = (HasLatestStrategy)resolver;
+ HasLatestStrategy r = (HasLatestStrategy) resolver;
r.setLatestStrategy(latest);
}
}
private static LatestStrategy getLatest(DependencyResolver resolver) {
if (resolver instanceof HasLatestStrategy) {
- HasLatestStrategy r = (HasLatestStrategy)resolver;
+ HasLatestStrategy r = (HasLatestStrategy) resolver;
return r.getLatestStrategy();
}
return null;
@@ -268,7 +280,7 @@
private static String getLatestStrategyName(DependencyResolver resolver) {
if (resolver instanceof HasLatestStrategy) {
- HasLatestStrategy r = (HasLatestStrategy)resolver;
+ HasLatestStrategy r = (HasLatestStrategy) resolver;
return r.getLatest();
}
return null;
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java Tue Jun 5 05:02:27 2007
@@ -32,60 +32,67 @@
import org.apache.ivy.core.search.OrganisationEntry;
import org.apache.ivy.core.search.RevisionEntry;
-
/**
*
*/
public interface DependencyResolver {
String getName();
+
/**
* Should only be used by configurator
- * @param name the new name of the resolver
+ *
+ * @param name
+ * the new name of the resolver
*/
void setName(String name);
+
/**
- * Resolve a module by id, getting its module descriptor and
- * resolving the revision if it's a latest one (i.e. a revision
- * uniquely identifying the revision of a module in the current environment -
- * If this revision is not able to identify uniquelely the revision of the module
+ * Resolve a module by id, getting its module descriptor and resolving the revision if it's a
+ * latest one (i.e. a revision uniquely identifying the revision of a module in the current
+ * environment - If this revision is not able to identify uniquelely the revision of the module
* outside of the current environment, then the resolved revision must begin by ##)
+ *
* @throws ParseException
*/
- ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException;
+ ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
+ throws ParseException;
+
DownloadReport download(Artifact[] artifacts, DownloadOptions options);
+
boolean exists(Artifact artifact);
+
void publish(Artifact artifact, File src, boolean overwrite) throws IOException;
-
+
/**
* Reports last resolve failure as Messages
*/
void reportFailure();
+
/**
* Reports last artifact download failure as Messages
+ *
* @param art
*/
void reportFailure(Artifact art);
-
+
// listing methods, enable to know what is available from this resolver
// the listing methods must only list entries directly
// available from them, no recursion is needed as long as sub resolvers
// are registered in ivy too.
-
+
/**
- * List all the values the given token can take if other tokens are set
- * as described in the otherTokenValues map.
- *
- * For instance, if token = "revision" and the map contains
- * "organisation"->"foo"
- * "module"->"bar"
- *
- * The results will be the list of revisions of the module bar from the org foo.
+ * List all the values the given token can take if other tokens are set as described in the
+ * otherTokenValues map. For instance, if token = "revision" and the map contains
+ * "organisation"->"foo" "module"->"bar" The results will be the list of revisions of the module
+ * bar from the org foo.
*/
String[] listTokenValues(String token, Map otherTokenValues);
-
+
OrganisationEntry[] listOrganisations();
+
ModuleEntry[] listModules(OrganisationEntry org);
+
RevisionEntry[] listRevisions(ModuleEntry module);
-
+
void dumpSettings();
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java Tue Jun 5 05:02:27 2007
@@ -30,26 +30,21 @@
import org.apache.ivy.plugins.resolver.util.ResolvedModuleRevisionProxy;
import org.apache.ivy.util.Message;
-
/**
* DualResolver is used to resolve dependencies with one dependency revolver, called ivy resolver,
* and then download artifacts found in the resolved dependencies from a second dependency resolver,
- * called artifact resolver.
- *
- * It is especially useful with resolvers using repository where there is a lot of artifact, but no
- * ivy file, like the maven ibiblio repository.
- *
- * If no ivy file is found by the ivy resolver, the artifact resolver is used to check if there is
- * artifact corresponding to the request (with default ivy file).
- *
- * For artifact download, however, only the artifact resolver is used.
- *
- * Exactly two resolvers should be added to this resolver for it to work properly. The first resolver added
- * if the ivy resolver, the second is the artifact one.
+ * called artifact resolver. It is especially useful with resolvers using repository where there is
+ * a lot of artifact, but no ivy file, like the maven ibiblio repository. If no ivy file is found by
+ * the ivy resolver, the artifact resolver is used to check if there is artifact corresponding to
+ * the request (with default ivy file). For artifact download, however, only the artifact resolver
+ * is used. Exactly two resolvers should be added to this resolver for it to work properly. The
+ * first resolver added if the ivy resolver, the second is the artifact one.
*/
public class DualResolver extends AbstractResolver {
private DependencyResolver _ivyResolver;
+
private DependencyResolver _artifactResolver;
+
private boolean _allownomd = true;
public void add(DependencyResolver resolver) {
@@ -58,21 +53,24 @@
} else if (_artifactResolver == null) {
_artifactResolver = resolver;
} else {
- throw new IllegalStateException("exactly two resolvers must be added: ivy(1) and artifact(2) one");
+ throw new IllegalStateException(
+ "exactly two resolvers must be added: ivy(1) and artifact(2) one");
}
}
-
- public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
+ public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
+ throws ParseException {
if (_ivyResolver == null || _artifactResolver == null) {
- throw new IllegalStateException("exactly two resolvers must be added: ivy(1) and artifact(2) one");
+ throw new IllegalStateException(
+ "exactly two resolvers must be added: ivy(1) and artifact(2) one");
}
data = new ResolveData(data, doValidate(data));
final ResolvedModuleRevision mr = _ivyResolver.getDependency(dd, data);
if (mr == null) {
checkInterrupted();
if (isAllownomd()) {
- Message.verbose("ivy resolver didn't find "+dd.getDependencyRevisionId()+": trying with artifact resolver");
+ Message.verbose("ivy resolver didn't find " + dd.getDependencyRevisionId()
+ + ": trying with artifact resolver");
return _artifactResolver.getDependency(dd, data);
} else {
return null;
@@ -81,15 +79,15 @@
return new ResolvedModuleRevisionProxy(mr, this);
}
}
-
+
public void reportFailure() {
_ivyResolver.reportFailure();
- _artifactResolver.reportFailure();
+ _artifactResolver.reportFailure();
}
public void reportFailure(Artifact art) {
_ivyResolver.reportFailure(art);
- _artifactResolver.reportFailure(art);
+ _artifactResolver.reportFailure(art);
}
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
@@ -99,15 +97,19 @@
public DependencyResolver getArtifactResolver() {
return _artifactResolver;
}
+
public void setArtifactResolver(DependencyResolver artifactResolver) {
_artifactResolver = artifactResolver;
}
+
public DependencyResolver getIvyResolver() {
return _ivyResolver;
}
+
public void setIvyResolver(DependencyResolver ivyResolver) {
_ivyResolver = ivyResolver;
}
+
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
if ("ivy".equals(artifact.getType())) {
_ivyResolver.publish(artifact, src, overwrite);
@@ -115,23 +117,23 @@
_artifactResolver.publish(artifact, src, overwrite);
}
}
-
+
public void dumpSettings() {
if (_ivyResolver == null || _artifactResolver == null) {
- throw new IllegalStateException("exactly two resolvers must be added: ivy(1) and artifact(2) one");
+ throw new IllegalStateException(
+ "exactly two resolvers must be added: ivy(1) and artifact(2) one");
}
- Message.verbose("\t"+getName()+" [dual "+_ivyResolver.getName()+" "+_artifactResolver.getName()+"]");
+ Message.verbose("\t" + getName() + " [dual " + _ivyResolver.getName() + " "
+ + _artifactResolver.getName() + "]");
}
-
+
public boolean exists(Artifact artifact) {
return _artifactResolver.exists(artifact);
}
-
public boolean isAllownomd() {
return _allownomd;
}
-
public void setAllownomd(boolean allownomd) {
_allownomd = allownomd;
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java Tue Jun 5 05:02:27 2007
@@ -25,18 +25,21 @@
public FileSystemResolver() {
setRepository(new FileRepository());
}
+
public String getTypeName() {
return "file";
}
- public boolean isLocal() {
- return getFileRepository().isLocal();
- }
- public void setLocal(boolean local) {
- getFileRepository().setLocal(local);
- }
- private FileRepository getFileRepository() {
- return (FileRepository) getRepository();
- }
-
+ public boolean isLocal() {
+ return getFileRepository().isLocal();
+ }
+
+ public void setLocal(boolean local) {
+ getFileRepository().setLocal(local);
+ }
+
+ private FileRepository getFileRepository() {
+ return (FileRepository) getRepository();
+ }
+
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java Tue Jun 5 05:02:27 2007
@@ -40,29 +40,33 @@
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
import org.apache.ivy.util.Message;
-
/**
- * IBiblioResolver is a resolver which can be used to resolve dependencies found
- * in the ibiblio maven repository, or similar repositories.
- * For more flexibility with url and patterns, see {@link org.apache.ivy.plugins.resolver.URLResolver}.
+ * IBiblioResolver is a resolver which can be used to resolve dependencies found in the ibiblio
+ * maven repository, or similar repositories. For more flexibility with url and patterns, see
+ * {@link org.apache.ivy.plugins.resolver.URLResolver}.
*/
public class IBiblioResolver extends URLResolver {
public static final String DEFAULT_PATTERN = "[module]/[type]s/[artifact]-[revision].[ext]";
+
public static final String DEFAULT_ROOT = "http://www.ibiblio.org/maven/";
+
private String _root = null;
+
private String _pattern = null;
-
+
// use poms if m2 compatible is true
private boolean _usepoms = true;
-
+
public IBiblioResolver() {
}
-
+
protected ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
if (isM2compatible() && isUsepoms()) {
ModuleRevisionId mrid = dd.getDependencyRevisionId();
mrid = convertM2IdForResourceSearch(mrid);
- ResolvedResource rres = findResourceUsingPatterns(mrid, getIvyPatterns(), DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data), data.getDate());
+ ResolvedResource rres = findResourceUsingPatterns(mrid, getIvyPatterns(),
+ DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data), data
+ .getDate());
return rres;
} else {
return null;
@@ -72,16 +76,16 @@
public void setM2compatible(boolean m2compatible) {
super.setM2compatible(m2compatible);
if (m2compatible) {
- if (_root == null) {
- _root = "http://repo1.maven.org/maven2/";
- }
- if (_pattern == null) {
- _pattern = "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]";
- }
+ if (_root == null) {
+ _root = "http://repo1.maven.org/maven2/";
+ }
+ if (_pattern == null) {
+ _pattern = "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]";
+ }
updateWholePattern();
}
}
-
+
public void ensureConfigured(IvySettings settings) {
if (settings != null && (_root == null || _pattern == null)) {
if (_root == null) {
@@ -108,10 +112,12 @@
private String getWholePattern() {
return _root + _pattern;
- }
+ }
+
public String getPattern() {
return _pattern;
}
+
public void setPattern(String pattern) {
if (pattern == null) {
throw new NullPointerException("pattern must not be null");
@@ -120,14 +126,19 @@
ensureConfigured(getSettings());
updateWholePattern();
}
+
public String getRoot() {
return _root;
}
+
/**
- * Sets the root of the maven like repository.
- * The maven like repository is necessarily an http repository.
- * @param root the root of the maven like repository
- * @throws IllegalArgumentException if root does not start with "http://"
+ * Sets the root of the maven like repository. The maven like repository is necessarily an http
+ * repository.
+ *
+ * @param root
+ * the root of the maven like repository
+ * @throws IllegalArgumentException
+ * if root does not start with "http://"
*/
public void setRoot(String root) {
if (root == null) {
@@ -141,83 +152,92 @@
ensureConfigured(getSettings());
updateWholePattern();
}
-
+
private void updateWholePattern() {
if (isM2compatible() && isUsepoms()) {
setIvyPatterns(Collections.singletonList(getWholePattern()));
}
setArtifactPatterns(Collections.singletonList(getWholePattern()));
}
+
public void publish(Artifact artifact, File src) {
throw new UnsupportedOperationException("publish not supported by IBiblioResolver");
}
+
// we do not allow to list organisations on ibiblio, nor modules in ibiblio 1
public String[] listTokenValues(String token, Map otherTokenValues) {
- if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) {
- return new String[0];
- }
- if (IvyPatternHelper.MODULE_KEY.equals(token) && !isM2compatible()) {
- return new String[0];
- }
+ if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) {
+ return new String[0];
+ }
+ if (IvyPatternHelper.MODULE_KEY.equals(token) && !isM2compatible()) {
+ return new String[0];
+ }
ensureConfigured(getSettings());
- return super.listTokenValues(token, otherTokenValues);
+ return super.listTokenValues(token, otherTokenValues);
}
+
public OrganisationEntry[] listOrganisations() {
return new OrganisationEntry[0];
}
+
public ModuleEntry[] listModules(OrganisationEntry org) {
- if (isM2compatible()) {
+ if (isM2compatible()) {
ensureConfigured(getSettings());
return super.listModules(org);
- }
+ }
return new ModuleEntry[0];
- }
+ }
+
public RevisionEntry[] listRevisions(ModuleEntry mod) {
ensureConfigured(getSettings());
return super.listRevisions(mod);
}
+
public String getTypeName() {
return "ibiblio";
}
- // override some methods to ensure configuration
- public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
+ // override some methods to ensure configuration
+ public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
+ throws ParseException {
ensureConfigured(data.getSettings());
return super.getDependency(dd, data);
}
-
+
protected ResolvedResource findArtifactRef(Artifact artifact, Date date) {
ensureConfigured(getSettings());
return super.findArtifactRef(artifact, date);
}
-
+
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
ensureConfigured(options.getSettings());
return super.download(artifacts, options);
}
+
public boolean exists(Artifact artifact) {
ensureConfigured(getSettings());
return super.exists(artifact);
}
+
public List getArtifactPatterns() {
ensureConfigured(getSettings());
return super.getArtifactPatterns();
}
- public boolean isUsepoms() {
- return _usepoms;
- }
-
- public void setUsepoms(boolean usepoms) {
- _usepoms = usepoms;
- updateWholePattern();
- }
-
- public void dumpSettings() {
- ensureConfigured(getSettings());
- super.dumpSettings();
- Message.debug("\t\troot: "+getRoot());
- Message.debug("\t\tpattern: "+getPattern());
- Message.debug("\t\tusepoms: "+_usepoms);
- }
+ public boolean isUsepoms() {
+ return _usepoms;
+ }
+
+ public void setUsepoms(boolean usepoms) {
+ _usepoms = usepoms;
+ updateWholePattern();
+ }
+
+ public void dumpSettings() {
+ ensureConfigured(getSettings());
+ super.dumpSettings();
+ Message.debug("\t\troot: " + getRoot());
+ Message.debug("\t\tpattern: " + getPattern());
+ Message.debug("\t\tusepoms: " + _usepoms);
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java Tue Jun 5 05:02:27 2007
@@ -47,20 +47,23 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-
/**
- * IvyRepResolver is a resolver which can be used to resolve dependencies found
- * in the ivy official repository for ivy files and ibiblio maven repository for the artifacts,
- * or similar repositories.
- * For more flexibility with url and patterns, see {@link org.apache.ivy.plugins.resolver.URLResolver}.
+ * IvyRepResolver is a resolver which can be used to resolve dependencies found in the ivy official
+ * repository for ivy files and ibiblio maven repository for the artifacts, or similar repositories.
+ * For more flexibility with url and patterns, see
+ * {@link org.apache.ivy.plugins.resolver.URLResolver}.
*/
public class IvyRepResolver extends URLResolver {
public static final String DEFAULT_IVYPATTERN = "[organisation]/[module]/ivy-[revision].xml";
+
public static final String DEFAULT_IVYROOT = "http://ivyrep.jayasoft.org/";
+
private String _ivyroot = null;
+
private String _ivypattern = null;
private String _artroot = null;
+
private String _artpattern = null;
public IvyRepResolver() {
@@ -119,13 +122,16 @@
return null;
}
return _ivyroot + _ivypattern;
- }
+ }
+
private String getWholeArtPattern() {
return _artroot + _artpattern;
- }
+ }
+
public String getIvypattern() {
return _ivypattern;
}
+
public void setIvypattern(String pattern) {
if (pattern == null) {
throw new NullPointerException("pattern must not be null");
@@ -134,14 +140,19 @@
ensureIvyConfigured(getSettings());
updateWholeIvyPattern();
}
+
public String getIvyroot() {
return _ivyroot;
}
+
/**
- * Sets the root of the maven like repository.
- * The maven like repository is necessarily an http repository.
- * @param root the root of the maven like repository
- * @throws IllegalArgumentException if root does not start with "http://"
+ * Sets the root of the maven like repository. The maven like repository is necessarily an http
+ * repository.
+ *
+ * @param root
+ * the root of the maven like repository
+ * @throws IllegalArgumentException
+ * if root does not start with "http://"
*/
public void setIvyroot(String root) {
if (root == null) {
@@ -155,19 +166,22 @@
ensureIvyConfigured(getSettings());
updateWholeIvyPattern();
}
-
+
public void setM2compatible(boolean m2compatible) {
if (m2compatible) {
- throw new IllegalArgumentException("ivyrep does not support maven2 compatibility. Please use ibiblio resolver instead, or even url or filesystem resolvers for more specific needs.");
+ throw new IllegalArgumentException(
+ "ivyrep does not support maven2 compatibility. Please use ibiblio resolver instead, or even url or filesystem resolvers for more specific needs.");
}
}
-
+
private void updateWholeIvyPattern() {
setIvyPatterns(Collections.singletonList(getWholeIvyPattern()));
}
+
private void updateWholeArtPattern() {
setArtifactPatterns(Collections.singletonList(getWholeArtPattern()));
}
+
public void publish(Artifact artifact, File src) {
throw new UnsupportedOperationException("publish not supported by IBiblioResolver");
}
@@ -175,12 +189,10 @@
public String getArtroot() {
return _artroot;
}
-
public String getArtpattern() {
return _artpattern;
}
-
public void setArtpattern(String pattern) {
if (pattern == null) {
@@ -190,7 +202,7 @@
ensureArtifactConfigured(getSettings());
updateWholeArtPattern();
}
-
+
public void setArtroot(String root) {
if (root == null) {
throw new NullPointerException("root must not be null");
@@ -203,14 +215,15 @@
ensureArtifactConfigured(getSettings());
updateWholeArtPattern();
}
-
+
public OrganisationEntry[] listOrganisations() {
ensureIvyConfigured(getSettings());
try {
URL content = new URL(_ivyroot + "content.xml");
final List ret = new ArrayList();
XMLHelper.parse(content, null, new DefaultHandler() {
- public void startElement(String uri,String localName,String qName,org.xml.sax.Attributes attributes) throws SAXException {
+ public void startElement(String uri, String localName, String qName,
+ org.xml.sax.Attributes attributes) throws SAXException {
if ("organisation".equals(qName)) {
String org = attributes.getValue("name");
if (org != null) {
@@ -219,29 +232,30 @@
}
}
});
- return (OrganisationEntry[])ret.toArray(new OrganisationEntry[ret.size()]);
+ return (OrganisationEntry[]) ret.toArray(new OrganisationEntry[ret.size()]);
} catch (MalformedURLException e) {
} catch (Exception e) {
- Message.warn("unable to parse content.xml file on ivyrep: "+e.getMessage());
+ Message.warn("unable to parse content.xml file on ivyrep: " + e.getMessage());
}
return super.listOrganisations();
}
- // overwrite parent to use only ivy patterns (and not artifact ones, cause ibiblio is too slow to answer)
+ // overwrite parent to use only ivy patterns (and not artifact ones, cause ibiblio is too slow
+ // to answer)
public ModuleEntry[] listModules(OrganisationEntry org) {
ensureIvyConfigured(getSettings());
Map tokenValues = new HashMap();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
Collection names = findIvyNames(tokenValues, IvyPatternHelper.MODULE_KEY);
ModuleEntry[] ret = new ModuleEntry[names.size()];
- int i =0;
+ int i = 0;
for (Iterator iter = names.iterator(); iter.hasNext(); i++) {
- String name = (String)iter.next();
+ String name = (String) iter.next();
ret[i] = new ModuleEntry(org, name);
}
return ret;
}
-
+
public RevisionEntry[] listRevisions(ModuleEntry mod) {
ensureIvyConfigured(getSettings());
ensureArtifactConfigured(getSettings());
@@ -251,30 +265,34 @@
public String getTypeName() {
return "ivyrep";
}
-
- // override some methods to ensure configuration
- public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {
+
+ // override some methods to ensure configuration
+ public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
+ throws ParseException {
ensureIvyConfigured(data.getSettings());
return super.getDependency(dd, data);
}
-
+
protected ResolvedResource findArtifactRef(Artifact artifact, Date date) {
ensureArtifactConfigured(getSettings());
return super.findArtifactRef(artifact, date);
}
-
+
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
ensureArtifactConfigured(options.getSettings());
return super.download(artifacts, options);
}
+
public boolean exists(Artifact artifact) {
ensureArtifactConfigured(getSettings());
return super.exists(artifact);
}
+
public List getIvyPatterns() {
ensureIvyConfigured(getSettings());
return super.getIvyPatterns();
}
+
public List getArtifactPatterns() {
ensureArtifactConfigured(getSettings());
return super.getArtifactPatterns();
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java Tue Jun 5 05:02:27 2007
@@ -31,7 +31,6 @@
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.DownloadReport;
import org.apache.ivy.core.resolve.DownloadOptions;
@@ -40,7 +39,6 @@
import org.apache.ivy.plugins.repository.AbstractRepository;
import org.apache.ivy.plugins.repository.Repository;
import org.apache.ivy.plugins.repository.Resource;
-import org.apache.ivy.plugins.resolver.util.MDResolvedResource;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
import org.apache.ivy.plugins.resolver.util.ResolverHelper;
import org.apache.ivy.plugins.resolver.util.ResourceMDParser;
@@ -49,22 +47,21 @@
import org.apache.ivy.util.FileUtil;
import org.apache.ivy.util.Message;
-
/**
*
*/
public class RepositoryResolver extends AbstractResourceResolver {
-
+
private Repository _repository;
+
private Boolean _alwaysCheckExactRevision = null;
-
public RepositoryResolver() {
}
-
+
public Repository getRepository() {
return _repository;
- }
+ }
public void setRepository(Repository repository) {
_repository = repository;
@@ -73,73 +70,78 @@
public void setName(String name) {
super.setName(name);
if (_repository instanceof AbstractRepository) {
- ((AbstractRepository)_repository).setName(name);
+ ((AbstractRepository) _repository).setName(name);
}
}
-
- protected ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, String pattern, Artifact artifact, ResourceMDParser rmdparser, Date date) {
- return findResourceUsingPattern(getName(), getRepository(), getLatestStrategy(), getSettings().getVersionMatcher(), rmdparser, mrid, pattern, artifact, date, isAlwaysCheckExactRevision());
+ protected ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, String pattern,
+ Artifact artifact, ResourceMDParser rmdparser, Date date) {
+ return findResourceUsingPattern(getName(), getRepository(), getLatestStrategy(),
+ getSettings().getVersionMatcher(), rmdparser, mrid, pattern, artifact, date,
+ isAlwaysCheckExactRevision());
}
-
- public static ResolvedResource findResourceUsingPattern(String name, Repository repository, LatestStrategy strategy, VersionMatcher versionMatcher, ResourceMDParser rmdparser, ModuleRevisionId mrid, String pattern, Artifact artifact, Date date, boolean alwaysCheckExactRevision) {
+
+ public static ResolvedResource findResourceUsingPattern(String name, Repository repository,
+ LatestStrategy strategy, VersionMatcher versionMatcher, ResourceMDParser rmdparser,
+ ModuleRevisionId mrid, String pattern, Artifact artifact, Date date,
+ boolean alwaysCheckExactRevision) {
try {
if (!versionMatcher.isDynamic(mrid) || alwaysCheckExactRevision) {
String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact);
- Message.debug("\t trying "+resourceName);
+ Message.debug("\t trying " + resourceName);
logAttempt(resourceName);
Resource res = repository.getResource(resourceName);
boolean reachable = res.exists();
if (reachable) {
- String revision = pattern.indexOf(IvyPatternHelper.REVISION_KEY) == -1? "working@"+name : mrid.getRevision();
+ String revision = pattern.indexOf(IvyPatternHelper.REVISION_KEY) == -1 ? "working@"
+ + name
+ : mrid.getRevision();
return new ResolvedResource(res, revision);
} else if (versionMatcher.isDynamic(mrid)) {
- return findDynamicResourceUsingPattern(name, repository, strategy, versionMatcher, rmdparser, mrid, pattern, artifact, date);
+ return findDynamicResourceUsingPattern(name, repository, strategy,
+ versionMatcher, rmdparser, mrid, pattern, artifact, date);
} else {
- Message.debug("\t"+name+": resource not reachable for "+mrid+": res="+res);
+ Message.debug("\t" + name + ": resource not reachable for " + mrid + ": res="
+ + res);
return null;
}
} else {
- return findDynamicResourceUsingPattern(name, repository, strategy, versionMatcher, rmdparser, mrid, pattern, artifact, date);
+ return findDynamicResourceUsingPattern(name, repository, strategy, versionMatcher,
+ rmdparser, mrid, pattern, artifact, date);
}
} catch (IOException ex) {
- throw new RuntimeException(name+": unable to get resource for "+mrid+": res="+IvyPatternHelper.substitute(pattern, mrid, artifact)+": "+ex, ex);
+ throw new RuntimeException(name + ": unable to get resource for " + mrid + ": res="
+ + IvyPatternHelper.substitute(pattern, mrid, artifact) + ": " + ex, ex);
}
}
-
- private static ResolvedResource findDynamicResourceUsingPattern(
- String name,
- Repository repository,
- LatestStrategy strategy,
- VersionMatcher versionMatcher,
- ResourceMDParser rmdparser,
- ModuleRevisionId mrid,
- String pattern,
- Artifact artifact,
- Date date) {
- logAttempt(IvyPatternHelper.substitute(pattern,
- ModuleRevisionId.newInstance(
- mrid,
- IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)),
- artifact));
+
+ private static ResolvedResource findDynamicResourceUsingPattern(String name,
+ Repository repository, LatestStrategy strategy, VersionMatcher versionMatcher,
+ ResourceMDParser rmdparser, ModuleRevisionId mrid, String pattern, Artifact artifact,
+ Date date) {
+ logAttempt(IvyPatternHelper.substitute(pattern, ModuleRevisionId.newInstance(mrid,
+ IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)), artifact));
ResolvedResource[] rress = ResolverHelper.findAll(repository, mrid, pattern, artifact);
if (rress == null) {
- Message.debug("\t"+name+": unable to list resources for "+mrid+": pattern="+pattern);
+ Message.debug("\t" + name + ": unable to list resources for " + mrid + ": pattern="
+ + pattern);
return null;
} else {
- ResolvedResource found = findResource(rress, name, strategy, versionMatcher, rmdparser, mrid, date);
- if (found == null) {
- Message.debug("\t"+name+": no resource found for "+mrid+": pattern="+pattern);
- }
- return found;
+ ResolvedResource found = findResource(rress, name, strategy, versionMatcher, rmdparser,
+ mrid, date);
+ if (found == null) {
+ Message.debug("\t" + name + ": no resource found for " + mrid + ": pattern="
+ + pattern);
+ }
+ return found;
}
}
-
+
protected long get(Resource resource, File dest) throws IOException {
- Message.verbose("\t"+getName()+": downloading "+resource.getName());
- Message.debug("\t\tto "+dest);
+ Message.verbose("\t" + getName() + ": downloading " + resource.getName());
+ Message.debug("\t\tto " + dest);
if (dest.getParentFile() != null) {
- dest.getParentFile().mkdirs();
+ dest.getParentFile().mkdirs();
}
_repository.get(resource.getName(), dest);
return dest.length();
@@ -148,82 +150,89 @@
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
String destPattern;
if ("ivy".equals(artifact.getType()) && !getIvyPatterns().isEmpty()) {
- destPattern = (String)getIvyPatterns().get(0);
+ destPattern = (String) getIvyPatterns().get(0);
} else if (!getArtifactPatterns().isEmpty()) {
- destPattern = (String)getArtifactPatterns().get(0);
+ destPattern = (String) getArtifactPatterns().get(0);
} else {
- throw new IllegalStateException("impossible to publish "+artifact+" using "+this+": no artifact pattern defined");
+ throw new IllegalStateException("impossible to publish " + artifact + " using " + this
+ + ": no artifact pattern defined");
}
// Check for m2 compatibility
ModuleRevisionId mrid = artifact.getModuleRevisionId();
if (isM2compatible()) {
mrid = convertM2IdForResourceSearch(mrid);
}
-
- String dest = IvyPatternHelper.substitute(destPattern,
- mrid,
- artifact);
-
+
+ String dest = IvyPatternHelper.substitute(destPattern, mrid, artifact);
+
put(artifact, src, dest, overwrite);
- Message.info("\tpublished "+artifact.getName()+" to "+hidePassword(dest));
+ Message.info("\tpublished " + artifact.getName() + " to " + hidePassword(dest));
+ }
+
+ private void put(Artifact artifact, File src, String dest, boolean overwrite)
+ throws IOException {
+ _repository.put(artifact, src, dest, overwrite);
+ String[] checksums = getChecksumAlgorithms();
+ for (int i = 0; i < checksums.length; i++) {
+ putChecksum(artifact, src, dest, overwrite, checksums[i]);
+ }
+ }
+
+ private void putChecksum(Artifact artifact, File src, String dest, boolean overwrite,
+ String algorithm) throws IOException {
+ File csFile = File.createTempFile("ivytemp", algorithm);
+ try {
+ FileUtil.copy(new ByteArrayInputStream(ChecksumHelper.computeAsString(src, algorithm)
+ .getBytes()), csFile, null);
+ _repository.put(DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, algorithm,
+ artifact.getExt() + "." + algorithm), csFile, dest + "." + algorithm, overwrite);
+ } finally {
+ csFile.delete();
+ }
}
- private void put(Artifact artifact, File src, String dest, boolean overwrite) throws IOException {
- _repository.put(artifact, src, dest, overwrite);
- String[] checksums = getChecksumAlgorithms();
- for (int i = 0; i < checksums.length; i++) {
- putChecksum(artifact, src, dest, overwrite, checksums[i]);
- }
- }
-
- private void putChecksum(Artifact artifact, File src, String dest, boolean overwrite, String algorithm) throws IOException {
- File csFile = File.createTempFile("ivytemp", algorithm);
- try {
- FileUtil.copy(new ByteArrayInputStream(ChecksumHelper.computeAsString(src, algorithm).getBytes()), csFile, null);
- _repository.put(DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, algorithm, artifact.getExt()+"."+algorithm), csFile, dest+"."+algorithm, overwrite);
- } finally {
- csFile.delete();
- }
- }
-
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
- EventManager eventManager = options.getEventManager();
- try {
- if (eventManager != null) {
- _repository.addTransferListener(eventManager);
- }
- return super.download(artifacts, options);
- } finally {
- if (eventManager != null) {
- _repository.removeTransferListener(eventManager);
- }
- }
- }
+ EventManager eventManager = options.getEventManager();
+ try {
+ if (eventManager != null) {
+ _repository.addTransferListener(eventManager);
+ }
+ return super.download(artifacts, options);
+ } finally {
+ if (eventManager != null) {
+ _repository.removeTransferListener(eventManager);
+ }
+ }
+ }
protected void findTokenValues(Collection names, List patterns, Map tokenValues, String token) {
for (Iterator iter = patterns.iterator(); iter.hasNext();) {
- String pattern = (String)iter.next();
- String partiallyResolvedPattern = IvyPatternHelper.substituteTokens(pattern, tokenValues);
- String[] values = ResolverHelper.listTokenValues(_repository, partiallyResolvedPattern, token);
+ String pattern = (String) iter.next();
+ String partiallyResolvedPattern = IvyPatternHelper.substituteTokens(pattern,
+ tokenValues);
+ String[] values = ResolverHelper.listTokenValues(_repository, partiallyResolvedPattern,
+ token);
if (values != null) {
names.addAll(Arrays.asList(values));
}
}
}
-
+
public String getTypeName() {
return "repository";
}
+
public void dumpSettings() {
super.dumpSettings();
- Message.debug("\t\trepository: "+getRepository());
+ Message.debug("\t\trepository: " + getRepository());
}
-
+
public void setSettings(IvySettings settings) {
super.setSettings(settings);
if (settings != null) {
if (_alwaysCheckExactRevision == null) {
- _alwaysCheckExactRevision = Boolean.valueOf(settings.getVariable("ivy.default.always.check.exact.revision"));
+ _alwaysCheckExactRevision = Boolean.valueOf(settings
+ .getVariable("ivy.default.always.check.exact.revision"));
}
}
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SFTPResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SFTPResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SFTPResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SFTPResolver.java Tue Jun 5 05:02:27 2007
@@ -20,29 +20,22 @@
import org.apache.ivy.plugins.repository.sftp.SFTPRepository;
/**
- * This resolver is able to work with any sftp server.
- *
- * It supports listing and publishing.
- *
- * The server host should absolutely be set using setHost.
- *
- * basedir defaults to .
- * port default to 22
- *
- * username and password will be prompted using a dialog box if not set. So if you are in
- * an headless environment, provide username and password.
+ * This resolver is able to work with any sftp server. It supports listing and publishing. The
+ * server host should absolutely be set using setHost. basedir defaults to . port default to 22
+ * username and password will be prompted using a dialog box if not set. So if you are in an
+ * headless environment, provide username and password.
*/
-public class SFTPResolver extends AbstractSshBasedResolver {
+public class SFTPResolver extends AbstractSshBasedResolver {
public SFTPResolver() {
setRepository(new SFTPRepository());
}
-
+
public String getTypeName() {
return "sftp";
}
-
+
public SFTPRepository getSFTPRepository() {
- return (SFTPRepository) getRepository();
+ return (SFTPRepository) getRepository();
}
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java Tue Jun 5 05:02:27 2007
@@ -23,57 +23,55 @@
* Resolver for SSH resolver for ivy
*/
public class SshResolver extends AbstractSshBasedResolver {
-
+
public SshResolver() {
setRepository(new SshRepository());
}
+
/**
- * sets the path separator used on the target system. Not sure if this is used or if '/' is used
+ * sets the path separator used on the target system. Not sure if this is used or if '/' is used
* on all implementation. default is to use '/'
- * @param sep file separator to use on the target system
+ *
+ * @param sep
+ * file separator to use on the target system
*/
public void setFileSeparator(String sep) {
- if(sep == null || sep.length() != 1)
- throw new IllegalArgumentException("File Separator has to be a single character and not "+sep);
- ((SshRepository)getRepository()).setFileSeparator(sep.trim().charAt(0));
+ if (sep == null || sep.length() != 1)
+ throw new IllegalArgumentException(
+ "File Separator has to be a single character and not " + sep);
+ ((SshRepository) getRepository()).setFileSeparator(sep.trim().charAt(0));
}
-
+
/**
- * set the command to get a directory listing
- * the command has to be a shell command working on the target system
- * and has to produce a listing of filenames, with each filename on a new line
- * the term %arg can be used in the command to substitue the path to be listed
- * (e.g. "ls -1 %arg | grep -v CVS" to get a listing without CVS directory)
- * if %arg is not part of the command, the path will be appended to the command
- * default is: "ls -1"
+ * set the command to get a directory listing the command has to be a shell command working on
+ * the target system and has to produce a listing of filenames, with each filename on a new line
+ * the term %arg can be used in the command to substitue the path to be listed (e.g. "ls -1 %arg |
+ * grep -v CVS" to get a listing without CVS directory) if %arg is not part of the command, the
+ * path will be appended to the command default is: "ls -1"
*/
public void setListCommand(String cmd) {
- ((SshRepository)getRepository()).setListCommand(cmd);
+ ((SshRepository) getRepository()).setListCommand(cmd);
}
/**
- * set the command to check for existence of a file
- * the command has to be a shell command working on the target system
- * and has to create an exit status of 0 for an existent file
- * and <> 0 for a non existing file given as argument
- * the term %arg can be used in the command to substitue the path to be listed
- * if %arg is not part of the command, the path will be appended to the command
- * default is: "ls"
+ * set the command to check for existence of a file the command has to be a shell command
+ * working on the target system and has to create an exit status of 0 for an existent file and <>
+ * 0 for a non existing file given as argument the term %arg can be used in the command to
+ * substitue the path to be listed if %arg is not part of the command, the path will be appended
+ * to the command default is: "ls"
*/
public void setExistCommand(String cmd) {
- ((SshRepository)getRepository()).setExistCommand(cmd);
+ ((SshRepository) getRepository()).setExistCommand(cmd);
}
/**
- * set the command to create a directory on the target system
- * the command has to be a shell command working on the target system
- * and has to create a directory with the given argument
- * the term %arg can be used in the command to substitue the path to be listed
- * if %arg is not part of the command, the path will be appended to the command
- * default is: "mkdir"
+ * set the command to create a directory on the target system the command has to be a shell
+ * command working on the target system and has to create a directory with the given argument
+ * the term %arg can be used in the command to substitue the path to be listed if %arg is not
+ * part of the command, the path will be appended to the command default is: "mkdir"
*/
public void setCreateDirCommand(String cmd) {
- ((SshRepository)getRepository()).setExistCommand(cmd);
+ ((SshRepository) getRepository()).setExistCommand(cmd);
}
public String getTypeName() {
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/URLResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/URLResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/URLResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/URLResolver.java Tue Jun 5 05:02:27 2007
@@ -20,13 +20,14 @@
import org.apache.ivy.plugins.repository.url.URLRepository;
/**
- * This resolver is able to work with any URLs, it handles latest revisions
- * with file and http urls only, and it does not handle publishing
+ * This resolver is able to work with any URLs, it handles latest revisions with file and http urls
+ * only, and it does not handle publishing
*/
-public class URLResolver extends RepositoryResolver {
+public class URLResolver extends RepositoryResolver {
public URLResolver() {
setRepository(new URLRepository());
}
+
public String getTypeName() {
return "url";
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VfsResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VfsResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VfsResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VfsResolver.java Tue Jun 5 05:02:27 2007
@@ -17,7 +17,6 @@
*/
package org.apache.ivy.plugins.resolver;
-
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -28,7 +27,9 @@
*/
public class VfsResolver extends RepositoryResolver {
private static Pattern URLPattern = Pattern.compile("[a-z]*://(.+):(.+)@.*");
+
private static int PASSWORD_GROUP = 2;
+
public VfsResolver() {
setRepository(new VfsRepository());
}
@@ -40,6 +41,7 @@
public String hidePassword(String name) {
return prepareForDisplay(name);
}
+
public static String prepareForDisplay(String name) {
StringBuffer s = new StringBuffer(name);
Matcher m = URLPattern.matcher(s);
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java Tue Jun 5 05:02:27 2007
@@ -20,48 +20,55 @@
import org.apache.ivy.plugins.repository.vsftp.VsftpRepository;
/**
- * This resolver uses SecureCRT vsft to access an sftp server.
- *
- * It supports listing and publishing.
- *
+ * This resolver uses SecureCRT vsft to access an sftp server. It supports listing and publishing.
* The server host should absolutely be set using setHost, so does the username.
- *
*/
-public class VsftpResolver extends RepositoryResolver {
- public VsftpResolver() {
+public class VsftpResolver extends RepositoryResolver {
+ public VsftpResolver() {
setRepository(new VsftpRepository());
}
+
public String getTypeName() {
return "vsftp";
}
+
public VsftpRepository getVsftpRepository() {
- return (VsftpRepository) getRepository();
+ return (VsftpRepository) getRepository();
+ }
+
+ public void disconnect() {
+ getVsftpRepository().disconnect();
+ }
+
+ public String getAuthentication() {
+ return getVsftpRepository().getAuthentication();
+ }
+
+ public String getHost() {
+ return getVsftpRepository().getHost();
+ }
+
+ public String getUsername() {
+ return getVsftpRepository().getUsername();
+ }
+
+ public void setAuthentication(String authentication) {
+ getVsftpRepository().setAuthentication(authentication);
+ }
+
+ public void setHost(String host) {
+ getVsftpRepository().setHost(host);
+ }
+
+ public void setUsername(String username) {
+ getVsftpRepository().setUsername(username);
+ }
+
+ public void setReuseConnection(long time) {
+ getVsftpRepository().setReuseConnection(time);
+ }
+
+ public void setReadTimeout(long readTimeout) {
+ getVsftpRepository().setReadTimeout(readTimeout);
}
- public void disconnect() {
- getVsftpRepository().disconnect();
- }
- public String getAuthentication() {
- return getVsftpRepository().getAuthentication();
- }
- public String getHost() {
- return getVsftpRepository().getHost();
- }
- public String getUsername() {
- return getVsftpRepository().getUsername();
- }
- public void setAuthentication(String authentication) {
- getVsftpRepository().setAuthentication(authentication);
- }
- public void setHost(String host) {
- getVsftpRepository().setHost(host);
- }
- public void setUsername(String username) {
- getVsftpRepository().setUsername(username);
- }
- public void setReuseConnection(long time) {
- getVsftpRepository().setReuseConnection(time);
- }
- public void setReadTimeout(long readTimeout) {
- getVsftpRepository().setReadTimeout(readTimeout);
- }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ApacheHttpURLLister.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ApacheHttpURLLister.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ApacheHttpURLLister.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ApacheHttpURLLister.java Tue Jun 5 05:02:27 2007
@@ -23,12 +23,13 @@
import org.apache.ivy.util.url.ApacheURLLister;
-
public class ApacheHttpURLLister implements URLLister {
private ApacheURLLister _lister = new ApacheURLLister();
+
public boolean accept(String pattern) {
return pattern.startsWith("http");
}
+
public List listAll(URL url) throws IOException {
return _lister.listAll(url);
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/FileURLLister.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/FileURLLister.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/FileURLLister.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/FileURLLister.java Tue Jun 5 05:02:27 2007
@@ -24,13 +24,13 @@
import java.util.Collections;
import java.util.List;
-
public class FileURLLister implements URLLister {
private File _basedir;
public FileURLLister() {
this(null);
}
+
public FileURLLister(File baseDir) {
_basedir = baseDir;
}
@@ -45,7 +45,7 @@
if (file.exists() && file.isDirectory()) {
String[] files = file.list();
List ret = new ArrayList(files.length);
- URL context = url.getPath().endsWith("/") ? url : new URL(url.toExternalForm()+"/");
+ URL context = url.getPath().endsWith("/") ? url : new URL(url.toExternalForm() + "/");
for (int i = 0; i < files.length; i++) {
ret.add(new URL(context, files[i]));
}
@@ -54,7 +54,7 @@
return Collections.EMPTY_LIST;
}
}
-
+
public String toString() {
return "file lister";
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/HasLatestStrategy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/HasLatestStrategy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/HasLatestStrategy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/HasLatestStrategy.java Tue Jun 5 05:02:27 2007
@@ -20,7 +20,9 @@
import org.apache.ivy.plugins.latest.LatestStrategy;
public interface HasLatestStrategy {
- public LatestStrategy getLatestStrategy();
+ public LatestStrategy getLatestStrategy();
+
public void setLatestStrategy(LatestStrategy latestStrategy);
+
public String getLatest();
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/MDResolvedResource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/MDResolvedResource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/MDResolvedResource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/MDResolvedResource.java Tue Jun 5 05:02:27 2007
@@ -21,15 +21,15 @@
import org.apache.ivy.plugins.repository.Resource;
public class MDResolvedResource extends ResolvedResource {
- private ResolvedModuleRevision _rmr;
+ private ResolvedModuleRevision _rmr;
- public MDResolvedResource(Resource res, String rev, ResolvedModuleRevision rmr) {
- super(res, rev);
- _rmr = rmr;
- }
-
- public ResolvedModuleRevision getResolvedModuleRevision() {
- return _rmr;
- }
+ public MDResolvedResource(Resource res, String rev, ResolvedModuleRevision rmr) {
+ super(res, rev);
+ _rmr = rmr;
+ }
+
+ public ResolvedModuleRevision getResolvedModuleRevision() {
+ return _rmr;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedModuleRevisionProxy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedModuleRevisionProxy.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedModuleRevisionProxy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedModuleRevisionProxy.java Tue Jun 5 05:02:27 2007
@@ -25,14 +25,14 @@
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.plugins.resolver.DependencyResolver;
-
-/**
- * the same ResolvedModuleRevision except that we say that it is another resolver
- * the artifact resolver, so that it's it that is used for artifact download
- * ==> forward all except getArtifactResolver method
+/**
+ * the same ResolvedModuleRevision except that we say that it is another resolver the artifact
+ * resolver, so that it's it that is used for artifact download ==> forward all except
+ * getArtifactResolver method
*/
public final class ResolvedModuleRevisionProxy implements ResolvedModuleRevision {
private final ResolvedModuleRevision _mr;
+
DependencyResolver _resolver;
public ResolvedModuleRevisionProxy(ResolvedModuleRevision mr, DependencyResolver artresolver) {
@@ -45,7 +45,7 @@
_mr = mr;
_resolver = artresolver;
}
-
+
public DependencyResolver getResolver() {
return _mr.getResolver();
}
@@ -73,7 +73,8 @@
public boolean isSearched() {
return _mr.isSearched();
}
+
public URL getLocalMDUrl() {
- return _mr.getLocalMDUrl();
+ return _mr.getLocalMDUrl();
}
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedResource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedResource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedResource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolvedResource.java Tue Jun 5 05:02:27 2007
@@ -20,23 +20,28 @@
import org.apache.ivy.plugins.latest.ArtifactInfo;
import org.apache.ivy.plugins.repository.Resource;
-public class ResolvedResource implements ArtifactInfo {
+public class ResolvedResource implements ArtifactInfo {
private Resource _res;
+
private String _rev;
-
+
public ResolvedResource(Resource res, String rev) {
_res = res;
_rev = rev;
}
+
public String getRevision() {
return _rev;
}
+
public Resource getResource() {
return _res;
}
+
public String toString() {
- return _res + " ("+_rev+")";
+ return _res + " (" + _rev + ")";
}
+
public long getLastModified() {
return getResource().getLastModified();
}