I modified the code displayed below.
At BasicURLHandler, how is it possible to retrieve de value of
"timestamp" attribute (from ivy.xml)
Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java
===================================================================
--- src/java/org/apache/ivy/util/url/BasicURLHandler.java (revision
661197)
+++ src/java/org/apache/ivy/util/url/BasicURLHandler.java (working
copy)
@@ -131,6 +131,10 @@
"Downloaded file size doesn't match expected
Content Length for " + src
+ ". Please retry.");
}
+ boolean remoteTimestamp = false;
+ if (remoteTimestamp) {
+ dest.setLastModified(srcConn.getLastModified());
+ }
} finally {
disconnect(srcConn);
Index: src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
===================================================================
--- src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (revision 661197)
+++ src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (working copy)
@@ -229,10 +229,19 @@
</xs:complexType>
</xs:element>
</xs:sequence>
- <xs:attribute
name="defaultconf" type="xs:string"/>
- <xs:attribute
name="defaultconfmapping" type="xs:string"/>
+ <xs:attribute name="defaultconf" type="xs:string"/>
+ <xs:attribute name="defaultconfmapping"
type="xs:string"/>
<xs:attribute name="confmappingoverride"
type="xs:boolean" />
- </xs:complexType>
+ <xs:attribute name="timestamp" default="current"
use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="current"/>
+ <xs:enumeration value="remote"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
Index:
src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
===================================================================
---
src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
(revision 661197)
+++
src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
(working copy)
@@ -520,6 +520,10 @@
if (confMappingOverride != null) {
md.setMappingOverride(Boolean.valueOf(confMappingOverride).booleanValue());
}
+ String timestamp =
ivy.substitute(attributes.getValue("timestamp"));
+ if (timestamp != null) {
+ md.setTimestamp(timestamp);
+ }
checkConfigurations();
Claudio Miranda wrote:
>
>
> I am doing some testing with Ivy and have implemented a small
> modification, to allow the downloaded resource to have the same date
> timestamp as the file in remote repo. It is a requirement from the
> customer.
>
> At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File
> dest, CopyProgressListener l)
> I added
>
> dest.setLastModified(srcConn.getLastModified());
>
> How is it possible to add an attribute "timestamp" to the
> "dependencies" xml tag ? See below, a sample:
>
> <ivy-module version="2.0">
> <info organisation="br.com.smartnet" module="hello-ivy"/>
> <dependencies timestamp="remote">
> <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
> <dependency org="commons-cli" name="commons-cli" rev="1.0"/>
> <dependency org="skaringa" name="skaringa" rev="r1p8"/>
> </dependencies>
> </ivy-module>
>
> It can have 2 values "remote" or "current", whereas "remote" set the
> last modified attribute, as the remote file is. The "current" means the
> current Ivy behavior.
>
> How can I read the timestamp value, at BasicURLHandler class ?
>
> This is the thread, with more explanation about this requested
> behavior
> http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html
>
> I plan to submit it as an enhancement to the Ivy issue tracking.
>
> Thanks
>
> Claudio Miranda
>
-----
Claudio Miranda
http://weblogs.java.net/blog/claudio
http://www.claudius.com.br/blog
--
View this message in context:
http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-tp17526130p17527290.html
Sent from the Ant - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]