// Update provider Services if the properties was changed private void updatePropertyServiceTable() { Object _key; Object _value; Provider.Service s; String serviceName; String algorithm; if (changedProperties == null || changedProperties.isEmpty()) { return; } java.util.Iterator<java.util.MapNS.Entry<String, String>> it = changedProperties.entrySet().iterator(); for (; it.hasNext(); ) { java.util.MapNS.Entry<String, String> entry = it.next(); _key = entry.getKey(); _value = entry.getValue(); if (_key == null || _value == null || !(_key is String) || !(_value is String)) { continue; } String key = (String)_key; String value = (String)_value; if (key.startsWith("Provider")) { // Provider service type is reserved //$NON-NLS-1$ continue; } int i; if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$ String aliasName; String service_alias = key.substring(10); i = service_alias.indexOf('.'); serviceName = service_alias.substring(0, i); aliasName = service_alias.substring(i + 1); algorithm = value; String algUp = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128); } else { o = propertyServiceTable.get(serviceName, algUp); } if (o != null) { s = (Provider.Service)o; s.aliases.add(aliasName); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName.toUpperCase(), s); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.ArrayList<String> l = new java.util.ArrayList<String>(); l.add(aliasName); s = new Provider.Service(this, serviceName, algorithm, className, l, new java.util.HashMap<String, String>()); propertyServiceTable.put(serviceName, algUp, s); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName .toUpperCase(), s); } } continue; } int j = key.indexOf('.'); if (j == -1) { // unknown format continue; } i = key.indexOf(' '); if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className> serviceName = key.substring(0, j); algorithm = key.substring(j + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.className = value; } else { s = new Provider.Service(this, serviceName, algorithm, value, new java.util.ArrayList<String>(), new java.util.HashMap<String, String>()); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } else { // <crypto_service>.<algorithm_or_type> // <attribute_name>=<attrValue> serviceName = key.substring(0, j); algorithm = key.substring(j + 1, i); String attribute = key.substring(i + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.attributes.put(attribute, value); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.HashMap<String, String> m = new java.util.HashMap<String, String>(); m.put(attribute, value); s = new Provider.Service(this, serviceName, algorithm, className, new java.util.ArrayList<String>(), m); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } } } servicesChanged(); changedProperties.clear(); }
// Update provider Services if the properties was changed private void updatePropertyServiceTable() { Object _key; Object _value; Provider.Service s; String serviceName; String algorithm; if (changedProperties == null || changedProperties.isEmpty()) { return; } java.util.Iterator <java.util.MapNS.Entry <String, String> > it = changedProperties.entrySet().iterator(); for (; it.hasNext();) { java.util.MapNS.Entry <String, String> entry = it.next(); _key = entry.getKey(); _value = entry.getValue(); if (_key == null || _value == null || !(_key is String) || !(_value is String)) { continue; } String key = (String)_key; String value = (String)_value; if (key.startsWith("Provider")) { // Provider service type is reserved //$NON-NLS-1$ continue; } int i; if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$ String aliasName; String service_alias = key.substring(10); i = service_alias.indexOf('.'); serviceName = service_alias.substring(0, i); aliasName = service_alias.substring(i + 1); algorithm = value; String algUp = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128); } else { o = propertyServiceTable.get(serviceName, algUp); } if (o != null) { s = (Provider.Service)o; s.aliases.add(aliasName); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap <String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName.toUpperCase(), s); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.ArrayList <String> l = new java.util.ArrayList <String>(); l.add(aliasName); s = new Provider.Service(this, serviceName, algorithm, className, l, new java.util.HashMap <String, String>()); propertyServiceTable.put(serviceName, algUp, s); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap <String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName .toUpperCase(), s); } } continue; } int j = key.indexOf('.'); if (j == -1) { // unknown format continue; } i = key.indexOf(' '); if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className> serviceName = key.substring(0, j); algorithm = key.substring(j + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.className = value; } else { s = new Provider.Service(this, serviceName, algorithm, value, new java.util.ArrayList <String>(), new java.util.HashMap <String, String>()); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } else { // <crypto_service>.<algorithm_or_type> // <attribute_name>=<attrValue> serviceName = key.substring(0, j); algorithm = key.substring(j + 1, i); String attribute = key.substring(i + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.attributes.put(attribute, value); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.HashMap <String, String> m = new java.util.HashMap <String, String>(); m.put(attribute, value); s = new Provider.Service(this, serviceName, algorithm, className, new java.util.ArrayList <String>(), m); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } } } servicesChanged(); changedProperties.clear(); }