| | |
| | | public Collection<T> visitDefined(DefinedDefaultBehaviorProvider<T> d, |
| | | Void p) { |
| | | Collection<String> stringValues = d.getDefaultValues(); |
| | | List<T> values = new ArrayList<T>(stringValues.size()); |
| | | List<T> values = new ArrayList<>(stringValues.size()); |
| | | |
| | | for (String stringValue : stringValues) { |
| | | try { |
| | |
| | | if (values.isEmpty()) { |
| | | // Recursively retrieve this property's default values. |
| | | Collection<T> tmp = find(target, pd2); |
| | | Collection<T> pvalues = new ArrayList<T>(tmp.size()); |
| | | Collection<T> pvalues = new ArrayList<>(tmp.size()); |
| | | for (T value : tmp) { |
| | | pd1.validateValue(value); |
| | | pvalues.add(value); |
| | | } |
| | | return pvalues; |
| | | } else { |
| | | Collection<T> pvalues = new ArrayList<T>(values.size()); |
| | | Collection<T> pvalues = new ArrayList<>(values.size()); |
| | | for (ByteString value : values) { |
| | | pvalues.add(ValueDecoder.decode(pd1, value)); |
| | | } |
| | |
| | | |
| | | |
| | | /** Singleton instance. */ |
| | | private static final ServerManagementContext INSTANCE = |
| | | new ServerManagementContext(); |
| | | private static final ServerManagementContext INSTANCE = new ServerManagementContext(); |
| | | |
| | | /** |
| | | * The root server managed object. |
| | | */ |
| | | private static final ServerManagedObject<RootCfg> ROOT = |
| | | new ServerManagedObject<RootCfg>( |
| | | /** The root server managed object. */ |
| | | private static final ServerManagedObject<RootCfg> ROOT = new ServerManagedObject<>( |
| | | ManagedObjectPath.emptyPath(), RootCfgDefn.getInstance(), Collections |
| | | .<PropertyDefinition<?>, SortedSet<?>> emptyMap(), null); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | |
| | | // Retrieve the children. |
| | | Set<DN> children = configEntry.getChildren().keySet(); |
| | | ArrayList<String> names = new ArrayList<String>(children.size()); |
| | | ArrayList<String> names = new ArrayList<>(children.size()); |
| | | for (DN child : children) { |
| | | // Assume that RDNs are single-valued and can be trimmed. |
| | | ByteString av = child.rdn().getAttributeValue(0); |
| | |
| | | |
| | | // Retrieve the children. |
| | | Set<DN> children = configEntry.getChildren().keySet(); |
| | | ArrayList<String> names = new ArrayList<String>(children.size()); |
| | | ArrayList<String> names = new ArrayList<>(children.size()); |
| | | for (DN child : children) { |
| | | // Assume that RDNs are single-valued and can be trimmed. |
| | | ByteString av = child.rdn().getAttributeValue(0); |
| | |
| | | .resolveManagedObjectDefinition(resolver); |
| | | |
| | | // Build the managed object's properties. |
| | | List<PropertyException> exceptions = new LinkedList<PropertyException>(); |
| | | Map<PropertyDefinition<?>, SortedSet<?>> properties = |
| | | new HashMap<PropertyDefinition<?>, SortedSet<?>>(); |
| | | List<PropertyException> exceptions = new LinkedList<>(); |
| | | Map<PropertyDefinition<?>, SortedSet<?>> properties = new HashMap<>(); |
| | | for (PropertyDefinition<?> pd : mod.getAllPropertyDefinitions()) { |
| | | List<ByteString> values = getAttribute(mod, pd, configEntry); |
| | | try { |
| | |
| | | |
| | | // If there were no decoding problems then return the managed |
| | | // object, otherwise throw an operations exception. |
| | | ServerManagedObject<? extends S> mo = decodeAux(path, mod, properties, |
| | | configEntry); |
| | | if (exceptions.isEmpty()) { |
| | | return mo; |
| | | } else { |
| | | ServerManagedObject<? extends S> mo = decodeAux(path, mod, properties, configEntry); |
| | | if (!exceptions.isEmpty()) { |
| | | throw new ServerManagedObjectDecodingException(mo, exceptions); |
| | | } |
| | | return mo; |
| | | } |
| | | |
| | | |
| | |
| | | Map<PropertyDefinition<?>, SortedSet<?>> properties, |
| | | ConfigEntry configEntry) { |
| | | ManagedObjectPath<C, S> newPath = path.asSubType(d); |
| | | return new ServerManagedObject<S>(newPath, d, properties, configEntry); |
| | | return new ServerManagedObject<>(newPath, d, properties, configEntry); |
| | | } |
| | | |
| | | |
| | |
| | | PropertyDefinition<T> pd, List<ByteString> values, |
| | | ConfigEntry newConfigEntry) throws PropertyException { |
| | | PropertyException exception = null; |
| | | SortedSet<T> pvalues = new TreeSet<T>(pd); |
| | | SortedSet<T> pvalues = new TreeSet<>(pd); |
| | | |
| | | if (!values.isEmpty()) { |
| | | // The property has values defined for it. |
| | |
| | | AttributeType type = DirectoryServer.getAttributeType(attrID, true); |
| | | List<Attribute> attributes = configEntry.getEntry().getAttribute(type, true); |
| | | |
| | | List<ByteString> results = new LinkedList<ByteString>(); |
| | | List<ByteString> results = new LinkedList<>(); |
| | | if (attributes != null) |
| | | { |
| | | for (Attribute a : attributes) |
| | |
| | | private <T> Collection<T> getDefaultValues(ManagedObjectPath<?, ?> p, |
| | | PropertyDefinition<T> pd, ConfigEntry newConfigEntry) |
| | | throws PropertyException { |
| | | DefaultValueFinder<T> v = new DefaultValueFinder<T>(newConfigEntry); |
| | | DefaultValueFinder<T> v = new DefaultValueFinder<>(newConfigEntry); |
| | | return v.find(p, pd); |
| | | } |
| | | |