@Override boolean isConnectorPropertyDefined() { PropertyList staticConnectors = configuration.getList(STATIC_CONNECTORS_PROPERTY); return staticConnectors != null && !staticConnectors.getList().isEmpty(); }
private String shutdown(Configuration parameters) throws InterruptedException { PropertyList env = parameters.getList(SHUTDOWN_SCRIPT_ENVIRONMENT_PROPERTY); return shutdown(env); }
private String start(Configuration parameters) throws InterruptedException { PropertyList env = parameters.getList(START_SCRIPT_ENVIRONMENT_PROPERTY); return start(env); }
private <T extends BundleDestinationSpecification> Set<T> getBundleDestinationSpecificationsOfType(Class<T> type) { if (this.bundleConfiguration == null) { return null; } PropertyList propertyList = this.bundleConfiguration.getList(BUNDLE_DEST_LIST_NAME); if (propertyList == null) { return null; } List<Property> list = propertyList.getList(); if (list.size() == 0) { return null; } Set<T> retVal = new HashSet<T>(list.size()); for (Property listItem : list) { PropertyMap map = (PropertyMap) listItem; T item = BundleDestinationSpecification.from(map, type); if (item != null) { retVal.add(item); } } return retVal; }
private void addScriptsEnvironment(Configuration operationParameters) { Configuration pluginConfiguration = resourceContext.getPluginConfiguration(); PropertyList startScriptEnv = pluginConfiguration .getList(TomcatServerOperationsDelegate.START_SCRIPT_ENVIRONMENT_PROPERTY); PropertyList shutdownScriptEnv = pluginConfiguration .getList(TomcatServerOperationsDelegate.SHUTDOWN_SCRIPT_ENVIRONMENT_PROPERTY); if (startScriptEnv != null) { operationParameters.put(startScriptEnv); } if (shutdownScriptEnv != null) { operationParameters.put(shutdownScriptEnv); } } }
private List<String> findAssignedServerGroups() { List<String> groups = new ArrayList<String>(); Configuration config = new Configuration(); loadAssignedServerGroups(config); for (Property prop : config.getList("*1").getList()) { PropertyMap map = (PropertyMap) prop; groups.add(map.getSimpleValue("server-group", null)); } return groups; }
private List<Filter> getFilters(String type) { PropertyList filtersListProperty = configuration.getList(type); if (filtersListProperty == null) { return emptyList(); } List<Filter> filters = new ArrayList<Filter>(); for (Property property : filtersListProperty.getList()) { PropertyMap filter = (PropertyMap) property; filters.add(new Filter(filter.getSimpleValue(DriftConfigurationDefinition.PROP_PATH, "."), filter .getSimpleValue(DriftConfigurationDefinition.PROP_PATTERN, ""))); } return filters; } }
private boolean shouldUpdateSchedules(MetricTemplate def) { if (importConfiguration == null) { return UPDATE_SCHEDULES_DEFAULT; } String updateAll = importConfiguration.getSimpleValue(UPDATE_ALL_SCHEDULES_PROPERTY, null); if (updateAll != null) { if (Boolean.parseBoolean(updateAll)) { return true; } } PropertyList perMetricOverrides = importConfiguration.getList(METRIC_UPDATE_OVERRIDES_PROPERTY); if (perMetricOverrides == null) { return UPDATE_SCHEDULES_DEFAULT; } PropertySimple override = findOverrideForMetric(def, perMetricOverrides); if (override == null) { return UPDATE_SCHEDULES_DEFAULT; } return override.getBooleanValue(); }
private void initLogEventSourcesConfigProp(String fileName, Configuration pluginConfiguration) { PropertyList logEventSources = pluginConfiguration .getList(LogFileEventResourceComponentHelper.LOG_EVENT_SOURCES_CONFIG_PROP); if (logEventSources == null) return; File serverLogFile = new File(fileName); if (serverLogFile.exists() && !serverLogFile.isDirectory()) { PropertyMap serverLogEventSource = new PropertyMap("logEventSource"); serverLogEventSource.put(new PropertySimple( LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.LOG_FILE_PATH, serverLogFile)); serverLogEventSource.put(new PropertySimple( LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.ENABLED, Boolean.FALSE)); logEventSources.add(serverLogEventSource); } }
private void addBundleDestinationSpecification(BundleDestinationSpecification def) { if (this.bundleConfiguration == null) { throw new NullPointerException("bundleConfiguration == null"); } PropertyList propertyList = this.bundleConfiguration.getList(BUNDLE_DEST_LIST_NAME); if (propertyList == null) { propertyList = new PropertyList(BUNDLE_DEST_LIST_NAME); this.bundleConfiguration.put(propertyList); } PropertyMap map = new PropertyMap(BUNDLE_DEST_LIST_ITEM_NAME); def.fillPropertyMap(map); propertyList.add(map); }
@Override public CreateResourceReport createResource(CreateResourceReport report) { Configuration resourceConfiguration = report.getResourceConfiguration(); PropertyList entries = resourceConfiguration.getList("entries"); if (entries != null && entries.getList().isEmpty()) { report.setErrorMessage("You need to provide at least one JNDI name"); report.setStatus(CreateResourceStatus.FAILURE); return report; } report = super.createResource(report); return report; } }
@Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { Configuration resourceConfiguration = report.getConfiguration(); PropertyList entries = resourceConfiguration.getList("entries"); if (entries == null || entries.getList().isEmpty()) { report.setErrorMessage("You need to provide at least one JNDI name"); report.setStatus(ConfigurationUpdateStatus.FAILURE); return; } //defer the rest of the validation for connector and discovery group name to //the base class super.updateResourceConfiguration(report); } }
private void initLogEventSourcesConfigProp(String fileName, Configuration pluginConfiguration) { PropertyList logEventSources = pluginConfiguration .getList(LogFileEventResourceComponentHelper.LOG_EVENT_SOURCES_CONFIG_PROP); if (logEventSources == null) return; File serverLogFile = new File(fileName); if (!serverLogFile.isDirectory()) { PropertyMap serverLogEventSource = new PropertyMap("logEventSource"); serverLogEventSource.put(new PropertySimple( LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.LOG_FILE_PATH, serverLogFile)); serverLogEventSource.put(new PropertySimple( LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.ENABLED, Boolean.FALSE)); logEventSources.add(serverLogEventSource); } }
@Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { // We need to filter the path properties that are marked with the read-only flag // This is done by setting the logical removed flag on the map to signal // the write delegate to skip the map Configuration config = report.getConfiguration(); PropertyList propertyList = config.getList("*3"); for (Property property : propertyList.getList()) { PropertyMap map = (PropertyMap) property; String ro = map.getSimpleValue("read-only", "false"); if (Boolean.parseBoolean(ro)) { map.setErrorMessage(ConfigurationWriteDelegate.LOGICAL_REMOVED); } } super.updateResourceConfiguration(report); }
public MapInListUIComponentTreeFactory(AbstractConfigurationComponent config, String listName, int listIndex) { super(config, getPropertyDefinitions(config.getConfigurationDefinition(), listName), (PropertyMap) config .getConfiguration().getList(listName).getList().get(listIndex), true, createValueExpressionFormat( config.getConfigurationExpressionString(), listName, listIndex)); this.listIndex = listIndex; }
@Override public Operation getBatchOperation() { CompositeOperation compositeOperation = new CompositeOperation(); if (hasDiscoveryGroupName()) { compositeOperation.addStep(new UndefineAttribute(address, STATIC_CONNECTORS_ATTRIBUTE)); compositeOperation.addStep(new WriteAttribute(address, DISCOVERY_GROUP_NAME, configuration .getSimpleValue(DISCOVERY_GROUP_NAME))); } else { compositeOperation.addStep(new UndefineAttribute(address, DISCOVERY_GROUP_NAME)); List<Property> propertyList = configuration.getList(STATIC_CONNECTORS_PROPERTY).getList(); List<String> staticConnectors = new ArrayList<String>(propertyList.size()); for (Property property : propertyList) { if (property instanceof PropertySimple) { PropertySimple propertySimple = (PropertySimple) property; staticConnectors.add(propertySimple.getStringValue()); } else { getLog().warn(property.getName() + " property has unexpected type: " + property.getClass()); } } compositeOperation.addStep(new WriteAttribute(address, STATIC_CONNECTORS_ATTRIBUTE, staticConnectors)); } return compositeOperation; } }
public static StorageNodeConfigurationComposite createCompositeConfiguration(Configuration storageNodeConfiguration, Configuration storageNodePluginConfiguration, StorageNode storageNode) { StorageNodeConfigurationComposite configuration = new StorageNodeConfigurationComposite(storageNode); configuration.setHeapSize(storageNodeConfiguration.getSimpleValue(RHQ_STORAGE_HEAP_MAX_PROPERTY)); configuration.setHeapNewSize(storageNodeConfiguration.getSimpleValue(RHQ_STORAGE_HEAP_NEW_PROPERTY)); configuration.setThreadStackSize(storageNodeConfiguration.getSimpleValue(RHQ_STORAGE_THREAD_STACK_PROPERTY)); configuration.setCommitLogLocation(storageNodeConfiguration.getSimpleValue(RHQ_STORAGE_COMMIT_LOG_PROPERTY)); configuration.setSavedCachesLocation(storageNodeConfiguration.getSimpleValue(RHQ_STORAGE_SAVED_CACHES_PROPERTY)); PropertyList allDataFileLocations = storageNodeConfiguration.getList(RHQ_STORAGE_DATA_FILE_PROPERTY); if(allDataFileLocations != null) { List<String> dataDirectories = new LinkedList<String>(); for (Property property : allDataFileLocations.getList()) { PropertySimple dataFileLocation = (PropertySimple) property; dataDirectories.add(dataFileLocation.getStringValue()); } configuration.setDataLocations(dataDirectories); } configuration.setJmxPort(Integer.parseInt(storageNodePluginConfiguration .getSimpleValue(RHQ_STORAGE_JMX_PORT_PROPERTY))); return configuration; }
private int addNewMap(AbstractConfigurationComponent config) { String listName = config.getListName(); PropertyDefinitionMap mapDefinition = (PropertyDefinitionMap) config.getConfigurationDefinition() .getPropertyDefinitionList(listName).getMemberDefinition(); String mapName = mapDefinition.getName(); PropertyMap newMap = new PropertyMap(mapName); for (PropertyDefinition mapMemberDefinition : mapDefinition.getOrderedPropertyDefinitions()) { PropertyDefinitionSimple simpleDefinition = (PropertyDefinitionSimple) mapMemberDefinition; newMap.put(new PropertySimple(simpleDefinition.getName(), (simpleDefinition.isRequired()) ? "" : null)); } PropertyList list = config.getConfiguration().getList(listName); list.add(newMap); return list.getList().size() - 1; }
public void addInclude(Filter filter) { PropertyList filtersList = configuration.getList(DriftConfigurationDefinition.PROP_INCLUDES); if (filtersList == null) { // this is going to be our first include filter - make sure we create an initial list and put it in the config filtersList = new PropertyList(DriftConfigurationDefinition.PROP_INCLUDES); configuration.put(filtersList); } PropertyMap filterMap = new PropertyMap(DriftConfigurationDefinition.PROP_INCLUDES_INCLUDE); filterMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATH, StringUtils.useForwardSlash(filter .getPath()))); filterMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATTERN, filter.getPattern())); filtersList.add(filterMap); }
public void addExclude(Filter filter) { PropertyList filtersList = configuration.getList(DriftConfigurationDefinition.PROP_EXCLUDES); if (filtersList == null) { // this is going to be our first include filter - make sure we create an initial list and put it in the config filtersList = new PropertyList(DriftConfigurationDefinition.PROP_EXCLUDES); configuration.put(filtersList); } PropertyMap filterMap = new PropertyMap(DriftConfigurationDefinition.PROP_EXCLUDES_EXCLUDE); filterMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATH, StringUtils.useForwardSlash(filter .getPath()))); filterMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATTERN, filter.getPattern())); filtersList.add(filterMap); }