/** * Creates a new LessEqNode object. * * @param attribute the attribute name * @param value the value to test for * @throws LdapSchemaException If the AttributeType does not have an ORDERING MatchingRule */ public LessEqNode( String attribute, byte[] value ) throws LdapSchemaException { super( attribute, value, AssertionType.LESSEQ ); // Check if the AttributeType has an Ordering MR if ( ( attributeType != null ) && ( attributeType.getOrdering() == null ) ) { throw new LdapSchemaException( I18n.err( I18n.ERR_13301_NO_ORDERING_MR_FOR_AT, attributeType.getName() ) ); } }
/** * Remove an attributeType that has to be anonymized * * @param attributeType the AttributeType that we don't want to be anonymized */ public void removeAnonAttributeType( AttributeType attributeType ) { attributeAnonymizers.remove( attributeType.getOid() ); }
/** * {@inheritDoc} */ @Override public boolean isInstanceOf( AttributeType attributeType ) throws LdapInvalidAttributeValueException { return ( attributeType != null ) && ( this.attributeType.equals( attributeType ) || this.attributeType.isDescendantOf( attributeType ) ); }
/** * Checks to see if this AttributeType is the ancestor of another * attributeType. * * @param descendant the perspective descendant to check * @return true if the descendant is truly a derived from this AttributeType */ public boolean isAncestorOf( AttributeType descendant ) { if ( ( descendant == null ) || this.equals( descendant ) ) { return false; } return isAncestorOrEqual( this, descendant ); }
if ( !at0.getSuperiorOid().equals( at1.getSuperiorOid() ) ) if ( !at0.getEqualityOid().equals( at1.getEqualityOid() ) ) if ( !at0.getSubstringOid().equals( at1.getSubstringOid() ) ) if ( !at0.getOrderingOid().equals( at1.getOrderingOid() ) ) if ( !at0.getSyntaxOid().equals( at1.getSyntaxOid() ) ) if ( at0.getSyntaxLength() != at1.getSyntaxLength() ) if ( at0.isSingleValued() != at1.isSingleValued() ) if ( at0.isCollective() != at1.isCollective() ) if ( at0.isUserModifiable() != at1.isUserModifiable() ) if ( at0.getUsage() != at1.getUsage() )
private void initTables( SchemaManager schemaManager ) throws IOException { MatchingRule mr = attributeType.getEquality(); if ( mr == null ) { throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) ); } /* * The forward key/value map stores attribute values to master table * primary keys. A value for an attribute can occur several times in * different entries so the forward map can have more than one value. */ UuidComparator.INSTANCE.setSchemaManager( schemaManager ); DnSerializer dnSerializer = new DnSerializer(); String forwardTableName = attributeType.getOid() + FORWARD_BTREE; forward = new MavibotTable<Dn, String>( recordMan, schemaManager, forwardTableName, dnSerializer, StringSerializer.INSTANCE, true ); String reverseTableName = attributeType.getOid() + REVERSE_BTREE; reverse = new MavibotTable<String, Dn>( recordMan, schemaManager, reverseTableName, StringSerializer.INSTANCE, dnSerializer, !attributeType.isSingleValued() ); } }
/** * Initializes the forward and reverse tables used by this Index. * * @param schemaManager The server schemaManager * @throws IOException if we cannot initialize the forward and reverse * tables * @throws NamingException */ private void initTables( SchemaManager schemaManager ) throws IOException { MatchingRule mr = attributeType.getEquality(); if ( mr == null ) { throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) ); } MavibotParentIdAndRdnSerializer.setSchemaManager( schemaManager ); MavibotParentIdAndRdnSerializer parentIdAndSerializer = new MavibotParentIdAndRdnSerializer(); String forwardTableName = attributeType.getOid() + FORWARD_BTREE; forward = new MavibotTable<ParentIdAndRdn, String>( recordMan, schemaManager, forwardTableName, parentIdAndSerializer, StringSerializer.INSTANCE, false ); String reverseTableName = attributeType.getOid() + REVERSE_BTREE; reverse = new MavibotTable<String, ParentIdAndRdn>( recordMan, schemaManager, reverseTableName, StringSerializer.INSTANCE, parentIdAndSerializer, false ); } }
/** * {@inheritDoc} */ @Override public Object normalizeByName( AttributeType attributeType, String value ) throws LdapException { MatchingRule mrule = attributeType.getEquality(); Normalizer normalizer; if ( mrule == null ) { return new NoOpNormalizer( attributeType.getOid() ); } else { normalizer = attributeType.getEquality().getNormalizer(); } if ( attributeType.getSyntax().isHumanReadable() ) { return normalizer.normalize( value ); } else { String unescaped = unescape( value ); return normalizer.normalize( unescaped ); } }
this.reverse = reverse; if ( !at.isSingleValued() ) if ( SchemaConstants.ENTRY_DN_AT_OID.equals( at.getOid() ) ) hr = at.getSyntax().isHumanReadable(); MatchingRule mr = at.getOrdering(); mr = at.getEquality();
/** * {@inheritDoc} */ @Override public void addMappingFor( AttributeType attributeType ) throws LdapException { MatchingRule equality = attributeType.getEquality(); OidNormalizer oidNormalizer; String oid = attributeType.getOid(); if ( equality == null ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_13703_AT_WITHOUT_EQ_MR, attributeType.getName() ) ); } oidNormalizer = new OidNormalizer( oid, new NoOpNormalizer( attributeType.getOid() ) ); } else { oidNormalizer = new OidNormalizer( oid, equality.getNormalizer() ); } oidNormalizerMap.put( oid, oidNormalizer ); // Also inject the attributeType's short names in the map for ( String name : attributeType.getNames() ) { oidNormalizerMap.put( Strings.toLowerCaseAscii( name ), oidNormalizer ); } }
/** * Set the latest value map to a defined anonymizer - if it exists -. * * @param attributeType The AttributeType we are targetting * @param latestValueMap The latest value map for this attribute */ public void setAttributeLatestValueMap( AttributeType attributeType, Map<Integer, ?> latestValueMap ) { Anonymizer anonymizer = attributeAnonymizers.get( attributeType.getOid() ); if ( anonymizer != null ) { if ( attributeType.getSyntax().isHumanReadable() ) { anonymizer.setLatestStringMap( latestValueMap ); } else { anonymizer.setLatestBytesMap( latestValueMap ); } } }
AttributeType superior = attributeType.getSuperior(); if ( ( superior != null ) && ( attributeType.getUsage() != superior.getUsage() ) ) String msg = I18n.err( I18n.ERR_13762_AT_MUST_HAVE_SUPERIOR_USAGE, attributeType.getName() ); if ( !attributeType.isUserModifiable() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) ) String msg = I18n.err( I18n.ERR_13763_AT_MUST_BE_USER_MODIFIABLE, attributeType.getName() );
public boolean isValid( AttributeType attributeType ) throws LdapInvalidAttributeValueException LdapSyntax syntax = attributeType.getSyntax(); if ( ( attributeType.isSingleValued() ) && ( values.size() > 1 ) )
/** * Check if a syntax is used by an AT or a MR */ private List<SchemaObject> checkInUse( String oid ) { List<SchemaObject> dependees = new ArrayList<>(); for ( AttributeType attributeType : schemaManager.getAttributeTypeRegistry() ) { if ( oid.equals( attributeType.getSyntax().getOid() ) ) { dependees.add( attributeType ); } } for ( MatchingRule matchingRule : schemaManager.getMatchingRuleRegistry() ) { if ( oid.equals( matchingRule.getSyntax().getOid() ) ) { dependees.add( matchingRule ); } } return dependees; }
/** * Gets a comparator using getMatchingRule() to resolve the matching * that the comparator is extracted from. * * @return a comparator associated with the attributeType or null if one cannot be found */ private LdapComparator<?> getLdapComparator() { if ( attributeType != null ) { MatchingRule mr = attributeType.getEquality(); if ( mr != null ) { return mr.getLdapComparator(); } } return null; }
if ( ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) && allUserAttributes ) if ( ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS ) && allOperationalAttributes ) if ( attributeTypeOptions.getAttributeType().equals( attributeType ) || attributeTypeOptions.getAttributeType().isAncestorOf( attributeType ) )
/** * Sets the attributeType this leaf node is based on. * * @param attributeType the attributeType that is asserted by this filter node */ public void setAttributeType( AttributeType attributeType ) { this.attributeType = attributeType; if ( attributeType != null ) { attribute = attributeType.getName(); } }
/** * Check if the entry contains any collective AttributeType (those starting with 'c-') */ private boolean containsAnyCollectiveAttributes( Entry entry ) throws LdapException { for ( Attribute attribute : entry.getAttributes() ) { AttributeType attributeType = attribute.getAttributeType(); if ( attributeType.isCollective() ) { return true; } } return false; }
/** * @see Object#equals(Object) */ @Override public boolean equals( Object o ) { // Short circuit if ( this == o ) { return true; } if ( !( o instanceof AttributeTypeOptions ) ) { return false; } AttributeTypeOptions that = ( AttributeTypeOptions ) o; return attributeType.equals( that.attributeType ); }