void show(Adapter adapter) { AdapterDescriptor descriptor = adapter.getDescriptor(); Utils.Resolver resolver = adapter.getResolver(); _id.setText(resolver.substitute(descriptor.id)); String currentEndpoints = adapter.getCurrentEndpoints(); if (currentEndpoints == null) { _currentStatus.setText("Inactive"); _currentEndpoints.setText(""); } else { _currentStatus.setText("Active"); _currentEndpoints.setText(currentEndpoints); } _description.setText(resolver.substitute(descriptor.description)); _replicaGroupId.setText(resolver.substitute(descriptor.replicaGroupId)); _priority.setText(resolver.substitute(descriptor.priority)); java.util.Map<String, String> properties = adapter.getProperties(); // getId() returns the name of the adapter! _endpoints.setText(resolver.substitute(properties.get(adapter.getId() + ".Endpoints"))); _publishedEndpoints.setText( resolver.substitute((String) properties.get(adapter.getId() + ".PublishedEndpoints"))); _registerProcess.setSelected(descriptor.registerProcess); _serverLifetime.setSelected(descriptor.serverLifetime); _objects.setObjects(descriptor.objects, resolver); _allocatables.setObjects(descriptor.allocatables, resolver); }
public static java.util.Map<String, String> makeParameterValues( java.util.Map<String, String> oldParameterValues, java.util.List<String> newParameters) { java.util.Map<String, String> result = new java.util.HashMap<String, String>(); for (String name : newParameters) { String value = oldParameterValues.get(name); if (value != null) { result.put(name, value); } } return result; }
static java.util.LinkedList<String[]> parameterValuesToAttributes( java.util.Map<String, String> parameterValues, java.util.List<String> parameters) { java.util.LinkedList<String[]> result = new java.util.LinkedList<String[]>(); // // We use a LinkedHashSet to maintain order while eliminating duplicates // for (String p : new java.util.LinkedHashSet<String>(parameters)) { String val = parameterValues.get(p); if (val != null) { result.add(createAttribute(p, val)); } } return result; }
static void writeParameters( XMLWriter writer, java.util.List<String> parameters, java.util.Map<String, String> defaultValues) throws java.io.IOException { for (String p : new java.util.LinkedHashSet<String>(parameters)) { String val = defaultValues.get(p); java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); attributes.add(createAttribute("name", p)); if (val != null) { attributes.add(createAttribute("default", val)); } writer.writeElement("parameter", attributes); } }