private void prepareConfigForMergeIntoStructured(Configuration config, Configuration latestStructured) { config.getAllProperties().clear(); for (Property property : latestStructured.getProperties()) { config.put(property); } }
/** * Unmask the values of all masked simple properties of type PASSWORD in the configuration. The configuration does not * need to be normalized; that is, properties defined by the configuration definition do not need to exist in the * configuration. * * @param configuration the configuration to be unmasked * @param unmaskedConfiguration the unmasked configuration that should be used as the reference to unmask the * configuration */ public static void unmaskConfiguration(@NotNull Configuration configuration, @NotNull Configuration unmaskedConfiguration) { Map<String, Property> memberProperties = configuration.getAllProperties(); for (Property memberProperty : memberProperties.values()) { unmaskProperty(memberProperty.getName(), configuration, unmaskedConfiguration); } }
Map<String,Property> propertyMap = parameters.getAllProperties(); for (Map.Entry<String,Property> entry : propertyMap.entrySet()) { if (entry.getValue() instanceof PropertySimple) {
public AvailabilityType getAvailability() { AvailabilityType avail; try { EmsConnection connection = loadConnection(); EmsBean bean = connection.getBean("Catalina:type=Server"); // this is necessary to prove that that not only the connection exists but is servicing requests. bean.getAttribute("serverInfo").refresh(); avail = AvailabilityType.UP; } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("An exception occurred during availability check for Tomcat Server Resource with key [" + this.getResourceContext().getResourceKey() + "] and plugin config [" + this.getPluginConfiguration().getAllProperties() + "].", e); } // If the connection is not servicing requests, then close it. this seems necessary for the // Tomcat connection, as, when Tomcat does come up again, it seems a new EMS connection is required, // otherwise EMS is not able to pick up the new process. closeConnection(); avail = AvailabilityType.DOWN; } return avail; }
Configuration config = loadResourceConfiguration(); ConfigurationDefinition configDefCopy = copyConfigurationDefinition(configurationDefinition); for (Property prop : report.getConfiguration().getAllProperties().values()) { if (prop instanceof PropertySimple) { PropertySimple propSimple = (PropertySimple) prop;
private Configuration mergeExistingResourcePluginConfiguration(Resource resource, Configuration pluginConfig) { // If there is no update necessary just return the current plugin config of the existing resource Configuration result = resource.getPluginConfiguration(); ConfigurationDefinition configDef = resource.getResourceType().getPluginConfigurationDefinition(); if (null == configDef) { return result; } Configuration existingPluginConfig = resource.getPluginConfiguration().deepCopy(false); Configuration defaultPluginConfig = ConfigurationUtility.createDefaultConfiguration(configDef); boolean configChanged = false; // for each property, update the existing plugin config if discovery has set a non-default value for (String propertyName : pluginConfig.getAllProperties().keySet()) { Property discoveredProp = pluginConfig.get(propertyName); Property defaultProp = defaultPluginConfig.get(propertyName); if (!discoveredProp.equals(defaultProp)) { if (log.isDebugEnabled()) { log.debug("Discovery reported a new version of " + resource + ". Updating value of config property" + " from [" + existingPluginConfig.get(propertyName) + "] to [" + discoveredProp + "]."); } existingPluginConfig.put(discoveredProp); configChanged = true; } } if (configChanged) { result = mergeExistingResourcePluginConfigurationOnServer(resource, existingPluginConfig); } return result; }
Property update = report.getConfiguration().getAllProperties().get(propDef.getName()); if ((null == current && isUndefined(update))) { propDefs.remove(propDef.getName());