001/* 002* CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008-2009 Sun Microsystems, Inc. 025 * Portions Copyright 2013-2014 ForgeRock AS. 026 */ 027package org.forgerock.opendj.server.core; 028 029import java.util.Set; 030 031import org.forgerock.opendj.ldap.DN; 032import org.forgerock.opendj.ldap.Entry; 033import org.forgerock.opendj.ldap.LdapException; 034import org.forgerock.opendj.ldap.RequestHandler; 035 036/** 037 * A connection to a data provider. When a connection is no longer needed it 038 * must be closed. 039 */ 040public interface DataProviderConnection extends RequestHandler<Operation> { 041 042 /** 043 * Closes this data provider connection. When this method returns the 044 * connection can no longer be used. 045 */ 046 void close(); 047 048 /** 049 * Indicates whether the underlying data provider contains the specified 050 * entry. 051 * 052 * @param dn 053 * The DN of the entry. 054 * @return {@code true} if the underlying data provider contains the 055 * specified entry, or {@code false} if it does not. 056 * @throws LdapException 057 * If a problem occurs while trying to make the determination, 058 * or if {@code dn} is not a DN equal to or subordinate to one 059 * of the base DNs managed by the underlying data provider. 060 */ 061 boolean containsEntry(DN dn) throws LdapException; 062 063 /** 064 * Deregisters an event listener from the underlying data provider. 065 * 066 * @param listener 067 * The event listener. 068 */ 069 void deregisterEventListener(DataProviderEventListener listener); 070 071 /** 072 * Returns an unmodifiable set containing the base DNs of the sub-trees 073 * which the underlying data provider contains. 074 * 075 * @return An unmodifiable set containing the base DNs of the sub-trees 076 * which the underlying data provider contains. 077 */ 078 Set<DN> getBaseDNs(); 079 080 /** 081 * Retrieves the specified entry from the underlying data provider. 082 * 083 * @param dn 084 * The DN of the entry. 085 * @return The requested entry, or {@code null} if the underlying data 086 * provider does not contain the specified entry. 087 * @throws LdapException 088 * If a problem occurs while trying to retrieve the entry, or if 089 * {@code dn} is not a DN equal to or subordinate to one of the 090 * base DNs managed by the underlying data provider. 091 */ 092 Entry getEntry(DN dn) throws LdapException; 093 094 /** 095 * Returns the current status of the provided base DN in the underlying data 096 * provider. 097 * 098 * @param baseDN 099 * The base DN in the underlying data provider. 100 * @return The current status of the provided base DN in the underlying data 101 * provider. 102 * @throws LdapException 103 * If {@code baseDN} is not one of the base DNs managed by the 104 * underlying data provider. 105 */ 106 DataProviderStatus getStatus(DN baseDN) throws LdapException; 107 108 /** 109 * Returns an unmodifiable set containing the OIDs of the controls that may 110 * be supported by the provided base DN in the underlying data provider. 111 * 112 * @param baseDN 113 * The base DN in the underlying data provider. 114 * @return An unmodifiable set containing the OIDs of the controls that may 115 * be supported by the provided base DN in the underlying data 116 * provider. 117 * @throws LdapException 118 * If {@code baseDN} is not one of the base DNs managed by the 119 * underlying data provider. 120 */ 121 Set<String> getSupportedControls(DN baseDN) throws LdapException; 122 123 /** 124 * Returns an unmodifiable set containing the OIDs of the features that may 125 * be supported by the provided base DN in the underlying data provider. 126 * 127 * @param baseDN 128 * The base DN in the underlying data provider. 129 * @return An unmodifiable set containing the OIDs of the features that may 130 * be supported by the provided base DN in the underlying data 131 * provider. 132 * @throws LdapException 133 * If {@code baseDN} is not one of the base DNs managed by the 134 * underlying data provider. 135 */ 136 Set<String> getSupportedFeatures(DN baseDN) throws LdapException; 137 138 /** 139 * Registers an event listener with the underlying data provider. 140 * 141 * @param listener 142 * The event listener. 143 */ 144 void registerEventListener(DataProviderEventListener listener); 145 146 /** 147 * Indicates whether or not the provided base DN in the underlying data 148 * provider supports change notification. 149 * 150 * @param baseDN 151 * The base DN in the underlying data provider. 152 * @return {@code true} if the provided base DN in the underlying data 153 * provider supports change notification. 154 * @throws LdapException 155 * If {@code baseDN} is not one of the base DNs managed by the 156 * underlying data provider. 157 */ 158 boolean supportsChangeNotification(DN baseDN) throws LdapException; 159}