r27210 - trunk/freenet/src/freenet/client/async

[email protected] Wed, 22 Apr 2009 12:13:53 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: saces
Date: 2009-04-22 12:13:53 +0000 (Wed, 22 Apr 2009)
New Revision: 27210

Modified:
   trunk/freenet/src/freenet/client/async/BaseManifestPutter.java
Log:
remove the 'file list to FieldSet' stuff, it does not work currently here, 
especially in container mode the sub data are freed if a subcontainer put is done

Modified: trunk/freenet/src/freenet/client/async/BaseManifestPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BaseManifestPutter.java	2009-04-22 12:10:40 UTC (rev 27209)
+++ trunk/freenet/src/freenet/client/async/BaseManifestPutter.java	2009-04-22 12:13:53 UTC (rev 27210)
@@ -1459,82 +1459,6 @@
 			container.store(this);
 	}
 	
-	/**
-	 * Convert a HashMap of name -> bucket to a HashSet of ManifestEntry's.
-	 * All are to have mimeOverride=null, i.e. we use the auto-detected mime type
-	 * from the filename.
-	 */
-	public static HashMap<String, Object> bucketsByNameToManifestEntries(HashMap<String,Object> bucketsByName) {
-		HashMap<String,Object> manifestEntries = new HashMap<String,Object>();
-		for (Map.Entry<String, Object> e : bucketsByName.entrySet()) {
-			String name = e.getKey();
-			Object o = e.getValue();
-			if(o instanceof Bucket) {
-				Bucket data = (Bucket) o;
-				manifestEntries.put(name, new ManifestElement(name, data, null,data.size()));
-			} else if(o instanceof HashMap) {
-				manifestEntries.put(name, bucketsByNameToManifestEntries((HashMap<String, Object>)o));
-			} else
-				throw new IllegalArgumentException(String.valueOf(o));
-		}
-		return manifestEntries;
-	}
-
-	/**
-	 * Convert a hierarchy of HashMap's of ManifestEntries into a series of 
-	 * ManifestElement's, each of which has a full path.
-	 */
-	public static ManifestElement[] flatten(HashMap<String,Object> manifestElements) {
-		Vector<ManifestElement> v = new Vector<ManifestElement>();
-		flatten(manifestElements, v, "");
-		return v.toArray(new ManifestElement[v.size()]);
-	}
-
-	public static void flatten(HashMap<String,Object> manifestElements, Vector<ManifestElement> v, String prefix) {
-		for(Map.Entry<String, Object> e : manifestElements.entrySet()) {
-			String name = e.getKey();
-			String fullName = prefix.length() == 0 ? name : prefix+ '/' +name;
-			Object o = e.getValue();
-			if(o instanceof HashMap) {
-				flatten((HashMap<String, Object>)o, v, fullName);
-			} else if(o instanceof ManifestElement) {
-				ManifestElement me = (ManifestElement) o;
-				v.add(new ManifestElement(me, fullName));
-			} else
-				throw new IllegalStateException(String.valueOf(o));
-		}
-	}
-
-	/**
-	 * Opposite of flatten(...).
-	 * Note that this can throw a ClassCastException if the vector passed in is
-	 * bogus (has files pretending to be directories).
-	 */
-	public static <T> HashMap<String, Object> unflatten(List<ManifestElement> v) {
-		HashMap<String, Object> manifestElements = new HashMap<String, Object>();
-		for(ManifestElement oldElement : v) {
-			add(oldElement, oldElement.getName(), manifestElements);
-		}
-		return manifestElements;
-	}
-	
-	private static void add(ManifestElement e, String namePart, Map<String, Object> target) {
-		int idx = namePart.indexOf('/');
-		if(idx < 0) {
-			target.put(namePart, new ManifestElement(e, namePart));
-		} else {
-			String before = namePart.substring(0, idx);
-			String after = namePart.substring(idx+1);
-			@SuppressWarnings("unchecked")
-			HashMap<String, Object> hm = (HashMap<String, Object>) target.get(before);
-			if(hm == null) {
-				hm = new HashMap<String, Object>();
-				target.put(before.intern(), hm);
-			}
-			add(e, after, hm);
-		}
-	}
-
 	public int countFiles() {
 		return numberOfFiles;
 	}