private MapInMap(Parent parent, String name) { super(new PropertyMap(name)); this.parent = parent; }
public MapInList(Parent parent, String name) { super(new PropertyMap(name)); this.parent = parent; }
public PropertyMap deepCopy(boolean keepId) { PropertyMap copy = new PropertyMap(this, keepId); for (Property property : map.values()) { copy.put(property.deepCopy(keepId)); } return copy; }
protected PropertyMap createPropertyMap(PropertyDefinitionMap propDefMap, Augeas augeas, AugeasNode node) { PropertyMap propMap = new PropertyMap(propDefMap.getName()); populatePropertyMap(propDefMap, propMap, augeas, node); return propMap; }
public void updateResourceConfiguration(AugeasNode node, ConfigurationDefinition resourceConfigDef, Configuration resourceConfig) throws AugeasRhqException { Collection<PropertyDefinition> propDefs = resourceConfigDef.getPropertyDefinitions().values(); PropertyMap startProp = new PropertyMap(); for (Property property : resourceConfig.getProperties()) startProp.put(property); for (PropertyDefinition propDef : propDefs) { updateProperty(propDef, startProp, node, 0); } }
private static PropertyMap getPropertyMap(String propertyName, Map<String, Object> map) { PropertyMap propertyMap = new PropertyMap(propertyName); Set<String> keys = map.keySet(); for (String key : keys) { Object value = map.get(key); Property target; if (value instanceof Map) { target = getPropertyMap(key, (Map)value); } else if (value instanceof List) { target = getPropertyList(key, (List)value); } else { target = new PropertySimple(key,value); } propertyMap.put(target); } return propertyMap; }
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); }
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); } }
public PropertyMap createPropertyMap(PropertyDefinitionMap propDefMap, AugeasNode node) throws AugeasRhqException { PropertyMap propMap = new PropertyMap(propDefMap.getName()); for (PropertyDefinition mapEntryPropDef : propDefMap.getOrderedPropertyDefinitions()) { propMap.put(loadProperty(mapEntryPropDef, node)); } return propMap; }
public OperationResult retrievePluginClassLoaderInformation() { Map<String, ClassLoader> classloaders; ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); ClassLoaderManager clm = this.pluginContainer.getPluginManager().getClassLoaderManager(); classloaders = clm.getPluginClassLoaders(); } finally { Thread.currentThread().setContextClassLoader(originalCL); } OperationResult info = new OperationResult(); PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaders.size())); PropertyList list = new PropertyList("classloaders"); info.getComplexResults().put(numClassLoaders); info.getComplexResults().put(list); for (Map.Entry<String, ClassLoader> entry : classloaders.entrySet()) { String pluginName = entry.getKey(); ClassLoader classloader = entry.getValue(); PropertyMap map = new PropertyMap("classloader"); map.put(new PropertySimple("pluginName", pluginName)); map.put(new PropertySimple("classloaderInfo", classloader)); list.add(map); } return info; }
private static void adaptPropertyMap(AbstractPropertyMap source, AbstractPropertyMap target, PropertyDefinitionMap definition, Object parent, boolean adaptReadonlyProperties) { if ((adaptReadonlyProperties || !definition.isReadOnly()) && target == null) { target = new PropertyMap(definition.getName()); add(parent, (PropertyMap) target); } for (Map.Entry<String, PropertyDefinition> e : definition.getPropertyDefinitions().entrySet()) { String name = e.getKey(); PropertyDefinition def = e.getValue(); Property sourceChild = source.get(name); // only bother if we have something to adapt from if (sourceChild != null) { Property targetChild = target.get(name); adaptProperty(sourceChild, targetChild, def, target, adaptReadonlyProperties); } } }
public void setBasedir(BaseDirectory basedir) { if (basedir == null) { throw new NullPointerException("basedir is null"); } if (basedir.getValueContext() == null) { throw new NullPointerException("valueContext is null"); } if (basedir.getValueName() == null) { throw new NullPointerException("valueName is null"); } String valueContext = basedir.getValueContext().name(); String valueName = basedir.getValueName(); PropertyMap basedirMap = new PropertyMap(DriftConfigurationDefinition.PROP_BASEDIR); basedirMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUECONTEXT, valueContext)); basedirMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUENAME, StringUtils .useForwardSlash(valueName))); configuration.put(basedirMap); }
private void initBasedir(DriftDescriptor descriptor, DriftDefinitionTemplate template) { Basedir basedir = descriptor.getBasedir(); String valueContext = basedir.getValueContext(); String valueName = basedir.getValueName(); PropertyMap basedirMap = new PropertyMap(DriftConfigurationDefinition.PROP_BASEDIR); basedirMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUECONTEXT, valueContext)); basedirMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_BASEDIR_VALUENAME, valueName)); template.getConfiguration().put(basedirMap); }
private void initExcludes(DriftDescriptor descriptor, DriftDefinitionTemplate template) { if (descriptor.getExcludes() != null && descriptor.getExcludes().getExclude().size() > 0) { Configuration config = template.getConfiguration(); PropertyList excludes = new PropertyList(DriftConfigurationDefinition.PROP_EXCLUDES); for (DriftFilterDescriptor exclude : descriptor.getExcludes().getExclude()) { PropertyMap excludeMap = new PropertyMap(DriftConfigurationDefinition.PROP_EXCLUDES_EXCLUDE); excludeMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATH, exclude.getPath())); excludeMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATTERN, exclude.getPattern())); excludes.add(excludeMap); } config.put(excludes); } }
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; }
private void initIncludes(DriftDescriptor descriptor, DriftDefinitionTemplate template) { if (descriptor.getIncludes() != null && descriptor.getIncludes().getInclude().size() > 0) { Configuration config = template.getConfiguration(); PropertyList includes = new PropertyList(DriftConfigurationDefinition.PROP_INCLUDES); for (DriftFilterDescriptor include : descriptor.getIncludes().getInclude()) { PropertyMap includeMap = new PropertyMap(DriftConfigurationDefinition.PROP_INCLUDES_INCLUDE); includeMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATH, include.getPath())); includeMap.put(new PropertySimple(DriftConfigurationDefinition.PROP_PATTERN, include.getPattern())); includes.add(includeMap); } config.put(includes); } }
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); }
@Override protected void fillPropertyMap(PropertyMap map) { super.fillPropertyMap(map); map.put(new PropertySimple(BUNDLE_DEST_DEFINITION_CONNECTION_NAME, connectionString)); PropertyList list = new PropertyList(BUNDLE_DEST_DEFINITION_REF_LIST_NAME); map.put(list); for (ConfigRef ref : referencedConfiguration) { PropertyMap refMap = new PropertyMap(BUNDLE_DEST_DEFINITION_REF_LIST_MEMBER_NAME); refMap.put(new PropertySimple(BUNDLE_DEST_DEF_REF_TYPE_NAME, ref.getType().name())); refMap.put(new PropertySimple(BUNDLE_DEST_DEF_REF_CONTEXT_NAME, ref.getContext().name())); refMap.put(new PropertySimple(BUNDLE_DEST_DEF_REF_NAME_NAME, ref.getName())); refMap.put(new PropertySimple(BUNDLE_DEST_DEF_REF_TARGET_NAME_NAME, ref.getTargetName())); list.add(refMap); } }