| | |
| | | import org.forgerock.opendj.config.AttributeTypePropertyDefinition; |
| | | import org.forgerock.opendj.config.BooleanPropertyDefinition; |
| | | import org.forgerock.opendj.config.ClassPropertyDefinition; |
| | | import org.forgerock.opendj.config.Configuration; |
| | | import org.forgerock.opendj.config.ConfigurationClient; |
| | | import org.forgerock.opendj.config.ConfigurationFramework; |
| | | import org.forgerock.opendj.config.DNPropertyDefinition; |
| | | import org.forgerock.opendj.config.DefaultBehaviorProvider; |
| | |
| | | return rd.getChildDefinition(); |
| | | } |
| | | |
| | | private boolean isHidden(RelationDefinition defn) { |
| | | private boolean isHidden(RelationDefinition<?, ?> defn) { |
| | | return defn == null || defn.hasOption(RelationOption.HIDDEN); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String visitAggregation(AggregationPropertyDefinition prop, Void p) { |
| | | public <C extends ConfigurationClient, S extends Configuration> String visitAggregation( |
| | | AggregationPropertyDefinition<C, S> prop, Void p) { |
| | | b.append(op); |
| | | final RelationDefinition<?, ?> rel = prop.getRelationDefinition(); |
| | | if (isHidden(rel)) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String visitEnum(EnumPropertyDefinition prop, Void p) { |
| | | public <E extends Enum<E>> String visitEnum(EnumPropertyDefinition<E> prop, Void p) { |
| | | b.append("<variablelist>").append(EOL); |
| | | final Class<?> en = prop.getEnumClass(); |
| | | final Object[] constants = en.getEnumConstants(); |
| | | for (Object enumConstant : constants) { |
| | | final LocalizableMessage valueSynopsis = prop.getValueSynopsis((Enum) enumConstant); |
| | | final LocalizableMessage valueSynopsis = prop.getValueSynopsis((E) enumConstant); |
| | | appendVarListEntry(b, enumConstant.toString(), op + valueSynopsis + cp); |
| | | } |
| | | b.append("</variablelist>").append(EOL); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String visitUnknown(PropertyDefinition prop, Void p) { |
| | | public <T> String visitUnknown(PropertyDefinition<T> prop, Void p) { |
| | | b.append(op).append(REF_DSCFG_UNKNOWN.get()).append(cp).append(EOL); |
| | | return null; |
| | | } |
| | |
| | | |
| | | Note: waiting on https://jira.codehaus.org/browse/MCLIRR-62 to be resolved to avoid the need to use \s* in the '<to>' tags. |
| | | --> |
| | | <difference> |
| | | <className>org/forgerock/opendj/ldap/Connections</className> |
| | | <differenceType>7002</differenceType> |
| | | <method>org.forgerock.opendj.ldap.ConnectionFactory newLoadBalancer(org.forgerock.opendj.ldap.LoadBalancingAlgorithm)</method> |
| | | <justification>OPENDJ-2878 Implement sharded request load-balancer</justification> |
| | | </difference> |
| | | <difference> |
| | | <className>org/forgerock/opendj/ldap/LoadBalancingAlgorithm</className> |
| | | <differenceType>8001</differenceType> |
| | | <justification>OPENDJ-2878 Implement sharded request load-balancer</justification> |
| | | </difference> |
| | | <difference> |
| | | <className>org/forgerock/opendj/ldap/LdapPromise</className> |
| | | <differenceType>7012</differenceType> |
| | | <method>org.forgerock.opendj.ldap.LdapPromise thenFinally(java.lang.Runnable)</method> |
| | | <justification>Consequence of COMMONs-5 Promise API improvements</justification> |
| | | </difference> |
| | | <difference> |
| | | <className>org/forgerock/opendj/ldap/RootDSE</className> |
| | | <differenceType>7004</differenceType> |
| | | <method>org.forgerock.opendj.ldap.LdapPromise readRootDSEAsync(org.forgerock.opendj.ldap.Connection, org.forgerock.opendj.ldap.LdapResultHandler)</method> |
| | | <justification>Code cleanup: remove unused LdapResultHandler parameter</justification> |
| | | </difference> |
| | | <difference> |
| | | <className>org/forgerock/opendj/ldap/spi/LdapPromises</className> |
| | | <differenceType>7004</differenceType> |
| | | <method>org.forgerock.opendj.ldap.spi.BindResultLdapPromiseImpl newBindLdapPromise(int, org.forgerock.opendj.ldap.requests.BindRequest, org.forgerock.opendj.ldap.requests.BindClient, org.forgerock.opendj.ldap.IntermediateResponseHandler, org.forgerock.opendj.ldap.Connection)</method> |
| | | <justification>Code cleanup: remove unused Connection parameter</justification> |
| | | </difference> |
| | | <difference> |
| | | <className>org/forgerock/opendj/ldap/spi/LdapPromises</className> |
| | | <differenceType>7002</differenceType> |
| | | <method>org.forgerock.opendj.ldap.spi.BindResultLdapPromiseImpl newBindLdapPromise(int, org.forgerock.opendj.ldap.requests.BindRequest, org.forgerock.opendj.ldap.requests.BindClient, org.forgerock.opendj.ldap.IntermediateResponseHandler, org.forgerock.opendj.ldap.spi.LDAPConnectionImpl)</method> |
| | | <justification>Code cleanup: remove overloaded method with unused parameter</justification> |
| | | </difference> |
| | | </differences> |
| | |
| | | <comparisonArtifacts> |
| | | <comparisonArtifact> |
| | | <groupId>${project.groupId}</groupId> |
| | | <artifactId>opendj-ldap-sdk</artifactId> |
| | | <!-- former name of this jar --> |
| | | <artifactId>opendj-core</artifactId> |
| | | <version>3.0.0</version> |
| | | </comparisonArtifact> |
| | | </comparisonArtifacts> |
| | |
| | | |
| | | /** |
| | | * Converts from OpenDJ server |
| | | * {@link org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.Scope} to OpenDJ LDAP SDK |
| | | * {@link org.forgerock.opendj.ldap.SearchScope}. |
| | | * {@link org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope} |
| | | * to OpenDJ LDAP SDK {@link org.forgerock.opendj.ldap.SearchScope}. |
| | | * |
| | | * @param srvScope |
| | | * The server scope value. |
| | |
| | | * must be called after parsing the arguments. |
| | | * @return the timeout to be used to connect in milliseconds. Returns |
| | | * {@code 0} if there is no timeout. |
| | | * @throw {@code IllegalStateException} if the method is called before |
| | | * @throws IllegalStateException if the method is called before |
| | | * parsing the arguments. |
| | | */ |
| | | public int getConnectTimeout() |
| | | public int getConnectTimeout() throws IllegalStateException |
| | | { |
| | | try |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import java.util.Collections; |
| | |
| | | import org.opends.server.types.ObjectClass; |
| | | |
| | | /** |
| | | * This is the event sent to notify the changes made in the superiors of a given |
| | | * object class. It is used mainly by the |
| | | * {@link |
| | | * org.opends.guitools.controlpanel.components.SuperiorObjectClassesEditor} |
| | | * class. It is linked to the {@link SuperiorObjectClassesChangedListener} |
| | | * interface. |
| | | * |
| | | * This is the event sent to notify the changes made in the superiors of a given object class. It is |
| | | * used mainly by the |
| | | * {@link org.opends.guitools.controlpanel.ui.components.SuperiorObjectClassesEditor} class. It is |
| | | * linked to the {@link SuperiorObjectClassesChangedListener} interface. |
| | | */ |
| | | public class SuperiorObjectClassesChangedEvent |
| | | { |
| | |
| | | * @param source the source of the event. |
| | | * @param newObjectClasses the set of new superior object classes. |
| | | */ |
| | | public SuperiorObjectClassesChangedEvent(Object source, |
| | | Set<ObjectClass> newObjectClasses) |
| | | public SuperiorObjectClassesChangedEvent(Object source, Set<ObjectClass> newObjectClasses) |
| | | { |
| | | this.source = source; |
| | | this.newObjectClasses.addAll(newObjectClasses); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * This is the listener that receives events about the changes made in the |
| | | * superiors of a given object class. It is used mainly by the |
| | | * {@link |
| | | * org.opends.guitools.controlpanel.components.SuperiorObjectClassesEditor} |
| | | * class. |
| | | * |
| | | * This is the listener that receives events about the changes made in the superiors of a given |
| | | * object class. It is used mainly by the |
| | | * {@link org.opends.guitools.controlpanel.ui.components.SuperiorObjectClassesEditor} class. |
| | | */ |
| | | public interface SuperiorObjectClassesChangedListener |
| | | { |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2015 ForgeRock AS. |
| | | * Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | |
| | | * Actions taken before and after the restore should be handled in the {@code beforeRestore()} and |
| | | * {@link #afterRestore(Path, Path)} methods. |
| | | * |
| | | * @see {@link BackupManager} |
| | | * @see org.opends.server.util.BackupManager |
| | | */ |
| | | public interface Backupable |
| | | { |
| | |
| | | |
| | | /** |
| | | * Creates a record with the provided key and value in the tree identified by the provided name. At the end of this |
| | | * method, the record is visible by {@link read(TreeName, ByteSequence)} and {@link openCursor(TreeName)} methods of |
| | | * method, the record is visible by {@link #read(TreeName, ByteSequence)} and {@link #openCursor(TreeName)} methods of |
| | | * this instance. The record is guaranteed to be persisted only after {@link #close()}. |
| | | * |
| | | * @param treeName |
| | |
| | | |
| | | /** |
| | | * Opens a cursor on the tree whose name is provided. Cursors are predictable only if there is no pending |
| | | * {@link put(TreeName, ByteSequence, ByteSequence)} operations. Indeed, once opened, cursors might not reflect |
| | | * {@link #put(TreeName, ByteSequence, ByteSequence)} operations. Indeed, once opened, cursors might not reflect |
| | | * changes. |
| | | * |
| | | * @param treeName |
| | |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.util.Utils; |
| | | import org.forgerock.opendj.config.ClassPropertyDefinition; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.meta.AccountStatusNotificationHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.AccountStatusNotificationHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.api.AccountStatusNotificationHandler; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | /** |
| | |
| | | ConfigurationDeleteListener <AccountStatusNotificationHandlerCfg> |
| | | { |
| | | /** A mapping between the DNs of the config entries and the associated notification handlers. */ |
| | | private final ConcurrentHashMap<DN,AccountStatusNotificationHandler> notificationHandlers; |
| | | private final ConcurrentHashMap<DN, AccountStatusNotificationHandler<?>> notificationHandlers; |
| | | |
| | | private final ServerContext serverContext; |
| | | |
| | |
| | | |
| | | // Get the configuration entry DN and the associated handler class. |
| | | DN configEntryDN = configuration.dn(); |
| | | AccountStatusNotificationHandler handler = notificationHandlers.get(configEntryDN); |
| | | AccountStatusNotificationHandler<?> handler = notificationHandlers.get(configEntryDN); |
| | | |
| | | // If the new configuration has the notification handler disabled, |
| | | // then remove it from the mapping list and clean it. |
| | |
| | | * @param configEntryDN the DN of the configuration entry associated to |
| | | * the notification handler to remove |
| | | */ |
| | | private void uninstallNotificationHandler( |
| | | DN configEntryDN |
| | | ) |
| | | private void uninstallNotificationHandler(DN configEntryDN) |
| | | { |
| | | AccountStatusNotificationHandler handler = |
| | | notificationHandlers.remove (configEntryDN); |
| | | AccountStatusNotificationHandler<?> handler = notificationHandlers.remove(configEntryDN); |
| | | if (handler != null) |
| | | { |
| | | DirectoryServer.deregisterAccountStatusNotificationHandler ( |
| | | configEntryDN |
| | | ); |
| | | DirectoryServer.deregisterAccountStatusNotificationHandler(configEntryDN); |
| | | handler.finalizeStatusNotificationHandler(); |
| | | } |
| | | } |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.util.Utils; |
| | | import org.forgerock.opendj.config.ClassPropertyDefinition; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.server.config.meta.CertificateMapperCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.CertificateMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | /** |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** A mapping between the DNs of the config entries and the associated certificate mappers. */ |
| | | private ConcurrentHashMap<DN,CertificateMapper> certificateMappers; |
| | | private ConcurrentHashMap<DN, CertificateMapper<?>> certificateMappers; |
| | | |
| | | private final ServerContext serverContext; |
| | | |
| | |
| | | String className = mapperConfiguration.getJavaClass(); |
| | | try |
| | | { |
| | | CertificateMapper mapper = loadMapper(className, mapperConfiguration, |
| | | true); |
| | | CertificateMapper<?> mapper = loadMapper(className, mapperConfiguration, true); |
| | | certificateMappers.put(mapperConfiguration.dn(), mapper); |
| | | DirectoryServer.registerCertificateMapper(mapperConfiguration.dn(), mapper); |
| | | } |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | CertificateMapper certificateMapper = null; |
| | | CertificateMapper<?> certificateMapper = null; |
| | | |
| | | // Get the name of the class and make sure we can instantiate it as a |
| | | // certificate mapper. |
| | |
| | | |
| | | DirectoryServer.deregisterCertificateMapper(configuration.dn()); |
| | | |
| | | CertificateMapper certificateMapper = |
| | | certificateMappers.remove(configuration.dn()); |
| | | CertificateMapper<?> certificateMapper = certificateMappers.remove(configuration.dn()); |
| | | if (certificateMapper != null) |
| | | { |
| | | certificateMapper.finalizeCertificateMapper(); |
| | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | // Get the existing mapper if it's already enabled. |
| | | CertificateMapper existingMapper = |
| | | certificateMappers.get(configuration.dn()); |
| | | CertificateMapper<?> existingMapper = certificateMappers.get(configuration.dn()); |
| | | |
| | | // If the new configuration has the mapper disabled, then disable it if it |
| | | // is enabled, or do nothing if it's already disabled. |
| | |
| | | { |
| | | DirectoryServer.deregisterCertificateMapper(configuration.dn()); |
| | | |
| | | CertificateMapper certificateMapper = |
| | | certificateMappers.remove(configuration.dn()); |
| | | CertificateMapper<?> certificateMapper = certificateMappers.remove(configuration.dn()); |
| | | if (certificateMapper != null) |
| | | { |
| | | certificateMapper.finalizeCertificateMapper(); |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | CertificateMapper certificateMapper = null; |
| | | CertificateMapper<?> certificateMapper = null; |
| | | try |
| | | { |
| | | certificateMapper = loadMapper(className, configuration, true); |
| | |
| | | * @throws InitializationException If a problem occurred while attempting to |
| | | * initialize the certificate mapper. |
| | | */ |
| | | private CertificateMapper loadMapper(String className, |
| | | private CertificateMapper<?> loadMapper(String className, |
| | | CertificateMapperCfg configuration, |
| | | boolean initialize) |
| | | throws InitializationException |
| | |
| | | |
| | | try |
| | | { |
| | | directoryServer.initializePlugins(Collections.EMPTY_SET); |
| | | directoryServer.initializePlugins(Collections.<PluginType> emptySet()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | import org.forgerock.services.context.AbstractContext; |
| | | import org.forgerock.services.context.Context; |
| | | |
| | | /** Context provided by this LDAP server to the embedded {@link HttpApplication}s. */ |
| | | /** Context provided by this LDAP server to the embedded {@link org.forgerock.http.HttpApplication}s. */ |
| | | public final class LDAPContext extends AbstractContext |
| | | { |
| | | private final ConnectionFactory ldapConnectionFactory; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Get the {@link LDAPConnectionFactory} attached to this context. |
| | | * Get the {@link org.forgerock.opendj.ldap.LDAPConnectionFactory} attached to this context. |
| | | * |
| | | * @return The {@link LDAPConnectionFactory} attached to this context. |
| | | * @return The {@link org.forgerock.opendj.ldap.LDAPConnectionFactory} attached to this context. |
| | | */ |
| | | public ConnectionFactory getLdapConnectionFactory() |
| | | { |
| | |
| | | * <li>Across all replicaDBs of a domain, provided a {@link ServerState}</li> |
| | | * <li>On one replica DB for a domain and serverId, provided a CSN</li> |
| | | * </ul> |
| | | * The cursor starting point is specified by providing a key, a {@link KeyMatchingStrategy} and |
| | | * a {@link PositionStrategy}. |
| | | * The cursor starting point is specified by providing a key, |
| | | * a {@link org.opends.server.replication.server.changelog.api.DBCursor.KeyMatchingStrategy} and |
| | | * a {@link org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy}. |
| | | */ |
| | | public interface ReplicationDomainDB |
| | | { |
| | |
| | | /** |
| | | * Decodes the provided authentication password value into its component parts. |
| | | * <p> |
| | | * FIXME this is a duplicate of {@link org.forgerock.opendj.ldap.schema.AuthPasswordSyntaxImplTest} |
| | | * FIXME this is a duplicate of {@link org.forgerock.opendj.ldap.schema.AuthPasswordSyntaxImpl} |
| | | * |
| | | * @param authPasswordValue The authentication password value to be decoded. |
| | | * @return A three-element array, containing the scheme, authInfo, and |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.util.Base64; |
| | | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides a generic interface that LDAP clients can use to perform |
| | | * various kinds of authentication to the Directory Server. This handles both |
| | |
| | | message, bindResponse2.getMatchedDN(), null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param saslProperties |
| | | * @param authID |
| | | * @param name |
| | | * @return |
| | | * @throws ClientException |
| | | */ |
| | | private String getAuthID(Map<String, List<String>> saslProperties, String authID, String name) throws ClientException |
| | | { |
| | | List<String> values = saslProperties.get(name); |
| | |
| | | * Creates a new attribute builder with an undefined attribute type |
| | | * and user-provided name. The attribute type, and optionally the |
| | | * user-provided name, must be defined using |
| | | * {@link #setAttributeType(AttributeType)} before the attribute |
| | | * {@link #setAttributeDescription(AttributeDescription)} before the attribute |
| | | * builder can be converted to an {@link Attribute}. Failure to do |
| | | * so will yield an {@link IllegalStateException}. |
| | | */ |
| | |
| | | /** |
| | | * A fluent API for parsing attributes as different types of object. An |
| | | * attribute parser is obtained from an entry using the method |
| | | * {@link Entry#parseAttribute} or from an attribute using |
| | | * {@link Attribute#parse}. |
| | | * {@link Entry#parseAttribute}. |
| | | * <p> |
| | | * Methods throw an {@code IllegalArgumentException} when a value cannot be |
| | | * parsed (e.g. because its syntax is invalid). Methods which return a |
| | |
| | | * </pre> |
| | | * |
| | | * @see Entry#parseAttribute |
| | | * @see Attribute#parse |
| | | */ |
| | | public final class AttributeParser { |
| | | // TODO: enums, filters, rdns? |
| | |
| | | /** |
| | | * A backup manager for any entity that is backupable (backend, storage). |
| | | * |
| | | * @see {@link Backupable} |
| | | * @see Backupable |
| | | */ |
| | | public class BackupManager |
| | | { |
| | |
| | | element, i)); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | lastWasDot = true; |
| | | } |
| | | lastWasDot = true; |
| | | } |
| | | else |
| | | { |
| | |
| | | InetAddress address, int port, |
| | | boolean allowReuse) |
| | | { |
| | | // Return pessimistic. |
| | | boolean isInUse = true; |
| | | Socket clientSocket = null; |
| | | ServerSocket serverSocket = null; |
| | | try { |
| | | // HACK: |
| | | // With dual stacks we can have a situation when INADDR_ANY/PORT |
| | | // is bound in TCP4 space but available in TCP6 space and since |
| | | // JavaServerSocket implemantation will always use TCP46 on dual |
| | | // JavaServerSocket implementation will always use TCP46 on dual |
| | | // stacks the bind below will always succeed in such cases thus |
| | | // shadowing anything that is already bound to INADDR_ANY/PORT. |
| | | // While technically correct, with IPv4 and IPv6 being separate |
| | | // address spaces, it presents a problem to end users because a |
| | | // common case scenario is to have a single service serving both |
| | | // address spaces ie listening to the same port in both spaces |
| | | // on wildcard addresses 0 and ::. ServerSocket implemantation |
| | | // on wildcard addresses 0 and ::. ServerSocket implementation |
| | | // does not provide any means of working with each address space |
| | | // separately such as doing TCP4 or TCP6 only binds thus we have |
| | | // to do a dummy connect to INADDR_ANY/PORT to check if it is |
| | |
| | | // addresses as specific IPv4 or IPv6 addresses will always be |
| | | // handled in their respective address space. |
| | | if (address.isAnyLocalAddress()) { |
| | | clientSocket = new Socket(); |
| | | try { |
| | | try (Socket clientSocket = new Socket()) { |
| | | // This might fail on some stacks but this is the best we |
| | | // can do. No need for explicit timeout since it is local |
| | | // address and we have to know for sure unless it fails. |
| | | clientSocket.connect(new InetSocketAddress(address, port)); |
| | | } catch (IOException e) { |
| | | // Expected, ignore. |
| | | } |
| | | if (clientSocket.isConnected()) { |
| | | return true; |
| | | if (clientSocket.isConnected()) { |
| | | return true; |
| | | } |
| | | } catch (IOException ignore) { |
| | | // ignore. |
| | | } |
| | | } |
| | | serverSocket = new ServerSocket(); |
| | | serverSocket.setReuseAddress(allowReuse); |
| | | serverSocket.bind(new InetSocketAddress(address, port)); |
| | | isInUse = false; |
| | | } catch (IOException e) { |
| | | isInUse = true; |
| | | } finally { |
| | | try { |
| | | if (serverSocket != null) { |
| | | serverSocket.close(); |
| | | } |
| | | } catch (Exception e) {} |
| | | try { |
| | | if (clientSocket != null) { |
| | | clientSocket.close(); |
| | | } |
| | | } catch (Exception e) {} |
| | | try (ServerSocket serverSocket = new ServerSocket()) { |
| | | serverSocket.setReuseAddress(allowReuse); |
| | | serverSocket.bind(new InetSocketAddress(address, port)); |
| | | return false; |
| | | } |
| | | } catch (IOException ignore) { |
| | | // no-op |
| | | } |
| | | return isInUse; |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns a lower-case string representation of a given string, verifying for null input string. |
| | | * {@see com.forgerock.opendj.util.StaticUtils#toLowerCase(String s)} |
| | | * |
| | | * @param s the mixed case string |
| | | * @return a lower-case string |
| | | * @see com.forgerock.opendj.util.StaticUtils#toLowerCase(String) |
| | | */ |
| | | public static String toLowerCase(String s) |
| | | { |
| | |
| | | /** |
| | | * Appends a lower-case string representation of a given ByteSequence to a StringBuilder, |
| | | * verifying for null input. |
| | | * {@see com.forgerock.opendj.util.StaticUtils#toLowerCase(ByteSequence s, StringBuilder string)} |
| | | * |
| | | * @param b The byte array for which to obtain the lowercase string |
| | | * representation. |
| | |
| | | * be appended. |
| | | * @param trim Indicates whether leading and trailing spaces should be |
| | | * omitted from the string representation. |
| | | * @see com.forgerock.opendj.util.StaticUtils#toLowerCase(ByteSequence, StringBuilder)} |
| | | */ |
| | | public static void toLowerCase(ByteSequence b, StringBuilder buffer, boolean trim) |
| | | { |
| | |
| | | public static File getFileForPath(String path) |
| | | { |
| | | File f = new File (path); |
| | | |
| | | if (f.isAbsolute()) |
| | | { |
| | | return f; |
| | | } |
| | | else |
| | | { |
| | | return new File(DirectoryServer.getInstanceRoot() + File.separator + |
| | | path); |
| | | } |
| | | return f.isAbsolute() ? f : new File(DirectoryServer.getInstanceRoot(), path); |
| | | } |
| | | |
| | | /** |
| | |
| | | public static File getFileForPath(String path, ServerContext serverContext) |
| | | { |
| | | File f = new File (path); |
| | | |
| | | if (f.isAbsolute()) |
| | | { |
| | | return f; |
| | | } |
| | | else |
| | | { |
| | | return new File(serverContext.getInstanceRoot() + File.separator + |
| | | path); |
| | | } |
| | | return f.isAbsolute() ? f : new File(serverContext.getInstanceRoot(), path); |
| | | } |
| | | |
| | | |
| | |
| | | // We've been blocked for too long. |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | waitTime = stopTime - currentTime; |
| | | } |
| | | waitTime = stopTime - currentTime; |
| | | |
| | | Iterator<SelectionKey> iterator = |
| | | selector.selectedKeys().iterator(); |
| | |
| | | * @return {@code true} if message corresponds to descriptor |
| | | */ |
| | | public static boolean hasDescriptor(LocalizableMessage msg, |
| | | LocalizableMessageDescriptor.Arg1 desc) |
| | | LocalizableMessageDescriptor.Arg1<?> desc) |
| | | { |
| | | return msg.ordinal() == desc.ordinal() |
| | | && msg.resourceName().equals(desc.resourceName()); |
| | |
| | | * @return {@code true} if message corresponds to descriptor |
| | | */ |
| | | public static boolean hasDescriptor(LocalizableMessage msg, |
| | | LocalizableMessageDescriptor.Arg2 desc) |
| | | LocalizableMessageDescriptor.Arg2<?, ?> desc) |
| | | { |
| | | return msg.ordinal() == desc.ordinal() |
| | | && msg.resourceName().equals(desc.resourceName()); |
| | |
| | | * @return {@code true} if message corresponds to descriptor |
| | | */ |
| | | public static boolean hasDescriptor(LocalizableMessage msg, |
| | | LocalizableMessageDescriptor.Arg3 desc) |
| | | LocalizableMessageDescriptor.Arg3<?, ?, ?> desc) |
| | | { |
| | | return msg.ordinal() == desc.ordinal() |
| | | && msg.resourceName().equals(desc.resourceName()); |
| | |
| | | * @return {@code true} if message corresponds to descriptor |
| | | */ |
| | | public static boolean hasDescriptor(LocalizableMessage msg, |
| | | LocalizableMessageDescriptor.Arg7 desc) |
| | | LocalizableMessageDescriptor.Arg7<?, ?, ?, ?, ?, ?, ?> desc) |
| | | { |
| | | return msg.ordinal() == desc.ordinal() |
| | | && msg.resourceName().equals(desc.resourceName()); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | mayInvoke=true) |
| | | public final class DynamicConstants |
| | | { |
| | | /** |
| | | * The official full product name for the Directory Server. |
| | | */ |
| | | /** The official full product name for the Directory Server. */ |
| | | public static String PRODUCT_NAME = "${project.name}"; |
| | | |
| | | /** |
| | | * The short product name for the Directory Server. |
| | | */ |
| | | /** The short product name for the Directory Server. */ |
| | | public static String SHORT_NAME = "${product.name}"; |
| | | |
| | | /** |
| | | * The major version number for the Directory Server. |
| | | */ |
| | | /** The major version number for the Directory Server. */ |
| | | public static int MAJOR_VERSION = ${parsedVersion.majorVersion}; |
| | | |
| | | /** |
| | | * The minor version number for the Directory Server. |
| | | */ |
| | | /** The minor version number for the Directory Server. */ |
| | | public static int MINOR_VERSION = ${parsedVersion.minorVersion}; |
| | | |
| | | /** |
| | | * The point version number for the Directory Server. |
| | | */ |
| | | /** The point version number for the Directory Server. */ |
| | | public static int POINT_VERSION = ${parsedVersion.incrementalVersion}; |
| | | |
| | | /** |
| | | * The official build number for the Directory Server. |
| | | */ |
| | | /** The official build number for the Directory Server. s*/ |
| | | public static int BUILD_NUMBER = ${parsedVersion.buildNumber}; |
| | | |
| | | /** |
| | | * The version qualifier string for the Directory Server. |
| | | */ |
| | | /** The version qualifier string for the Directory Server. */ |
| | | public static String VERSION_QUALIFIER = "${parsedVersion.qualifier}"; |
| | | |
| | | /** |
| | | * The set of bug IDs for fixes included in this build of the Directory |
| | | * Server. |
| | | */ |
| | | /** The set of bug IDs for fixes included in this build of the Directory Server. */ |
| | | public static String FIX_IDS = "${patchFixIds}"; |
| | | |
| | | /** |
| | | * The build ID for the generated build of the Directory Server. |
| | | */ |
| | | /** The build ID for the generated build of the Directory Server. */ |
| | | public static String BUILD_ID = "${buildDateTime}"; |
| | | |
| | | /** |
| | | * The username of the user that created this build. |
| | | */ |
| | | /** The username of the user that created this build. */ |
| | | public static String BUILD_USER = "${user.name}"; |
| | | |
| | | /** |
| | | * The Java version used to generate this build. |
| | | */ |
| | | /** The Java version used to generate this build. */ |
| | | public static String BUILD_JAVA_VERSION = "${java.version}"; |
| | | |
| | | /** |
| | | * The vendor for the Java version used to generate this build. |
| | | */ |
| | | /** The vendor for the Java version used to generate this build. */ |
| | | public static String BUILD_JAVA_VENDOR = "${java.vendor}"; |
| | | |
| | | /** |
| | | * The JVM version used to generate this build. |
| | | */ |
| | | /** The JVM version used to generate this build. */ |
| | | public static String BUILD_JVM_VERSION = "${java.vm.version}"; |
| | | |
| | | /** |
| | | * The vendor for the JVM used to generate this build. |
| | | */ |
| | | /** The vendor for the JVM used to generate this build. */ |
| | | public static String BUILD_JVM_VENDOR = "${java.vm.vendor}"; |
| | | |
| | | /** |
| | | * The operating system on which this build was generated. |
| | | */ |
| | | /** The operating system on which this build was generated. */ |
| | | public static String BUILD_OS = "${os.name} ${os.version} ${os.arch}"; |
| | | |
| | | /** |
| | |
| | | /** The revision on which this build is based. */ |
| | | public static String REVISION = "${buildRevision}"; |
| | | |
| | | /** |
| | | * The Subversion url repository location on which this build is based. |
| | | */ |
| | | public static String URL_REPOSITORY = |
| | | "${scm.url}"; |
| | | /** The version control url repository location on which this build is based. */ |
| | | public static String URL_REPOSITORY = "${scm.url}"; |
| | | /** The documentation home. */ |
| | | public static String DOC_REFERENCE_HOME = "${docHomepageUrl}"; |
| | | /** The documentation url. */ |
| | | public static String DOC_REFERENCE_WIKI = "${docWikiUrl}"; |
| | | /** The documentation url. */ |
| | | public static String DOC_QUICK_REFERENCE_GUIDE = "${docGuideRefUrl}"; |
| | | |
| | | /** |
| | | * The documentation home. |
| | | */ |
| | | public static String DOC_REFERENCE_HOME = |
| | | "${docHomepageUrl}"; |
| | | /** The administration guide. */ |
| | | public static String ADMINISTRATION_GUIDE_URL = "${docGuideAdminUrl}"; |
| | | |
| | | /** |
| | | * The documentation url. |
| | | */ |
| | | public static String DOC_REFERENCE_WIKI = |
| | | "${docWikiUrl}"; |
| | | |
| | | /** |
| | | * The documentation url. |
| | | */ |
| | | public static String DOC_QUICK_REFERENCE_GUIDE = |
| | | "${docGuideRefUrl}"; |
| | | |
| | | /** |
| | | * The administration guide. |
| | | */ |
| | | public static String ADMINISTRATION_GUIDE_URL = |
| | | "${docGuideAdminUrl}"; |
| | | |
| | | /** |
| | | * A string representation of the version number. |
| | | */ |
| | | /** A string representation of the version number. */ |
| | | public static String VERSION_NUMBER_STRING = String.format("%s.%s.%s", MAJOR_VERSION, MINOR_VERSION, POINT_VERSION); |
| | | |
| | | /** |
| | | * A string representation of the version number. |
| | | */ |
| | | /** A string representation of the version number. */ |
| | | public static String OPENDJ_NUMBER_STRING = VERSION_NUMBER_STRING; |
| | | |
| | | /** |
| | | * A string representation of the release version. |
| | | */ |
| | | public static String RELEASE_VERSION_STRING = |
| | | OPENDJ_NUMBER_STRING; |
| | | /** A string representation of the release version. */ |
| | | public static String RELEASE_VERSION_STRING = OPENDJ_NUMBER_STRING; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | |
| | | static { |
| | | |
| | | try { |
| | | Class c = Class.forName("org.opends.server.util.ReleaseDefinition"); |
| | | Class<?> c = Class.forName("org.opends.server.util.ReleaseDefinition"); |
| | | Object obj = c.newInstance(); |
| | | |
| | | try { |
| | |
| | | + OPENDJ_NUMBER_STRING + ")" ; |
| | | } |
| | | catch (Exception ex) {} |
| | | } catch (Exception ex) { |
| | | } |
| | | } catch (Exception ex) {} |
| | | } |
| | | /** |
| | | * A compact version string for this product, suitable for use in path |
| | | * names and similar cases. |
| | | */ |
| | | |
| | | /** A compact version string for this product, suitable for use in path names and similar cases. */ |
| | | public static String COMPACT_VERSION_STRING = |
| | | SHORT_NAME + "-" + VERSION_NUMBER_STRING; |
| | | |
| | | /** |
| | | * A full version string for this product. |
| | | */ |
| | | /** A full version string for this product. */ |
| | | public static String FULL_VERSION_STRING = PRODUCT_NAME + " " + RELEASE_VERSION_STRING |
| | | + (VERSION_QUALIFIER != null && !VERSION_QUALIFIER.isEmpty() ? "-" + VERSION_QUALIFIER : "") |
| | | + (FIX_IDS != null && !FIX_IDS.isEmpty() ? "+" + FIX_IDS : ""); |
| | | |
| | | /** |
| | | * A printable version string for this product. |
| | | */ |
| | | /** A printable version string for this product. */ |
| | | public static final String PRINTABLE_VERSION_STRING = |
| | | FULL_VERSION_STRING + System.getProperty("line.separator") + |
| | | "Build " + BUILD_ID + System.getProperty("line.separator"); |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.server.core; |
| | | |
| | |
| | | * <p> |
| | | * TODO: do we need removeBackup? |
| | | * <p> |
| | | * TODO: is there any boiler plate code that abstracted in order to make |
| | | * implementation simpler? E.g. initialization, crypto. |
| | | * TODO: is there any boiler plate code that abstracted in order to make implementation simpler? |
| | | * E.g. initialization, crypto. |
| | | * <p> |
| | | * FIXME: the async APIs used below are a bad fit. We do not want to return an |
| | | * {@link LdapException}. We really need a more generic promises API. |
| | | * {@link org.forgerock.opendj.ldap.LdapException}. We really need a more generic promises API. |
| | | */ |
| | | public interface ArchivableDataProvider { |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.server.core; |
| | | |
| | |
| | | * A data provider which supports LDIF export functionality. |
| | | * <p> |
| | | * FIXME: the async APIs used below are a bad fit. We do not want to return an |
| | | * {@link LdapException}. We really need a more generic promises API. |
| | | * {@link org.forgerock.opendj.ldap.LdapException}. We really need a more generic promises API. |
| | | */ |
| | | public interface ExportableDataProvider { |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.server.core; |
| | | |
| | |
| | | * A data provider which supports LDIF import functionality. |
| | | * <p> |
| | | * FIXME: the async APIs used below are a bad fit. We do not want to return an |
| | | * {@link LdapException}. We really need a more generic promises API. |
| | | * {@link org.forgerock.opendj.ldap.LdapException}. We really need a more generic promises API. |
| | | * <p> |
| | | * FIXME: it would be nice if we can use EntryReader, however we may need to |
| | | * provide an optimized implementation for use in multi-threaded imports. E.g. |
| | | * performing DN checking as early as possible before doing schema validation. |
| | | * FIXME: it would be nice if we can use EntryReader, however we may need to provide an optimized |
| | | * implementation for use in multi-threaded imports. E.g. performing DN checking as early as |
| | | * possible before doing schema validation. |
| | | * <p> |
| | | * FIXME: import allows you to append, merge, replace entries. Do we need to |
| | | * expose that here? |
| | | * FIXME: import allows you to append, merge, replace entries. Do we need to expose that here? |
| | | */ |
| | | public interface ImportableDataProvider { |
| | | |