You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC
svn commit: r544459 [18/36] - in /incubator/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver...
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java Tue Jun 5 05:02:27 2007
@@ -47,94 +47,104 @@
import org.apache.ivy.util.Message;
import org.apache.ivy.util.StringUtils;
-
/**
*
*/
public class XmlReportOutputter implements ReportOutputter {
- public String getName() {
- return XML;
- }
-
+ public String getName() {
+ return XML;
+ }
+
public void output(ResolveReport report, File destDir) {
String[] confs = report.getConfigurations();
for (int i = 0; i < confs.length; i++) {
output(report.getConfigurationReport(confs[i]), report.getResolveId(), confs, destDir);
}
}
-
- public void output(ConfigurationResolveReport report, String resolveId, String[] confs, File destDir) {
- try {
- destDir.mkdirs();
- CacheManager cacheMgr = new CacheManager(null, destDir);
- File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolveId, report.getConfiguration());
- OutputStream stream = new FileOutputStream(reportFile);
- output(report, confs, stream);
- stream.close();
-
- Message.verbose("\treport for "+report.getModuleDescriptor().getModuleRevisionId()+" "+report.getConfiguration()+" produced in "+reportFile);
-
+
+ public void output(ConfigurationResolveReport report, String resolveId, String[] confs,
+ File destDir) {
+ try {
+ destDir.mkdirs();
+ CacheManager cacheMgr = new CacheManager(null, destDir);
+ File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolveId, report
+ .getConfiguration());
+ OutputStream stream = new FileOutputStream(reportFile);
+ output(report, confs, stream);
+ stream.close();
+
+ Message.verbose("\treport for " + report.getModuleDescriptor().getModuleRevisionId()
+ + " " + report.getConfiguration() + " produced in " + reportFile);
+
File reportXsl = new File(destDir, "ivy-report.xsl");
File reportCss = new File(destDir, "ivy-report.css");
if (!reportXsl.exists()) {
- FileUtil.copy(XmlReportOutputter.class.getResource("ivy-report.xsl"), reportXsl, null);
+ FileUtil.copy(XmlReportOutputter.class.getResource("ivy-report.xsl"), reportXsl,
+ null);
}
if (!reportCss.exists()) {
- FileUtil.copy(XmlReportOutputter.class.getResource("ivy-report.css"), reportCss, null);
+ FileUtil.copy(XmlReportOutputter.class.getResource("ivy-report.css"), reportCss,
+ null);
}
- } catch (IOException ex) {
- Message.error("impossible to produce report for "+report.getModuleDescriptor()+": "+ex.getMessage());
- }
+ } catch (IOException ex) {
+ Message.error("impossible to produce report for " + report.getModuleDescriptor() + ": "
+ + ex.getMessage());
+ }
}
-
+
public void output(ConfigurationResolveReport report, OutputStream stream) {
- output(report, new String[] {report.getConfiguration()}, stream);
+ output(report, new String[] {report.getConfiguration()}, stream);
}
+
public void output(ConfigurationResolveReport report, String[] confs, OutputStream stream) {
- PrintWriter out = new PrintWriter(stream);
- ModuleRevisionId mrid = report.getModuleDescriptor().getModuleRevisionId();
+ PrintWriter out = new PrintWriter(stream);
+ ModuleRevisionId mrid = report.getModuleDescriptor().getModuleRevisionId();
out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
out.println("<?xml-stylesheet type=\"text/xsl\" href=\"ivy-report.xsl\"?>");
- out.println("<ivy-report version=\"1.0\">");
- out.println("\t<info");
- out.println("\t\torganisation=\""+mrid.getOrganisation()+"\"");
- out.println("\t\tmodule=\""+mrid.getName()+"\"");
- out.println("\t\trevision=\""+mrid.getRevision()+"\"");
- if (mrid.getBranch() != null) {
- out.println("\t\tbranch=\""+mrid.getBranch()+"\"");
- }
- Map extraAttributes = mrid.getExtraAttributes();
- for (Iterator it = extraAttributes.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Entry) it.next();
- out.println("\t\textra-" + entry.getKey() + "=\"" + entry.getValue() + "\"");
- }
- out.println("\t\tconf=\""+report.getConfiguration()+"\"");
- out.println("\t\tconfs=\""+StringUtils.join(confs, ", ")+"\"");
- out.println("\t\tdate=\""+Ivy.DATE_FORMAT.format(report.getDate())+"\"/>");
-
- out.println("\t<dependencies>");
-
- // create a list of ModuleRevisionIds indicating the position for each dependency
- List dependencies = new ArrayList(report.getModuleRevisionIds());
-
- for (Iterator iter = report.getModuleIds().iterator(); iter.hasNext();) {
- ModuleId mid = (ModuleId) iter.next();
- out.println("\t\t<module organisation=\""+mid.getOrganisation()+"\"" +
- " name=\""+mid.getName()+"\"" +
- " resolver=\""+report.getResolveEngine().getSettings().getResolverName(mid)+"\">");
- for (Iterator it2 = report.getNodes(mid).iterator(); it2.hasNext();) {
- IvyNode dep = (IvyNode)it2.next();
+ out.println("<ivy-report version=\"1.0\">");
+ out.println("\t<info");
+ out.println("\t\torganisation=\"" + mrid.getOrganisation() + "\"");
+ out.println("\t\tmodule=\"" + mrid.getName() + "\"");
+ out.println("\t\trevision=\"" + mrid.getRevision() + "\"");
+ if (mrid.getBranch() != null) {
+ out.println("\t\tbranch=\"" + mrid.getBranch() + "\"");
+ }
+ Map extraAttributes = mrid.getExtraAttributes();
+ for (Iterator it = extraAttributes.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Entry) it.next();
+ out.println("\t\textra-" + entry.getKey() + "=\"" + entry.getValue() + "\"");
+ }
+ out.println("\t\tconf=\"" + report.getConfiguration() + "\"");
+ out.println("\t\tconfs=\"" + StringUtils.join(confs, ", ") + "\"");
+ out.println("\t\tdate=\"" + Ivy.DATE_FORMAT.format(report.getDate()) + "\"/>");
+
+ out.println("\t<dependencies>");
+
+ // create a list of ModuleRevisionIds indicating the position for each dependency
+ List dependencies = new ArrayList(report.getModuleRevisionIds());
+
+ for (Iterator iter = report.getModuleIds().iterator(); iter.hasNext();) {
+ ModuleId mid = (ModuleId) iter.next();
+ out.println("\t\t<module organisation=\"" + mid.getOrganisation() + "\"" + " name=\""
+ + mid.getName() + "\"" + " resolver=\""
+ + report.getResolveEngine().getSettings().getResolverName(mid) + "\">");
+ for (Iterator it2 = report.getNodes(mid).iterator(); it2.hasNext();) {
+ IvyNode dep = (IvyNode) it2.next();
ModuleDescriptor md = null;
if (dep.getModuleRevision() != null) {
md = dep.getModuleRevision().getDescriptor();
}
StringBuffer details = new StringBuffer();
- if (dep.isLoaded()) {
- details.append(" status=\"").append(dep.getDescriptor().getStatus()).append("\"").append(
- " pubdate=\"").append(Ivy.DATE_FORMAT.format(new Date(dep.getPublication()))).append("\"").append(
- " resolver=\"").append(dep.getModuleRevision().getResolver().getName()).append("\"").append(
- " artresolver=\"").append(dep.getModuleRevision().getArtifactResolver().getName()).append("\"");
+ if (dep.isLoaded()) {
+ details.append(" status=\"").append(dep.getDescriptor().getStatus()).append(
+ "\"").append(" pubdate=\"").append(
+ Ivy.DATE_FORMAT.format(new Date(dep.getPublication()))).append("\"")
+ .append(" resolver=\"").append(
+ dep.getModuleRevision().getResolver().getName()).append("\"")
+ .append(" artresolver=\"").append(
+ dep.getModuleRevision().getArtifactResolver().getName()).append(
+ "\"");
}
if (dep.isEvicted(report.getConfiguration())) {
EvictionData ed = dep.getEvictedData(report.getConfiguration());
@@ -150,31 +160,36 @@
if (md != null && md.getHomePage() != null) {
details.append(" homepage=\"").append(md.getHomePage()).append("\"");
}
- extraAttributes = md!=null?md.getExtraAttributes():dep.getResolvedId().getExtraAttributes();
+ extraAttributes = md != null ? md.getExtraAttributes() : dep.getResolvedId()
+ .getExtraAttributes();
for (Iterator iterator = extraAttributes.keySet().iterator(); iterator.hasNext();) {
- String attName = (String)iterator.next();
- details.append(" extra-").append(attName).append("=\"").append(extraAttributes.get(attName)).append("\"");
+ String attName = (String) iterator.next();
+ details.append(" extra-").append(attName).append("=\"").append(
+ extraAttributes.get(attName)).append("\"");
}
- String defaultValue = dep.getDescriptor() != null ? " default=\""+dep.getDescriptor().isDefault()+"\"" : "";
+ String defaultValue = dep.getDescriptor() != null ? " default=\""
+ + dep.getDescriptor().isDefault() + "\"" : "";
int position = dependencies.indexOf(dep.getResolvedId());
- out.println("\t\t\t<revision name=\""+dep.getResolvedId().getRevision()+"\"" +
- (dep.getResolvedId().getBranch() == null?"":" branch=\""+dep.getResolvedId().getBranch()+"\"")+
- details +
- " downloaded=\""+dep.isDownloaded()+"\""+
- " searched=\""+dep.isSearched()+"\""+
- defaultValue+
- " conf=\""+toString(dep.getConfigurations(report.getConfiguration()))+"\""+
- " position=\""+position+"\">");
+ out.println("\t\t\t<revision name=\""
+ + dep.getResolvedId().getRevision()
+ + "\""
+ + (dep.getResolvedId().getBranch() == null ? "" : " branch=\""
+ + dep.getResolvedId().getBranch() + "\"") + details
+ + " downloaded=\"" + dep.isDownloaded() + "\"" + " searched=\""
+ + dep.isSearched() + "\"" + defaultValue + " conf=\""
+ + toString(dep.getConfigurations(report.getConfiguration())) + "\""
+ + " position=\"" + position + "\">");
if (md != null) {
License[] licenses = md.getLicenses();
for (int i = 0; i < licenses.length; i++) {
String lurl;
if (licenses[i].getUrl() != null) {
- lurl = " url=\""+licenses[i].getUrl()+"\"";
+ lurl = " url=\"" + licenses[i].getUrl() + "\"";
} else {
lurl = "";
}
- out.println("\t\t\t\t<license name=\""+licenses[i].getName()+"\""+lurl+"/>");
+ out.println("\t\t\t\t<license name=\"" + licenses[i].getName() + "\""
+ + lurl + "/>");
}
}
if (dep.isEvicted(report.getConfiguration())) {
@@ -182,67 +197,76 @@
Collection selected = ed.getSelected();
if (selected != null) {
for (Iterator it3 = selected.iterator(); it3.hasNext();) {
- IvyNode sel = (IvyNode)it3.next();
- out.println("\t\t\t\t<evicted-by rev=\""+sel.getResolvedId().getRevision()+"\"/>");
+ IvyNode sel = (IvyNode) it3.next();
+ out.println("\t\t\t\t<evicted-by rev=\""
+ + sel.getResolvedId().getRevision() + "\"/>");
}
}
}
Caller[] callers = dep.getCallers(report.getConfiguration());
- for (int i = 0; i < callers.length; i++) {
- StringBuffer callerDetails = new StringBuffer();
- Map callerExtraAttributes = callers[i].getDependencyDescriptor().getExtraAttributes();
- for (Iterator iterator = callerExtraAttributes.keySet().iterator(); iterator.hasNext();) {
- String attName = (String)iterator.next();
- callerDetails.append(" extra-").append(attName).append("=\"").append(callerExtraAttributes.get(attName)).append("\"");
- }
-
- out.println("\t\t\t\t<caller organisation=\""+callers[i].getModuleRevisionId().getOrganisation()+"\"" +
- " name=\""+callers[i].getModuleRevisionId().getName()+"\"" +
- " conf=\""+toString(callers[i].getCallerConfigurations())+"\""+
- " rev=\""+callers[i].getAskedDependencyId().getRevision()+"\""+
- callerDetails+
- "/>");
- }
- ArtifactDownloadReport[] adr = report.getDownloadReports(dep.getResolvedId());
- out.println("\t\t\t\t<artifacts>");
- for (int i = 0; i < adr.length; i++) {
- out.print("\t\t\t\t\t<artifact name=\""+adr[i].getName()+"\" type=\""+adr[i].getType()+"\" ext=\""+adr[i].getExt()+"\"");
+ for (int i = 0; i < callers.length; i++) {
+ StringBuffer callerDetails = new StringBuffer();
+ Map callerExtraAttributes = callers[i].getDependencyDescriptor()
+ .getExtraAttributes();
+ for (Iterator iterator = callerExtraAttributes.keySet().iterator(); iterator
+ .hasNext();) {
+ String attName = (String) iterator.next();
+ callerDetails.append(" extra-").append(attName).append("=\"").append(
+ callerExtraAttributes.get(attName)).append("\"");
+ }
+
+ out.println("\t\t\t\t<caller organisation=\""
+ + callers[i].getModuleRevisionId().getOrganisation() + "\""
+ + " name=\"" + callers[i].getModuleRevisionId().getName() + "\""
+ + " conf=\"" + toString(callers[i].getCallerConfigurations()) + "\""
+ + " rev=\"" + callers[i].getAskedDependencyId().getRevision() + "\""
+ + callerDetails + "/>");
+ }
+ ArtifactDownloadReport[] adr = report.getDownloadReports(dep.getResolvedId());
+ out.println("\t\t\t\t<artifacts>");
+ for (int i = 0; i < adr.length; i++) {
+ out.print("\t\t\t\t\t<artifact name=\"" + adr[i].getName() + "\" type=\""
+ + adr[i].getType() + "\" ext=\"" + adr[i].getExt() + "\"");
extraAttributes = adr[i].getArtifact().getExtraAttributes();
- for (Iterator iterator = extraAttributes.keySet().iterator(); iterator.hasNext();) {
- String attName = (String)iterator.next();
- out.print(" extra-"+attName+"=\""+extraAttributes.get(attName)+"\"");
- }
- out.print(" status=\""+adr[i].getDownloadStatus()+"\"");
- out.print(" size=\""+adr[i].getSize()+"\"");
-
- ArtifactOrigin origin = adr[i].getArtifactOrigin();
- if (origin != null) {
- out.println(">");
- out.println("\t\t\t\t\t\t<origin-location is-local=\"" + String.valueOf(origin.isLocal()) + "\"" +
- " location=\"" + origin.getLocation() + "\"/>");
- out.println("\t\t\t\t\t</artifact>");
- } else {
- out.println("/>");
- }
- }
- out.println("\t\t\t\t</artifacts>");
- out.println("\t\t\t</revision>");
- }
- out.println("\t\t</module>");
- }
- out.println("\t</dependencies>");
- out.println("</ivy-report>");
- out.flush();
- }
-
- private String toString(String[] strs) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < strs.length; i++) {
- buf.append(strs[i]);
- if (i + 1 < strs.length) {
- buf.append(", ");
- }
- }
- return buf.toString();
- }
+ for (Iterator iterator = extraAttributes.keySet().iterator(); iterator
+ .hasNext();) {
+ String attName = (String) iterator.next();
+ out
+ .print(" extra-" + attName + "=\"" + extraAttributes.get(attName)
+ + "\"");
+ }
+ out.print(" status=\"" + adr[i].getDownloadStatus() + "\"");
+ out.print(" size=\"" + adr[i].getSize() + "\"");
+
+ ArtifactOrigin origin = adr[i].getArtifactOrigin();
+ if (origin != null) {
+ out.println(">");
+ out.println("\t\t\t\t\t\t<origin-location is-local=\""
+ + String.valueOf(origin.isLocal()) + "\"" + " location=\""
+ + origin.getLocation() + "\"/>");
+ out.println("\t\t\t\t\t</artifact>");
+ } else {
+ out.println("/>");
+ }
+ }
+ out.println("\t\t\t\t</artifacts>");
+ out.println("\t\t\t</revision>");
+ }
+ out.println("\t\t</module>");
+ }
+ out.println("\t</dependencies>");
+ out.println("</ivy-report>");
+ out.flush();
+ }
+
+ private String toString(String[] strs) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < strs.length; i++) {
+ buf.append(strs[i]);
+ if (i + 1 < strs.length) {
+ buf.append(", ");
+ }
+ }
+ return buf.toString();
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java Tue Jun 5 05:02:27 2007
@@ -40,39 +40,57 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-
public class XmlReportParser {
private static class SaxXmlReportParser {
private List _mrids;
+
private List _defaultMrids;
+
private List _realMrids;
- private List _artifacts;
- private ModuleRevisionId _mRevisionId;
- private File _report;
- SaxXmlReportParser(File report) {
- _artifacts = new ArrayList();
+
+ private List _artifacts;
+
+ private ModuleRevisionId _mRevisionId;
+
+ private File _report;
+
+ SaxXmlReportParser(File report) {
+ _artifacts = new ArrayList();
_mrids = new ArrayList();
_defaultMrids = new ArrayList();
_realMrids = new ArrayList();
- _report = report;
- }
-
- public void parse() throws Exception {
+ _report = report;
+ }
+
+ public void parse() throws Exception {
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(_report, new DefaultHandler() {
private String _organisation;
+
private String _module;
+
private String _branch;
+
private String _revision;
+
private int _position;
+
private Date _pubdate;
+
private boolean _skip;
- private ModuleRevisionId _mrid;
+
+ private ModuleRevisionId _mrid;
+
private boolean _default;
- private SortedMap _revisionsMap = new TreeMap(); // Use a TreeMap to order by position (position = key)
+
+ private SortedMap _revisionsMap = new TreeMap(); // Use a TreeMap to order by
+
+ // position (position = key)
+
private List _revisionArtifacts = null;
-
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
if ("module".equals(qName)) {
_organisation = attributes.getValue("organisation");
_module = attributes.getValue("name");
@@ -81,17 +99,20 @@
_branch = attributes.getValue("branch");
_revision = attributes.getValue("name");
_default = Boolean.valueOf(attributes.getValue("default")).booleanValue();
- // retrieve position from file. If no position is found, it may be an old report generated with a previous version,
+ // retrieve position from file. If no position is found, it may be an old
+ // report generated with a previous version,
// in which case, we put it at the last position
String pos = attributes.getValue("position");
- _position = pos == null ? getMaxPos()+1 : Integer.valueOf(pos).intValue();
- if (attributes.getValue("error") != null || attributes.getValue("evicted") != null) {
+ _position = pos == null ? getMaxPos() + 1 : Integer.valueOf(pos).intValue();
+ if (attributes.getValue("error") != null
+ || attributes.getValue("evicted") != null) {
_skip = true;
} else {
_revisionsMap.put(new Integer(_position), _revisionArtifacts);
- _mrid = ModuleRevisionId.newInstance(_organisation, _module, _branch, _revision,
- ExtendableItemHelper.getExtraAttributes(attributes, "extra-"));
- _mrids.add(_mrid);
+ _mrid = ModuleRevisionId.newInstance(_organisation, _module, _branch,
+ _revision, ExtendableItemHelper.getExtraAttributes(attributes,
+ "extra-"));
+ _mrids.add(_mrid);
if (_default) {
_defaultMrids.add(_mrid);
} else {
@@ -101,7 +122,9 @@
_pubdate = Ivy.DATE_FORMAT.parse(attributes.getValue("pubdate"));
_skip = false;
} catch (ParseException e) {
- throw new IllegalArgumentException("invalid publication date for "+_organisation+" "+_module+" "+_revision+": "+attributes.getValue("pubdate"));
+ throw new IllegalArgumentException("invalid publication date for "
+ + _organisation + " " + _module + " " + _revision + ": "
+ + attributes.getValue("pubdate"));
}
}
} else if ("artifact".equals(qName)) {
@@ -115,89 +138,102 @@
String artifactName = attributes.getValue("name");
String type = attributes.getValue("type");
String ext = attributes.getValue("ext");
- Artifact artifact = new DefaultArtifact(_mrid, _pubdate, artifactName, type, ext, ExtendableItemHelper.getExtraAttributes(attributes, "extra-"));
+ Artifact artifact = new DefaultArtifact(_mrid, _pubdate, artifactName,
+ type, ext, ExtendableItemHelper.getExtraAttributes(attributes,
+ "extra-"));
_revisionArtifacts.add(artifact);
} else if ("info".equals(qName)) {
- String organisation = attributes.getValue("organisation");
- String name = attributes.getValue("module");
- String branch = attributes.getValue("branch");
- String revision = attributes.getValue("revision");
- Map extraAttributes = new HashMap();
- for (int i = 0; i < attributes.getLength(); i++) {
- String attName = attributes.getQName(i);
- if (attName.startsWith("extra-")) {
- String extraAttrName = attName.substring(6);
- String extraAttrValue = attributes.getValue(i);
- extraAttributes.put(extraAttrName, extraAttrValue);
- }
- }
- _mRevisionId = ModuleRevisionId.newInstance(organisation, name, branch, revision, extraAttributes);
+ String organisation = attributes.getValue("organisation");
+ String name = attributes.getValue("module");
+ String branch = attributes.getValue("branch");
+ String revision = attributes.getValue("revision");
+ Map extraAttributes = new HashMap();
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String attName = attributes.getQName(i);
+ if (attName.startsWith("extra-")) {
+ String extraAttrName = attName.substring(6);
+ String extraAttrValue = attributes.getValue(i);
+ extraAttributes.put(extraAttrName, extraAttrValue);
+ }
+ }
+ _mRevisionId = ModuleRevisionId.newInstance(organisation, name, branch,
+ revision, extraAttributes);
}
}
- public void endElement(String uri, String localName, String qname) throws SAXException {
+ public void endElement(String uri, String localName, String qname)
+ throws SAXException {
if ("dependencies".equals(qname)) {
// add the artifacts in the correct order
- for (Iterator it = _revisionsMap.values().iterator(); it.hasNext(); ) {
+ for (Iterator it = _revisionsMap.values().iterator(); it.hasNext();) {
List artifacts = (List) it.next();
_artifacts.addAll(artifacts);
}
}
}
-
+
private int getMaxPos() {
- return _revisionsMap.isEmpty() ? -1 : ((Integer)_revisionsMap.keySet().toArray()[_revisionsMap.size()-1]).intValue();
+ return _revisionsMap.isEmpty() ? -1 : ((Integer) _revisionsMap.keySet()
+ .toArray()[_revisionsMap.size() - 1]).intValue();
}
- });
- }
+ });
+ }
+
+ public List getArtifacts() {
+ return _artifacts;
+ }
+
+ public List getModuleRevisionIds() {
+ return _mrids;
+ }
- public List getArtifacts() {
- return _artifacts;
- }
- public List getModuleRevisionIds() {
- return _mrids;
- }
public List getRealModuleRevisionIds() {
return _realMrids;
}
+
public ModuleRevisionId getResolvedModule() {
- return _mRevisionId;
+ return _mRevisionId;
}
}
-
+
private SaxXmlReportParser parser = null;
public void parse(File report) throws ParseException {
- if (!report.exists()) {
- throw new IllegalStateException("Report file '" + report.getAbsolutePath() + "' does not exist.");
- }
-
- parser = new SaxXmlReportParser(report);
- try {
- parser.parse();
- } catch (Exception e) {
- ParseException pe = new ParseException("failed to parse report: "+report+": "+e.getMessage(), 0);
+ if (!report.exists()) {
+ throw new IllegalStateException("Report file '" + report.getAbsolutePath()
+ + "' does not exist.");
+ }
+
+ parser = new SaxXmlReportParser(report);
+ try {
+ parser.parse();
+ } catch (Exception e) {
+ ParseException pe = new ParseException("failed to parse report: " + report + ": "
+ + e.getMessage(), 0);
pe.initCause(e);
throw pe;
- }
+ }
}
-
+
public Artifact[] getArtifacts() {
- return (Artifact[]) parser.getArtifacts().toArray(new Artifact[parser.getArtifacts().size()]);
+ return (Artifact[]) parser.getArtifacts().toArray(
+ new Artifact[parser.getArtifacts().size()]);
}
-
+
public ModuleRevisionId[] getDependencyRevisionIds() {
- return (ModuleRevisionId[])parser.getModuleRevisionIds().toArray(new ModuleRevisionId[parser.getModuleRevisionIds().size()]);
+ return (ModuleRevisionId[]) parser.getModuleRevisionIds().toArray(
+ new ModuleRevisionId[parser.getModuleRevisionIds().size()]);
}
-
+
public ModuleRevisionId[] getRealDependencyRevisionIds() {
- return (ModuleRevisionId[])parser.getRealModuleRevisionIds().toArray(new ModuleRevisionId[parser.getRealModuleRevisionIds().size()]);
+ return (ModuleRevisionId[]) parser.getRealModuleRevisionIds().toArray(
+ new ModuleRevisionId[parser.getRealModuleRevisionIds().size()]);
}
+
/**
* Returns the <tt>ModuleRevisionId</tt> of the resolved module.
*/
public ModuleRevisionId getResolvedModule() {
- return parser.getResolvedModule();
+ return parser.getResolvedModule();
}
}
-
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/AbstractRepository.java Tue Jun 5 05:02:27 2007
@@ -25,13 +25,13 @@
import org.apache.ivy.core.module.descriptor.Artifact;
-
-
public abstract class AbstractRepository implements Repository {
private EventListenerList _listeners = new EventListenerList();
+
private String _name;
+
private TransferEvent _evt;
-
+
public void addTransferListener(TransferListener listener) {
_listeners.add(TransferListener.class, listener);
}
@@ -43,24 +43,24 @@
public boolean hasTransferListener(TransferListener listener) {
return Arrays.asList(_listeners.getListeners(TransferListener.class)).contains(listener);
}
-
+
protected void fireTransferInitiated(Resource res, int requestType) {
_evt = new TransferEvent(this, res, TransferEvent.TRANSFER_INITIATED, requestType);
fireTransferEvent(_evt);
}
-
+
protected void fireTransferStarted() {
_evt.setEventType(TransferEvent.TRANSFER_STARTED);
fireTransferEvent(_evt);
}
-
+
protected void fireTransferStarted(long totalLength) {
_evt.setEventType(TransferEvent.TRANSFER_STARTED);
_evt.setTotalLength(totalLength);
_evt.setTotalLengthSet(true);
fireTransferEvent(_evt);
}
-
+
protected void fireTransferProgress(long length) {
_evt.setEventType(TransferEvent.TRANSFER_PROGRESS);
_evt.setLength(length);
@@ -69,38 +69,38 @@
}
fireTransferEvent(_evt);
}
-
+
protected void fireTransferCompleted() {
_evt.setEventType(TransferEvent.TRANSFER_COMPLETED);
if (_evt.getTotalLength() > 0 && !_evt.isTotalLengthSet()) {
- _evt.setTotalLengthSet(true);
+ _evt.setTotalLengthSet(true);
}
fireTransferEvent(_evt);
}
-
+
protected void fireTransferCompleted(long totalLength) {
_evt.setEventType(TransferEvent.TRANSFER_COMPLETED);
_evt.setTotalLength(totalLength);
_evt.setTotalLengthSet(true);
fireTransferEvent(_evt);
}
-
+
protected void fireTransferError() {
_evt.setEventType(TransferEvent.TRANSFER_ERROR);
fireTransferEvent(_evt);
}
-
+
protected void fireTransferError(Exception ex) {
_evt.setEventType(TransferEvent.TRANSFER_ERROR);
_evt.setException(ex);
fireTransferEvent(_evt);
}
-
+
protected void fireTransferEvent(TransferEvent evt) {
Object[] listeners = _listeners.getListenerList();
- for (int i = listeners.length-2; i>=0; i-=2) {
- if (listeners[i]==TransferListener.class) {
- ((TransferListener)listeners[i+1]).transferProgress(evt);
+ for (int i = listeners.length - 2; i >= 0; i -= 2) {
+ if (listeners[i] == TransferListener.class) {
+ ((TransferListener) listeners[i + 1]).transferProgress(evt);
}
}
}
@@ -116,21 +116,21 @@
public String getName() {
return _name;
}
-
public void setName(String name) {
_name = name;
}
-
+
public String toString() {
return getName();
}
-
- public void put(Artifact artifact, File source, String destination, boolean overwrite) throws IOException {
- put(source, destination, overwrite);
+
+ public void put(Artifact artifact, File source, String destination, boolean overwrite)
+ throws IOException {
+ put(source, destination, overwrite);
}
- protected void put(File source, String destination, boolean overwrite) throws IOException {
- throw new UnsupportedOperationException("put in not supported by "+getName());
- }
+ protected void put(File source, String destination, boolean overwrite) throws IOException {
+ throw new UnsupportedOperationException("put in not supported by " + getName());
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/BasicResource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/BasicResource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/BasicResource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/BasicResource.java Tue Jun 5 05:02:27 2007
@@ -21,51 +21,56 @@
import java.io.InputStream;
public class BasicResource implements Resource {
- private boolean _local;
- private String _name;
- private long _lastModified;
- private long _contentLength;
- private boolean _exists;
-
-
- public BasicResource(String name, boolean exists, long contentLength, long lastModified, boolean local) {
- _name = name;
- _exists = exists;
- _contentLength = contentLength;
- _lastModified = lastModified;
- _local = local;
- }
-
- public Resource clone(String cloneName) {
- throw new UnsupportedOperationException("basic resource do not support the clone method");
- }
-
- public boolean exists() {
- return _exists;
- }
-
- public long getContentLength() {
- return _contentLength;
- }
-
- public long getLastModified() {
- return _lastModified;
- }
-
- public String getName() {
- return _name;
- }
-
- public boolean isLocal() {
- return _local;
- }
-
- public InputStream openStream() throws IOException {
- throw new UnsupportedOperationException("basic resource do not support the openStream method");
- }
-
- public String toString() {
- return getName();
- }
+ private boolean _local;
+
+ private String _name;
+
+ private long _lastModified;
+
+ private long _contentLength;
+
+ private boolean _exists;
+
+ public BasicResource(String name, boolean exists, long contentLength, long lastModified,
+ boolean local) {
+ _name = name;
+ _exists = exists;
+ _contentLength = contentLength;
+ _lastModified = lastModified;
+ _local = local;
+ }
+
+ public Resource clone(String cloneName) {
+ throw new UnsupportedOperationException("basic resource do not support the clone method");
+ }
+
+ public boolean exists() {
+ return _exists;
+ }
+
+ public long getContentLength() {
+ return _contentLength;
+ }
+
+ public long getLastModified() {
+ return _lastModified;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public boolean isLocal() {
+ return _local;
+ }
+
+ public InputStream openStream() throws IOException {
+ throw new UnsupportedOperationException(
+ "basic resource do not support the openStream method");
+ }
+
+ public String toString() {
+ return getName();
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/LazyResource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/LazyResource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/LazyResource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/LazyResource.java Tue Jun 5 05:02:27 2007
@@ -17,80 +17,81 @@
*/
package org.apache.ivy.plugins.repository;
-
public abstract class LazyResource implements Resource {
- private boolean _init = false;
-
- private boolean _local;
- private String _name;
- private long _lastModified;
- private long _contentLength;
- private boolean _exists;
-
-
- public LazyResource(String name) {
- _name = name;
- }
-
- protected abstract void init();
-
- private void checkInit() {
- if (!_init) {
- init();
- _init = true;
- }
- }
-
- public boolean exists() {
- checkInit();
- return _exists;
- }
-
- public long getContentLength() {
- checkInit();
- return _contentLength;
- }
-
- public long getLastModified() {
- checkInit();
- return _lastModified;
- }
-
- public String getName() {
- return _name;
- }
-
- public boolean isLocal() {
- checkInit();
- return _local;
- }
-
- public String toString() {
- return getName();
- }
-
- protected void setContentLength(long contentLength) {
- _contentLength = contentLength;
- }
-
- protected void setExists(boolean exists) {
- _exists = exists;
- }
-
- protected void setLastModified(long lastModified) {
- _lastModified = lastModified;
- }
-
- protected void setLocal(boolean local) {
- _local = local;
- }
+ private boolean _init = false;
- protected void init(Resource r) {
- setContentLength(r.getContentLength());
- setLocal(r.isLocal());
- setLastModified(r.getLastModified());
- setExists(r.exists());
- }
+ private boolean _local;
+
+ private String _name;
+
+ private long _lastModified;
+
+ private long _contentLength;
+
+ private boolean _exists;
+
+ public LazyResource(String name) {
+ _name = name;
+ }
+
+ protected abstract void init();
+
+ private void checkInit() {
+ if (!_init) {
+ init();
+ _init = true;
+ }
+ }
+
+ public boolean exists() {
+ checkInit();
+ return _exists;
+ }
+ public long getContentLength() {
+ checkInit();
+ return _contentLength;
+ }
+
+ public long getLastModified() {
+ checkInit();
+ return _lastModified;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public boolean isLocal() {
+ checkInit();
+ return _local;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ protected void setContentLength(long contentLength) {
+ _contentLength = contentLength;
+ }
+
+ protected void setExists(boolean exists) {
+ _exists = exists;
+ }
+
+ protected void setLastModified(long lastModified) {
+ _lastModified = lastModified;
+ }
+
+ protected void setLocal(boolean local) {
+ _local = local;
+ }
+
+ protected void init(Resource r) {
+ setContentLength(r.getContentLength());
+ setLocal(r.isLocal());
+ setLastModified(r.getLastModified());
+ setExists(r.exists());
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Repository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Repository.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Repository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Repository.java Tue Jun 5 05:02:27 2007
@@ -23,121 +23,137 @@
import org.apache.ivy.core.module.descriptor.Artifact;
-
/**
- * Represents a collection of resources available to Ivy. Ivy uses one or more
- * repositories as both a source of resources for Ivy enabled build systems and
- * as a distribution center for resources generated by Ivy enabled build systems.
+ * Represents a collection of resources available to Ivy. Ivy uses one or more repositories as both
+ * a source of resources for Ivy enabled build systems and as a distribution center for resources
+ * generated by Ivy enabled build systems.
* </p>
- * <p>A repository supports the following fundamental operations
+ * <p>
+ * A repository supports the following fundamental operations
* <ul>
- * <li>retrieving a resource from the repository.</li>
- * <li>transfering a resource to the repository.</li>
- * <li>retrieving a listing of resources.</li>
+ * <li>retrieving a resource from the repository.</li>
+ * <li>transfering a resource to the repository.</li>
+ * <li>retrieving a listing of resources.</li>
* </ul>
* </p>
* <h4>Resource Retrieval</h4>
* </p>
- * <p>{@link #get} retrieves a resource specified by a provided identifier creating a new file .</p>
+ * <p>
+ * {@link #get} retrieves a resource specified by a provided identifier creating a new file .
+ * </p>
* </p>
* <h4>resource Publication</h4>
* </p>
- * <p>{@link #put} transfers a file to the repository.
+ * <p>
+ * {@link #put} transfers a file to the repository.
* </p>
* </p>
* <h4>resource Listing</h4>
* </p>
- * <p>{@link #list} returns a listing of file like objects
- * belonging to a specified parent directory.</p>
+ * <p>
+ * {@link #list} returns a listing of file like objects belonging to a specified parent directory.
+ * </p>
* </p>
*/
public interface Repository {
-
- /**
- * Return the resource associated with a specified identifier.
- *
- * If the resource does not exist, it should return a Resource with exists() returning false.
- *
- * An IOException should only be thrown when a real IO problem occurs, like the impossibility to
- * connect to a server.
- *
- * @param source A string identifying the resource.
- * @return The resource associated with the resource identifier.
- * @throws IOException On error whle trying to get resource.
- */
- Resource getResource(String source) throws IOException;
-
+
+ /**
+ * Return the resource associated with a specified identifier. If the resource does not exist,
+ * it should return a Resource with exists() returning false. An IOException should only be
+ * thrown when a real IO problem occurs, like the impossibility to connect to a server.
+ *
+ * @param source
+ * A string identifying the resource.
+ * @return The resource associated with the resource identifier.
+ * @throws IOException
+ * On error whle trying to get resource.
+ */
+ Resource getResource(String source) throws IOException;
+
/**
* Fetch a resource from the repository.
*
- * @param source A string identifying the resource to be fetched.
- * @param destination Where to place the fetched resource.
- * @throws IOException On retrieval failure.
+ * @param source
+ * A string identifying the resource to be fetched.
+ * @param destination
+ * Where to place the fetched resource.
+ * @throws IOException
+ * On retrieval failure.
*/
void get(String source, File destination) throws IOException;
-
-
+
/**
* Transfer a resource to the repository
- * @param artifact The artifact to be transferred.
- * @param source The local file to be transferred.
- * @param destination Where to transfer the resource.
- * @param overwrite Whether the transfer should overwrite an existing resource.
*
- * @throws IOException On publication failure.
+ * @param artifact
+ * The artifact to be transferred.
+ * @param source
+ * The local file to be transferred.
+ * @param destination
+ * Where to transfer the resource.
+ * @param overwrite
+ * Whether the transfer should overwrite an existing resource.
+ * @throws IOException
+ * On publication failure.
*/
- void put(Artifact artifact, File source, String destination, boolean overwrite) throws IOException;
-
+ void put(Artifact artifact, File source, String destination, boolean overwrite)
+ throws IOException;
+
/**
* Return a listing of resources names
*
- * @param parent The parent directory from which to generate the listing.
+ * @param parent
+ * The parent directory from which to generate the listing.
* @return A listing of the parent directory's file content, as a List of String.
- * @throws IOException On listing failure.
+ * @throws IOException
+ * On listing failure.
*/
List list(String parent) throws IOException;
-
+
/**
* Add a listener to the repository.
*
- * @param listener The listener to attach to the repository.
+ * @param listener
+ * The listener to attach to the repository.
*/
void addTransferListener(TransferListener listener);
-
+
/**
* Remove a listener on the repository
*
- * @param listener The listener to remove
+ * @param listener
+ * The listener to remove
*/
void removeTransferListener(TransferListener listener);
-
+
/**
* Determine if a given listener is attached to the repository.
*
- * @param listener The listener being quireied
+ * @param listener
+ * The listener being quireied
* @return <code>true</code> if the provided listener is attached to the repository,
* <code>false</code> if not.
*/
boolean hasTransferListener(TransferListener listener);
-
+
/**
* Get the repository's file separator string.
*
* @return The repository's file separator delimiter
*/
String getFileSeparator();
-
+
/**
* Normalize a string.
*
- * @param source The string to normalize.
+ * @param source
+ * The string to normalize.
* @return The normalized string.
*/
String standardize(String source);
-
+
/**
* Return the name of the repository
- *
*/
String getName();
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/RepositoryCopyProgressListener.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/RepositoryCopyProgressListener.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/RepositoryCopyProgressListener.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/RepositoryCopyProgressListener.java Tue Jun 5 05:02:27 2007
@@ -28,6 +28,7 @@
}
private Long _totalLength = null;
+
public void start(CopyProgressEvent evt) {
if (_totalLength != null) {
_repository.fireTransferStarted(_totalLength.longValue());
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Resource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Resource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Resource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/Resource.java Tue Jun 5 05:02:27 2007
@@ -21,57 +21,53 @@
import java.io.InputStream;
/**
- * Represents a resource in an Ivy {@link Repository}.
- *
- * The resource interface allows one to obtain the following information about a resource:
+ * Represents a resource in an Ivy {@link Repository}. The resource interface allows one to obtain
+ * the following information about a resource:
* <ul>
- * <li>resource name/identifier in repository syntax</li>
- * <li>date the resource was last modified.</li>
- * <li>size of the resource in bytes.</li>
- * <li>if the resource is available.</li>
- *</ul>
- *</p>
- *<h4>Implementation Notes</h4>
- * In implementing the interface you need to ensure the following behaviors:
- * <ul>
- * <li>All of the methods specified in the interface fail by returning an empty value
- * (<code>false</code>, <code>0</code>, <code>""</code>). In other words, the specified interface
- * methods should not throw RuntimeExceptions.
- * </li>
- * <li>Failure conditions should be logged using the
- * {@link org.apache.ivy.util.Message#verbose} method.
- * </li>
- * <li>Failure of one of the interface's specified methods results in all other interface specified
- * methods returning an empty value (<code>false</code>, <code>0</code>, <code>""</code>).</li>
- * </ul>
- * </p>
+ * <li>resource name/identifier in repository syntax</li>
+ * <li>date the resource was last modified.</li>
+ * <li>size of the resource in bytes.</li>
+ * <li>if the resource is available.</li>
+ * </ul>
+ * </p>
+ * <h4>Implementation Notes</h4>
+ * In implementing the interface you need to ensure the following behaviors:
+ * <ul>
+ * <li>All of the methods specified in the interface fail by returning an empty value (<code>false</code>,
+ * <code>0</code>, <code>""</code>). In other words, the specified interface methods should
+ * not throw RuntimeExceptions. </li>
+ * <li>Failure conditions should be logged using the {@link org.apache.ivy.util.Message#verbose}
+ * method. </li>
+ * <li>Failure of one of the interface's specified methods results in all other interface specified
+ * methods returning an empty value (<code>false</code>, <code>0</code>, <code>""</code>).</li>
+ * </ul>
+ * </p>
*/
public interface Resource {
- /**
- * Get the name of the resource.
- *
- * @return the repositorie's assigned resource name/identifier.
- */
+ /**
+ * Get the name of the resource.
+ *
+ * @return the repositorie's assigned resource name/identifier.
+ */
public String getName();
-
+
/**
* Get the date the resource was last modified
*
- * @return A <code>long</code> value representing the time the file was
- * last modified, measured in milliseconds since the epoch
- * (00:00:00 GMT, January 1, 1970), or <code>0L</code> if the
- * file does not exist or if an I/O error occurs.
+ * @return A <code>long</code> value representing the time the file was last modified,
+ * measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or
+ * <code>0L</code> if the file does not exist or if an I/O error occurs.
*/
public long getLastModified();
-
+
/**
* Get the resource size
*
* @return a <code>long</code> value representing the size of the resource in bytes.
*/
public long getContentLength();
-
+
/**
* Determine if the resource is available.
* </p>
@@ -80,24 +76,27 @@
* @return <code>boolean</code> value indicating if the resource is available.
*/
public boolean exists();
-
+
/**
* Is this resource local to this host, i.e. is it on the file system?
- *
+ *
* @return <code>boolean</code> value indicating if the resource is local.
*/
public boolean isLocal();
/**
* Clones this resource with a new resource with a different name
- * @param cloneName the name of the clone
+ *
+ * @param cloneName
+ * the name of the clone
* @return the cloned resource
*/
- public Resource clone(String cloneName);
-
- /**
- * Opens a stream on this resource
- * @return the opened input stream
- */
- public InputStream openStream() throws IOException;
+ public Resource clone(String cloneName);
+
+ /**
+ * Opens a stream on this resource
+ *
+ * @return the opened input stream
+ */
+ public InputStream openStream() throws IOException;
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ResourceHelper.java Tue Jun 5 05:02:27 2007
@@ -23,7 +23,6 @@
import org.apache.ivy.plugins.repository.file.FileResource;
import org.apache.ivy.plugins.repository.url.URLResource;
-
public class ResourceHelper {
public static boolean equals(Resource res, File f) {
if (res == null && f == null) {
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferEvent.java Tue Jun 5 05:02:27 2007
@@ -21,12 +21,9 @@
import org.apache.ivy.core.event.IvyEvent;
-
/**
- * TransferEvent is used to notify TransferListeners about progress in transfer
- * of resources form/to the respository
- *
- * This class is LARGELY inspired by org.apache.maven.wagon.events.TransferEvent
+ * TransferEvent is used to notify TransferListeners about progress in transfer of resources form/to
+ * the respository This class is LARGELY inspired by org.apache.maven.wagon.events.TransferEvent
* released under the following copyright license:
*
* <pre>
@@ -48,7 +45,6 @@
* </pre>
*
* Orginal class written by Michal Maczka.
- *
*/
public class TransferEvent extends IvyEvent {
/**
@@ -86,16 +82,15 @@
*/
public final static int REQUEST_PUT = 6;
-
- public static final String TRANSFER_INITIATED_NAME = "transfer-initiated";
+ public static final String TRANSFER_INITIATED_NAME = "transfer-initiated";
- public static final String TRANSFER_STARTED_NAME = "transfer-started";
+ public static final String TRANSFER_STARTED_NAME = "transfer-started";
- public static final String TRANSFER_PROGRESS_NAME = "transfer-progress";
+ public static final String TRANSFER_PROGRESS_NAME = "transfer-progress";
- public static final String TRANSFER_COMPLETED_NAME = "transfer-completed";
+ public static final String TRANSFER_COMPLETED_NAME = "transfer-completed";
- public static final String TRANSFER_ERROR_NAME = "transfer-error";
+ public static final String TRANSFER_ERROR_NAME = "transfer-error";
private Resource _resource;
@@ -108,14 +103,17 @@
private File _localFile;
private Repository _repository;
+
private long _length;
private long _totalLength;
+
private boolean _isTotalLengthSet = false;
- public TransferEvent(final Repository repository, final Resource resource, final int eventType, final int requestType) {
- super(getName(eventType));
-
+ public TransferEvent(final Repository repository, final Resource resource, final int eventType,
+ final int requestType) {
+ super(getName(eventType));
+
_repository = repository;
addAttribute("repository", _repository.getName());
_resource = resource;
@@ -124,16 +122,18 @@
setEventType(eventType);
setRequestType(requestType);
- addAttribute("request-type", requestType == REQUEST_GET?"get":"put");
+ addAttribute("request-type", requestType == REQUEST_GET ? "get" : "put");
}
- public TransferEvent(final Repository repository, final Resource resource, final Exception exception, final int requestType) {
+ public TransferEvent(final Repository repository, final Resource resource,
+ final Exception exception, final int requestType) {
this(repository, resource, TRANSFER_ERROR, requestType);
_exception = exception;
}
- public TransferEvent(final Repository repository, final Resource resource, long length, final int requestType) {
+ public TransferEvent(final Repository repository, final Resource resource, long length,
+ final int requestType) {
this(repository, resource, TRANSFER_PROGRESS, requestType);
_length = length;
@@ -141,21 +141,20 @@
}
private static String getName(int eventType) {
- switch (eventType) {
- case TRANSFER_INITIATED:
- return TRANSFER_INITIATED_NAME;
- case TRANSFER_STARTED:
- return TRANSFER_STARTED_NAME;
- case TRANSFER_PROGRESS:
- return TRANSFER_PROGRESS_NAME;
- case TRANSFER_COMPLETED:
- return TRANSFER_COMPLETED_NAME;
- case TRANSFER_ERROR:
- return TRANSFER_ERROR_NAME;
- }
- return null;
- }
-
+ switch (eventType) {
+ case TRANSFER_INITIATED:
+ return TRANSFER_INITIATED_NAME;
+ case TRANSFER_STARTED:
+ return TRANSFER_STARTED_NAME;
+ case TRANSFER_PROGRESS:
+ return TRANSFER_PROGRESS_NAME;
+ case TRANSFER_COMPLETED:
+ return TRANSFER_COMPLETED_NAME;
+ case TRANSFER_ERROR:
+ return TRANSFER_ERROR_NAME;
+ }
+ return null;
+ }
/**
* @return Returns the resource.
@@ -185,21 +184,20 @@
* Sets the request type
*
* @param requestType
- * The requestType to set. The Request type value should be
- * either
+ * The requestType to set. The Request type value should be either
* <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>.
* @throws IllegalArgumentException when
*/
protected void setRequestType(final int requestType) {
switch (requestType) {
- case REQUEST_PUT:
- break;
- case REQUEST_GET:
- break;
+ case REQUEST_PUT:
+ break;
+ case REQUEST_GET:
+ break;
- default:
- throw new IllegalArgumentException("Illegal request type: " + requestType);
+ default:
+ throw new IllegalArgumentException("Illegal request type: " + requestType);
}
_requestType = requestType;
@@ -219,18 +217,18 @@
protected void setEventType(final int eventType) {
switch (eventType) {
- case TRANSFER_INITIATED:
- break;
- case TRANSFER_STARTED:
- break;
- case TRANSFER_COMPLETED:
- break;
- case TRANSFER_PROGRESS:
- break;
- case TRANSFER_ERROR:
- break;
- default:
- throw new IllegalArgumentException("Illegal event type: " + eventType);
+ case TRANSFER_INITIATED:
+ break;
+ case TRANSFER_STARTED:
+ break;
+ case TRANSFER_COMPLETED:
+ break;
+ case TRANSFER_PROGRESS:
+ break;
+ case TRANSFER_ERROR:
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal event type: " + eventType);
}
this._eventType = eventType;
@@ -259,11 +257,9 @@
_localFile = localFile;
}
-
public long getLength() {
return _length;
}
-
protected void setLength(long length) {
_length = length;
@@ -288,7 +284,5 @@
public void setTotalLengthSet(boolean isTotalLengthSet) {
_isTotalLengthSet = isTotalLengthSet;
}
-
-
-
+
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferListener.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferListener.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferListener.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/TransferListener.java Tue Jun 5 05:02:27 2007
@@ -19,7 +19,6 @@
import java.util.EventListener;
-
/**
* Listen to repository transfer
*/
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileRepository.java Tue Jun 5 05:02:27 2007
@@ -28,10 +28,11 @@
import org.apache.ivy.plugins.repository.TransferEvent;
import org.apache.ivy.util.FileUtil;
-
public class FileRepository extends AbstractRepository {
private RepositoryCopyProgressListener _progress = new RepositoryCopyProgressListener(this);
+
private File _baseDir;
+
private boolean _local = true;
public FileRepository() {
@@ -60,11 +61,12 @@
try {
_progress.setTotalLength(new Long(src.length()));
if (!FileUtil.copy(src, destination, _progress, overwrite)) {
- if (!overwrite) {
- throw new IOException("file copy not done from "+src+" to "+destination+": destination probably already exists and overwrite is false");
- } else {
- throw new IOException("file copy not done from "+src+" to "+destination);
- }
+ if (!overwrite) {
+ throw new IOException("file copy not done from " + src + " to " + destination
+ + ": destination probably already exists and overwrite is false");
+ } else {
+ throw new IOException("file copy not done from " + src + " to " + destination);
+ }
}
} catch (IOException ex) {
fireTransferError(ex);
@@ -84,14 +86,14 @@
if (names != null) {
List ret = new ArrayList(names.length);
for (int i = 0; i < names.length; i++) {
- ret.add(parent+getFileSeparator()+names[i]);
+ ret.add(parent + getFileSeparator() + names[i]);
}
return ret;
}
}
return null;
}
-
+
private File getFile(String source) {
if (_baseDir != null) {
return new File(_baseDir, source);
@@ -100,12 +102,12 @@
}
}
- public boolean isLocal() {
- return _local;
- }
-
- public void setLocal(boolean local) {
- _local = local;
- }
+ public boolean isLocal() {
+ return _local;
+ }
+
+ public void setLocal(boolean local) {
+ _local = local;
+ }
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/file/FileResource.java Tue Jun 5 05:02:27 2007
@@ -24,22 +24,22 @@
import org.apache.ivy.plugins.repository.Resource;
-
public class FileResource implements Resource {
private File _file;
+
private FileRepository _repository;
public FileResource(FileRepository repository, File f) {
- _repository = repository;
+ _repository = repository;
_file = f;
}
public String getName() {
return _file.getPath();
}
-
+
public Resource clone(String cloneName) {
- return new FileResource(_repository, new File(cloneName));
+ return new FileResource(_repository, new File(cloneName));
}
public long getLastModified() {
@@ -61,16 +61,16 @@
public File getFile() {
return _file;
}
-
+
public FileRepository getRepository() {
- return _repository;
+ return _repository;
}
-
+
public boolean isLocal() {
return _repository.isLocal();
}
- public InputStream openStream() throws IOException {
- return new FileInputStream(_file);
- }
+ public InputStream openStream() throws IOException {
+ return new FileInputStream(_file);
+ }
}
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=544459&r1=544458&r2=544459
==============================================================================
--- 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 Tue Jun 5 05:02:27 2007
@@ -40,194 +40,194 @@
import com.jcraft.jsch.SftpProgressMonitor;
import com.jcraft.jsch.ChannelSftp.LsEntry;
-
/**
- * SFTP Repository, allow to use a repository accessed by sftp protocol.
- *
- * It supports all operations: get, put and list.
- *
- * It relies on jsch for sftp handling, and thus is compatible with sftp version 0, 1, 2 and 3
- *
- *
+ * SFTP Repository, allow to use a repository accessed by sftp protocol. It supports all operations:
+ * get, put and list. It relies on jsch for sftp handling, and thus is compatible with sftp version
+ * 0, 1, 2 and 3
*/
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;
- fireTransferStarted(max);
- }
-
- public void end() {
- fireTransferCompleted(_totalLength);
- }
-
- public boolean count(long count) {
- fireTransferProgress(count);
- return true;
- }
- }
+ public void init(int op, String src, String dest, long max) {
+ _totalLength = max;
+ fireTransferStarted(max);
+ }
+
+ public void end() {
+ fireTransferCompleted(_totalLength);
+ }
+
+ public boolean count(long count) {
+ fireTransferProgress(count);
+ return true;
+ }
+ }
-
public SFTPRepository() {
}
-
public Resource getResource(String source) {
return new SFTPResource(this, source);
}
-
/**
- * This method is similar to getResource, except that the returned resource is fully initialised
+ * This method is similar to getResource, except that the returned resource is fully initialised
* (resolved in the sftp repository), and that the given string is a full remote path
- * @param path the full remote path in the repository of the resource
- * @return a fully initialised resource, able to answer to all its methods without needing
- * any further connection
+ *
+ * @param path
+ * the full remote path in the repository of the resource
+ * @return a fully initialised resource, able to answer to all its methods without needing any
+ * further connection
*/
- public Resource resolveResource(String path) {
- try {
- ChannelSftp c = getSftpChannel(path);
- Collection r = c.ls(path);
- if (r != null) {
- for (Iterator iter = r.iterator(); iter.hasNext();) {
- Object obj=iter.next();
- if(obj instanceof LsEntry){
- LsEntry entry = (LsEntry) obj;
- SftpATTRS attrs = entry.getAttrs();
- return new BasicResource(path, true, attrs.getSize(), attrs.getMTime() * 1000, false);
- }
- }
- }
- } catch (Exception e) {
- Message.debug("reolving resource error: "+e.getMessage());
- //silent fail, return unexisting resource
- }
- return new BasicResource(path, false, 0, 0, false);
- }
+ public Resource resolveResource(String path) {
+ try {
+ ChannelSftp c = getSftpChannel(path);
+ Collection r = c.ls(path);
+ if (r != null) {
+ for (Iterator iter = r.iterator(); iter.hasNext();) {
+ Object obj = iter.next();
+ if (obj instanceof LsEntry) {
+ LsEntry entry = (LsEntry) obj;
+ SftpATTRS attrs = entry.getAttrs();
+ return new BasicResource(path, true, attrs.getSize(),
+ attrs.getMTime() * 1000, false);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Message.debug("reolving resource error: " + e.getMessage());
+ // silent fail, return unexisting resource
+ }
+ return new BasicResource(path, false, 0, 0, false);
+ }
- public InputStream openStream(SFTPResource resource) throws IOException {
+ public InputStream openStream(SFTPResource resource) throws IOException {
ChannelSftp c = getSftpChannel(resource.getName());
try {
- return c.get(resource.getName());
- } catch (SftpException e) {
- e.printStackTrace();
- IOException ex = new IOException("impossible to open stream for "+resource+" on "+getHost()+(e.getMessage() != null?": " + e.getMessage():""));
- ex.initCause(e);
- throw ex;
- }
- }
+ return c.get(resource.getName());
+ } catch (SftpException e) {
+ e.printStackTrace();
+ IOException ex = new IOException("impossible to open stream for " + resource + " on "
+ + getHost() + (e.getMessage() != null ? ": " + e.getMessage() : ""));
+ ex.initCause(e);
+ throw ex;
+ }
+ }
public void get(String source, File destination) throws IOException {
fireTransferInitiated(getResource(source), TransferEvent.REQUEST_GET);
ChannelSftp c = getSftpChannel(source);
try {
- c.get(source, destination.getAbsolutePath(), new MyProgressMonitor());
- } catch (SftpException e) {
- e.printStackTrace();
- IOException ex = new IOException("impossible to get "+source+" on "+getHost()+(e.getMessage() != null?": " + e.getMessage():""));
- ex.initCause(e);
- throw ex;
- }
+ c.get(source, destination.getAbsolutePath(), new MyProgressMonitor());
+ } catch (SftpException e) {
+ e.printStackTrace();
+ IOException ex = new IOException("impossible to get " + source + " on " + getHost()
+ + (e.getMessage() != null ? ": " + e.getMessage() : ""));
+ ex.initCause(e);
+ throw ex;
+ }
}
- public void put(File source, String destination, boolean overwrite) throws IOException {
+ public void put(File source, String destination, boolean overwrite) throws IOException {
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);
- }
- c.put(source.getAbsolutePath(), destination, new MyProgressMonitor());
- } catch (SftpException e) {
- IOException ex = new IOException(e.getMessage());
- ex.initCause(e);
- throw ex;
- }
- }
-
- private void mkdirs(String directory, ChannelSftp c) throws IOException, SftpException {
- try {
- SftpATTRS att = c.stat(directory);
- if (att != null) {
- if (att.isDir()) {
- return;
- }
- }
- } catch (SftpException ex) {
- if (directory.indexOf('/') != -1) {
- mkdirs(directory.substring(0, directory.lastIndexOf('/')),c);
- }
- c.mkdir(directory);
- }
- }
-
-
- public List list(String parent) throws IOException {
- try {
- ChannelSftp c = getSftpChannel(parent);
- Collection r = c.ls(parent);
- if (r != null) {
- if (!parent.endsWith("/")) {
- parent = parent+"/";
- }
- List result = new ArrayList();
- for (Iterator iter = r.iterator(); iter.hasNext();) {
- Object obj=iter.next();
- if(obj instanceof LsEntry){
- LsEntry entry = (LsEntry) obj;
- if (".".equals(entry.getFilename()) || "..".equals(entry.getFilename())) {
- continue;
- }
- result.add(parent+entry.getFilename());
- }
- }
- return result;
- }
- } catch (Exception e) {
- //silent fail, return null listing
- }
- return null;
- }
+ if (destination.indexOf('/') != -1) {
+ mkdirs(destination.substring(0, destination.lastIndexOf('/')), c);
+ }
+ c.put(source.getAbsolutePath(), destination, new MyProgressMonitor());
+ } catch (SftpException e) {
+ IOException ex = new IOException(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+
+ private void mkdirs(String directory, ChannelSftp c) throws IOException, SftpException {
+ try {
+ SftpATTRS att = c.stat(directory);
+ if (att != null) {
+ if (att.isDir()) {
+ return;
+ }
+ }
+ } catch (SftpException ex) {
+ if (directory.indexOf('/') != -1) {
+ mkdirs(directory.substring(0, directory.lastIndexOf('/')), c);
+ }
+ c.mkdir(directory);
+ }
+ }
+
+ public List list(String parent) throws IOException {
+ try {
+ ChannelSftp c = getSftpChannel(parent);
+ Collection r = c.ls(parent);
+ if (r != null) {
+ if (!parent.endsWith("/")) {
+ parent = parent + "/";
+ }
+ List result = new ArrayList();
+ for (Iterator iter = r.iterator(); iter.hasNext();) {
+ Object obj = iter.next();
+ if (obj instanceof LsEntry) {
+ LsEntry entry = (LsEntry) obj;
+ if (".".equals(entry.getFilename()) || "..".equals(entry.getFilename())) {
+ continue;
+ }
+ result.add(parent + entry.getFilename());
+ }
+ }
+ return result;
+ }
+ } catch (Exception e) {
+ // silent fail, return null listing
+ }
+ return null;
+ }
/**
* Checks the existence for a remote file
- * @param file to check
- * @param channel to use
+ *
+ * @param file
+ * to check
+ * @param channel
+ * to use
* @returns true if file exists, false otherwise
* @throws IOException
* @throws SftpException
*/
- private boolean checkExistence(String file, ChannelSftp channel) throws IOException, SftpException {
+ private boolean checkExistence(String file, ChannelSftp channel) throws IOException,
+ SftpException {
try {
return channel.stat(file) != null;
} catch (SftpException ex) {
return false;
}
}
-
- /**
- * Establish the connection to the server if not yet connected, and listen to ivy events
- * for closing connection when resolve is finished.
- *
- * Not meant to be used in multi threaded environment.
- *
- * @return the ChannelSftp with which a connection is established
- * @throws IOException if any connection problem occurs
- */
- private ChannelSftp getSftpChannel(String pathOrUri) throws IOException {
- Session session = getSession(pathOrUri);
+
+ /**
+ * Establish the connection to the server if not yet connected, and listen to ivy events for
+ * closing connection when resolve is finished. Not meant to be used in multi threaded
+ * environment.
+ *
+ * @return the ChannelSftp with which a connection is established
+ * @throws IOException
+ * if any connection problem occurs
+ */
+ private ChannelSftp getSftpChannel(String pathOrUri) throws IOException {
+ Session session = getSession(pathOrUri);
String host = session.getHost();
ChannelSftp channel = SshCache.getInstance().getChannelSftp(session);
- if(channel == null) {
+ if (channel == null) {
try {
channel = (ChannelSftp) session.openChannel("sftp");
channel.connect();
- Message.verbose(":: SFTP :: connected to "+host+"!");
- SshCache.getInstance().attachChannelSftp(session,channel);
+ Message.verbose(":: SFTP :: connected to " + host + "!");
+ SshCache.getInstance().attachChannelSftp(session, channel);
} catch (JSchException e) {
IOException ex = new IOException(e.getMessage());
ex.initCause(e);
@@ -235,10 +235,10 @@
}
}
return channel;
- }
+ }
protected String getRepositoryScheme() {
- // use the Resolver type name here?
+ // use the Resolver type name here?
// would be nice if it would be static, so we could use SFTPResolver.getTypeName()
return "sftp";
}
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPResource.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPResource.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPResource.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPResource.java Tue Jun 5 05:02:27 2007
@@ -22,55 +22,58 @@
import org.apache.ivy.plugins.repository.Resource;
-
public class SFTPResource implements Resource {
- private SFTPRepository _repository;
+ private SFTPRepository _repository;
+
private String _path;
-
+
private transient boolean _init = false;
+
private transient boolean _exists;
+
private transient long _lastModified;
+
private transient long _contentLength;
public SFTPResource(SFTPRepository repository, String path) {
- _repository = repository;
- _path = path;
- }
+ _repository = repository;
+ _path = path;
+ }
- public String getName() {
+ public String getName() {
return _path;
}
-
+
public Resource clone(String cloneName) {
- return new SFTPResource(_repository, cloneName);
+ return new SFTPResource(_repository, cloneName);
}
public long getLastModified() {
- init();
+ init();
return _lastModified;
}
public long getContentLength() {
- init();
+ init();
return _contentLength;
}
public boolean exists() {
- init();
+ init();
return _exists;
}
private void init() {
- if (!_init) {
- Resource r = _repository.resolveResource(_path);
- _contentLength = r.getContentLength();
- _lastModified = r.getLastModified();
- _exists = r.exists();
- _init = true;
- }
- }
+ if (!_init) {
+ Resource r = _repository.resolveResource(_path);
+ _contentLength = r.getContentLength();
+ _lastModified = r.getLastModified();
+ _exists = r.exists();
+ _init = true;
+ }
+ }
- public String toString() {
+ public String toString() {
return getName();
}
@@ -78,7 +81,7 @@
return false;
}
- public InputStream openStream() throws IOException {
- return _repository.openStream(this);
- }
+ public InputStream openStream() throws IOException {
+ return _repository.openStream(this);
+ }
}