1 16 package org.apache.cocoon.sitemap; 17 18 import java.util.HashMap ; 19 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.cocoon.util.location.Locatable; 22 import org.apache.cocoon.util.location.Location; 23 24 29 public class SitemapParameters extends Parameters implements Locatable { 30 31 private Location location = Location.UNKNOWN; 32 33 public SitemapParameters(Location location) { 34 this.location = location; 35 } 36 37 43 public Location getLocation() { 44 return this.location; 45 } 46 47 55 public static Location getLocation(Parameters param) { 56 Location loc = null; 57 if (param instanceof Locatable) { 58 loc = ((Locatable)param).getLocation(); 59 } 60 return loc == null ? Location.UNKNOWN : loc; 61 } 62 63 66 public static String getStatementLocation(Parameters param) { 67 return getLocation(param).toString(); 68 } 69 70 73 public static class LocatedHashMap extends HashMap implements Locatable { 74 private Location loc; 75 76 public Location getLocation() { 77 return this.loc; 78 } 79 80 public LocatedHashMap(Location loc) { 81 this.loc = loc; 82 } 83 84 public LocatedHashMap(Location loc, int size) { 85 super(size); 86 this.loc = loc; 87 } 88 } 89 } 90 | Popular Tags |