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 gs...@apache.org on 2007/07/28 19:11:59 UTC
svn commit: r560593 [2/3] - in /incubator/ivy/core/trunk:
src/java/org/apache/ivy/plugins/parser/m2/
src/java/org/apache/ivy/plugins/parser/xml/
src/java/org/apache/ivy/plugins/repository/sftp/
src/java/org/apache/ivy/plugins/repository/ssh/ src/java/o...
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java Sat Jul 28 12:11:58 2007
@@ -39,7 +39,12 @@
/**
*
*/
-public class XmlModuleDescriptorWriter {
+public final class XmlModuleDescriptorWriter {
+
+ private XmlModuleDescriptorWriter() {
+ //Utility class
+ }
+
public static void write(ModuleDescriptor md, File output) throws IOException {
write(md, null, output);
}
@@ -57,226 +62,264 @@
out.print(licenseHeader);
}
out.println("<ivy-module version=\"1.0\">");
- out.println("\t<info organisation=\"" + md.getModuleRevisionId().getOrganisation()
- + "\"");
- out.println("\t\tmodule=\"" + md.getModuleRevisionId().getName() + "\"");
- String branch = md.getResolvedModuleRevisionId().getBranch();
- if (branch != null) {
- out.println("\t\tbranch=\"" + branch + "\"");
- }
- String revision = md.getResolvedModuleRevisionId().getRevision();
- if (revision != null) {
- out.println("\t\trevision=\"" + revision + "\"");
- }
- out.println("\t\tstatus=\"" + md.getStatus() + "\"");
- out.println("\t\tpublication=\""
- + Ivy.DATE_FORMAT.format(md.getResolvedPublicationDate()) + "\"");
- if (md.isDefault()) {
- out.println("\t\tdefault=\"true\"");
- }
- if (md instanceof DefaultModuleDescriptor) {
- DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
- if (dmd.getNamespace() != null && !dmd.getNamespace().getName().equals("system")) {
- out.println("\t\tnamespace=\"" + dmd.getNamespace().getName() + "\"");
- }
- }
- out.println("\t/>");
- Configuration[] confs = md.getConfigurations();
- if (confs.length > 0) {
- out.println("\t<configurations>");
- for (int i = 0; i < confs.length; i++) {
- out.print("\t\t<conf");
- out.print(" name=\"" + confs[i].getName() + "\"");
- out.print(" visibility=\"" + confs[i].getVisibility() + "\"");
- if (confs[i].getDescription() != null) {
- out.print(" description=\"" + confs[i].getDescription() + "\"");
- }
- String[] exts = confs[i].getExtends();
- if (exts.length > 0) {
- out.print(" extends=\"");
- for (int j = 0; j < exts.length; j++) {
- out.print(exts[j]);
- if (j + 1 < exts.length) {
- out.print(",");
- }
+ printInfoTag(md, out);
+ printConfigurations(md, out);
+ printPublications(md, out);
+ printDependencies(md, out);
+ out.println("</ivy-module>");
+ } finally {
+ out.close();
+ }
+ }
+
+ private static void printDependencies(ModuleDescriptor md, PrintWriter out) {
+ DependencyDescriptor[] dds = md.getDependencies();
+ if (dds.length > 0) {
+ out.println("\t<dependencies>");
+ for (int i = 0; i < dds.length; i++) {
+ out.print("\t\t<dependency");
+ out
+ .print(" org=\"" + dds[i].getDependencyRevisionId().getOrganisation()
+ + "\"");
+ out.print(" name=\"" + dds[i].getDependencyRevisionId().getName() + "\"");
+ out.print(" rev=\"" + dds[i].getDependencyRevisionId().getRevision() + "\"");
+ if (dds[i].isForce()) {
+ out.print(" force=\"" + dds[i].isForce() + "\"");
+ }
+ if (dds[i].isChanging()) {
+ out.print(" changing=\"" + dds[i].isChanging() + "\"");
+ }
+ if (!dds[i].isTransitive()) {
+ out.print(" transitive=\"" + dds[i].isTransitive() + "\"");
+ }
+ out.print(" conf=\"");
+ String[] modConfs = dds[i].getModuleConfigurations();
+ for (int j = 0; j < modConfs.length; j++) {
+ String[] depConfs = dds[i].getDependencyConfigurations(modConfs[j]);
+ out.print(modConfs[j] + "->");
+ for (int k = 0; k < depConfs.length; k++) {
+ out.print(depConfs[k]);
+ if (k + 1 < depConfs.length) {
+ out.print(",");
}
- out.print("\"");
}
+ if (j + 1 < modConfs.length) {
+ out.print(";");
+ }
+ }
+ out.print("\"");
+
+ DependencyArtifactDescriptor[] depArtifacts = dds[i].getAllDependencyArtifacts();
+ if (depArtifacts.length > 0) {
+ out.println(">");
+ }
+ printDependencyArtefacts(md, out, depArtifacts);
+
+ IncludeRule[] includes = dds[i].getAllIncludeRules();
+ if (includes.length > 0 && depArtifacts.length == 0) {
+ out.println(">");
+ }
+ printDependencyIncludeRules(md, out, includes);
+
+ ExcludeRule[] excludes = dds[i].getAllExcludeRules();
+ if (excludes.length > 0 && includes.length == 0 && depArtifacts.length == 0) {
+ out.println(">");
+ }
+ printDependencyExcludeRules(md, out, excludes);
+ if (includes.length + excludes.length + depArtifacts.length == 0) {
out.println("/>");
+ } else {
+ out.println("\t\t</dependency>");
}
- out.println("\t</configurations>");
}
- out.println("\t<publications>");
- Artifact[] artifacts = md.getAllArtifacts();
- for (int i = 0; i < artifacts.length; i++) {
- out.print("\t\t<artifact");
- out.print(" name=\"" + artifacts[i].getName() + "\"");
- out.print(" type=\"" + artifacts[i].getType() + "\"");
- out.print(" ext=\"" + artifacts[i].getExt() + "\"");
- out.print(" conf=\"" + getConfs(md, artifacts[i]) + "\"");
+ printAllExcludes(md, out);
+ }
+ }
+
+ private static void printAllExcludes(ModuleDescriptor md, PrintWriter out) {
+ ExcludeRule[] excludes = md.getAllExcludeRules();
+ if (excludes.length > 0) {
+ for (int j = 0; j < excludes.length; j++) {
+ out.print("\t\t<exclude");
+ out.print(" org=\""
+ + excludes[j].getId().getModuleId().getOrganisation() + "\"");
+ out.print(" module=\"" + excludes[j].getId().getModuleId().getName()
+ + "\"");
+ out.print(" artifact=\"" + excludes[j].getId().getName() + "\"");
+ out.print(" type=\"" + excludes[j].getId().getType() + "\"");
+ out.print(" ext=\"" + excludes[j].getId().getExt() + "\"");
+ String[] ruleConfs = excludes[j].getConfigurations();
+ if (!Arrays.asList(ruleConfs).equals(
+ Arrays.asList(md.getConfigurationsNames()))) {
+ out.print(" conf=\"");
+ for (int k = 0; k < ruleConfs.length; k++) {
+ out.print(ruleConfs[k]);
+ if (k + 1 < ruleConfs.length) {
+ out.print(",");
+ }
+ }
+ out.print("\"");
+ }
+ out.print(" matcher=\"" + excludes[j].getMatcher().getName() + "\"");
out.println("/>");
}
- out.println("\t</publications>");
+ }
+ out.println("\t</dependencies>");
+ }
- DependencyDescriptor[] dds = md.getDependencies();
- if (dds.length > 0) {
- out.println("\t<dependencies>");
- for (int i = 0; i < dds.length; i++) {
- out.print("\t\t<dependency");
- out
- .print(" org=\"" + dds[i].getDependencyRevisionId().getOrganisation()
- + "\"");
- out.print(" name=\"" + dds[i].getDependencyRevisionId().getName() + "\"");
- out.print(" rev=\"" + dds[i].getDependencyRevisionId().getRevision() + "\"");
- if (dds[i].isForce()) {
- out.print(" force=\"" + dds[i].isForce() + "\"");
- }
- if (dds[i].isChanging()) {
- out.print(" changing=\"" + dds[i].isChanging() + "\"");
- }
- if (!dds[i].isTransitive()) {
- out.print(" transitive=\"" + dds[i].isTransitive() + "\"");
+ private static void printDependencyExcludeRules(ModuleDescriptor md, PrintWriter out,
+ ExcludeRule[] excludes) {
+ if (excludes.length > 0) {
+ for (int j = 0; j < excludes.length; j++) {
+ out.print("\t\t\t<exclude");
+ out.print(" org=\""
+ + excludes[j].getId().getModuleId().getOrganisation() + "\"");
+ out.print(" module=\"" + excludes[j].getId().getModuleId().getName()
+ + "\"");
+ out.print(" name=\"" + excludes[j].getId().getName() + "\"");
+ out.print(" type=\"" + excludes[j].getId().getType() + "\"");
+ out.print(" ext=\"" + excludes[j].getId().getExt() + "\"");
+ String[] ruleConfs = excludes[j].getConfigurations();
+ if (!Arrays.asList(ruleConfs).equals(
+ Arrays.asList(md.getConfigurationsNames()))) {
+ out.print(" conf=\"");
+ for (int k = 0; k < ruleConfs.length; k++) {
+ out.print(ruleConfs[k]);
+ if (k + 1 < ruleConfs.length) {
+ out.print(",");
+ }
}
+ out.print("\"");
+ }
+ out.print(" matcher=\"" + excludes[j].getMatcher().getName() + "\"");
+ out.println("/>");
+ }
+ }
+ }
+
+ private static void printDependencyIncludeRules(ModuleDescriptor md, PrintWriter out,
+ IncludeRule[] includes) {
+ if (includes.length > 0) {
+ for (int j = 0; j < includes.length; j++) {
+ out.print("\t\t\t<include");
+ out.print(" name=\"" + includes[j].getId().getName() + "\"");
+ out.print(" type=\"" + includes[j].getId().getType() + "\"");
+ out.print(" ext=\"" + includes[j].getId().getExt() + "\"");
+ String[] ruleConfs = includes[j].getConfigurations();
+ if (!Arrays.asList(ruleConfs).equals(
+ Arrays.asList(md.getConfigurationsNames()))) {
out.print(" conf=\"");
- String[] modConfs = dds[i].getModuleConfigurations();
- for (int j = 0; j < modConfs.length; j++) {
- String[] depConfs = dds[i].getDependencyConfigurations(modConfs[j]);
- out.print(modConfs[j] + "->");
- for (int k = 0; k < depConfs.length; k++) {
- out.print(depConfs[k]);
- if (k + 1 < depConfs.length) {
- out.print(",");
- }
+ for (int k = 0; k < ruleConfs.length; k++) {
+ out.print(ruleConfs[k]);
+ if (k + 1 < ruleConfs.length) {
+ out.print(",");
}
- if (j + 1 < modConfs.length) {
- out.print(";");
+ }
+ out.print("\"");
+ }
+ out.print(" matcher=\"" + includes[j].getMatcher().getName() + "\"");
+ out.println("/>");
+ }
+ }
+ }
+
+ private static void printDependencyArtefacts(ModuleDescriptor md, PrintWriter out,
+ DependencyArtifactDescriptor[] depArtifacts) {
+ if (depArtifacts.length > 0) {
+ for (int j = 0; j < depArtifacts.length; j++) {
+ out.print("\t\t\t<artifact");
+ out.print(" name=\"" + depArtifacts[j].getName() + "\"");
+ out.print(" type=\"" + depArtifacts[j].getType() + "\"");
+ out.print(" ext=\"" + depArtifacts[j].getExt() + "\"");
+ String[] dadconfs = depArtifacts[j].getConfigurations();
+ if (!Arrays.asList(dadconfs).equals(
+ Arrays.asList(md.getConfigurationsNames()))) {
+ out.print(" conf=\"");
+ for (int k = 0; k < dadconfs.length; k++) {
+ out.print(dadconfs[k]);
+ if (k + 1 < dadconfs.length) {
+ out.print(",");
}
}
out.print("\"");
- DependencyArtifactDescriptor[] depArtifacts = dds[i]
- .getAllDependencyArtifacts();
- if (depArtifacts.length > 0) {
- out.println(">");
- for (int j = 0; j < depArtifacts.length; j++) {
- out.print("\t\t\t<artifact");
- out.print(" name=\"" + depArtifacts[j].getName() + "\"");
- out.print(" type=\"" + depArtifacts[j].getType() + "\"");
- out.print(" ext=\"" + depArtifacts[j].getExt() + "\"");
- String[] dadconfs = depArtifacts[j].getConfigurations();
- if (!Arrays.asList(dadconfs).equals(
- Arrays.asList(md.getConfigurationsNames()))) {
- out.print(" conf=\"");
- for (int k = 0; k < dadconfs.length; k++) {
- out.print(dadconfs[k]);
- if (k + 1 < dadconfs.length) {
- out.print(",");
- }
- }
- out.print("\"");
- }
- Map extra = depArtifacts[j].getExtraAttributes();
- for (Iterator iter = extra.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- out.print(" " + entry.getKey() + "=\"" + entry.getValue() + "\"");
- }
- out.println("/>");
- }
- }
- IncludeRule[] includes = dds[i].getAllIncludeRules();
- if (includes.length > 0) {
- if (depArtifacts.length == 0) {
- out.println(">");
- }
- for (int j = 0; j < includes.length; j++) {
- out.print("\t\t\t<include");
- out.print(" name=\"" + includes[j].getId().getName() + "\"");
- out.print(" type=\"" + includes[j].getId().getType() + "\"");
- out.print(" ext=\"" + includes[j].getId().getExt() + "\"");
- String[] ruleConfs = includes[j].getConfigurations();
- if (!Arrays.asList(ruleConfs).equals(
- Arrays.asList(md.getConfigurationsNames()))) {
- out.print(" conf=\"");
- for (int k = 0; k < ruleConfs.length; k++) {
- out.print(ruleConfs[k]);
- if (k + 1 < ruleConfs.length) {
- out.print(",");
- }
- }
- out.print("\"");
- }
- out.print(" matcher=\"" + includes[j].getMatcher().getName() + "\"");
- out.println("/>");
- }
- }
- ExcludeRule[] excludes = dds[i].getAllExcludeRules();
- if (excludes.length > 0) {
- if (includes.length == 0 && depArtifacts.length == 0) {
- out.println(">");
- }
- for (int j = 0; j < excludes.length; j++) {
- out.print("\t\t\t<exclude");
- out.print(" org=\""
- + excludes[j].getId().getModuleId().getOrganisation() + "\"");
- out.print(" module=\"" + excludes[j].getId().getModuleId().getName()
- + "\"");
- out.print(" name=\"" + excludes[j].getId().getName() + "\"");
- out.print(" type=\"" + excludes[j].getId().getType() + "\"");
- out.print(" ext=\"" + excludes[j].getId().getExt() + "\"");
- String[] ruleConfs = excludes[j].getConfigurations();
- if (!Arrays.asList(ruleConfs).equals(
- Arrays.asList(md.getConfigurationsNames()))) {
- out.print(" conf=\"");
- for (int k = 0; k < ruleConfs.length; k++) {
- out.print(ruleConfs[k]);
- if (k + 1 < ruleConfs.length) {
- out.print(",");
- }
- }
- out.print("\"");
- }
- out.print(" matcher=\"" + excludes[j].getMatcher().getName() + "\"");
- out.println("/>");
- }
- }
- if (includes.length + excludes.length + depArtifacts.length == 0) {
- out.println("/>");
- } else {
- out.println("\t\t</dependency>");
- }
- }
- ExcludeRule[] excludes = md.getAllExcludeRules();
- if (excludes.length > 0) {
- for (int j = 0; j < excludes.length; j++) {
- out.print("\t\t<exclude");
- out.print(" org=\""
- + excludes[j].getId().getModuleId().getOrganisation() + "\"");
- out.print(" module=\"" + excludes[j].getId().getModuleId().getName()
- + "\"");
- out.print(" artifact=\"" + excludes[j].getId().getName() + "\"");
- out.print(" type=\"" + excludes[j].getId().getType() + "\"");
- out.print(" ext=\"" + excludes[j].getId().getExt() + "\"");
- String[] ruleConfs = excludes[j].getConfigurations();
- if (!Arrays.asList(ruleConfs).equals(
- Arrays.asList(md.getConfigurationsNames()))) {
- out.print(" conf=\"");
- for (int k = 0; k < ruleConfs.length; k++) {
- out.print(ruleConfs[k]);
- if (k + 1 < ruleConfs.length) {
- out.print(",");
- }
- }
- out.print("\"");
+ }
+ Map extra = depArtifacts[j].getExtraAttributes();
+ for (Iterator iter = extra.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ out.print(" " + entry.getKey() + "=\"" + entry.getValue() + "\"");
+ }
+ out.println("/>");
+ }
+ }
+ }
+
+ private static void printPublications(ModuleDescriptor md, PrintWriter out) {
+ out.println("\t<publications>");
+ Artifact[] artifacts = md.getAllArtifacts();
+ for (int i = 0; i < artifacts.length; i++) {
+ out.print("\t\t<artifact");
+ out.print(" name=\"" + artifacts[i].getName() + "\"");
+ out.print(" type=\"" + artifacts[i].getType() + "\"");
+ out.print(" ext=\"" + artifacts[i].getExt() + "\"");
+ out.print(" conf=\"" + getConfs(md, artifacts[i]) + "\"");
+ out.println("/>");
+ }
+ out.println("\t</publications>");
+ }
+
+ private static void printConfigurations(ModuleDescriptor md, PrintWriter out) {
+ Configuration[] confs = md.getConfigurations();
+ if (confs.length > 0) {
+ out.println("\t<configurations>");
+ for (int i = 0; i < confs.length; i++) {
+ out.print("\t\t<conf");
+ out.print(" name=\"" + confs[i].getName() + "\"");
+ out.print(" visibility=\"" + confs[i].getVisibility() + "\"");
+ if (confs[i].getDescription() != null) {
+ out.print(" description=\"" + confs[i].getDescription() + "\"");
+ }
+ String[] exts = confs[i].getExtends();
+ if (exts.length > 0) {
+ out.print(" extends=\"");
+ for (int j = 0; j < exts.length; j++) {
+ out.print(exts[j]);
+ if (j + 1 < exts.length) {
+ out.print(",");
}
- out.print(" matcher=\"" + excludes[j].getMatcher().getName() + "\"");
- out.println("/>");
}
+ out.print("\"");
}
- out.println("\t</dependencies>");
+ out.println("/>");
+ }
+ out.println("\t</configurations>");
+ }
+ }
+
+ private static void printInfoTag(ModuleDescriptor md, PrintWriter out) {
+ out.println("\t<info organisation=\"" + md.getModuleRevisionId().getOrganisation()
+ + "\"");
+ out.println("\t\tmodule=\"" + md.getModuleRevisionId().getName() + "\"");
+ String branch = md.getResolvedModuleRevisionId().getBranch();
+ if (branch != null) {
+ out.println("\t\tbranch=\"" + branch + "\"");
+ }
+ String revision = md.getResolvedModuleRevisionId().getRevision();
+ if (revision != null) {
+ out.println("\t\trevision=\"" + revision + "\"");
+ }
+ out.println("\t\tstatus=\"" + md.getStatus() + "\"");
+ out.println("\t\tpublication=\""
+ + Ivy.DATE_FORMAT.format(md.getResolvedPublicationDate()) + "\"");
+ if (md.isDefault()) {
+ out.println("\t\tdefault=\"true\"");
+ }
+ if (md instanceof DefaultModuleDescriptor) {
+ DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
+ if (dmd.getNamespace() != null && !dmd.getNamespace().getName().equals("system")) {
+ out.println("\t\tnamespace=\"" + dmd.getNamespace().getName() + "\"");
}
- out.println("</ivy-module>");
- } finally {
- out.close();
}
+ out.println("\t/>");
}
private static String getConfs(ModuleDescriptor md, Artifact artifact) {
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java Sat Jul 28 12:11:58 2007
@@ -47,15 +47,15 @@
*/
public class SFTPRepository extends AbstractSshBasedRepository {
private final class MyProgressMonitor implements SftpProgressMonitor {
- private long _totalLength;
+ private long totalLength;
public void init(int op, String src, String dest, long max) {
- _totalLength = max;
+ totalLength = max;
fireTransferStarted(max);
}
public void end() {
- fireTransferCompleted(_totalLength);
+ fireTransferCompleted(totalLength);
}
public boolean count(long count) {
@@ -133,8 +133,9 @@
fireTransferInitiated(getResource(destination), TransferEvent.REQUEST_PUT);
ChannelSftp c = getSftpChannel(destination);
try {
- if (!overwrite && checkExistence(destination, c))
+ if (!overwrite && checkExistence(destination, c)) {
throw new IOException("destination file exists and overwrite == true");
+ }
if (destination.indexOf('/') != -1) {
mkdirs(destination.substring(0, destination.lastIndexOf('/')), c);
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java Sat Jul 28 12:11:58 2007
@@ -83,12 +83,14 @@
result = new SshResource(this, source, true, fileInfo.getLength(), fileInfo
.getLastModified());
} catch (IOException e) {
- if (session != null)
+ if (session != null) {
releaseSession(session, source);
+ }
result = new SshResource();
} catch (URISyntaxException e) {
- if (session != null)
+ if (session != null) {
releaseSession(session, source);
+ }
result = new SshResource();
} catch (RemoteScpException e) {
result = new SshResource();
@@ -259,8 +261,9 @@
Scp myCopy = new Scp(session);
myCopy.put(source.getCanonicalPath(), path, name);
} catch (IOException e) {
- if (session != null)
+ if (session != null) {
releaseSession(session, destination);
+ }
throw e;
} catch (RemoteScpException e) {
throw new IOException(e.getMessage());
@@ -279,8 +282,9 @@
ChannelExec channel = null;
String trimmed = path;
try {
- while (trimmed.length() > 0 && trimmed.charAt(trimmed.length() - 1) == fileSeparator)
+ while (trimmed.length() > 0 && trimmed.charAt(trimmed.length() - 1) == fileSeparator) {
trimmed = trimmed.substring(0, trimmed.length() - 1);
+ }
if (trimmed.length() == 0 || checkExistence(trimmed, session)) {
return;
}
@@ -297,8 +301,9 @@
StringBuffer stdErr = new StringBuffer();
readSessionOutput(channel, stdOut, stdErr);
} finally {
- if (channel != null)
+ if (channel != null) {
channel.disconnect();
+ }
}
}
@@ -349,8 +354,9 @@
Scp myCopy = new Scp(session);
myCopy.get(sourceUri.getPath(), destination.getCanonicalPath());
} catch (IOException e) {
- if (session != null)
+ if (session != null) {
releaseSession(session, source);
+ }
throw e;
} catch (RemoteScpException e) {
throw new IOException(e.getMessage());
@@ -439,8 +445,9 @@
try {
scp.get(resource.getName(), os);
} catch (IOException e) {
- if (session != null)
+ if (session != null) {
releaseSession(session, resource.getName());
+ }
throw e;
} catch (RemoteScpException e) {
throw new IOException(e.getMessage());
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java Sat Jul 28 12:11:58 2007
@@ -52,37 +52,37 @@
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("MMM dd, yyyy HH:mm",
Locale.US);
- private String _host;
+ private String host;
- private String _username;
+ private String username;
- private String _authentication = "gssapi";
+ private String authentication = "gssapi";
- private Reader _in;
+ private Reader in;
- private Reader _err;
+ private Reader err;
- private PrintWriter _out;
+ private PrintWriter out;
- private volatile StringBuffer _errors = new StringBuffer();
+ private volatile StringBuffer errors = new StringBuffer();
- private long _readTimeout = 30000;
+ private long readTimeout = 30000;
- private long _reuseConnection = 5 * 60 * 1000; // reuse connection during 5 minutes by default
+ private long reuseConnection = 5 * 60 * 1000; // reuse connection during 5 minutes by default
- private volatile long _lastCommand;
+ private volatile long lastCommand;
- private volatile boolean _inCommand;
+ private volatile boolean inCommand;
- private Process _process;
+ private Process process;
- private Thread _connectionCleaner;
+ private Thread connectionCleaner;
- private Thread _errorsReader;
+ private Thread errorsReader;
- private volatile long _errorsLastUpdateTime;
+ private volatile long errorsLastUpdateTime;
- private Ivy _ivy = null;
+ private Ivy ivy = null;
public Resource getResource(String source) throws IOException {
initIvy();
@@ -90,7 +90,7 @@
}
private void initIvy() {
- _ivy = IvyContext.getContext().getIvy();
+ ivy = IvyContext.getContext().getIvy();
}
protected Resource getInitResource(String source) throws IOException {
@@ -135,7 +135,7 @@
long prevLength = 0;
long lastUpdate = System.currentTimeMillis();
- long timeout = _readTimeout;
+ long timeout = readTimeout;
while (get.isAlive()) {
checkInterrupted();
long length = to.exists() ? to.length() : 0;
@@ -148,22 +148,25 @@
Message.verbose("download hang for more than " + timeout
+ "ms. Interrupting.");
get.interrupt();
- if (to.exists())
+ if (to.exists()) {
to.delete();
+ }
throw new IOException(source + " download timeout from " + getHost());
}
}
try {
get.join(100);
} catch (InterruptedException e) {
- if (to.exists())
+ if (to.exists()) {
to.delete();
+ }
return;
}
}
if (ex[0] != null) {
- if (to.exists())
+ if (to.exists()) {
to.delete();
+ }
throw ex[0];
}
@@ -245,7 +248,6 @@
int index = destDir.lastIndexOf('/');
if (index != -1) {
mkdirs(destDir.substring(0, index));
- ;
}
sendCommand("mkdir " + destDir);
}
@@ -255,11 +257,11 @@
}
protected String sendCommand(String command) throws IOException {
- return sendCommand(command, false, _readTimeout);
+ return sendCommand(command, false, readTimeout);
}
protected void sendCommand(String command, Pattern expectedResponse) throws IOException {
- sendCommand(command, expectedResponse, _readTimeout);
+ sendCommand(command, expectedResponse, readTimeout);
}
/**
@@ -281,12 +283,12 @@
}
protected String sendCommand(String command, boolean sendErrorAsResponse) throws IOException {
- return sendCommand(command, sendErrorAsResponse, _readTimeout);
+ return sendCommand(command, sendErrorAsResponse, readTimeout);
}
protected String sendCommand(String command, boolean sendErrorAsResponse, boolean single)
throws IOException {
- return sendCommand(command, sendErrorAsResponse, single, _readTimeout);
+ return sendCommand(command, sendErrorAsResponse, single, readTimeout);
}
protected String sendCommand(String command, boolean sendErrorAsResponse, long timeout)
@@ -300,15 +302,15 @@
// end of process and end of stream...
checkInterrupted();
- _inCommand = true;
- _errorsLastUpdateTime = 0;
+ inCommand = true;
+ errorsLastUpdateTime = 0;
synchronized (this) {
- if (!single || _in != null) {
+ if (!single || in != null) {
ensureConnectionOpened();
Message.debug("sending command '" + command + "' to " + getHost());
updateLastCommandTime();
- _out.println(command);
- _out.flush();
+ out.println(command);
+ out.flush();
} else {
sendSingleCommand(command);
}
@@ -317,7 +319,7 @@
try {
return readResponse(sendErrorAsResponse, timeout);
} finally {
- _inCommand = false;
+ inCommand = false;
if (single) {
closeConnection();
}
@@ -325,7 +327,7 @@
}
protected String readResponse(boolean sendErrorAsResponse) throws IOException {
- return readResponse(sendErrorAsResponse, _readTimeout);
+ return readResponse(sendErrorAsResponse, readTimeout);
}
protected synchronized String readResponse(final boolean sendErrorAsResponse, long timeout)
@@ -342,7 +344,7 @@
// the reading is done in a for loop making five attempts to read the stream
// if we do not reach the next prompt
for (int attempts = 0; !getPrompt && attempts < 5; attempts++) {
- while ((c = _in.read()) != -1) {
+ while ((c = in.read()) != -1) {
attempts = 0; // we manage to read something, reset numer of
// attempts
response.append((char) c);
@@ -364,12 +366,12 @@
}
if (getPrompt) {
// wait enough for error stream to be fully read
- if (_errorsLastUpdateTime == 0) {
+ if (errorsLastUpdateTime == 0) {
// no error written yet, but it may be pending...
- _errorsLastUpdateTime = _lastCommand;
+ errorsLastUpdateTime = lastCommand;
}
- while ((System.currentTimeMillis() - _errorsLastUpdateTime) < 50) {
+ while ((System.currentTimeMillis() - errorsLastUpdateTime) < 50) {
try {
Thread.sleep(30);
} catch (InterruptedException e) {
@@ -377,12 +379,12 @@
}
}
}
- if (_errors.length() > 0) {
+ if (errors.length() > 0) {
if (sendErrorAsResponse) {
- response.append(_errors);
- _errors.setLength(0);
+ response.append(errors);
+ errors.setLength(0);
} else {
- throw new IOException(chomp(_errors).toString());
+ throw new IOException(chomp(errors).toString());
}
}
chomp(response);
@@ -404,6 +406,7 @@
try {
wait(timeout);
} catch (InterruptedException e) {
+ //nothing to do
}
}
updateLastCommandTime();
@@ -440,7 +443,7 @@
}
protected synchronized void ensureConnectionOpened() throws IOException {
- if (_in == null) {
+ if (in == null) {
Message.verbose("connecting to " + getUsername() + "@" + getHost() + "... ");
String connectionCommand = getConnectionCommand();
exec(connectionCommand);
@@ -448,30 +451,31 @@
try {
readResponse(false); // waits for first prompt
- if (_reuseConnection > 0) {
- _connectionCleaner = new IvyThread() {
+ if (reuseConnection > 0) {
+ connectionCleaner = new IvyThread() {
public void run() {
initContext();
try {
long sleep = 10;
- while (_in != null && sleep > 0) {
+ while (in != null && sleep > 0) {
sleep(sleep);
- sleep = _reuseConnection
- - (System.currentTimeMillis() - _lastCommand);
- if (_inCommand) {
- sleep = sleep <= 0 ? _reuseConnection : sleep;
+ sleep = reuseConnection
+ - (System.currentTimeMillis() - lastCommand);
+ if (inCommand) {
+ sleep = sleep <= 0 ? reuseConnection : sleep;
}
}
} catch (InterruptedException e) {
+ //nothing to do
}
disconnect();
}
};
- _connectionCleaner.start();
+ connectionCleaner.start();
}
- if (_ivy != null) {
- _ivy.getEventManager().addIvyListener(new IvyListener() {
+ if (ivy != null) {
+ ivy.getEventManager().addIvyListener(new IvyListener() {
public void progress(IvyEvent event) {
disconnect();
event.getSource().removeIvyListener(this);
@@ -489,35 +493,36 @@
}
private void updateLastCommandTime() {
- _lastCommand = System.currentTimeMillis();
+ lastCommand = System.currentTimeMillis();
}
private void exec(String command) throws IOException {
Message.debug("launching '" + command + "'");
- _process = Runtime.getRuntime().exec(command);
- _in = new InputStreamReader(_process.getInputStream());
- _err = new InputStreamReader(_process.getErrorStream());
- _out = new PrintWriter(_process.getOutputStream());
+ process = Runtime.getRuntime().exec(command);
+ in = new InputStreamReader(process.getInputStream());
+ err = new InputStreamReader(process.getErrorStream());
+ out = new PrintWriter(process.getOutputStream());
- _errorsReader = new IvyThread() {
+ errorsReader = new IvyThread() {
public void run() {
initContext();
int c;
try {
- while (_err != null && (c = _err.read()) != -1) {
- _errors.append((char) c);
- _errorsLastUpdateTime = System.currentTimeMillis();
+ while (err != null && (c = err.read()) != -1) {
+ errors.append((char) c);
+ errorsLastUpdateTime = System.currentTimeMillis();
}
} catch (IOException e) {
+ //nothing to do
}
}
};
- _errorsReader.start();
+ errorsReader.start();
}
private void checkInterrupted() {
- if (_ivy != null) {
- _ivy.checkInterrupted();
+ if (ivy != null) {
+ ivy.checkInterrupted();
}
}
@@ -536,17 +541,18 @@
* Called whenever an api level method end
*/
private void cleanup() {
- if (_reuseConnection == 0) {
+ if (reuseConnection == 0) {
disconnect();
}
}
public synchronized void disconnect() {
- if (_in != null) {
+ if (in != null) {
Message.verbose("disconnecting from " + getHost() + "... ");
try {
sendCommand("exit", false, 300);
} catch (IOException e) {
+ //nothing I can do
} finally {
closeConnection();
Message.verbose("disconnected of " + getHost());
@@ -555,35 +561,39 @@
}
private synchronized void closeConnection() {
- if (_connectionCleaner != null) {
- _connectionCleaner.interrupt();
+ if (connectionCleaner != null) {
+ connectionCleaner.interrupt();
}
- if (_errorsReader != null) {
- _errorsReader.interrupt();
+ if (errorsReader != null) {
+ errorsReader.interrupt();
}
try {
- _process.destroy();
+ process.destroy();
} catch (Exception ex) {
+ //nothing I can do
}
try {
- _in.close();
+ in.close();
} catch (Exception e) {
+ //nothing I can do
}
try {
- _err.close();
+ err.close();
} catch (Exception e) {
+ //nothing I can do
}
try {
- _out.close();
+ out.close();
} catch (Exception e) {
+ //nothing I can do
}
- _connectionCleaner = null;
- _errorsReader = null;
- _process = null;
- _in = null;
- _out = null;
- _err = null;
+ connectionCleaner = null;
+ errorsReader = null;
+ process = null;
+ in = null;
+ out = null;
+ err = null;
Message.debug("connection to " + getHost() + " closed");
}
@@ -619,12 +629,12 @@
}
protected String getSingleCommand(String command) {
- return "vsh -noprompt -auth " + _authentication + " " + _username + "@" + _host + " "
+ return "vsh -noprompt -auth " + authentication + " " + username + "@" + host + " "
+ command;
}
protected String getConnectionCommand() {
- return "vsftp -noprompt -auth " + _authentication + " " + _username + "@" + _host;
+ return "vsftp -noprompt -auth " + authentication + " " + username + "@" + host;
}
protected Pattern getExpectedDownloadMessage(String source, File to) {
@@ -640,27 +650,27 @@
}
public String getAuthentication() {
- return _authentication;
+ return authentication;
}
public void setAuthentication(String authentication) {
- _authentication = authentication;
+ this.authentication = authentication;
}
public String getHost() {
- return _host;
+ return host;
}
public void setHost(String host) {
- _host = host;
+ this.host = host;
}
public String getUsername() {
- return _username;
+ return username;
}
public void setUsername(String username) {
- _username = username;
+ this.username = username;
}
private static StringBuffer chomp(StringBuffer str) {
@@ -685,14 +695,14 @@
* @param time
*/
public void setReuseConnection(long time) {
- _reuseConnection = time;
+ this.reuseConnection = time;
}
public long getReadTimeout() {
- return _readTimeout;
+ return readTimeout;
}
public void setReadTimeout(long readTimeout) {
- _readTimeout = readTimeout;
+ this.readTimeout = readTimeout;
}
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java Sat Jul 28 12:11:58 2007
@@ -133,5 +133,5 @@
getSshBasedRepository().setPort(port);
}
- abstract public String getTypeName();
+ public abstract String getTypeName();
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java Sat Jul 28 12:11:58 2007
@@ -42,8 +42,6 @@
import org.apache.ivy.util.Message;
public class CacheResolver extends FileSystemResolver {
- private File _configured = null;
-
public CacheResolver() {
}
@@ -161,7 +159,7 @@
}
private void ensureConfigured(IvySettings settings, File cache) {
- if (settings == null || cache == null || (_configured != null && _configured.equals(cache))) {
+ if (settings == null || cache == null) {
return;
}
setIvyPatterns(Collections.singletonList(cache.getAbsolutePath() + "/"
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=560593&r1=560592&r2=560593
==============================================================================
--- 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 Sat Jul 28 12:11:58 2007
@@ -45,30 +45,30 @@
*/
public class ChainResolver extends AbstractResolver {
public static class ResolvedModuleRevisionArtifactInfo implements ArtifactInfo {
- private ResolvedModuleRevision _rmr;
+ private ResolvedModuleRevision rmr;
public ResolvedModuleRevisionArtifactInfo(ResolvedModuleRevision rmr) {
- _rmr = rmr;
+ this.rmr = rmr;
}
public String getRevision() {
- return _rmr.getId().getRevision();
+ return rmr.getId().getRevision();
}
public long getLastModified() {
- return _rmr.getPublicationDate().getTime();
+ return rmr.getPublicationDate().getTime();
}
}
- private boolean _returnFirst = false;
+ private boolean returnFirst = false;
- private List _chain = new ArrayList();
+ private List chain = new ArrayList();
- private boolean _dual;
+ private boolean dual;
public void add(DependencyResolver resolver) {
- _chain.add(resolver);
+ chain.add(resolver);
}
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
@@ -78,7 +78,7 @@
List errors = new ArrayList();
- for (Iterator iter = _chain.iterator(); iter.hasNext();) {
+ for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
LatestStrategy oldLatest = setLatestIfRequired(resolver, getLatestStrategy());
ResolvedModuleRevision mr = null;
@@ -95,7 +95,7 @@
}
checkInterrupted();
if (mr != null) {
- boolean shouldReturn = _returnFirst;
+ boolean shouldReturn = returnFirst;
shouldReturn |= !getSettings().getVersionMatcher().isDynamic(
dd.getDependencyRevisionId())
&& ret != null && !ret.getDescriptor().isDefault();
@@ -187,14 +187,14 @@
}
public void reportFailure() {
- for (Iterator iter = _chain.iterator(); iter.hasNext();) {
+ for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
resolver.reportFailure();
}
}
public void reportFailure(Artifact art) {
- for (Iterator iter = _chain.iterator(); iter.hasNext();) {
+ for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
resolver.reportFailure(art);
}
@@ -203,7 +203,7 @@
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
List artifactsToDownload = new ArrayList(Arrays.asList(artifacts));
DownloadReport report = new DownloadReport();
- for (Iterator iter = _chain.iterator(); iter.hasNext() && !artifactsToDownload.isEmpty();) {
+ 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);
@@ -225,36 +225,36 @@
}
public List getResolvers() {
- return _chain;
+ return chain;
}
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
- if (_chain.isEmpty()) {
+ 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;
+ return returnFirst;
}
public void setReturnFirst(boolean returnFirst) {
- _returnFirst = returnFirst;
+ this.returnFirst = returnFirst;
}
public void dumpSettings() {
- Message.verbose("\t" + getName() + " [chain] " + _chain);
+ Message.verbose("\t" + getName() + " [chain] " + chain);
Message.debug("\t\treturn first: " + isReturnFirst());
Message.debug("\t\tdual: " + isDual());
- for (Iterator iter = _chain.iterator(); iter.hasNext();) {
+ for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver r = (DependencyResolver) iter.next();
Message.debug("\t\t-> " + r.getName());
}
}
public boolean exists(Artifact artifact) {
- for (Iterator iter = _chain.iterator(); iter.hasNext();) {
+ for (Iterator iter = chain.iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
if (resolver.exists(artifact)) {
return true;
@@ -287,11 +287,11 @@
}
public void setDual(boolean b) {
- _dual = b;
+ dual = b;
}
public boolean isDual() {
- return _dual;
+ return dual;
}
}
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=560593&r1=560592&r2=560593
==============================================================================
--- 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 Sat Jul 28 12:11:58 2007
@@ -41,17 +41,17 @@
* first resolver added if the ivy resolver, the second is the artifact one.
*/
public class DualResolver extends AbstractResolver {
- private DependencyResolver _ivyResolver;
+ private DependencyResolver ivyResolver;
- private DependencyResolver _artifactResolver;
+ private DependencyResolver artifactResolver;
- private boolean _allownomd = true;
+ private boolean allownomd = true;
public void add(DependencyResolver resolver) {
- if (_ivyResolver == null) {
- _ivyResolver = resolver;
- } else if (_artifactResolver == null) {
- _artifactResolver = resolver;
+ if (ivyResolver == null) {
+ ivyResolver = resolver;
+ } else if (artifactResolver == null) {
+ artifactResolver = resolver;
} else {
throw new IllegalStateException(
"exactly two resolvers must be added: ivy(1) and artifact(2) one");
@@ -60,18 +60,18 @@
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
throws ParseException {
- if (_ivyResolver == null || _artifactResolver == null) {
+ if (ivyResolver == null || artifactResolver == null) {
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);
+ 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");
- return _artifactResolver.getDependency(dd, data);
+ return artifactResolver.getDependency(dd, data);
} else {
return null;
}
@@ -81,61 +81,61 @@
}
public void reportFailure() {
- _ivyResolver.reportFailure();
- _artifactResolver.reportFailure();
+ ivyResolver.reportFailure();
+ artifactResolver.reportFailure();
}
public void reportFailure(Artifact art) {
- _ivyResolver.reportFailure(art);
- _artifactResolver.reportFailure(art);
+ ivyResolver.reportFailure(art);
+ artifactResolver.reportFailure(art);
}
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
- return _artifactResolver.download(artifacts, options);
+ return artifactResolver.download(artifacts, options);
}
public DependencyResolver getArtifactResolver() {
- return _artifactResolver;
+ return artifactResolver;
}
public void setArtifactResolver(DependencyResolver artifactResolver) {
- _artifactResolver = artifactResolver;
+ this.artifactResolver = artifactResolver;
}
public DependencyResolver getIvyResolver() {
- return _ivyResolver;
+ return ivyResolver;
}
public void setIvyResolver(DependencyResolver ivyResolver) {
- _ivyResolver = ivyResolver;
+ this.ivyResolver = ivyResolver;
}
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
if ("ivy".equals(artifact.getType())) {
- _ivyResolver.publish(artifact, src, overwrite);
+ ivyResolver.publish(artifact, src, overwrite);
} else {
- _artifactResolver.publish(artifact, src, overwrite);
+ artifactResolver.publish(artifact, src, overwrite);
}
}
public void dumpSettings() {
- if (_ivyResolver == null || _artifactResolver == null) {
+ if (ivyResolver == null || artifactResolver == null) {
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);
+ return artifactResolver.exists(artifact);
}
public boolean isAllownomd() {
- return _allownomd;
+ return allownomd;
}
public void setAllownomd(boolean allownomd) {
- _allownomd = allownomd;
+ this.allownomd = allownomd;
}
}
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=560593&r1=560592&r2=560593
==============================================================================
--- 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 Sat Jul 28 12:11:58 2007
@@ -58,35 +58,35 @@
public static final String DEFAULT_IVYROOT = "http://ivyrep.jayasoft.org/";
- private String _ivyroot = null;
+ private String ivyroot = null;
- private String _ivypattern = null;
+ private String ivypattern = null;
- private String _artroot = null;
+ private String artroot = null;
- private String _artpattern = null;
+ private String artpattern = null;
public IvyRepResolver() {
}
private void ensureArtifactConfigured(IvySettings settings) {
- if (settings != null && (_artroot == null || _artpattern == null)) {
- if (_artroot == null) {
+ if (settings != null && (artroot == null || artpattern == null)) {
+ if (artroot == null) {
String root = settings.getVariable("ivy.ivyrep.default.artifact.root");
if (root != null) {
- _artroot = root;
+ artroot = root;
} else {
settings.configureRepositories(true);
- _artroot = settings.getVariable("ivy.ivyrep.default.artifact.root");
+ artroot = settings.getVariable("ivy.ivyrep.default.artifact.root");
}
}
- if (_artpattern == null) {
+ if (artpattern == null) {
String pattern = settings.getVariable("ivy.ivyrep.default.artifact.pattern");
if (pattern != null) {
- _artpattern = pattern;
+ artpattern = pattern;
} else {
settings.configureRepositories(false);
- _artpattern = settings.getVariable("ivy.ivyrep.default.artifact.pattern");
+ artpattern = settings.getVariable("ivy.ivyrep.default.artifact.pattern");
}
}
updateWholeArtPattern();
@@ -94,23 +94,23 @@
}
private void ensureIvyConfigured(IvySettings settings) {
- if (settings != null && (_ivyroot == null || _ivypattern == null)) {
- if (_ivyroot == null) {
+ if (settings != null && (ivyroot == null || ivypattern == null)) {
+ if (ivyroot == null) {
String root = settings.getVariable("ivy.ivyrep.default.ivy.root");
if (root != null) {
- _ivyroot = root;
+ ivyroot = root;
} else {
settings.configureRepositories(true);
- _ivyroot = settings.getVariable("ivy.ivyrep.default.ivy.root");
+ ivyroot = settings.getVariable("ivy.ivyrep.default.ivy.root");
}
}
- if (_ivypattern == null) {
+ if (ivypattern == null) {
String pattern = settings.getVariable("ivy.ivyrep.default.ivy.pattern");
if (pattern != null) {
- _ivypattern = pattern;
+ ivypattern = pattern;
} else {
settings.configureRepositories(false);
- _ivypattern = settings.getVariable("ivy.ivyrep.default.ivy.pattern");
+ ivypattern = settings.getVariable("ivy.ivyrep.default.ivy.pattern");
}
}
updateWholeIvyPattern();
@@ -118,31 +118,31 @@
}
private String getWholeIvyPattern() {
- if (_ivyroot == null || _ivypattern == null) {
+ if (ivyroot == null || ivypattern == null) {
return null;
}
- return _ivyroot + _ivypattern;
+ return ivyroot + ivypattern;
}
private String getWholeArtPattern() {
- return _artroot + _artpattern;
+ return artroot + artpattern;
}
public String getIvypattern() {
- return _ivypattern;
+ return ivypattern;
}
public void setIvypattern(String pattern) {
if (pattern == null) {
throw new NullPointerException("pattern must not be null");
}
- _ivypattern = pattern;
+ ivypattern = pattern;
ensureIvyConfigured(getSettings());
updateWholeIvyPattern();
}
public String getIvyroot() {
- return _ivyroot;
+ return ivyroot;
}
/**
@@ -159,9 +159,9 @@
throw new NullPointerException("root must not be null");
}
if (!root.endsWith("/")) {
- _ivyroot = root + "/";
+ ivyroot = root + "/";
} else {
- _ivyroot = root;
+ ivyroot = root;
}
ensureIvyConfigured(getSettings());
updateWholeIvyPattern();
@@ -169,8 +169,9 @@
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.");
}
}
@@ -187,18 +188,18 @@
}
public String getArtroot() {
- return _artroot;
+ return artroot;
}
public String getArtpattern() {
- return _artpattern;
+ return artpattern;
}
public void setArtpattern(String pattern) {
if (pattern == null) {
throw new NullPointerException("pattern must not be null");
}
- _artpattern = pattern;
+ artpattern = pattern;
ensureArtifactConfigured(getSettings());
updateWholeArtPattern();
}
@@ -208,9 +209,9 @@
throw new NullPointerException("root must not be null");
}
if (!root.endsWith("/")) {
- _artroot = root + "/";
+ artroot = root + "/";
} else {
- _artroot = root;
+ artroot = root;
}
ensureArtifactConfigured(getSettings());
updateWholeArtPattern();
@@ -219,7 +220,7 @@
public OrganisationEntry[] listOrganisations() {
ensureIvyConfigured(getSettings());
try {
- URL content = new URL(_ivyroot + "content.xml");
+ 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,
@@ -234,6 +235,7 @@
});
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());
}
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=560593&r1=560592&r2=560593
==============================================================================
--- 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 Sat Jul 28 12:11:58 2007
@@ -93,9 +93,8 @@
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,
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=560593&r1=560592&r2=560593
==============================================================================
--- 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 Sat Jul 28 12:11:58 2007
@@ -36,18 +36,19 @@
* file separator to use on the target system
*/
public void setFileSeparator(String sep) {
- if (sep == null || sep.length() != 1)
+ 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"
+ * 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);
@@ -55,10 +56,10 @@
/**
* 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: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java Sat Jul 28 12:11:58 2007
@@ -38,7 +38,12 @@
/**
* Utility class used to deal with file related operations, like copy, full reading, symlink, ...
*/
-public class FileUtil {
+public final class FileUtil {
+
+ private FileUtil() {
+ //Utility class
+ }
+
// according to tests by users, 64kB seems to be a good value for the buffer used during copy
// further improvements could be obtained using NIO API
private static final int BUFFER_SIZE = 64 * 1024;
@@ -238,8 +243,10 @@
* Returns a collection of all Files being contained in the given directory, recursively,
* including directories.
*
- * @param dir The directory from which all files, including files in subdirectory) are extracted.
- * @return A collectoin containing all the files of the given directory and it's subdirectories.
+ * @param dir The directory from which all files, including files in subdirectory)
+ * are extracted.
+ * @return A collectoin containing all the files of the given directory and it's
+ * subdirectories.
*/
public static Collection listAll(File dir) {
return listAll(dir, new ArrayList());
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java?view=diff&rev=560593&r1=560592&r2=560593
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java Sat Jul 28 12:11:58 2007
@@ -23,7 +23,12 @@
* Convenient class used only for uncapitalization Usually use commons lang but here we do not want
* to have such a dependency for only one feature
*/
-public class StringUtils {
+public final class StringUtils {
+
+ private StringUtils() {
+ //Utility class
+ }
+
public static String uncapitalize(String string) {
if (string == null || string.length() == 0) {
return string;
@@ -59,7 +64,7 @@
// basic string codec (same algo as CVS passfile, inspired by ant CVSPass class
/** Array contain char conversion data */
- private final static char[] SHIFTS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ private static final char[] SHIFTS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 114, 120, 53, 79, 96, 109,
72, 108, 70, 64, 76, 67, 116, 74, 68, 87, 111, 52, 75, 119, 49, 34, 82, 81, 95, 65,
112, 86, 118, 110, 122, 105, 41, 57, 83, 43, 46, 102, 40, 89, 38, 103, 45, 50, 42, 123,
@@ -84,7 +89,7 @@
* the string to encrypt
* @return the encrypted version of the string
*/
- public final static String encrypt(String str) {
+ public static final String encrypt(String str) {
if (str == null) {
return null;
}
@@ -108,7 +113,7 @@
* the encrypted string to decrypt
* @return The decrypted string.
*/
- public final static String decrypt(String str) {
+ public static final String decrypt(String str) {
if (str == null) {
return null;
}