| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | |
| | | @Override |
| | | public DITContentRule getDITContentRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(name)); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public DITStructureRule getDITStructureRule(final int ruleID) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | throw new UnknownSchemaElementException(WARN_DSR_UNKNOWN.get(String |
| | | .valueOf(ruleID))); |
| | |
| | | |
| | | @Override |
| | | public MatchingRule getMatchingRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(name)); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public MatchingRuleUse getMatchingRuleUse(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(name)); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public NameForm getNameForm(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(name)); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public ObjectClass getObjectClass(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | throw new UnknownSchemaElementException( |
| | | WARN_OBJECTCLASS_UNKNOWN.get(name)); |
| | |
| | | |
| | | private static interface Impl |
| | | { |
| | | AttributeType getAttributeType(String name) |
| | | throws UnknownSchemaElementException; |
| | | AttributeType getAttributeType(String name); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | DITContentRule getDITContentRule(String name) |
| | | throws UnknownSchemaElementException; |
| | | DITContentRule getDITContentRule(String name); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | DITStructureRule getDITStructureRule(int ruleID) |
| | | throws UnknownSchemaElementException; |
| | | DITStructureRule getDITStructureRule(int ruleID); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | MatchingRule getMatchingRule(String name) |
| | | throws UnknownSchemaElementException; |
| | | MatchingRule getMatchingRule(String name); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | MatchingRuleUse getMatchingRuleUse(String name) |
| | | throws UnknownSchemaElementException; |
| | | MatchingRuleUse getMatchingRuleUse(String name); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | NameForm getNameForm(String name) throws UnknownSchemaElementException; |
| | | NameForm getNameForm(String name); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | ObjectClass getObjectClass(String name) |
| | | throws UnknownSchemaElementException; |
| | | ObjectClass getObjectClass(String name); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | Syntax getSyntax(String numericOID) throws UnknownSchemaElementException; |
| | | Syntax getSyntax(String numericOID); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | @Override |
| | | public AttributeType getAttributeType(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | if (!strictImpl.hasAttributeType(name)) |
| | | { |
| | |
| | | |
| | | @Override |
| | | public DITContentRule getDITContentRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return strictImpl.getDITContentRule(name); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public DITStructureRule getDITStructureRule(final int ruleID) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return strictImpl.getDITStructureRule(ruleID); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public MatchingRule getMatchingRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return strictImpl.getMatchingRule(name); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public MatchingRuleUse getMatchingRuleUse(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return strictImpl.getMatchingRuleUse(name); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public NameForm getNameForm(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return strictImpl.getNameForm(name); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public ObjectClass getObjectClass(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return strictImpl.getObjectClass(name); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public AttributeType getAttributeType(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final AttributeType type = numericOID2AttributeTypes.get(name); |
| | | if (type != null) |
| | |
| | | |
| | | @Override |
| | | public DITContentRule getDITContentRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final DITContentRule rule = numericOID2ContentRules.get(name); |
| | | if (rule != null) |
| | |
| | | |
| | | @Override |
| | | public DITStructureRule getDITStructureRule(final int ruleID) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final DITStructureRule rule = id2StructureRules.get(ruleID); |
| | | if (rule == null) |
| | |
| | | |
| | | @Override |
| | | public MatchingRule getMatchingRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final MatchingRule rule = numericOID2MatchingRules.get(name); |
| | | if (rule != null) |
| | |
| | | |
| | | @Override |
| | | public MatchingRuleUse getMatchingRuleUse(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final MatchingRuleUse rule = numericOID2MatchingRuleUses.get(name); |
| | | if (rule != null) |
| | |
| | | |
| | | @Override |
| | | public NameForm getNameForm(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final NameForm form = numericOID2NameForms.get(name); |
| | | if (form != null) |
| | |
| | | |
| | | @Override |
| | | public ObjectClass getObjectClass(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final ObjectClass oc = numericOID2ObjectClasses.get(name); |
| | | if (oc != null) |
| | |
| | | |
| | | @Override |
| | | public Syntax getSyntax(final String numericOID) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | final Syntax syntax = numericOID2Syntaxes.get(numericOID); |
| | | if (syntax == null) |
| | |
| | | public static FutureResult<Schema> readSchemaAsync( |
| | | final Connection connection, final DN name, |
| | | final ResultHandler<? super Schema> handler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | final FutureResultTransformer<SchemaBuilder, Schema> future = |
| | | new FutureResultTransformer<SchemaBuilder, Schema>(handler) |
| | |
| | | * If the {@code connection} or {@code name} was {@code null}. |
| | | */ |
| | | public static Schema readSchema(final Connection connection, final DN name) |
| | | throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | throws ErrorResultException, InterruptedException |
| | | { |
| | | return new SchemaBuilder().addSchema(connection, name, true).toSchema(); |
| | | } |
| | |
| | | public static FutureResult<Schema> readSchemaForEntryAsync( |
| | | final Connection connection, final DN name, |
| | | final ResultHandler<? super Schema> handler) |
| | | throws UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | { |
| | | final FutureResultTransformer<SchemaBuilder, Schema> future = |
| | | new FutureResultTransformer<SchemaBuilder, Schema>(handler) |
| | |
| | | * If the {@code connection} or {@code name} was {@code null}. |
| | | */ |
| | | public static Schema readSchemaForEntry(final Connection connection, |
| | | final DN name) throws ErrorResultException, InterruptedException, |
| | | UnsupportedOperationException, IllegalStateException, |
| | | NullPointerException |
| | | final DN name) throws ErrorResultException, InterruptedException |
| | | { |
| | | return new SchemaBuilder().addSchemaForEntry(connection, name, true) |
| | | .toSchema(); |
| | |
| | | * not found or if the provided name is ambiguous. |
| | | */ |
| | | public AttributeType getAttributeType(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getAttributeType(name); |
| | | } |
| | |
| | | * not found or if the provided name is ambiguous. |
| | | */ |
| | | public DITContentRule getDITContentRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getDITContentRule(name); |
| | | } |
| | |
| | | * was not found. |
| | | */ |
| | | public DITStructureRule getDITStructureRule(final int ruleID) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getDITStructureRule(ruleID); |
| | | } |
| | |
| | | * not found or if the provided name is ambiguous. |
| | | */ |
| | | public MatchingRule getMatchingRule(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getMatchingRule(name); |
| | | } |
| | |
| | | * was not found or if the provided name is ambiguous. |
| | | */ |
| | | public MatchingRuleUse getMatchingRuleUse(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getMatchingRuleUse(name); |
| | | } |
| | |
| | | * found or if the provided name is ambiguous. |
| | | */ |
| | | public NameForm getNameForm(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getNameForm(name); |
| | | } |
| | |
| | | * found or if the provided name is ambiguous. |
| | | */ |
| | | public ObjectClass getObjectClass(final String name) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getObjectClass(name); |
| | | } |
| | |
| | | * or if the provided name is ambiguous. |
| | | */ |
| | | public Syntax getSyntax(final String numericOID) |
| | | throws UnknownSchemaElementException |
| | | { |
| | | return impl.getSyntax(numericOID); |
| | | } |
| | |
| | | * @throws NullPointerException |
| | | * If {@code entry} was {@code null}. |
| | | */ |
| | | public Entry toEntry(final Entry entry) throws NullPointerException |
| | | public Entry toEntry(final Entry entry) |
| | | { |
| | | Attribute attr = new LinkedAttribute(Schema.ATTR_LDAP_SYNTAXES); |
| | | for (final Syntax syntax : getSyntaxes()) |