OPENDJ-3089 Remove DirectoryServerContext.getSchemaNG() method and uses in classes
| | |
| | | public static SchemaElement updateSchemaElementExtraPropertyMultiplesValues(ServerContext serverContext, |
| | | SchemaElement element, String property, List<String> values) |
| | | { |
| | | org.forgerock.opendj.ldap.schema.Schema schemaNG = serverContext != null ? |
| | | serverContext.getSchemaNG() : org.forgerock.opendj.ldap.schema.Schema.getDefaultSchema(); |
| | | SchemaBuilder schemaBuilder = new SchemaBuilder(schemaNG); |
| | | org.forgerock.opendj.ldap.schema.Schema schema = serverContext != null ? |
| | | serverContext.getSchema() : org.forgerock.opendj.ldap.schema.Schema.getDefaultSchema(); |
| | | SchemaBuilder schemaBuilder = new SchemaBuilder(schema); |
| | | if (element instanceof AttributeType) |
| | | { |
| | | AttributeType attr = (AttributeType) element; |
| | |
| | | |
| | | /** Schema used to build the compressed information. */ |
| | | @GuardedBy("lock") |
| | | private Schema schemaNG; |
| | | private Schema schema; |
| | | @GuardedBy("lock") |
| | | private Mappings mappings = new Mappings(); |
| | | |
| | |
| | | boolean shared = true; |
| | | try |
| | | { |
| | | Schema currentSchema = serverContext.getSchemaNG(); |
| | | if (schemaNG != currentSchema) |
| | | Schema currentSchema = serverContext.getSchema(); |
| | | if (schema != currentSchema) |
| | | { |
| | | sharedLock.unlock(); |
| | | exclusiveLock.lock(); |
| | | shared = false; |
| | | |
| | | currentSchema = serverContext.getSchemaNG(); |
| | | if (schemaNG != currentSchema) |
| | | currentSchema = serverContext.getSchema(); |
| | | if (schema != currentSchema) |
| | | { |
| | | // build new maps from existing ones |
| | | Mappings newMappings = new Mappings(mappings.adEncodeMap.size(), mappings.ocEncodeMap.size()); |
| | |
| | | reloadObjectClassesMap(mappings, newMappings); |
| | | |
| | | mappings = newMappings; |
| | | schemaNG = currentSchema; |
| | | schema = currentSchema; |
| | | } |
| | | } |
| | | return mappings; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public org.forgerock.opendj.ldap.schema.Schema getSchemaNG() |
| | | { |
| | | return directoryServer.schemaHandler.getSchema(); |
| | | } |
| | | |
| | | @Override |
| | | public SchemaHandler getSchemaHandler() |
| | | { |
| | | return directoryServer.schemaHandler; |
| | |
| | | |
| | | /** |
| | | * Returns the schema of the server. |
| | | * <p> |
| | | * The schema is immutable. Any change on the schema must be done using a {@code SchemaHandler} |
| | | * which is available through the {@code getSchemaHandler()} method. |
| | | * |
| | | * @return the schema |
| | | */ |
| | | Schema getSchema(); |
| | | |
| | | /** |
| | | * Returns the new schema of the server (SDK schema). |
| | | * <p> |
| | | * This method will disappear once migration to new schema |
| | | * is finished. Meanwhile, it is necessary to keep both the |
| | | * legacy version and the new version. |
| | | * |
| | | * @return the new version of the schema |
| | | */ |
| | | org.forgerock.opendj.ldap.schema.Schema getSchemaNG(); |
| | | |
| | | /** |
| | | * Returns the schema handler, which provides schema management. |
| | | * Returns the schema handler, which provides operations to the schema. |
| | | * |
| | | * @return the schema handler |
| | | */ |
| | |
| | | */ |
| | | public DN toDn(ServerContext serverContext) |
| | | { |
| | | return DN.valueOf(toString(), serverContext.getSchemaNG()); |
| | | return DN.valueOf(toString(), serverContext.getSchema()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | "no_realm", config.getRequiredScope(), resolver, "u:{" + config.getAuthzidJsonPointer()+"}"); |
| | | this.delegate = newConditionalFilter( |
| | | chainOf(oauth2Filter.getFilter(), new InternalProxyAuthzFilter(getIdentityMapper(config.getIdentityMapperDN()), |
| | | serverContext.getSchemaNG())), |
| | | serverContext.getSchema())), |
| | | oauth2Filter.getCondition()); |
| | | } |
| | | |
| | |
| | | String property, String...values) |
| | | { |
| | | SchemaBuilder schemaBuilder = |
| | | new SchemaBuilder(serverContext != null ? serverContext.getSchemaNG() : Schema.getDefaultSchema()); |
| | | new SchemaBuilder(serverContext != null ? serverContext.getSchema() : Schema.getDefaultSchema()); |
| | | AttributeType.Builder builder = |
| | | schemaBuilder.buildAttributeType(attributeType).removeExtraProperty(property, (String) null); |
| | | if (values != null && values.length > 0) |
| | |
| | | public ServerContextBuilder schema(Schema schema) |
| | | { |
| | | when(serverContext.getSchema()).thenReturn(schema); |
| | | when(serverContext.getSchemaNG()).thenReturn(schema); |
| | | return this; |
| | | } |
| | | |
| | |
| | | { |
| | | when(serverContext.getSchemaHandler()).thenReturn(handler); |
| | | when(serverContext.getSchema()).thenReturn(handler.getSchema()); |
| | | when(serverContext.getSchemaNG()).thenReturn(handler.getSchema()); |
| | | return this; |
| | | } |
| | | |