1 /*
2 =================== DO NOT EDIT THIS FILE ====================
3 Generated by Modello 1.0.1 on 2009-09-09 03:30:24,
4 any modifications will be overwritten.
5 ==============================================================
6 */
7
8 package org.apache.maven.artifact.repository.metadata;
9
10 /**
11 * Versioning information for an artifact.
12 *
13 * @version $Revision$ $Date$
14 */
15 public class Versioning
16 implements java.io.Serializable
17 {
18
19 //--------------------------/
20 //- Class/Member Variables -/
21 //--------------------------/
22
23 /**
24 * What the latest version in the directory is, including
25 * snapshots.
26 */
27 private String latest;
28
29 /**
30 * What the latest version in the directory is, of the releases.
31 */
32 private String release;
33
34 /**
35 * The current snapshot data in use for this version.
36 */
37 private Snapshot snapshot;
38
39 /**
40 * Field versions.
41 */
42 private java.util.List<String> versions;
43
44 /**
45 * When the metadata was last updated.
46 */
47 private String lastUpdated;
48
49
50 //-----------/
51 //- Methods -/
52 //-----------/
53
54 /**
55 * Method addVersion.
56 *
57 * @param string
58 */
59 public void addVersion( String string )
60 {
61 if ( !(string instanceof String) )
62 {
63 throw new ClassCastException( "Versioning.addVersions(string) parameter must be instanceof " + String.class.getName() );
64 }
65 getVersions().add( string );
66 } //-- void addVersion( String )
67
68 /**
69 * Get when the metadata was last updated.
70 *
71 * @return String
72 */
73 public String getLastUpdated()
74 {
75 return this.lastUpdated;
76 } //-- String getLastUpdated()
77
78 /**
79 * Get what the latest version in the directory is, including
80 * snapshots.
81 *
82 * @return String
83 */
84 public String getLatest()
85 {
86 return this.latest;
87 } //-- String getLatest()
88
89 /**
90 * Get what the latest version in the directory is, of the
91 * releases.
92 *
93 * @return String
94 */
95 public String getRelease()
96 {
97 return this.release;
98 } //-- String getRelease()
99
100 /**
101 * Get the current snapshot data in use for this version.
102 *
103 * @return Snapshot
104 */
105 public Snapshot getSnapshot()
106 {
107 return this.snapshot;
108 } //-- Snapshot getSnapshot()
109
110 /**
111 * Method getVersions.
112 *
113 * @return List
114 */
115 public java.util.List<String> getVersions()
116 {
117 if ( this.versions == null )
118 {
119 this.versions = new java.util.ArrayList<String>();
120 }
121
122 return this.versions;
123 } //-- java.util.List<String> getVersions()
124
125 /**
126 * Method removeVersion.
127 *
128 * @param string
129 */
130 public void removeVersion( String string )
131 {
132 if ( !(string instanceof String) )
133 {
134 throw new ClassCastException( "Versioning.removeVersions(string) parameter must be instanceof " + String.class.getName() );
135 }
136 getVersions().remove( string );
137 } //-- void removeVersion( String )
138
139 /**
140 * Set when the metadata was last updated.
141 *
142 * @param lastUpdated
143 */
144 public void setLastUpdated( String lastUpdated )
145 {
146 this.lastUpdated = lastUpdated;
147 } //-- void setLastUpdated( String )
148
149 /**
150 * Set what the latest version in the directory is, including
151 * snapshots.
152 *
153 * @param latest
154 */
155 public void setLatest( String latest )
156 {
157 this.latest = latest;
158 } //-- void setLatest( String )
159
160 /**
161 * Set what the latest version in the directory is, of the
162 * releases.
163 *
164 * @param release
165 */
166 public void setRelease( String release )
167 {
168 this.release = release;
169 } //-- void setRelease( String )
170
171 /**
172 * Set the current snapshot data in use for this version.
173 *
174 * @param snapshot
175 */
176 public void setSnapshot( Snapshot snapshot )
177 {
178 this.snapshot = snapshot;
179 } //-- void setSnapshot( Snapshot )
180
181 /**
182 * Set versions available for the artifact.
183 *
184 * @param versions
185 */
186 public void setVersions( java.util.List<String> versions )
187 {
188 this.versions = versions;
189 } //-- void setVersions( java.util.List )
190
191
192 public void updateTimestamp()
193 {
194 setLastUpdatedTimestamp( new java.util.Date() );
195 }
196
197 public void setLastUpdatedTimestamp( java.util.Date date )
198 {
199 java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
200 java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
201 fmt.setTimeZone( timezone );
202 setLastUpdated( fmt.format( date ) );
203 }
204
205 }