| | |
| | | import org.opends.server.admin.ManagedObjectPath; |
| | | import org.opends.server.admin.OptionalRelationDefinition; |
| | | import org.opends.server.admin.PropertyDefinition; |
| | | import org.opends.server.admin.PropertyDefinitionsOptions; |
| | | import org.opends.server.admin.PropertyIsMandatoryException; |
| | | import org.opends.server.admin.PropertyIsReadOnlyException; |
| | | import org.opends.server.admin.PropertyOption; |
| | |
| | | // The managed object's properties. |
| | | private final PropertySet properties; |
| | | |
| | | /** Decoding options for property definitions values. */ |
| | | private final PropertyDefinitionsOptions propertyDefOptions; |
| | | |
| | | /** |
| | | * Creates a new abstract managed object. |
| | | * |
| | |
| | | * committed). |
| | | * @param namingPropertyDefinition |
| | | * Optional naming property definition. |
| | | * @param propertyDefOptions TODO |
| | | */ |
| | | protected AbstractManagedObject(ManagedObjectDefinition<T, ? extends Configuration> d, |
| | | ManagedObjectPath<T, ? extends Configuration> path, PropertySet properties, boolean existsOnServer, |
| | | PropertyDefinition<?> namingPropertyDefinition) { |
| | | PropertyDefinition<?> namingPropertyDefinition, PropertyDefinitionsOptions propertyDefOptions) { |
| | | this.definition = d; |
| | | this.path = path; |
| | | this.properties = properties; |
| | | this.existsOnServer = existsOnServer; |
| | | this.namingPropertyDefinition = namingPropertyDefinition; |
| | | this.propertyDefOptions = propertyDefOptions; |
| | | } |
| | | |
| | | /** |
| | |
| | | PropertyDefinition<?> pd = r.getNamingPropertyDefinition(); |
| | | if (pd != null) { |
| | | try { |
| | | pd.decodeValue(name); |
| | | pd.decodeValue(name, propertyDefOptions); |
| | | } catch (IllegalPropertyValueStringException e) { |
| | | throw new IllegalManagedObjectNameException(name, pd); |
| | | throw new IllegalManagedObjectNameException(name, pd, propertyDefOptions); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new PropertyIsReadOnlyException(pd); |
| | | } |
| | | |
| | | properties.setPropertyValues(pd, values); |
| | | properties.setPropertyValues(pd, values, propertyDefOptions); |
| | | |
| | | // If this is a naming property then update the name. |
| | | if (pd.equals(namingPropertyDefinition)) { |
| | |
| | | |
| | | // Set the naming property if there is one. |
| | | if (namingPropertyDefinition != null) { |
| | | P value = namingPropertyDefinition.decodeValue(name); |
| | | childProperties.setPropertyValues(namingPropertyDefinition, Collections.singleton(value)); |
| | | P value = namingPropertyDefinition.decodeValue(name, propertyDefOptions); |
| | | childProperties.setPropertyValues(namingPropertyDefinition, Collections.singleton(value), |
| | | propertyDefOptions); |
| | | } |
| | | |
| | | return newInstance(d, p, childProperties, false, namingPropertyDefinition); |