1 21 22 package org.apache.slide.webdav.util; 23 24 import java.util.Collection ; 25 import java.util.HashMap ; 26 import java.util.Iterator ; 27 28 import org.apache.slide.content.NodeProperty.NamespaceCache; 29 30 public class PropertySearchSetProperty { 31 32 private static HashMap propertyMap = null; 33 34 private String property = null; 35 36 private String description = null; 37 38 private String namespace = null; 39 40 45 public static Iterator getPropertySetIterator(){ 46 if (propertyMap == null) { 47 loadProperties(); 48 } 49 Collection values = propertyMap.values(); 50 return values.iterator(); 51 } 52 53 private PropertySearchSetProperty (String prop, String namesp, String desc) { 54 property = prop; 55 description = desc; 56 namespace = namesp; 57 } 58 59 61 private static void loadProperties () { 62 String propSet = AclConstants.C_PRINCIPAL_SEARCH_PROPERTY_SET; 63 int index = 0; 64 int doubleIndex = 0; 65 int trippleIndex = 0; 66 String currentProp = null; 67 String currentTripple = null; 68 String currentDesc = null; 69 String namespace = null; 70 propertyMap = new HashMap (); 71 int len = AclConstants.C_PRINCIPAL_SEARCH_PROPERTY_SET.length(); 72 while ((index != -1) && (index != (len-1))) { 73 index = propSet.indexOf(AclConstants.C_SEARCH_PROPERTY_SET_SEPERATOR); 74 if (index == -1) { 75 currentTripple = propSet; 76 } else { 77 currentTripple = propSet.substring(0, index); 78 propSet = propSet.substring(index+1); 79 } 80 81 if ((len > 0) && (!(propSet.equals(AclConstants.C_SEARCH_PROPERTY_SET_SEPERATOR)))) { 82 trippleIndex = currentTripple.indexOf(","); 83 if (trippleIndex == -1) { 84 currentProp = currentTripple; 85 namespace = NamespaceCache.DEFAULT_URI; 86 currentDesc = ""; 87 }else { 88 String currentDouble = currentTripple.substring(trippleIndex+1); 89 currentProp = currentTripple.substring(0,trippleIndex); 90 doubleIndex = currentDouble.indexOf(","); 91 if (doubleIndex == -1) { 92 namespace = currentDouble; 93 currentDesc = ""; 94 }else { 95 namespace = currentDouble.substring(0,doubleIndex); 96 currentDesc = currentDouble.substring(doubleIndex+1); 97 } 98 } 99 String key = new String (currentProp + namespace); 100 propertyMap.put(key,(new PropertySearchSetProperty(currentProp,namespace,currentDesc))); 101 len = propSet.length(); 102 } 103 } 104 } 105 106 110 public static boolean inSearchPropertySet(String property, String namespace) { 111 if (propertyMap == null) { 112 loadProperties(); 113 } 114 String space; 115 if (namespace == null) { 116 space = NamespaceCache.DEFAULT_URI; 117 } else { 118 space = namespace; 119 } 120 return propertyMap.containsKey(property + space); 121 } 122 123 127 public String getPropertyName() { 128 return property; 129 } 130 131 135 public String getNamespace() { 136 return namespace; 137 } 138 139 143 public String getDescription () { 144 return description; 145 } 146 } 147 148 | Popular Tags |