Changeset 2688 in josm for trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java
- Timestamp:
- 28.12.2009 00:15:22 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java
r2613 r2688 6 6 7 7 import java.io.InputStream; 8 import java.io.UnsupportedEncodingException; 8 9 import java.util.ArrayList; 9 10 import java.util.Collection; … … 13 14 14 15 import org.openstreetmap.josm.data.osm.Changeset; 16 import org.openstreetmap.josm.data.osm.ChangesetDataSet; 15 17 import org.openstreetmap.josm.data.osm.DataSet; 16 18 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 140 142 if (in == null) 141 143 return null; 142 monitor.indeterminateSubTask(tr("({0}/{1}) Downloading changeset { 0} ...", i,ids.size(), id));144 monitor.indeterminateSubTask(tr("({0}/{1}) Downloading changeset {2} ...", i,ids.size(), id)); 143 145 List<Changeset> changesets = OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true)); 144 146 if (changesets == null || changesets.isEmpty()) { … … 159 161 160 162 /** 161 * not implemented yet163 * Downloads the content of a changeset 162 164 * 163 * @param id 164 * @param monitor 165 * @return 166 * @throws OsmTransferException 165 * @param id the changset id. >0 required. 166 * @param monitor the progress monitor. {@see NullProgressMonitor#INSTANCE} assumed if null. 167 * @return the changset content 168 * @throws IllegalArgumentException thrown if id <= 0 169 * @throws OsmTransferException thrown if something went wrong 167 170 */ 168 public Changeset downloadChangeset(long id, ProgressMonitor monitor) throws OsmTransferException { 169 return null; 171 public ChangesetDataSet downloadChangeset(int id, ProgressMonitor monitor) throws IllegalArgumentException, OsmTransferException { 172 if (id <= 0) 173 throw new IllegalArgumentException(tr("Expected value of type integer > 0 for parameter ''{0}'', got {1}", "id", id)); 174 if (monitor == null) { 175 monitor = NullProgressMonitor.INSTANCE; 176 } 177 try { 178 monitor.beginTask(tr("Downloading changeset content")); 179 StringBuffer sb = new StringBuffer(); 180 sb.append("changeset/").append(id).append("/download"); 181 InputStream in = getInputStream(sb.toString(), monitor.createSubTaskMonitor(1, true)); 182 if (in == null) 183 return null; 184 monitor.setCustomText(tr("Downloading content for changeset {0} ...", id)); 185 OsmChangesetContentParser parser = new OsmChangesetContentParser(in); 186 ChangesetDataSet ds = parser.parse(monitor.createSubTaskMonitor(1, true)); 187 return ds; 188 } catch(UnsupportedEncodingException e) { 189 throw new OsmTransferException(e); 190 } catch(OsmDataParsingException e) { 191 throw new OsmTransferException(e); 192 } finally { 193 monitor.finishTask(); 194 } 170 195 } 171 196 }
Note: See TracChangeset
for help on using the changeset viewer.
