You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/01/14 09:27:43 UTC
svn commit: r1557968 [15/26] - in /ant/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/
src...
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java Tue Jan 14 08:27:37 2014
@@ -94,7 +94,7 @@ public class ChainResolver extends Abstr
mr = forcedRevision(mr);
}
}
-
+
for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
LatestStrategy oldLatest = setLatestIfRequired(resolver, getLatestStrategy());
@@ -132,8 +132,8 @@ public class ChainResolver extends Abstr
err.append("\t").append(StringUtils.getErrorMessage(ex)).append("\n");
}
err.setLength(err.length() - 1);
- throw new RuntimeException("several problems occurred while resolving " + dd + ":\n"
- + err);
+ throw new RuntimeException("several problems occurred while resolving " + dd
+ + ":\n" + err);
}
}
if (resolved == mr) {
@@ -145,20 +145,19 @@ public class ChainResolver extends Abstr
private ResolvedModuleRevision resolvedRevision(ResolvedModuleRevision mr) {
if (isDual() && mr != null) {
- return new ResolvedModuleRevision(
- mr.getResolver(), this, mr.getDescriptor(), mr.getReport(), mr.isForce());
+ return new ResolvedModuleRevision(mr.getResolver(), this, mr.getDescriptor(),
+ mr.getReport(), mr.isForce());
} else {
return mr;
}
}
-
+
private ResolvedModuleRevision forcedRevision(ResolvedModuleRevision rmr) {
if (rmr == null) {
return null;
}
- return new ResolvedModuleRevision(
- rmr.getResolver(), rmr.getArtifactResolver(),
- rmr.getDescriptor(), rmr.getReport(), true);
+ return new ResolvedModuleRevision(rmr.getResolver(), rmr.getArtifactResolver(),
+ rmr.getDescriptor(), rmr.getReport(), true);
}
private LatestStrategy setLatestIfRequired(DependencyResolver resolver,
@@ -181,10 +180,10 @@ public class ChainResolver extends Abstr
return result;
}
}
-
+
return null;
}
-
+
public Map[] listTokenValues(String[] tokens, Map criteria) {
Set result = new HashSet();
for (Iterator iter = chain.iterator(); iter.hasNext();) {
@@ -192,7 +191,7 @@ public class ChainResolver extends Abstr
Map[] temp = resolver.listTokenValues(tokens, new HashMap(criteria));
result.addAll(Arrays.asList(temp));
}
-
+
return (Map[]) result.toArray(new Map[result.size()]);
}
@@ -215,8 +214,9 @@ public class ChainResolver extends Abstr
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) {
@@ -247,8 +247,8 @@ public class ChainResolver extends Abstr
getFirstResolver().abortPublishTransaction();
}
- public void beginPublishTransaction(
- ModuleRevisionId module, boolean overwrite) throws IOException {
+ public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite)
+ throws IOException {
getFirstResolver().beginPublishTransaction(module, overwrite);
}
@@ -290,7 +290,7 @@ public class ChainResolver extends Abstr
}
return false;
}
-
+
public ArtifactOrigin locate(Artifact artifact) {
for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
@@ -301,7 +301,7 @@ public class ChainResolver extends Abstr
}
return ArtifactOrigin.unkwnown(artifact);
}
-
+
public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options) {
for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
@@ -314,7 +314,7 @@ public class ChainResolver extends Abstr
adr.setDownloadStatus(DownloadStatus.FAILED);
return adr;
}
-
+
private static void setLatest(DependencyResolver resolver, LatestStrategy latest) {
if (resolver instanceof HasLatestStrategy) {
HasLatestStrategy r = (HasLatestStrategy) resolver;
@@ -346,5 +346,4 @@ public class ChainResolver extends Abstr
return dual;
}
-
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java Tue Jan 14 08:27:37 2014
@@ -62,13 +62,15 @@ public interface DependencyResolver {
*/
ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
throws ParseException;
-
+
/**
- * Finds the module descriptor for the specified <tt>DependencyDescriptor</tt>.
- * If this resolver can't find the module descriptor, <tt>null</tt> is returned.
+ * Finds the module descriptor for the specified <tt>DependencyDescriptor</tt>. If this resolver
+ * can't find the module descriptor, <tt>null</tt> is returned.
*
- * @param dd the dependency descriptor
- * @param data the resolve data
+ * @param dd
+ * the dependency descriptor
+ * @param data
+ * the resolve data
* @return the module descriptor, or <tt>null</tt>
*/
ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data);
@@ -92,7 +94,7 @@ public interface DependencyResolver {
* @return a DownloadReport with details about each Artifact download.
*/
DownloadReport download(Artifact[] artifacts, DownloadOptions options);
-
+
/**
* Download an artifact according to the given DownloadOptions.
* <p>
@@ -108,16 +110,15 @@ public interface DependencyResolver {
* @return a report detailing how the download has gone, is never <code>null</code>.
*/
ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options);
-
/**
- * Returns <code>true</code> if the given artifact can be located by this resolver and
- * actually exist.
+ * Returns <code>true</code> if the given artifact can be located by this resolver and actually
+ * exist.
*
* @param artifact
* the artifact which should be tested.
- * @return <code>true</code> if the given artifact can be located by this resolver and
- * actually exist.
+ * @return <code>true</code> if the given artifact can be located by this resolver and actually
+ * exist.
*/
boolean exists(Artifact artifact);
@@ -133,9 +134,11 @@ public interface DependencyResolver {
ArtifactOrigin locate(Artifact artifact);
void publish(Artifact artifact, File src, boolean overwrite) throws IOException;
-
+
void beginPublishTransaction(ModuleRevisionId module, boolean overwrite) throws IOException;
+
void abortPublishTransaction() throws IOException;
+
void commitPublishTransaction() throws IOException;
/**
@@ -161,9 +164,9 @@ public interface DependencyResolver {
* "organisation"->"foo" "module"->"bar" The results will be the list of revisions of the module
* bar from the org foo.
* <p>
- * Note that listing does not take into account namespaces, and return raw
- * information without any namespace transformation. The caller is responsible for calling
- * namespace transformation with the Namespace returned by {@link #getNamespace()}.
+ * Note that listing does not take into account namespaces, and return raw information without
+ * any namespace transformation. The caller is responsible for calling namespace transformation
+ * with the Namespace returned by {@link #getNamespace()}.
* </p>
*/
String[] listTokenValues(String token, Map otherTokenValues);
@@ -184,15 +187,16 @@ public interface DependencyResolver {
ModuleEntry[] listModules(OrganisationEntry org);
RevisionEntry[] listRevisions(ModuleEntry module);
-
+
/**
* Returns the namespace associated with this resolver.
+ *
* @return the namespace associated with this resolver.
*/
Namespace getNamespace();
-
+
void dumpSettings();
-
+
void setSettings(ResolverSettings settings);
/**
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DualResolver.java Tue Jan 14 08:27:37 2014
@@ -46,6 +46,7 @@ import org.apache.ivy.util.Message;
*/
public class DualResolver extends AbstractResolver {
public static final String DESCRIPTOR_OPTIONAL = "optional";
+
public static final String DESCRIPTOR_REQUIRED = "required";
private DependencyResolver ivyResolver;
@@ -72,7 +73,7 @@ public class DualResolver extends Abstra
"exactly two resolvers must be added: ivy(1) and artifact(2) one");
}
ResolvedModuleRevision resolved = data.getCurrentResolvedModuleRevision();
-
+
data = new ResolveData(data, doValidate(data));
final ResolvedModuleRevision mr = ivyResolver.getDependency(dd, data);
if (mr == null) {
@@ -89,8 +90,8 @@ public class DualResolver extends Abstra
// nothing has actually been resolved here, we don't need to touch the returned rmr
return mr;
}
- return new ResolvedModuleRevision(
- mr.getResolver(), this, mr.getDescriptor(), mr.getReport(), mr.isForce());
+ return new ResolvedModuleRevision(mr.getResolver(), this, mr.getDescriptor(),
+ mr.getReport(), mr.isForce());
}
}
@@ -141,14 +142,12 @@ public class DualResolver extends Abstra
artifactResolver.abortPublishTransaction();
}
-
- public void beginPublishTransaction(
- ModuleRevisionId module, boolean overwrite) throws IOException {
+ public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite)
+ throws IOException {
ivyResolver.beginPublishTransaction(module, overwrite);
artifactResolver.beginPublishTransaction(module, overwrite);
}
-
public void commitPublishTransaction() throws IOException {
ivyResolver.commitPublishTransaction();
artifactResolver.commitPublishTransaction();
@@ -170,7 +169,7 @@ public class DualResolver extends Abstra
return artifactResolver.exists(artifact);
}
}
-
+
public ArtifactOrigin locate(Artifact artifact) {
if (artifact.isMetadata()) {
return ivyResolver.locate(artifact);
@@ -178,7 +177,7 @@ public class DualResolver extends Abstra
return artifactResolver.locate(artifact);
}
}
-
+
public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options) {
if (artifact.getArtifact().isMetadata()) {
return ivyResolver.download(artifact, options);
@@ -192,28 +191,27 @@ public class DualResolver extends Abstra
}
public void setAllownomd(boolean allownomd) {
- Message.deprecated(
- "allownomd is deprecated, please use descriptor=\""
- + (allownomd ? DESCRIPTOR_OPTIONAL : DESCRIPTOR_REQUIRED) + "\" instead");
+ Message.deprecated("allownomd is deprecated, please use descriptor=\""
+ + (allownomd ? DESCRIPTOR_OPTIONAL : DESCRIPTOR_REQUIRED) + "\" instead");
this.allownomd = allownomd;
}
/**
- * Sets the module descriptor presence rule.
- * Should be one of {@link #DESCRIPTOR_REQUIRED} or {@link #DESCRIPTOR_OPTIONAL}.
- *
- * @param descriptorRule the descriptor rule to use with this resolver.
+ * Sets the module descriptor presence rule. Should be one of {@link #DESCRIPTOR_REQUIRED} or
+ * {@link #DESCRIPTOR_OPTIONAL}.
+ *
+ * @param descriptorRule
+ * the descriptor rule to use with this resolver.
*/
public void setDescriptor(String descriptorRule) {
if (DESCRIPTOR_REQUIRED.equals(descriptorRule)) {
- allownomd = false;
+ allownomd = false;
} else if (DESCRIPTOR_OPTIONAL.equals(descriptorRule)) {
- allownomd = true;
+ allownomd = true;
} else {
- throw new IllegalArgumentException(
- "unknown descriptor rule '" + descriptorRule
- + "'. Allowed rules are: "
- + Arrays.asList(new String[] {DESCRIPTOR_REQUIRED, DESCRIPTOR_OPTIONAL}));
+ throw new IllegalArgumentException("unknown descriptor rule '" + descriptorRule
+ + "'. Allowed rules are: "
+ + Arrays.asList(new String[] {DESCRIPTOR_REQUIRED, DESCRIPTOR_OPTIONAL}));
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java Tue Jan 14 08:27:37 2014
@@ -40,46 +40,49 @@ import org.apache.ivy.util.Message;
public class FileSystemResolver extends RepositoryResolver {
private static final String TRANSACTION_DESTINATION_SUFFIX = ".part";
- private static final Pattern TRANSACTION_PATTERN =
- Pattern.compile("(.*[/\\\\]\\[revision\\])([/\\\\].+)");
-
+
+ private static final Pattern TRANSACTION_PATTERN = Pattern
+ .compile("(.*[/\\\\]\\[revision\\])([/\\\\].+)");
+
/**
* Transactional mode.
*
- * auto: use transaction if possible, only log verbose message if not
- * true: always use transaction, fail if not supported
- * false: never use transactions
+ * auto: use transaction if possible, only log verbose message if not true: always use
+ * transaction, fail if not supported false: never use transactions
*/
private String transactional = "auto"; // one of 'auto', 'true' or 'false'
-
+
/**
* When set indicates if this resolver supports transaction
*/
private Boolean supportTransaction;
+
/**
* The pattern leading to the directory where files are published before being moved at the end
* of a transaction
*/
private String baseTransactionPattern;
+
/**
* Map between actual patterns and patterns used during the transaction to put files in a
* temporary directory
*/
- private Map/*<String,String>*/ fullTransactionPatterns = new HashMap();
+ private Map/* <String,String> */fullTransactionPatterns = new HashMap();
/**
* Location where files are published during the transaction
*/
private File transactionTempDir;
+
/**
* Location where files should end up at the end of the transaction
*/
private File transactionDestDir;
-
+
public FileSystemResolver() {
setRepository(new FileRepository());
}
-
+
public String getTypeName() {
return "file";
}
@@ -95,21 +98,17 @@ public class FileSystemResolver extends
private FileRepository getFileRepository() {
return (FileRepository) getRepository();
}
-
protected String getDestination(String pattern, Artifact artifact, ModuleRevisionId mrid) {
if (supportTransaction() && isTransactionStarted()) {
-
+
String destPattern = (String) fullTransactionPatterns.get(pattern);
if (destPattern == null) {
throw new IllegalArgumentException(
- "unsupported pattern for publish destination pattern: " + pattern
- + ". supported patterns: " + fullTransactionPatterns.keySet());
+ "unsupported pattern for publish destination pattern: " + pattern
+ + ". supported patterns: " + fullTransactionPatterns.keySet());
}
- return IvyPatternHelper.substitute(
- destPattern,
- mrid,
- artifact);
+ return IvyPatternHelper.substitute(destPattern, mrid, artifact);
} else {
return super.getDestination(pattern, artifact, mrid);
}
@@ -121,15 +120,15 @@ public class FileSystemResolver extends
public void abortPublishTransaction() throws IOException {
if (supportTransaction()) {
- if (isTransactionStarted()) {
+ if (isTransactionStarted()) {
try {
getFileRepository().delete(transactionTempDir);
Message.info("\tpublish aborted: deleted " + transactionTempDir);
} finally {
closeTransaction();
}
- } else {
- Message.info("\tpublish aborted: nothing was started");
+ } else {
+ Message.info("\tpublish aborted: nothing was started");
}
}
}
@@ -141,27 +140,26 @@ public class FileSystemResolver extends
}
if (transactionDestDir.exists()) {
throw new IOException(
- "impossible to commit transaction: transaction destination directory "
- + "already exists: " + transactionDestDir
- + "\npossible cause: usage of identifying tokens after the revision token");
+ "impossible to commit transaction: transaction destination directory "
+ + "already exists: "
+ + transactionDestDir
+ + "\npossible cause: usage of identifying tokens after the revision token");
}
try {
getFileRepository().move(transactionTempDir, transactionDestDir);
-
- Message.info("\tpublish commited: moved " + transactionTempDir
- + " \n\t\tto " + transactionDestDir);
+
+ Message.info("\tpublish commited: moved " + transactionTempDir + " \n\t\tto "
+ + transactionDestDir);
} catch (IOException ex) {
IOException commitEx;
try {
getFileRepository().delete(transactionTempDir);
- commitEx = new IOException(
- "publish transaction commit error for " + transactionDestDir
- + ": rolled back");
+ commitEx = new IOException("publish transaction commit error for "
+ + transactionDestDir + ": rolled back");
} catch (IOException deleteEx) {
- commitEx = new IOException(
- "publish transaction commit error for " + transactionDestDir
- + ": rollback impossible either, "
- + "please remove " + transactionTempDir + " manually");
+ commitEx = new IOException("publish transaction commit error for "
+ + transactionDestDir + ": rollback impossible either, "
+ + "please remove " + transactionTempDir + " manually");
}
commitEx.initCause(ex);
throw commitEx;
@@ -171,8 +169,8 @@ public class FileSystemResolver extends
}
}
- public void beginPublishTransaction(
- ModuleRevisionId module, boolean overwrite) throws IOException {
+ public void beginPublishTransaction(ModuleRevisionId module, boolean overwrite)
+ throws IOException {
if (supportTransaction()) {
if (isTransactionStarted()) {
throw new IllegalStateException("a transaction is already started and not closed!");
@@ -182,23 +180,23 @@ public class FileSystemResolver extends
} else {
initTransaction(module);
if (transactionDestDir.exists()) {
- unsupportedTransaction(
- "transaction destination directory already exists: " + transactionDestDir
- + "\npossible cause: usage of identifying tokens after the revision token");
+ unsupportedTransaction("transaction destination directory already exists: "
+ + transactionDestDir
+ + "\npossible cause: usage of identifying tokens after the revision token");
closeTransaction();
} else {
- Message.verbose(
- "\tstarting transaction: publish during transaction will be done in \n\t\t"
- + transactionTempDir
- + "\n\tand on commit moved to \n\t\t" + transactionDestDir);
+ Message.verbose("\tstarting transaction: publish during transaction will be done in \n\t\t"
+ + transactionTempDir
+ + "\n\tand on commit moved to \n\t\t"
+ + transactionDestDir);
}
}
}
}
-
+
protected Collection filterNames(Collection values) {
if (supportTransaction()) {
- values = super.filterNames(values);
+ values = super.filterNames(values);
for (Iterator iterator = values.iterator(); iterator.hasNext();) {
String v = (String) iterator.next();
if (v.endsWith(TRANSACTION_DESTINATION_SUFFIX)) {
@@ -210,7 +208,7 @@ public class FileSystemResolver extends
return super.filterNames(values);
}
}
-
+
public boolean supportTransaction() {
if ("false".equals(transactional)) {
return false;
@@ -223,13 +221,13 @@ public class FileSystemResolver extends
transactionTempDir = null;
transactionDestDir = null;
}
-
+
private void checkSupportTransaction() {
if (supportTransaction == null) {
supportTransaction = Boolean.FALSE;
List ivyPatterns = getIvyPatterns();
List artifactPatterns = getArtifactPatterns();
-
+
if (ivyPatterns.size() > 0) {
String pattern = (String) ivyPatterns.get(0);
Matcher m = TRANSACTION_PATTERN.matcher(pattern);
@@ -238,8 +236,8 @@ public class FileSystemResolver extends
return;
} else {
baseTransactionPattern = m.group(1);
- fullTransactionPatterns.put(pattern,
- m.group(1) + TRANSACTION_DESTINATION_SUFFIX + m.group(2));
+ fullTransactionPatterns.put(pattern, m.group(1)
+ + TRANSACTION_DESTINATION_SUFFIX + m.group(2));
}
}
if (artifactPatterns.size() > 0) {
@@ -251,16 +249,16 @@ public class FileSystemResolver extends
} else if (baseTransactionPattern != null) {
if (!baseTransactionPattern.equals(m.group(1))) {
unsupportedTransaction("ivy pattern and artifact pattern "
- + "do not use the same directory for revision");
+ + "do not use the same directory for revision");
return;
} else {
- fullTransactionPatterns.put(pattern,
- m.group(1) + TRANSACTION_DESTINATION_SUFFIX + m.group(2));
+ fullTransactionPatterns.put(pattern, m.group(1)
+ + TRANSACTION_DESTINATION_SUFFIX + m.group(2));
}
} else {
baseTransactionPattern = m.group(1);
- fullTransactionPatterns.put(pattern,
- m.group(1) + TRANSACTION_DESTINATION_SUFFIX + m.group(2));
+ fullTransactionPatterns.put(pattern, m.group(1)
+ + TRANSACTION_DESTINATION_SUFFIX + m.group(2));
}
}
supportTransaction = Boolean.TRUE;
@@ -270,8 +268,8 @@ public class FileSystemResolver extends
private void unsupportedTransaction(String msg) {
String fullMsg = getName() + " do not support transaction. " + msg;
if ("true".equals(transactional)) {
- throw new IllegalStateException(fullMsg
- + ". Set transactional attribute to 'auto' or 'false' or fix the problem.");
+ throw new IllegalStateException(fullMsg
+ + ". Set transactional attribute to 'auto' or 'false' or fix the problem.");
} else {
Message.verbose(fullMsg);
supportTransaction = Boolean.FALSE;
@@ -283,14 +281,14 @@ public class FileSystemResolver extends
if (isM2compatible()) {
mrid = convertM2IdForResourceSearch(module);
}
-
- transactionTempDir = Checks.checkAbsolute(IvyPatternHelper.substitute(
- baseTransactionPattern,
- ModuleRevisionId.newInstance(
- mrid, mrid.getRevision() + TRANSACTION_DESTINATION_SUFFIX)),
- "baseTransactionPattern");
- transactionDestDir = Checks.checkAbsolute(IvyPatternHelper.substitute(
- baseTransactionPattern, mrid), "baseTransactionPattern");
+
+ transactionTempDir = Checks.checkAbsolute(
+ IvyPatternHelper.substitute(
+ baseTransactionPattern,
+ ModuleRevisionId.newInstance(mrid, mrid.getRevision()
+ + TRANSACTION_DESTINATION_SUFFIX)), "baseTransactionPattern");
+ transactionDestDir = Checks.checkAbsolute(
+ IvyPatternHelper.substitute(baseTransactionPattern, mrid), "baseTransactionPattern");
}
public String getTransactional() {
@@ -306,18 +304,18 @@ public class FileSystemResolver extends
p.setPattern(file.getAbsolutePath());
super.addConfiguredIvy(p);
}
-
+
public void addIvyPattern(String pattern) {
File file = Checks.checkAbsolute(pattern, "ivy pattern");
super.addIvyPattern(file.getAbsolutePath());
}
-
+
public void addConfiguredArtifact(IvyPattern p) {
File file = Checks.checkAbsolute(p.getPattern(), "artifact pattern");
p.setPattern(file.getAbsolutePath());
super.addConfiguredArtifact(p);
}
-
+
public void addArtifactPattern(String pattern) {
File file = Checks.checkAbsolute(pattern, "artifact pattern");
super.addArtifactPattern(file.getAbsolutePath());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java Tue Jan 14 08:27:37 2014
@@ -61,13 +61,14 @@ import org.xml.sax.SAXException;
* {@link org.apache.ivy.plugins.resolver.URLResolver}.
*/
public class IBiblioResolver extends URLResolver {
- private static final String M2_PER_MODULE_PATTERN
- = "[revision]/[artifact]-[revision](-[classifier]).[ext]";
- private static final String M2_PATTERN = "[organisation]/[module]/" + M2_PER_MODULE_PATTERN;
+ private static final String M2_PER_MODULE_PATTERN = "[revision]/[artifact]-[revision](-[classifier]).[ext]";
+
+ private static final String M2_PATTERN = "[organisation]/[module]/" + M2_PER_MODULE_PATTERN;
public static final String DEFAULT_PATTERN = "[module]/[type]s/[artifact]-[revision].[ext]";
public static final String DEFAULT_ROOT = "http://www.ibiblio.org/maven/";
+
public static final String DEFAULT_M2_ROOT = "http://repo1.maven.org/maven2/";
private String root = null;
@@ -76,7 +77,7 @@ public class IBiblioResolver extends URL
// use poms if m2 compatible is true
private boolean usepoms = true;
-
+
// use maven-metadata.xml is exists to list revisions
private boolean useMavenMetadata = true;
@@ -90,7 +91,7 @@ public class IBiblioResolver extends URL
if (isM2compatible() && isUsepoms()) {
ModuleRevisionId mrid = dd.getDependencyRevisionId();
mrid = convertM2IdForResourceSearch(mrid);
-
+
ResolvedResource rres = null;
if (dd.getDependencyRevisionId().getRevision().endsWith("SNAPSHOT")) {
rres = findSnapshotDescriptor(dd, data, mrid);
@@ -98,10 +99,10 @@ public class IBiblioResolver extends URL
return rres;
}
}
-
+
rres = findResourceUsingPatterns(mrid, getIvyPatterns(),
- DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data), data
- .getDate());
+ DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data),
+ data.getDate());
return rres;
} else {
return null;
@@ -116,7 +117,7 @@ public class IBiblioResolver extends URL
}
ResolvedResource rres = null;
if (artifact.getId().getRevision().endsWith("SNAPSHOT") && isM2compatible()) {
- rres = findSnapshotArtifact(artifact, date, mrid);
+ rres = findSnapshotArtifact(artifact, date, mrid);
if (rres != null) {
return rres;
}
@@ -131,8 +132,8 @@ public class IBiblioResolver extends URL
if (rev != null) {
// replace the revision token in file name with the resolved revision
String pattern = getWholePattern().replaceFirst("\\-\\[revision\\]", "-" + rev);
- return findResourceUsingPattern(mrid, pattern, artifact,
- getDefaultRMDParser(artifact.getModuleRevisionId().getModuleId()), date);
+ return findResourceUsingPattern(mrid, pattern, artifact, getDefaultRMDParser(artifact
+ .getModuleRevisionId().getModuleId()), date);
}
return null;
}
@@ -143,41 +144,40 @@ public class IBiblioResolver extends URL
if (rev != null) {
// here it would be nice to be able to store the resolved snapshot version, to avoid
// having to follow the same process to download artifacts
-
+
Message.verbose("[" + rev + "] " + mrid);
// replace the revision token in file name with the resolved revision
String pattern = getWholePattern().replaceFirst("\\-\\[revision\\]", "-" + rev);
return findResourceUsingPattern(mrid, pattern,
- DefaultArtifact.newPomArtifact(
- mrid, data.getDate()), getRMDParser(dd, data), data.getDate());
+ DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data),
+ data.getDate());
}
return null;
}
-
+
private String findSnapshotVersion(ModuleRevisionId mrid) {
if (!isM2compatible()) {
return null;
}
-
+
if (shouldUseMavenMetadata(getWholePattern())) {
InputStream metadataStream = null;
try {
- String metadataLocation = IvyPatternHelper.substitute(
- root + "[organisation]/[module]/[revision]/maven-metadata.xml", mrid);
+ String metadataLocation = IvyPatternHelper.substitute(root
+ + "[organisation]/[module]/[revision]/maven-metadata.xml", mrid);
Resource metadata = getRepository().getResource(metadataLocation);
if (metadata.exists()) {
metadataStream = metadata.openStream();
final StringBuffer timestamp = new StringBuffer();
final StringBuffer buildNumer = new StringBuffer();
XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() {
- public void endElement(String uri, String localName, String qName)
+ public void endElement(String uri, String localName, String qName)
throws SAXException {
if ("metadata/versioning/snapshot/timestamp".equals(getContext())) {
timestamp.append(getText());
}
- if ("metadata/versioning/snapshot/buildNumber"
- .equals(getContext())) {
+ if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) {
buildNumer.append(getText());
}
super.endElement(uri, localName, qName);
@@ -188,7 +188,7 @@ public class IBiblioResolver extends URL
String rev = mrid.getRevision();
rev = rev.substring(0, rev.length() - "SNAPSHOT".length());
rev = rev + timestamp.toString() + "-" + buildNumer.toString();
-
+
return rev;
}
} else {
@@ -253,7 +253,7 @@ public class IBiblioResolver extends URL
protected String getModuleDescriptorExtension() {
return "pom";
}
-
+
private String getWholePattern() {
return root + pattern;
}
@@ -321,7 +321,7 @@ public class IBiblioResolver extends URL
ensureConfigured(getSettings());
return super.listTokenValues(token, otherTokenValues);
}
-
+
protected String[] listTokenValues(String pattern, String token) {
if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) {
return new String[0];
@@ -330,45 +330,44 @@ public class IBiblioResolver extends URL
return new String[0];
}
ensureConfigured(getSettings());
-
+
// let's see if we should use maven metadata for this listing...
- if (IvyPatternHelper.REVISION_KEY.equals(token)
+ if (IvyPatternHelper.REVISION_KEY.equals(token)
&& shouldUseMavenMetadata(getWholePattern())) {
// now we must use metadata if available
/*
- * we substitute tokens with ext token only in the m2 per module pattern, to match
- * has has been done in the given pattern
+ * we substitute tokens with ext token only in the m2 per module pattern, to match has
+ * has been done in the given pattern
*/
String partiallyResolvedM2PerModulePattern = IvyPatternHelper.substituteTokens(
- M2_PER_MODULE_PATTERN,
- Collections.singletonMap(IvyPatternHelper.EXT_KEY, "pom"));
+ M2_PER_MODULE_PATTERN, Collections.singletonMap(IvyPatternHelper.EXT_KEY, "pom"));
if (pattern.endsWith(partiallyResolvedM2PerModulePattern)) {
/*
* the given pattern already contain resolved org and module, we just have to
* replace the per module pattern at the end by 'maven-metadata.xml' to have the
* maven metadata file location
*/
- String metadataLocation = pattern.substring(0, pattern
- .lastIndexOf(partiallyResolvedM2PerModulePattern))
- + "maven-metadata.xml";
+ String metadataLocation = pattern.substring(0,
+ pattern.lastIndexOf(partiallyResolvedM2PerModulePattern))
+ + "maven-metadata.xml";
List revs = listRevisionsWithMavenMetadata(getRepository(), metadataLocation);
if (revs != null) {
return (String[]) revs.toArray(new String[revs.size()]);
}
} else {
/*
- * this is probably because the given pattern has been substituted with jar ext,
- * if this resolver has optional module descriptors. But since we have to use
- * maven metadata, we don't care about this case, maven metadata has already
- * been used when looking for revisions with the pattern substituted with
- * ext=xml for the "ivy" pattern.
- */
+ * this is probably because the given pattern has been substituted with jar ext, if
+ * this resolver has optional module descriptors. But since we have to use maven
+ * metadata, we don't care about this case, maven metadata has already been used
+ * when looking for revisions with the pattern substituted with ext=xml for the
+ * "ivy" pattern.
+ */
return new String[0];
}
}
return super.listTokenValues(pattern, token);
}
-
+
public OrganisationEntry[] listOrganisations() {
return new OrganisationEntry[0];
}
@@ -385,12 +384,12 @@ public class IBiblioResolver extends URL
ensureConfigured(getSettings());
return super.listRevisions(mod);
}
-
- protected ResolvedResource[] listResources(
- Repository repository, ModuleRevisionId mrid, String pattern, Artifact artifact) {
+
+ protected ResolvedResource[] listResources(Repository repository, ModuleRevisionId mrid,
+ String pattern, Artifact artifact) {
if (shouldUseMavenMetadata(pattern)) {
- List revs = listRevisionsWithMavenMetadata(
- repository, mrid.getModuleId().getAttributes());
+ List revs = listRevisionsWithMavenMetadata(repository, mrid.getModuleId()
+ .getAttributes());
if (revs != null) {
Message.debug("\tfound revs: " + revs);
List rres = new ArrayList();
@@ -402,11 +401,12 @@ public class IBiblioResolver extends URL
if (rev.endsWith("SNAPSHOT")) {
String snapshotVersion = findSnapshotVersion(historicalMrid);
if (snapshotVersion != null) {
- patternForRev = pattern.replaceFirst("\\-\\[revision\\]", "-" + snapshotVersion);
+ patternForRev = pattern.replaceFirst("\\-\\[revision\\]", "-"
+ + snapshotVersion);
}
}
- String resolvedPattern = IvyPatternHelper.substitute(
- patternForRev, historicalMrid, artifact);
+ String resolvedPattern = IvyPatternHelper.substitute(patternForRev,
+ historicalMrid, artifact);
try {
Resource res = repository.getResource(resolvedPattern);
if (res != null) {
@@ -423,7 +423,7 @@ public class IBiblioResolver extends URL
}
return (ResolvedResource[]) rres.toArray(new ResolvedResource[rres.size()]);
} else {
- // maven metadata not available or something went wrong,
+ // maven metadata not available or something went wrong,
// use default listing capability
return super.listResources(repository, mrid, pattern, artifact);
}
@@ -433,8 +433,8 @@ public class IBiblioResolver extends URL
}
private List listRevisionsWithMavenMetadata(Repository repository, Map tokenValues) {
- String metadataLocation = IvyPatternHelper.substituteTokens(
- root + "[organisation]/[module]/maven-metadata.xml", tokenValues);
+ String metadataLocation = IvyPatternHelper.substituteTokens(root
+ + "[organisation]/[module]/maven-metadata.xml", tokenValues);
return listRevisionsWithMavenMetadata(repository, metadataLocation);
}
@@ -448,7 +448,7 @@ public class IBiblioResolver extends URL
final List metadataRevs = new ArrayList();
metadataStream = metadata.openStream();
XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() {
- public void endElement(String uri, String localName, String qName)
+ public void endElement(String uri, String localName, String qName)
throws SAXException {
if ("metadata/versioning/versions/version".equals(getContext())) {
metadataRevs.add(getText().trim());
@@ -477,7 +477,7 @@ public class IBiblioResolver extends URL
}
return revs;
}
-
+
protected void findTokenValues(Collection names, List patterns, Map tokenValues, String token) {
if (IvyPatternHelper.REVISION_KEY.equals(token)) {
if (shouldUseMavenMetadata(getWholePattern())) {
@@ -495,12 +495,9 @@ public class IBiblioResolver extends URL
return isUseMavenMetadata() && isM2compatible() && pattern.endsWith(M2_PATTERN);
}
-
public String getTypeName() {
return "ibiblio";
}
-
-
// override some methods to ensure configuration
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
@@ -518,7 +515,7 @@ public class IBiblioResolver extends URL
ensureConfigured(getSettings());
return super.exists(artifact);
}
-
+
public ArtifactOrigin locate(Artifact artifact) {
ensureConfigured(getSettings());
return super.locate(artifact);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java Tue Jan 14 08:27:37 2014
@@ -100,10 +100,9 @@ public class IvyRepResolver extends URLR
if (root != null) {
ivyroot = root;
} else {
- throw new IllegalStateException(
- "ivyroot is mandatory on IvyRepResolver. "
- + "Make sure to set it in your settings, before setting ivypattern "
- + "if you wish to set ivypattern too.");
+ throw new IllegalStateException("ivyroot is mandatory on IvyRepResolver. "
+ + "Make sure to set it in your settings, before setting ivypattern "
+ + "if you wish to set ivypattern too.");
}
}
if (ivypattern == null) {
@@ -171,9 +170,10 @@ public class IvyRepResolver extends URLR
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.");
}
}
@@ -237,7 +237,7 @@ public class IvyRepResolver extends URLR
});
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);
}
@@ -291,7 +291,7 @@ public class IvyRepResolver extends URLR
ensureArtifactConfigured(getSettings());
return super.exists(artifact);
}
-
+
public ArtifactOrigin locate(Artifact artifact) {
ensureArtifactConfigured(getSettings());
return super.locate(artifact);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java Tue Jan 14 08:27:37 2014
@@ -59,7 +59,7 @@ public class RepositoryResolver extends
private Repository repository;
private Boolean alwaysCheckExactRevision = null;
-
+
private String signerName = null;
public RepositoryResolver() {
@@ -79,7 +79,7 @@ public class RepositoryResolver extends
((AbstractRepository) repository).setName(name);
}
}
-
+
public void setSigner(String signerName) {
this.signerName = signerName;
}
@@ -104,11 +104,10 @@ public class RepositoryResolver extends
File temp = File.createTempFile("ivy", artifact.getExt());
temp.deleteOnExit();
repository.get(res.getName(), temp);
- ModuleDescriptorParser parser =
- ModuleDescriptorParserRegistry.getInstance().getParser(res);
- ModuleDescriptor md =
- parser.parseDescriptor(
- getParserSettings(), temp.toURI().toURL(), res, false);
+ ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
+ .getInstance().getParser(res);
+ ModuleDescriptor md = parser.parseDescriptor(getParserSettings(), temp
+ .toURI().toURL(), res, false);
revision = md.getRevision();
if ((revision == null) || (revision.length() == 0)) {
revision = "working@" + name;
@@ -121,8 +120,7 @@ public class RepositoryResolver extends
}
return new ResolvedResource(res, revision);
} else if (versionMatcher.isDynamic(mrid)) {
- return findDynamicResourceUsingPattern(
- rmdparser, mrid, pattern, artifact, date);
+ return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date);
} else {
Message.debug("\t" + name + ": resource not reachable for " + mrid + ": res="
+ res);
@@ -140,12 +138,13 @@ public class RepositoryResolver extends
}
}
- private ResolvedResource findDynamicResourceUsingPattern(
- ResourceMDParser rmdparser, ModuleRevisionId mrid, String pattern, Artifact artifact,
- Date date) {
+ private ResolvedResource findDynamicResourceUsingPattern(ResourceMDParser rmdparser,
+ ModuleRevisionId mrid, String pattern, Artifact artifact, Date date) {
String name = getName();
- logAttempt(IvyPatternHelper.substitute(pattern, ModuleRevisionId.newInstance(mrid,
- IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)), artifact));
+ logAttempt(IvyPatternHelper.substitute(
+ pattern,
+ ModuleRevisionId.newInstance(mrid,
+ IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)), artifact));
ResolvedResource[] rress = listResources(repository, mrid, pattern, artifact);
if (rress == null) {
Message.debug("\t" + name + ": unable to list resources for " + mrid + ": pattern="
@@ -160,7 +159,7 @@ public class RepositoryResolver extends
return found;
}
}
-
+
protected Resource getResource(String source) throws IOException {
return repository.getResource(source);
}
@@ -180,8 +179,8 @@ public class RepositoryResolver extends
* @return an array of ResolvedResource, all pointing to a different revision of the given
* Artifact.
*/
- protected ResolvedResource[] listResources(
- Repository repository, ModuleRevisionId mrid, String pattern, Artifact artifact) {
+ protected ResolvedResource[] listResources(Repository repository, ModuleRevisionId mrid,
+ String pattern, Artifact artifact) {
return ResolverHelper.findAll(repository, mrid, pattern, artifact);
}
@@ -214,7 +213,8 @@ public class RepositoryResolver extends
String dest = getDestination(destPattern, artifact, mrid);
put(artifact, src, dest, overwrite);
- Message.info("\tpublished " + artifact.getName() + " to " + hidePassword(repository.standardize(dest)));
+ Message.info("\tpublished " + artifact.getName() + " to "
+ + hidePassword(repository.standardize(dest)));
}
protected String getDestination(String pattern, Artifact artifact, ModuleRevisionId mrid) {
@@ -247,27 +247,30 @@ public class RepositoryResolver extends
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);
+ repository.put(
+ DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, algorithm, artifact.getExt()
+ + "." + algorithm), csFile, dest + "." + algorithm, overwrite);
} finally {
csFile.delete();
}
}
- protected void putSignature(Artifact artifact, File src, String dest, boolean overwrite) throws IOException {
+ protected void putSignature(Artifact artifact, File src, String dest, boolean overwrite)
+ throws IOException {
SignatureGenerator gen = getSettings().getSignatureGenerator(signerName);
if (gen == null) {
- throw new IllegalArgumentException("Couldn't sign the artifacts! " +
- "Unknown signer name: '" + signerName + "'");
+ throw new IllegalArgumentException("Couldn't sign the artifacts! "
+ + "Unknown signer name: '" + signerName + "'");
}
File tempFile = File.createTempFile("ivytemp", gen.getExtension());
try {
gen.sign(src, tempFile);
- repository.put(DefaultArtifact.cloneWithAnotherTypeAndExt(artifact,
- gen.getExtension(), artifact.getExt() + "." + gen.getExtension()),
- tempFile, dest + "." + gen.getExtension(), overwrite);
+ repository.put(
+ DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, gen.getExtension(),
+ artifact.getExt() + "." + gen.getExtension()), tempFile,
+ dest + "." + gen.getExtension(), overwrite);
} finally {
tempFile.delete();
}
@@ -303,7 +306,7 @@ public class RepositoryResolver extends
protected String[] listTokenValues(String pattern, String token) {
return ResolverHelper.listTokenValues(repository, pattern, token);
}
-
+
protected boolean exist(String path) {
try {
Resource resource = repository.getResource(path);
@@ -313,7 +316,7 @@ public class RepositoryResolver extends
return false;
}
}
-
+
public String getTypeName() {
return "repository";
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ResolverSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ResolverSettings.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ResolverSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ResolverSettings.java Tue Jan 14 08:27:37 2014
@@ -32,11 +32,11 @@ public interface ResolverSettings extend
LatestStrategy getLatestStrategy(String latestStrategyName);
LatestStrategy getDefaultLatestStrategy();
-
+
RepositoryCacheManager getRepositoryCacheManager(String name);
-
+
RepositoryCacheManager getDefaultRepositoryCacheManager();
-
+
RepositoryCacheManager[] getRepositoryCacheManagers();
Namespace getNamespace(String namespaceName);
@@ -48,11 +48,11 @@ public interface ResolverSettings extend
void configureRepositories(boolean b);
VersionMatcher getVersionMatcher();
-
+
String getResolveMode(ModuleId moduleId);
void filterIgnore(Collection names);
-
+
SignatureGenerator getSignatureGenerator(String name);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/SshResolver.java Tue Jan 14 08:27:37 2014
@@ -23,14 +23,14 @@ import org.apache.ivy.plugins.repository
* Resolver for SSH resolver for ivy
*/
public class SshResolver extends AbstractSshBasedResolver {
-
+
public SshResolver() {
setRepository(new SshRepository());
}
-
+
/**
- * A four digit string (e.g., 0644, see "man chmod", "man open") specifying the permissions
- * of the published files.
+ * A four digit string (e.g., 0644, see "man chmod", "man open") specifying the permissions of
+ * the published files.
*/
public void setPublishPermissions(String permissions) {
((SshRepository) getRepository()).setPublishPermissions(permissions);
@@ -54,9 +54,9 @@ public class SshResolver extends Abstrac
/**
* 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"
+ * 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);
@@ -64,10 +64,10 @@ public class SshResolver extends Abstrac
/**
* 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"
+ * 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);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/BuiltFileResource.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/BuiltFileResource.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/BuiltFileResource.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/BuiltFileResource.java Tue Jan 14 08:27:37 2014
@@ -32,8 +32,8 @@ import org.apache.ivy.plugins.repository
public class BuiltFileResource implements Resource {
/**
- * Where the build file should put built artifacts (relative
- * to the build directory). Value is: {@value}
+ * Where the build file should put built artifacts (relative to the build directory). Value is:
+ * {@value}
*/
public static final String BUILT_ARTIFACT_PATTERN = "artifacts/[type]s/[artifact].[ext]";
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java Tue Jan 14 08:27:37 2014
@@ -43,21 +43,29 @@ import org.apache.tools.ant.ProjectHelpe
public class PackagerCacheEntry {
private final ModuleRevisionId mr;
+
private final File dir;
+
private final File resourceCache;
+
private final String resourceURL;
+
private final boolean validate;
+
private final boolean preserve;
+
private final boolean restricted;
+
private final boolean verbose;
+
private final boolean quiet;
private boolean built;
// CheckStyle:ParameterNumber OFF
- public PackagerCacheEntry(ModuleRevisionId mr, File rootDir,
- File resourceCache, String resourceURL, boolean validate,
- boolean preserve, boolean restricted, boolean verbose, boolean quiet) {
+ public PackagerCacheEntry(ModuleRevisionId mr, File rootDir, File resourceCache,
+ String resourceURL, boolean validate, boolean preserve, boolean restricted,
+ boolean verbose, boolean quiet) {
this.mr = mr;
this.dir = getSubdir(rootDir, this.mr);
this.resourceCache = resourceCache;
@@ -68,6 +76,7 @@ public class PackagerCacheEntry {
this.verbose = verbose;
this.quiet = quiet;
}
+
// CheckStyle:ParameterNumber ON
/**
@@ -85,8 +94,8 @@ public class PackagerCacheEntry {
public synchronized void build(Resource packagerResource, Map properties) throws IOException {
// Sanity check
if (this.built) {
- throw new IllegalStateException("build in directory `"
- + this.dir + "' already completed");
+ throw new IllegalStateException("build in directory `" + this.dir
+ + "' already completed");
}
// Remove work directory if it exists (e.g. left over from last time)
@@ -117,27 +126,27 @@ public class PackagerCacheEntry {
// Execute the Ant build file
Project project = new Project();
project.init();
- project.setUserProperty("ant.file" , new File(dir, "build.xml").getAbsolutePath());
+ project.setUserProperty("ant.file", new File(dir, "build.xml").getAbsolutePath());
ProjectHelper.configureProject(project, new File(dir, "build.xml"));
project.setBaseDir(dir);
-
+
// Configure logging verbosity
BuildLogger logger = new DefaultLogger();
- logger.setMessageOutputLevel(this.verbose ? Project.MSG_VERBOSE
+ logger.setMessageOutputLevel(this.verbose ? Project.MSG_VERBOSE
: this.quiet ? Project.MSG_WARN : Project.MSG_INFO);
logger.setOutputPrintStream(System.out);
logger.setErrorPrintStream(System.err);
project.addBuildListener(logger);
// Set properties
- project.setUserProperty("ivy.packager.organisation",
- "" + this.mr.getModuleId().getOrganisation());
+ project.setUserProperty("ivy.packager.organisation", ""
+ + this.mr.getModuleId().getOrganisation());
project.setUserProperty("ivy.packager.module", "" + this.mr.getModuleId().getName());
project.setUserProperty("ivy.packager.revision", "" + this.mr.getRevision());
project.setUserProperty("ivy.packager.branch", "" + this.mr.getBranch());
if (this.resourceCache != null) {
- project.setUserProperty("ivy.packager.resourceCache",
- "" + this.resourceCache.getCanonicalPath());
+ project.setUserProperty("ivy.packager.resourceCache",
+ "" + this.resourceCache.getCanonicalPath());
}
if (this.resourceURL != null) {
project.setUserProperty("ivy.packager.resourceURL", "" + getResourceURL());
@@ -153,7 +162,7 @@ public class PackagerCacheEntry {
project.setUserProperty((String) entry.getKey(), (String) entry.getValue());
}
}
-
+
// Execute task
Message.verbose("performing packager resolver build in " + this.dir);
try {
@@ -174,17 +183,17 @@ public class PackagerCacheEntry {
/**
* Get a built artifact.
- *
- * @throws IllegalStateException if this entry's built has not
- * (yet) completed successfully
+ *
+ * @throws IllegalStateException
+ * if this entry's built has not (yet) completed successfully
*/
public ResolvedResource getBuiltArtifact(Artifact artifact) {
if (!this.built) {
throw new IllegalStateException("build in directory `" + this.dir
- + "' has not yet successfully completed");
+ + "' has not yet successfully completed");
}
- return new ResolvedResource(
- new BuiltFileResource(this.dir, artifact), this.mr.getRevision());
+ return new ResolvedResource(new BuiltFileResource(this.dir, artifact),
+ this.mr.getRevision());
}
public synchronized boolean cleanup() {
@@ -217,8 +226,8 @@ public class PackagerCacheEntry {
private String getResourceURL() {
String baseURL = IvyPatternHelper.substitute(resourceURL, mr.getOrganisation(),
- mr.getName(), mr.getRevision(), null, null, null, null,
- mr.getQualifiedExtraAttributes(), null);
+ mr.getName(), mr.getRevision(), null, null, null, null,
+ mr.getQualifiedExtraAttributes(), null);
int slash = baseURL.lastIndexOf('/');
if (slash != -1) {
baseURL = baseURL.substring(0, slash + 1);
@@ -227,10 +236,7 @@ public class PackagerCacheEntry {
}
private static File getSubdir(File rootDir, ModuleRevisionId mr) {
- return new File(rootDir,
- mr.getOrganisation() + File.separatorChar
- + mr.getName() + File.separatorChar
- + mr.getRevision());
+ return new File(rootDir, mr.getOrganisation() + File.separatorChar + mr.getName()
+ + File.separatorChar + mr.getRevision());
}
}
-
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerResolver.java Tue Jan 14 08:27:37 2014
@@ -36,31 +36,39 @@ import org.apache.ivy.util.Message;
/**
* Resolver that performs a "build" operation to resolve artifacts.
- *
+ *
* <p>
- * The resolver is configured with a base URL, from which the "ivy.xml"
- * and "packager.xml" files are resolved. The latter file contains
- * instructions describing how to build the actual artifacts.
+ * The resolver is configured with a base URL, from which the "ivy.xml" and "packager.xml" files are
+ * resolved. The latter file contains instructions describing how to build the actual artifacts.
*/
public class PackagerResolver extends URLResolver {
private static final String PACKAGER_ARTIFACT_NAME = "packager";
+
private static final String PACKAGER_ARTIFACT_TYPE = "packager";
+
private static final String PACKAGER_ARTIFACT_EXT = "xml";
- private final HashMap/*<ModuleRevisionId, PackagerCacheEntry>*/ packagerCache = new HashMap();
+ private final HashMap/* <ModuleRevisionId, PackagerCacheEntry> */packagerCache = new HashMap();
private File buildRoot;
+
private File resourceCache;
+
private String resourceURL;
- private Map/*<String,String>*/ properties = new LinkedHashMap();
-
+
+ private Map/* <String,String> */properties = new LinkedHashMap();
+
private boolean validate = true;
+
private boolean preserve;
+
private boolean restricted = true;
+
private boolean verbose;
+
private boolean quiet;
-
+
public PackagerResolver() {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
@@ -68,7 +76,7 @@ public class PackagerResolver extends UR
}
});
}
-
+
protected synchronized void clearCache() {
if (this.preserve) {
return;
@@ -89,9 +97,9 @@ public class PackagerResolver extends UR
public void setBuildRoot(File buildRoot) {
this.buildRoot = buildRoot;
}
-
+
/**
- * Returns root directory under which builds take place.
+ * Returns root directory under which builds take place.
*/
public File getBuildRoot() {
return buildRoot;
@@ -103,7 +111,7 @@ public class PackagerResolver extends UR
public void setResourceCache(File resourceCache) {
this.resourceCache = resourceCache;
}
-
+
/**
* Get resource cache directory.
*/
@@ -165,20 +173,23 @@ public class PackagerResolver extends UR
public void setAllownomd(boolean b) {
Message.error("allownomd not supported by resolver " + this);
}
+
public void setDescriptor(String rule) {
if (DESCRIPTOR_OPTIONAL.equals(rule)) {
- Message.error("descriptor=\"" + DESCRIPTOR_OPTIONAL
- + "\" not supported by resolver " + this);
+ Message.error("descriptor=\"" + DESCRIPTOR_OPTIONAL + "\" not supported by resolver "
+ + this);
return;
}
super.setDescriptor(rule);
}
-
+
/**
* Sets a property to be passed to the child Ant build responsible for packaging the dependency.
*
- * @param propertyKey the property to pass
- * @param propertyValue the value of the property to pass
+ * @param propertyKey
+ * the property to pass
+ * @param propertyValue
+ * the value of the property to pass
*/
public void setProperty(String propertyKey, String propertyValue) {
properties.put(propertyKey, propertyValue);
@@ -200,8 +211,8 @@ public class PackagerResolver extends UR
// For our special packager.xml file, defer to superclass
if (PACKAGER_ARTIFACT_NAME.equals(artifact.getName())
- && PACKAGER_ARTIFACT_TYPE.equals(artifact.getType())
- && PACKAGER_ARTIFACT_EXT.equals(artifact.getExt())) {
+ && PACKAGER_ARTIFACT_TYPE.equals(artifact.getType())
+ && PACKAGER_ARTIFACT_EXT.equals(artifact.getExt())) {
return super.findArtifactRef(artifact, date);
}
@@ -219,13 +230,13 @@ public class PackagerResolver extends UR
// Build the artifacts (if not done already)
if (entry == null) {
ResolvedResource packager = findArtifactRef(new DefaultArtifact(mr, null,
- PACKAGER_ARTIFACT_NAME, PACKAGER_ARTIFACT_TYPE, PACKAGER_ARTIFACT_EXT), date);
+ PACKAGER_ARTIFACT_NAME, PACKAGER_ARTIFACT_TYPE, PACKAGER_ARTIFACT_EXT), date);
if (packager == null) {
return null;
}
entry = new PackagerCacheEntry(mr, this.buildRoot, this.resourceCache,
- this.resourceURL, this.validate, this.preserve, this.restricted,
- this.verbose, this.quiet);
+ this.resourceURL, this.validate, this.preserve, this.restricted, this.verbose,
+ this.quiet);
try {
entry.build(packager.getResource(), properties);
} catch (IOException e) {
@@ -242,4 +253,3 @@ public class PackagerResolver extends UR
return "packager";
}
}
-
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java Tue Jan 14 08:27:37 2014
@@ -37,7 +37,7 @@ import org.apache.ivy.util.Message;
public final class ResolverHelper {
private ResolverHelper() {
}
-
+
// lists all the values a token can take in a pattern, as listed by a given url lister
public static String[] listTokenValues(Repository rep, String pattern, String token) {
String fileSep = rep.getFileSeparator();
@@ -131,9 +131,10 @@ public final class ResolverHelper {
public static ResolvedResource[] findAll(Repository rep, ModuleRevisionId mrid, String pattern,
Artifact artifact) {
// substitute all but revision
- String partiallyResolvedPattern = IvyPatternHelper.substitute(pattern, ModuleRevisionId
- .newInstance(mrid, IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)),
- artifact);
+ String partiallyResolvedPattern = IvyPatternHelper.substitute(
+ pattern,
+ ModuleRevisionId.newInstance(mrid,
+ IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)), artifact);
Message.debug("\tlisting all in " + partiallyResolvedPattern);
String[] revs = listTokenValues(rep, partiallyResolvedPattern,
@@ -161,15 +162,14 @@ public final class ResolverHelper {
Message.debug("\tfound resolved res: " + ret);
}
return (ResolvedResource[]) ret.toArray(new ResolvedResource[ret.size()]);
- } else if (partiallyResolvedPattern.indexOf(
- "[" + IvyPatternHelper.REVISION_KEY + "]") == -1) {
+ } else if (partiallyResolvedPattern.indexOf("[" + IvyPatternHelper.REVISION_KEY + "]") == -1) {
// the partially resolved pattern is completely resolved, check the resource
try {
Resource res = rep.getResource(partiallyResolvedPattern);
if (res.exists()) {
Message.debug("\tonly one resource found without real listing: "
- + "using and defining it as working@"
- + rep.getName() + " revision: " + res.getName());
+ + "using and defining it as working@" + rep.getName() + " revision: "
+ + res.getName());
return new ResolvedResource[] {new ResolvedResource(res, "working@"
+ rep.getName())};
}
@@ -190,7 +190,7 @@ public final class ResolverHelper {
// IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY), mrid.getExtraAttributes()),
// artifact);
// Message.debug("\tlisting all in "+partiallyResolvedPattern);
- //
+ //
// String[] revs = listTokenValues(rep, partiallyResolvedPattern,
// IvyPatternHelper.REVISION_KEY);
// if (revs != null) {
@@ -262,9 +262,7 @@ public final class ResolverHelper {
try {
return listAll(lister, new URL(root));
} catch (MalformedURLException e) {
- Message
- .warn("malformed url from pattern root: " + root + ": "
- + e.getMessage());
+ Message.warn("malformed url from pattern root: " + root + ": " + e.getMessage());
return null;
}
} else {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResourceMDParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResourceMDParser.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResourceMDParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResourceMDParser.java Tue Jan 14 08:27:37 2014
@@ -27,8 +27,8 @@ public interface ResourceMDParser {
* the resource at which the module descriptor is located
* @param rev
* the revision at which the module descriptor should be
- * @return the parsed module descriptor as a {@link MDResolvedResource}, or <code>null</code>
- * if parsing has failed or if the resource is not available.
+ * @return the parsed module descriptor as a {@link MDResolvedResource}, or <code>null</code> if
+ * parsing has failed or if the resource is not available.
*/
MDResolvedResource parse(Resource resource, String rev);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java Tue Jan 14 08:27:37 2014
@@ -21,11 +21,11 @@ import java.io.File;
import java.io.IOException;
public interface SignatureGenerator {
-
+
String getName();
-
+
void sign(File src, File dest) throws IOException;
-
+
String getExtension();
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java Tue Jan 14 08:27:37 2014
@@ -43,7 +43,7 @@ import org.bouncycastle.openpgp.PGPSigna
import org.bouncycastle.openpgp.PGPUtil;
public class OpenPGPSignatureGenerator implements SignatureGenerator {
-
+
private static final long MASK = 0xFFFFFFFFL;
static {
@@ -51,65 +51,70 @@ public class OpenPGPSignatureGenerator i
}
private String name;
+
private String secring;
+
private String password;
- private String keyId;
-
+
+ private String keyId;
+
private PGPSecretKey pgpSec;
-
+
public String getName() {
return name;
}
-
+
public void setName(String name) {
this.name = name;
}
-
+
public String getExtension() {
return "asc";
}
-
+
public void setPassword(String password) {
this.password = password;
}
-
+
public void setSecring(String secring) {
this.secring = secring;
}
-
+
public void setKeyId(String keyId) {
if (!"auto".equals(keyId)) {
this.keyId = keyId;
}
}
-
+
public void sign(File src, File dest) throws IOException {
OutputStream out = null;
InputStream in = null;
InputStream keyIn = null;
-
+
try {
if (secring == null) {
secring = System.getProperty("user.home") + "/.gnupg/secring.gpg";
}
-
+
if (pgpSec == null) {
keyIn = new FileInputStream(secring);
pgpSec = readSecretKey(keyIn);
}
-
- PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(), BouncyCastleProvider.PROVIDER_NAME);
- PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
+
+ PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(),
+ BouncyCastleProvider.PROVIDER_NAME);
+ PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey()
+ .getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
-
+
in = new FileInputStream(src);
out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
-
+
int ch = 0;
while ((ch = in.read()) >= 0) {
sGen.update((byte) ch);
}
-
+
sGen.generate().encode(out);
} catch (SignatureException e) {
IOException ioexc = new IOException();
@@ -131,17 +136,20 @@ public class OpenPGPSignatureGenerator i
if (out != null) {
try {
out.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
if (in != null) {
try {
in.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
if (keyIn != null) {
try {
keyIn.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
}
}
@@ -150,26 +158,27 @@ public class OpenPGPSignatureGenerator i
in = PGPUtil.getDecoderStream(in);
PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
- PGPSecretKey key = null;
- for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext(); ) {
- PGPSecretKeyRing kRing = (PGPSecretKeyRing) it.next();
-
- for (Iterator it2 = kRing.getSecretKeys(); key == null && it2.hasNext(); ) {
+ PGPSecretKey key = null;
+ for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext();) {
+ PGPSecretKeyRing kRing = (PGPSecretKeyRing) it.next();
+
+ for (Iterator it2 = kRing.getSecretKeys(); key == null && it2.hasNext();) {
PGPSecretKey k = (PGPSecretKey) it2.next();
if ((keyId == null) && k.isSigningKey()) {
key = k;
}
- if ((keyId != null) && (Long.valueOf(keyId, 16).longValue() == (k.getKeyID() & MASK))) {
+ if ((keyId != null)
+ && (Long.valueOf(keyId, 16).longValue() == (k.getKeyID() & MASK))) {
key = k;
}
}
}
-
+
if (key == null) {
- throw new IllegalArgumentException("Can't find encryption key" +
- (keyId != null ? " '" + keyId + "' " : " ") + "in key ring.");
+ throw new IllegalArgumentException("Can't find encryption key"
+ + (keyId != null ? " '" + keyId + "' " : " ") + "in key ring.");
}
-
+
return key;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java Tue Jan 14 08:27:37 2014
@@ -40,10 +40,11 @@ public class LogTrigger extends Abstract
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private String message = "";
-
+
private File file = null;
private boolean append = true;
+
/** encoding; set to null or empty means 'default' */
private String encoding = "";
@@ -54,7 +55,8 @@ public class LogTrigger extends Abstract
/**
* Logs the given message.
*
- * @param message the message to log
+ * @param message
+ * the message to log
*/
protected void log(String message) {
if (file == null) {
@@ -70,9 +72,8 @@ public class LogTrigger extends Abstract
if (encoding == null || encoding.length() == 0) {
out = new FileWriter(filename, append);
} else {
- out = new BufferedWriter(
- new OutputStreamWriter(
- new FileOutputStream(filename, append), encoding));
+ out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename,
+ append), encoding));
}
out.write(message, 0, message.length());
} catch (IOException e) {
@@ -91,8 +92,9 @@ public class LogTrigger extends Abstract
/**
* Message to write.
- *
- * @param msg Sets the value for the message variable.
+ *
+ * @param msg
+ * Sets the value for the message variable.
*/
public void setMessage(String msg) {
this.message = msg;
@@ -100,7 +102,9 @@ public class LogTrigger extends Abstract
/**
* File to write to.
- * @param file the file to write to, if not set, echo to standard Ivy logging
+ *
+ * @param file
+ * the file to write to, if not set, echo to standard Ivy logging
*/
public void setFile(File file) {
this.file = file;
@@ -108,16 +112,20 @@ public class LogTrigger extends Abstract
/**
* If true, append to existing file.
- * @param append if true, append to existing file, default is false.
+ *
+ * @param append
+ * if true, append to existing file, default is false.
*/
public void setAppend(boolean append) {
this.append = append;
}
/**
- * Declare the encoding to use when outputting to a file;
- * Use "" for the platform's default encoding.
- * @param encoding the character encoding to use.
+ * Declare the encoding to use when outputting to a file; Use "" for the platform's default
+ * encoding.
+ *
+ * @param encoding
+ * the character encoding to use.
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java Tue Jan 14 08:27:37 2014
@@ -42,11 +42,13 @@ public class VersionRangeMatcher extends
private static final String OPEN_INC = "[";
private static final String OPEN_EXC = "]";
+
private static final String OPEN_EXC_MAVEN = "(";
private static final String CLOSE_INC = "]";
private static final String CLOSE_EXC = "[";
+
private static final String CLOSE_EXC_MAVEN = ")";
private static final String LOWER_INFINITE = "(";
@@ -173,14 +175,14 @@ public class VersionRangeMatcher extends
private boolean isLower(ModuleRevisionId askedMrid, String revision,
ModuleRevisionId foundMrid, boolean inclusive) {
ModuleRevisionId mRevId = ModuleRevisionId.newInstance(askedMrid, revision);
- int result = comparator.compare(mRevId, foundMrid);
+ int result = comparator.compare(mRevId, foundMrid);
return result <= (inclusive ? 0 : -1);
}
private boolean isUpper(ModuleRevisionId askedMrid, String revision,
ModuleRevisionId foundMrid, boolean inclusive) {
ModuleRevisionId mRevId = ModuleRevisionId.newInstance(askedMrid, revision);
- int result = comparator.compare(mRevId, foundMrid);
+ int result = comparator.compare(mRevId, foundMrid);
return result >= (inclusive ? 0 : 1);
}