From: <bra...@us...> - 2011-09-06 04:06:15
|
Revision: 3524 http://archive-access.svn.sourceforge.net/archive-access/?rev=3524&view=rev Author: bradtofel Date: 2011-09-06 04:06:09 +0000 (Tue, 06 Sep 2011) Log Message: ----------- FEATURE: allows multiple possible locations for a block - attempts to read will try each in order Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequence.java Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/BlockLocation.java Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/BlockLocation.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/BlockLocation.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/BlockLocation.java 2011-09-06 04:06:09 UTC (rev 3524) @@ -0,0 +1,41 @@ +/* + * This file is part of the Wayback archival access software + * (http://archive-access.sourceforge.net/projects/wayback/). + * + * Licensed to the Internet Archive (IA) by one or more individual + * contributors. + * + * The IA licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.archive.wayback.resourceindex.ziplines; + +public class BlockLocation { + String name; + String locations[]; + public BlockLocation(String name, String locations[]) { + this.name = name; + this.locations = locations; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @return the locations + */ + public String[] getLocations() { + return locations; + } +} Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequence.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequence.java 2011-09-06 04:02:57 UTC (rev 3523) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequence.java 2011-09-06 04:06:09 UTC (rev 3524) @@ -37,11 +37,11 @@ ZiplinedBlockStringSequence.class.getName()); private FlatFile chunkIndex = null; - private HashMap<String,String> chunkMap = null; + private HashMap<String,BlockLocation> chunkMap = null; private int maxBlocks = 10000; public ZiplinedBlockStringSequence(FlatFile chunkIndex, - HashMap<String,String> chunkMap) { + HashMap<String,BlockLocation> chunkMap) { this.chunkIndex = chunkIndex; this.chunkMap = chunkMap; } @@ -80,11 +80,11 @@ break; } // add this and keep lookin... - String url = chunkMap.get(parts[1]); + BlockLocation bl = chunkMap.get(parts[1]); long offset = Long.parseLong(parts[2]); int count = Integer.parseInt(parts[3]); - blocks.add(new ZiplinedBlock(url, offset, count)); + blocks.add(new ZiplinedBlock(bl.getLocations(), offset, count)); } } finally { if(itr != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |