DirectoryServer.java: getAttributeTypeOrDefault(String lowerName, String upperName, Syntax) => getAttributeType(String nameOrOid, Syntax)
| | |
| | | // Remove the 'get' from the method name and add the prefix. |
| | | String attrName = attrPrefix + method.getName().substring(3); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName, attrName, integerSyntax); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName, integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String.valueOf(method.invoke(stats)))); |
| | | } |
| | | catch (Exception e) |
| | |
| | | public void putConfigAttribute(ConfigAttribute attribute) |
| | | { |
| | | String name = attribute.getName(); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault( |
| | | name.toLowerCase(), name, attribute.getSyntax()); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(name, attribute.getSyntax()); |
| | | |
| | | List<Attribute> attrs = new ArrayList<>(2); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType, name); |
| | |
| | | */ |
| | | public static AttributeType getAttributeTypeOrDefault(String lowerName) |
| | | { |
| | | return getAttributeTypeOrDefault(lowerName, lowerName, getDefaultAttributeSyntax()); |
| | | return getAttributeType(lowerName, getDefaultAttributeSyntax()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName) |
| | | { |
| | | return getAttributeTypeOrDefault(lowerName, upperName, getDefaultAttributeSyntax()); |
| | | return getAttributeType(upperName, getDefaultAttributeSyntax()); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the attribute type for the provided lowercase name or OID. It will return a generated |
| | | * "default" version with the uppercase name or OID if the requested attribute type is not defined |
| | | * in the schema. |
| | | * Retrieves the attribute type for the provided name or OID. It will return a generated |
| | | * placeholder version with the name or OID if the requested attribute type is not defined in the |
| | | * schema. |
| | | * |
| | | * @param lowerName |
| | | * The lowercase name or OID for the attribute type to retrieve. |
| | | * @param upperName |
| | | * The uppercase name or OID for the attribute type to generate. |
| | | * @param nameOrOid |
| | | * The name or OID for the attribute type to look for. |
| | | * @param syntax |
| | | * The syntax for the attribute type to generate. |
| | | * @return The requested attribute type, or a generated "default" version if there is no attribute |
| | | * with the specified type defined in the server schema |
| | | * @return The requested attribute type, or a generated placeholder version if there is no |
| | | * attribute with the specified type defined in the server schema |
| | | */ |
| | | public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName, Syntax syntax) |
| | | public static AttributeType getAttributeType(String nameOrOid, Syntax syntax) |
| | | { |
| | | return directoryServer.schema.getAttributeType(upperName, syntax); |
| | | return directoryServer.schema.getAttributeType(nameOrOid, syntax); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | private Attribute attr(String name, Syntax syntax, Object value) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name, name, syntax); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(name, syntax); |
| | | return Attributes.create(attrType, String.valueOf(value)); |
| | | } |
| | | |
| | |
| | | |
| | | private void putAttribute(ArrayList<Attribute> monitorAttrs, String attrName, Object value) |
| | | { |
| | | AttributeType attrType = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax()); |
| | | AttributeType attrType = getAttributeType(attrName, getDefaultIntegerSyntax()); |
| | | monitorAttrs.add(Attributes.create(attrType, String.valueOf(value))); |
| | | } |
| | | } |
| | |
| | | |
| | | private void putAttribute(ArrayList<Attribute> monitorAttrs, String attrName, Object value) |
| | | { |
| | | AttributeType attrType = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax()); |
| | | AttributeType attrType = getAttributeType(attrName, getDefaultIntegerSyntax()); |
| | | monitorAttrs.add(Attributes.create(attrType, String.valueOf(value))); |
| | | } |
| | | } |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | String attrName = "x-test-integer-type"; |
| | | AttributeType dummy = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax()); |
| | | AttributeType dummy = getAttributeType(attrName, getDefaultIntegerSyntax()); |
| | | DirectoryServer.getSchema().registerAttributeType(dummy, true); |
| | | } |
| | | |
| | |
| | | AT_CN = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | |
| | | String attrName = "x-test-integer-type"; |
| | | AttributeType dummy = getAttributeTypeOrDefault(attrName, attrName, getDefaultIntegerSyntax()); |
| | | AttributeType dummy = getAttributeType(attrName, getDefaultIntegerSyntax()); |
| | | DirectoryServer.getSchema().registerAttributeType(dummy, true); |
| | | |
| | | AV_DC_ORG = ByteString.valueOfUtf8("org"); |