Improvements suggested by UCDetector: remove dead code, add final keywords, change visibilities
21 files deleted
64 files modified
| | |
| | | * Client exceptions represent communications problems, security problems, and |
| | | * service related problems. |
| | | */ |
| | | public abstract class AdminClientException extends AdminException { |
| | | abstract class AdminClientException extends AdminException { |
| | | |
| | | /** Serialization ID. */ |
| | | private static final long serialVersionUID = 4044747533980824456L; |
| | |
| | | * interacting with the Directory Server. These fall broadly into two |
| | | * categories: authentication problems and authorization problems. |
| | | */ |
| | | public abstract class AdminSecurityException extends AdminClientException { |
| | | abstract class AdminSecurityException extends AdminClientException { |
| | | |
| | | /** Fake serialization ID. */ |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | * A condition which evaluates to <code>true</code> if and only if all of its |
| | | * sub-conditions are <code>true</code>. |
| | | */ |
| | | public final class ANDCondition implements Condition { |
| | | final class ANDCondition implements Condition { |
| | | |
| | | /** The list of sub-conditions. */ |
| | | private final List<Condition> conditions; |
| | |
| | | condition.initialize(d); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import org.forgerock.util.Utils; |
| | | |
| | | /** |
| | | * Represents a particular version of OpenDJ useful for making comparisons between versions. FIXME TODO Move this file |
| | | * in ? package. |
| | | * Represents a particular version of OpenDJ useful for making comparisons between versions. |
| | | * <p> |
| | | * FIXME TODO Move this file in ? package. |
| | | */ |
| | | public class BuildVersion implements Comparable<BuildVersion> { |
| | | class BuildVersion implements Comparable<BuildVersion> { |
| | | |
| | | private final int major; |
| | | private final int minor; |
| | |
| | | return b.toString(); |
| | | } |
| | | |
| | | /** The sub-command associated with this handler. */ |
| | | private final SubCommand subCommand; |
| | | /** The argument which should be used to specify the category of managed object to be retrieved. */ |
| | | private final StringArgument categoryArgument; |
| | | |
| | | /** A table listing all the available types of managed object indexed on their parent type. */ |
| | | private final Map<String, Map<String, AbstractManagedObjectDefinition<?, ?>>> categoryMap = new TreeMap<>(); |
| | | |
| | | /** The argument which should be used to display inherited properties. */ |
| | | private BooleanArgument inheritedModeArgument; |
| | | |
| | | /** The sub-command associated with this handler. */ |
| | | private final SubCommand subCommand; |
| | | |
| | | private final BooleanArgument inheritedModeArgument; |
| | | /** A table listing all the available types of managed object indexed on their tag(s). */ |
| | | private final Map<Tag, Map<String, AbstractManagedObjectDefinition<?, ?>>> tagMap = new HashMap<>(); |
| | | |
| | | /** The argument which should be used to specify the sub-type of managed object to be retrieved. */ |
| | | private final StringArgument typeArgument; |
| | | |
| | |
| | | private ManagementContext context; |
| | | |
| | | /** The connection parameters command builder. */ |
| | | private CommandBuilder contextCommandBuilder; |
| | | |
| | | private final CommandBuilder contextCommandBuilder; |
| | | /** The connection factory provider. */ |
| | | private final ConnectionFactoryProvider provider; |
| | | |
| | | /** The connection factory. */ |
| | | private final ConnectionFactory factory; |
| | | |
| | |
| | | public LDAPManagementContextFactory(ConnectionFactoryProvider cfp) throws ArgumentException { |
| | | this.provider = cfp; |
| | | factory = cfp.getAuthenticatedConnectionFactory(); |
| | | contextCommandBuilder = null; |
| | | } |
| | | |
| | | /** Closes this management context. */ |
| | |
| | | REMOVE |
| | | } |
| | | |
| | | private PropertyDefinition<T> propertyDefinition; |
| | | private Type type; |
| | | private final PropertyDefinition<T> propertyDefinition; |
| | | private final Type type; |
| | | private final SortedSet<T> values; |
| | | private final SortedSet<T> originalValues; |
| | | |
| | |
| | | /** The set of get-xxx-prop available sub-commands. */ |
| | | private final SortedSet<GetPropSubCommandHandler> getPropHandlers = new TreeSet<>(); |
| | | /** The help sub-command handler. */ |
| | | private HelpSubCommandHandler helpHandler; |
| | | private final HelpSubCommandHandler helpHandler; |
| | | /** The set of list-xxx available sub-commands. */ |
| | | private final SortedSet<ListSubCommandHandler> listHandlers = new TreeSet<>(); |
| | | /** The set of set-xxx-prop available sub-commands. */ |
| | |
| | | |
| | | import static com.forgerock.opendj.ldap.config.ConfigMessages.*; |
| | | |
| | | import org.forgerock.opendj.config.DecodingException; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.config.DecodingException; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | | * This exception is thrown when the server refuses to use or delete a managed |
| | | * object due to one or more constraints that cannot be satisfied. |
| | | */ |
| | | public class ConstraintViolationException extends DecodingException { |
| | | class ConstraintViolationException extends DecodingException { |
| | | |
| | | /** Serialization ID. */ |
| | | private static final long serialVersionUID = -4902443848460011875L; |
| | |
| | | * A utility class to assist in converting DsmlValues (in Objects) into |
| | | * the required ByteStrings, and back again. |
| | | */ |
| | | public class ByteStringUtility |
| | | class ByteStringUtility |
| | | { |
| | | /** |
| | | * Returns a ByteString from a DsmlValue Object. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import org.opends.server.protocols.ldap.AbandonRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | |
| | | * This class provides the functionality for the performing an |
| | | * LDAP ABANDON operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLAbandonOperation |
| | | class DSMLAbandonOperation |
| | | { |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | /** |
| | | * Create an instance with the specified LDAP connection. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.RawAttribute; |
| | | |
| | |
| | | * This class provides the functionality for the performing an |
| | | * LDAP ADD operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLAddOperation |
| | | class DSMLAddOperation |
| | | { |
| | | |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | /** |
| | | * Create the instance with the specified LDAP connection. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.CompareRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | |
| | |
| | | * This class provides the functionality for the performing an |
| | | * LDAP COMPARE operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLCompareOperation |
| | | class DSMLCompareOperation |
| | | { |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | /** |
| | | * Create an instance with the specified LDAP connection. |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @author Vivek Nagar |
| | | */ |
| | | public class DSMLDeleteOperation |
| | | class DSMLDeleteOperation |
| | | { |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | /** |
| | | * Create an instance with the specified LDAP connection. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | 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.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | |
| | |
| | | * This class provides the functionality for the performing an |
| | | * LDAP EXTENDED operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLExtendedOperation |
| | | class DSMLExtendedOperation |
| | | { |
| | | private LDAPConnection connection; |
| | | private Set<String> stringResponses; |
| | | private final LDAPConnection connection; |
| | | private final Set<String> stringResponses; |
| | | |
| | | /** |
| | | * Create an instance with the specified LDAP connection. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ModifyDNRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyDNResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.opends.server.types.LDAPException; |
| | | |
| | | |
| | |
| | | * This class provides the functionality for the performing an |
| | | * LDAP MODIFY_DN operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLModifyDNOperation |
| | | class DSMLModifyDNOperation |
| | | { |
| | | |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | /** |
| | | * Create the instance with the specified connection. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | |
| | | import org.opends.server.protocols.ldap.ModifyResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.opends.server.types.RawModification; |
| | | |
| | | |
| | |
| | | * This class provides the functionality for the performing an |
| | | * LDAP MODIFY operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLModifyOperation |
| | | class DSMLModifyOperation |
| | | { |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | /** |
| | | * Create the instance with the specified LDAP connection. |
| | |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | |
| | | import javax.xml.bind.JAXBElement; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DereferenceAliasesPolicy; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPConstants; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | |
| | | import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp; |
| | | import org.opends.server.tools.LDAPConnection; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DereferenceAliasesPolicy; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.RawFilter; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | |
| | | /** |
| | | * This class provides the functionality for the performing an LDAP |
| | | * SEARCH operation based on the specified DSML request. |
| | | */ |
| | | public class DSMLSearchOperation |
| | | class DSMLSearchOperation |
| | | { |
| | | |
| | | private LDAPConnection connection; |
| | | private final LDAPConnection connection; |
| | | |
| | | |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.StringTokenizer; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | |
| | | import javax.xml.parsers.DocumentBuilderFactory; |
| | | import javax.xml.parsers.ParserConfigurationException; |
| | | import javax.xml.parsers.SAXParserFactory; |
| | | import javax.xml.soap.*; |
| | | import javax.xml.soap.MessageFactory; |
| | | import javax.xml.soap.MimeHeaders; |
| | | import javax.xml.soap.SOAPBody; |
| | | import javax.xml.soap.SOAPConstants; |
| | | import javax.xml.soap.SOAPElement; |
| | | import javax.xml.soap.SOAPException; |
| | | import javax.xml.soap.SOAPHeader; |
| | | import javax.xml.soap.SOAPMessage; |
| | | import javax.xml.validation.Schema; |
| | | import javax.xml.validation.SchemaFactory; |
| | | |
| | |
| | | import org.opends.server.tools.SSLConnectionFactory; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.util.Base64; |
| | | |
| | | import org.w3c.dom.Document; |
| | | import org.xml.sax.Attributes; |
| | | import org.xml.sax.EntityResolver; |
| | |
| | | private static Schema schema; |
| | | |
| | | /** Prevent multiple logging when trying to set unavailable/unsupported parser features */ |
| | | private static AtomicBoolean logFeatureWarnings = new AtomicBoolean(false); |
| | | private static final AtomicBoolean logFeatureWarnings = new AtomicBoolean(false); |
| | | |
| | | private String hostName; |
| | | private Integer port; |
| | |
| | | private String trustStorePasswordValue; |
| | | private Boolean trustAll; |
| | | private Boolean useHTTPAuthzID; |
| | | private HashSet<String> exopStrings = new HashSet<>(); |
| | | private final Set<String> exopStrings = new HashSet<>(); |
| | | |
| | | /** |
| | | * This method will be called by the Servlet Container when |
| | |
| | | */ |
| | | @Override |
| | | public void init(ServletConfig config) throws ServletException { |
| | | |
| | | try { |
| | | hostName = config.getServletContext().getInitParameter(HOST); |
| | | |
| | | port = Integer.valueOf(config.getServletContext().getInitParameter(PORT)); |
| | | |
| | | userDN = config.getServletContext().getInitParameter(USERDN); |
| | | |
| | | userPassword = config.getServletContext().getInitParameter(USERPWD); |
| | | |
| | | useSSL = Boolean.valueOf( |
| | | config.getServletContext().getInitParameter(USESSL)); |
| | | |
| | | useStartTLS = Boolean.valueOf( |
| | | config.getServletContext().getInitParameter(USESTARTTLS)); |
| | | |
| | | trustStorePathValue = |
| | | config.getServletContext().getInitParameter(TRUSTSTOREPATH); |
| | | |
| | | trustStorePasswordValue = |
| | | config.getServletContext().getInitParameter(TRUSTSTOREPASSWORD); |
| | | |
| | | trustAll = Boolean.valueOf( |
| | | config.getServletContext().getInitParameter(TRUSTALLCERTS)); |
| | | |
| | | useHTTPAuthzID = Boolean.valueOf( |
| | | config.getServletContext().getInitParameter(USEHTTPAUTHZID)); |
| | | hostName = stringValue(config, HOST); |
| | | port = Integer.valueOf(stringValue(config, PORT)); |
| | | userDN = stringValue(config, USERDN); |
| | | userPassword = stringValue(config, USERPWD); |
| | | useSSL = booleanValue(config, USESSL); |
| | | useStartTLS = booleanValue(config, USESTARTTLS); |
| | | trustStorePathValue = stringValue(config, TRUSTSTOREPATH); |
| | | trustStorePasswordValue = stringValue(config, TRUSTSTOREPASSWORD); |
| | | trustAll = booleanValue(config, TRUSTALLCERTS); |
| | | useHTTPAuthzID = booleanValue(config, USEHTTPAUTHZID); |
| | | |
| | | /* |
| | | * Find all the param-names matching the pattern: |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean booleanValue(ServletConfig config, String paramName) |
| | | { |
| | | return Boolean.valueOf(stringValue(config, paramName)); |
| | | } |
| | | |
| | | private String stringValue(ServletConfig config, String paramName) |
| | | { |
| | | return config.getServletContext().getInitParameter(paramName); |
| | | } |
| | | |
| | | /** |
| | | * Check if using the proxy authz control will work, by using it to read |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2012-2015 ForgeRock AS. |
| | | * Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.dsml.protocol; |
| | | |
| | |
| | | */ |
| | | public class ResultCodeFactory |
| | | { |
| | | static HashMap<Integer,LDAPResultCode> codeToDescr = new HashMap<>(); |
| | | static final HashMap<Integer, LDAPResultCode> codeToDescr = new HashMap<>(); |
| | | static |
| | | { |
| | | codeToDescr.put(0, LDAPResultCode.SUCCESS); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | | * The object of this class represent a Replica (i.e. a suffix in a given |
| | | * server). |
| | | */ |
| | | /** The object of this class represent a Replica (i.e. a suffix in a given server). */ |
| | | public class ReplicaDescriptor |
| | | { |
| | | private SuffixDescriptor suffix; |
| | | private int entries = -1; |
| | | private ServerDescriptor server; |
| | | private Set<String> replicationServers = new HashSet<>(); |
| | | private final Set<String> replicationServers = new HashSet<>(); |
| | | private int replicationId = -1; |
| | | private int missingChanges = -1; |
| | | private long ageOfOldestMissingChange = -1; |
| | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.types.HostPort; |
| | | |
| | | /** The object of this class represent an OpenDS server. */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Cleans up the contents of the ads truststore. |
| | | * |
| | | * @param ctx the bound instance. |
| | | * @throws NamingException in case an error occurs while updating the |
| | | * instance's ads-truststore via LDAP. |
| | | */ |
| | | public static void cleanAdsTrustStore(InitialLdapContext ctx) |
| | | throws NamingException |
| | | { |
| | | try |
| | | { |
| | | SearchControls sc = new SearchControls(); |
| | | sc.setSearchScope(SearchControls.ONELEVEL_SCOPE); |
| | | sc.setReturningAttributes(new String[] { SchemaConstants.NO_ATTRIBUTES }); |
| | | NamingEnumeration<SearchResult> ne = ctx.search(TRUSTSTORE_DN, |
| | | "(objectclass=ds-cfg-instance-key)", sc); |
| | | ArrayList<String> dnsToDelete = new ArrayList<>(); |
| | | try |
| | | { |
| | | while (ne.hasMore()) |
| | | { |
| | | SearchResult sr = ne.next(); |
| | | dnsToDelete.add(sr.getName()+","+TRUSTSTORE_DN); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | ne.close(); |
| | | } |
| | | for (String dn : dnsToDelete) |
| | | { |
| | | ctx.destroySubcontext(dn); |
| | | } |
| | | } |
| | | catch (NameNotFoundException nnfe) |
| | | { |
| | | // Ignore |
| | | logger.warn(LocalizableMessage.raw("Error cleaning truststore: "+nnfe, nnfe)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the values of the ds-base-dn-entry count attributes for the given |
| | | * backend monitor entry using the provided InitialLdapContext. |
| | | * @param ctx the InitialLdapContext to use to update the configuration. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | | |
| | | import javax.naming.ldap.BasicControl; |
| | | |
| | | /** |
| | | * This class implements the LDAP subtree delete control for JNDI. |
| | | */ |
| | | public class SubtreeDeleteControl extends BasicControl |
| | | /** This class implements the LDAP subtree delete control for JNDI. */ |
| | | class SubtreeDeleteControl extends BasicControl |
| | | { |
| | | /** |
| | | * The serial version identifier required to satisfy the compiler |
| | |
| | | */ |
| | | static final long serialVersionUID = 3941576361457157921L; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public SubtreeDeleteControl() |
| | | { |
| | | super("1.2.840.113556.1.4.805"); |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | import javax.naming.NamingException; |
| | | |
| | | import org.opends.admin.ads.util.ApplicationTrustManager; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * This class represents the Exception that can occur while reading server |
| | |
| | | public class TopologyCacheException extends OpenDsException { |
| | | |
| | | private static final long serialVersionUID = 1709535837273360382L; |
| | | private Type type; |
| | | private String ldapUrl; |
| | | private ApplicationTrustManager trustManager; |
| | | private final Type type; |
| | | private final String ldapUrl; |
| | | private final ApplicationTrustManager trustManager; |
| | | |
| | | /** |
| | | * Error type. |
| | | */ |
| | | /** Error type. */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Error reading the ADS. |
| | | */ |
| | | /** Error reading the ADS. */ |
| | | GENERIC_READING_ADS, |
| | | /** |
| | | * Creating connection to a particular server. |
| | | */ |
| | | /** Creating connection to a particular server. */ |
| | | GENERIC_CREATING_CONNECTION, |
| | | /** |
| | | * Error reading the configuration of a particular server. |
| | | */ |
| | | /** Error reading the configuration of a particular server. */ |
| | | GENERIC_READING_SERVER, |
| | | /** |
| | | * The DN provided in the DirContext of ADS is not of a global |
| | | * administrator. |
| | | */ |
| | | /** The DN provided in the DirContext of ADS is not of a global administrator. */ |
| | | NOT_GLOBAL_ADMINISTRATOR, |
| | | /** |
| | | * Not enough permissions to read the server configuration. |
| | | */ |
| | | /** Not enough permissions to read the server configuration. */ |
| | | NO_PERMISSIONS, |
| | | /** |
| | | * Timeout reading the configuration of a particular server. |
| | | */ |
| | | /** Timeout reading the configuration of a particular server. */ |
| | | TIMEOUT, |
| | | /** |
| | | * Unexpected error. |
| | | */ |
| | | /** Unexpected error. */ |
| | | BUG |
| | | } |
| | | |
| | |
| | | * ADSContextException occurs. |
| | | * @param ace the exception which is the cause of this exception. |
| | | */ |
| | | public TopologyCacheException(ADSContextException ace) |
| | | TopologyCacheException(ADSContextException ace) |
| | | { |
| | | super(ace); |
| | | type = Type.GENERIC_READING_ADS; |
| | | ldapUrl = null; |
| | | trustManager = null; |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | super(t); |
| | | this.type = type; |
| | | this.ldapUrl = null; |
| | | this.trustManager = null; |
| | | } |
| | | |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.admin.ads; |
| | | |
| | |
| | | */ |
| | | public class TopologyCacheFilter |
| | | { |
| | | private Set<String> baseDNs = new HashSet<>(); |
| | | private final Set<String> baseDNs = new HashSet<>(); |
| | | private boolean searchMonitoringInformation = true; |
| | | private boolean searchBaseDNInformation = true; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Removes a base DN fom the list of baseDNs to search. |
| | | * @param dn the DN of the base DN to be removed. |
| | | */ |
| | | public void removeBaseDNToSearch(String dn) |
| | | { |
| | | baseDNs.remove(dn); |
| | | } |
| | | |
| | | /** |
| | | * Returns the list of base DNs that will be searched for. If the list is |
| | | * empty we will search for all the base DNs. |
| | | * @return the list of base DNs we will search for. |
| | |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.naming.ldap.LdapName; |
| | | import javax.naming.ldap.Rdn; |
| | |
| | | private String lastRefusedAuthType; |
| | | private X509Certificate[] lastRefusedChain; |
| | | private Cause lastRefusedCause; |
| | | private KeyStore keystore; |
| | | private final KeyStore keystore; |
| | | |
| | | /** |
| | | * The following ArrayList contain information about the certificates |
| | | * explicitly accepted by the user. |
| | | */ |
| | | private ArrayList<X509Certificate[]> acceptedChains = new ArrayList<>(); |
| | | private ArrayList<String> acceptedAuthTypes = new ArrayList<>(); |
| | | private ArrayList<String> acceptedHosts = new ArrayList<>(); |
| | | private final List<X509Certificate[]> acceptedChains = new ArrayList<>(); |
| | | private final List<String> acceptedAuthTypes = new ArrayList<>(); |
| | | private final List<String> acceptedHosts = new ArrayList<>(); |
| | | |
| | | private String host; |
| | | |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.admin.ads.util; |
| | | |
| | |
| | | private static final long serialVersionUID = 1151044344529478436L; |
| | | |
| | | /** Private certificate chain. */ |
| | | private X509Certificate[] chain; |
| | | private final X509Certificate[] chain; |
| | | |
| | | // ------------------ |
| | | // Constructor |
| | |
| | | START_TLS |
| | | } |
| | | |
| | | private String ldapUrl; |
| | | private Type type; |
| | | private final String ldapUrl; |
| | | private final Type type; |
| | | |
| | | /** |
| | | * The constructor of the PreferredConnection. |
| | |
| | | import javax.net.ssl.TrustManager; |
| | | |
| | | /** An implementation of SSLSocketFactory. */ |
| | | public class TrustedSocketFactory extends SSLSocketFactory |
| | | class TrustedSocketFactory extends SSLSocketFactory |
| | | { |
| | | private static Map<Thread, TrustManager> hmTrustManager = new HashMap<>(); |
| | | private static Map<Thread, KeyManager> hmKeyManager = new HashMap<>(); |
| | | private static final Map<Thread, TrustManager> hmTrustManager = new HashMap<>(); |
| | | private static final Map<Thread, KeyManager> hmKeyManager = new HashMap<>(); |
| | | |
| | | private static Map<TrustManager, SocketFactory> hmDefaultFactoryTm = new HashMap<>(); |
| | | private static Map<KeyManager, SocketFactory> hmDefaultFactoryKm = new HashMap<>(); |
| | | private static final Map<TrustManager, SocketFactory> hmDefaultFactoryTm = new HashMap<>(); |
| | | private static final Map<KeyManager, SocketFactory> hmDefaultFactoryKm = new HashMap<>(); |
| | | |
| | | private SSLSocketFactory innerFactory; |
| | | private TrustManager trustManager; |
| | | private KeyManager keyManager; |
| | | private final TrustManager trustManager; |
| | | private final KeyManager keyManager; |
| | | |
| | | /** |
| | | * Constructor of the TrustedSocketFactory. |
| | | * @param trustManager the trust manager to use. |
| | | * @param keyManager the key manager to use. |
| | | */ |
| | | public TrustedSocketFactory(TrustManager trustManager, KeyManager keyManager) |
| | | TrustedSocketFactory(TrustManager trustManager, KeyManager keyManager) |
| | | { |
| | | this.trustManager = trustManager; |
| | | this.keyManager = keyManager; |
| | |
| | | * @param keyManager |
| | | * the key manager to use. |
| | | */ |
| | | public static synchronized void setCurrentThreadTrustManager( |
| | | TrustManager trustManager, KeyManager keyManager) |
| | | static synchronized void setCurrentThreadTrustManager(TrustManager trustManager, KeyManager keyManager) |
| | | { |
| | | setThreadTrustManager(trustManager, Thread.currentThread()); |
| | | setThreadKeyManager (keyManager, Thread.currentThread()); |
| | |
| | | * @param trustManager the trust manager to use. |
| | | * @param thread the thread where we want to use the provided trust manager. |
| | | */ |
| | | public static synchronized void setThreadTrustManager( |
| | | TrustManager trustManager, Thread thread) |
| | | static synchronized void setThreadTrustManager(TrustManager trustManager, Thread thread) |
| | | { |
| | | TrustManager currentTrustManager = hmTrustManager.get(thread); |
| | | if (currentTrustManager != null) { |
| | |
| | | * @param keyManager the key manager to use. |
| | | * @param thread the thread where we want to use the provided key manager. |
| | | */ |
| | | public static synchronized void setThreadKeyManager( |
| | | KeyManager keyManager, Thread thread) |
| | | static synchronized void setThreadKeyManager(KeyManager keyManager, Thread thread) |
| | | { |
| | | KeyManager currentKeyManager = hmKeyManager.get(thread); |
| | | if (currentKeyManager != null) { |
| | |
| | | /** This occurs for instance when the authentication provided by the user is not valid. */ |
| | | ERROR_READING_CONFIGURATION_WITH_LDAP(4); |
| | | |
| | | private int returnCode; |
| | | private final int returnCode; |
| | | private ErrorReturnCode(int returnCode) |
| | | { |
| | | this.returnCode = returnCode; |
| | |
| | | */ |
| | | public abstract class AbstractNodeTask implements Runnable { |
| | | |
| | | BasicNode node; |
| | | boolean cancelled; |
| | | private final BasicNode node; |
| | | private boolean cancelled; |
| | | |
| | | /** |
| | | * The constructor of the node searcher. |
| | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import javax.naming.InterruptedNamingException; |
| | |
| | | FAILED |
| | | } |
| | | |
| | | BrowserController controller; |
| | | State state; |
| | | boolean recursive; |
| | | private final BrowserController controller; |
| | | private State state; |
| | | private final boolean recursive; |
| | | |
| | | SearchResult localEntry; |
| | | SearchResult remoteEntry; |
| | | private SearchResult localEntry; |
| | | private SearchResult remoteEntry; |
| | | LDAPURL remoteUrl; |
| | | boolean isLeafNode; |
| | | final ArrayList<SearchResult> childEntries = new ArrayList<>(); |
| | | private boolean isLeafNode; |
| | | private final List<SearchResult> childEntries = new ArrayList<>(); |
| | | final boolean differential; |
| | | Exception exception; |
| | | Object exceptionArg; |
| | |
| | | * Returns the child entries of the node. |
| | | * @return the child entries of the node. |
| | | */ |
| | | public ArrayList<SearchResult> getChildEntries() { |
| | | public List<SearchResult> getChildEntries() { |
| | | return childEntries; |
| | | } |
| | | |
| | |
| | | i = i + 1; |
| | | } |
| | | if (entry == null) { |
| | | throw new SearchAbandonException( |
| | | State.FAILED, lastException, lastExceptionArg); |
| | | throw new SearchAbandonException(State.FAILED, lastException, lastExceptionArg); |
| | | } |
| | | else |
| | | |
| | | if (url.getScope() != SearchScope.BASE_OBJECT) |
| | | { |
| | | if (url.getScope() != SearchScope.BASE_OBJECT) |
| | | { |
| | | // The URL is to be transformed: the code assumes that the URL points |
| | | // to the remote entry. |
| | | url = new LDAPURL(url.getScheme(), url.getHost(), |
| | | url.getPort(), entry.getName(), url.getAttributes(), |
| | | SearchScope.BASE_OBJECT, null, url.getExtensions()); |
| | | } |
| | | checkLoopInReferral(url, referral[i-1]); |
| | | remoteUrl = url; |
| | | remoteEntry = entry; |
| | | // The URL is to be transformed: the code assumes that the URL points |
| | | // to the remote entry. |
| | | url = new LDAPURL(url.getScheme(), url.getHost(), |
| | | url.getPort(), entry.getName(), url.getAttributes(), |
| | | SearchScope.BASE_OBJECT, null, url.getExtensions()); |
| | | } |
| | | checkLoopInReferral(url, referral[i-1]); |
| | | remoteUrl = url; |
| | | remoteEntry = entry; |
| | | } |
| | | |
| | | /** |
| | |
| | | while (entries.hasMore()) |
| | | { |
| | | SearchResult r = entries.next(); |
| | | String name; |
| | | if (r.getName().length() == 0) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | name = unquoteRelativeName(r.getName())+","+parentDn; |
| | | } |
| | | |
| | | String name = unquoteRelativeName(r.getName()) + "," + parentDn; |
| | | boolean add = false; |
| | | if (useCustomFilter()) |
| | | { |
| | |
| | | private SearchResult searchManuallyEntry(InitialLdapContext ctx, String dn) |
| | | throws NamingException |
| | | { |
| | | SearchResult sr = null; |
| | | // Send an LDAP search |
| | | // Send an LDAP search |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | ctls.setReturningAttributes(controller.getAttrsForRedSearch()); |
| | |
| | | controller.getObjectSearchFilter(), |
| | | ctls); |
| | | |
| | | SearchResult sr = null; |
| | | try |
| | | { |
| | | while (entries.hasMore()) |
| | |
| | | * and the attribute 'ref' is present and <CODE>false</CODE> otherwise. |
| | | * @throws NamingException if an error occurs. |
| | | */ |
| | | static boolean isReferralEntry(SearchResult entry) throws NamingException { |
| | | boolean result = false; |
| | | private static boolean isReferralEntry(SearchResult entry) throws NamingException |
| | | { |
| | | Set<String> ocValues = ConnectionUtils.getValues(entry, "objectClass"); |
| | | if (ocValues != null) { |
| | | for (String value : ocValues) |
| | | { |
| | | boolean isReferral = "referral".equalsIgnoreCase(value); |
| | | |
| | | if (isReferral) { |
| | | result = ConnectionUtils.getFirstValue(entry, "ref") != null; |
| | | break; |
| | | return ConnectionUtils.getFirstValue(entry, "ref") != null; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | |
| | |
| | | */ |
| | | class NodeSearcherQueue implements Runnable { |
| | | |
| | | private String name; |
| | | private ArrayList<AbstractNodeTask> waitingQueue = new ArrayList<>(); |
| | | private HashMap<BasicNode, AbstractNodeTask> workingList = new HashMap<>(); |
| | | private HashMap<BasicNode, BasicNode> cancelList = new HashMap<>(); |
| | | private ThreadGroup threadGroup; |
| | | private final String name; |
| | | private final List<AbstractNodeTask> waitingQueue = new ArrayList<>(); |
| | | private final Map<BasicNode, AbstractNodeTask> workingList = new HashMap<>(); |
| | | private final Map<BasicNode, BasicNode> cancelList = new HashMap<>(); |
| | | private final ThreadGroup threadGroup; |
| | | |
| | | |
| | | /** |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | /** |
| | | * The exception used by the NodeRefresher when the refresh process is |
| | | * cancelled, interrupted or something failed. |
| | | * |
| | | */ |
| | | class SearchAbandonException extends Exception { |
| | | |
| | | private static final long serialVersionUID = 7768798649278383859L; |
| | | private NodeRefresher.State state; |
| | | private Exception x; |
| | | private Object arg; |
| | | private final NodeRefresher.State state; |
| | | private final Exception x; |
| | | private final Object arg; |
| | | |
| | | /** |
| | | * The constructor for the class. |
| | |
| | | } |
| | | } |
| | | |
| | | private LocalizableMessage msg; |
| | | private String attributeName; |
| | | private boolean isAborted; |
| | | private final LocalizableMessage msg; |
| | | private final String attributeName; |
| | | private boolean isNumeric; |
| | | private boolean isGMTDate; |
| | | private boolean isValueInBytes; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAborted() |
| | | { |
| | | return isAborted; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isNumeric() |
| | | { |
| | | return isNumeric; |
| | |
| | | |
| | | private void calculateProperties() |
| | | { |
| | | isAborted = attributeName.indexOf("ds-mon-aborted-") == 0; |
| | | |
| | | canHaveAverage = attributeName.endsWith("total-count") || |
| | | attributeName.endsWith("Requests") || |
| | | attributeName.endsWith("Responses") || |
| | |
| | | */ |
| | | public class CustomSearchResult implements Comparable<CustomSearchResult> |
| | | { |
| | | private String dn; |
| | | private final String dn; |
| | | private Map<String, List<Object>> attributes; |
| | | private SortedSet<String> attrNames; |
| | | private String toString; |
| | |
| | | return toString().compareTo(o.toString()); |
| | | } |
| | | |
| | | /** |
| | | * Return a new object, copy of the current object. |
| | | * |
| | | * @return a new object, copy of the current object |
| | | */ |
| | | public CustomSearchResult duplicate() |
| | | { |
| | | CustomSearchResult sr = new CustomSearchResult(dn); |
| | | sr.attributes = new HashMap<>(attributes); |
| | | sr.attrNames = new TreeSet<>(attrNames); |
| | | sr.toString = toString; |
| | | sr.hashCode = hashCode; |
| | | return sr; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | import java.util.Comparator; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | |
| | | public class DatabaseMonitoringTableModel extends SortableTableModel implements Comparator<BackendDescriptor> |
| | | { |
| | | private static final long serialVersionUID = 548035716525600536L; |
| | | private Set<BackendDescriptor> data = new HashSet<>(); |
| | | private ArrayList<String[]> dataArray = new ArrayList<>(); |
| | | private final Set<BackendDescriptor> data = new HashSet<>(); |
| | | private final List<String[]> dataArray = new ArrayList<>(); |
| | | |
| | | private String[] columnNames = {}; |
| | | private LocalizableMessage NO_VALUE_SET = INFO_CTRL_PANEL_NO_MONITORING_VALUE.get(); |
| | | private LocalizableMessage NOT_IMPLEMENTED = INFO_CTRL_PANEL_NOT_IMPLEMENTED.get(); |
| | | private final LocalizableMessage NO_VALUE_SET = INFO_CTRL_PANEL_NO_MONITORING_VALUE.get(); |
| | | private final LocalizableMessage NOT_IMPLEMENTED = INFO_CTRL_PANEL_NOT_IMPLEMENTED.get(); |
| | | |
| | | /** The fields to be displayed. */ |
| | | private LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | private final Set<String> attributes = new LinkedHashSet<>(); |
| | | /** The sort column of the table. */ |
| | | private int sortColumn; |
| | | /** Whether the sorting is ascending or descending. */ |
| | |
| | | * Sets the fields displayed by this table model. |
| | | * @param fields the statistic fields displayed by this table model. |
| | | */ |
| | | public void setAttributes(LinkedHashSet<String> fields) |
| | | public void setAttributes(Set<String> fields) |
| | | { |
| | | this.attributes.clear(); |
| | | this.attributes.addAll(fields); |
| | |
| | | * @param backend the backend. |
| | | * @return the label to be used for the provided backend. |
| | | */ |
| | | protected String getName(BackendDescriptor backend) |
| | | private String getName(BackendDescriptor backend) |
| | | { |
| | | return backend.getBackendID(); |
| | | } |
| | |
| | | * @return the monitoring entry associated with the provided backend. Returns |
| | | * <CODE>null</CODE> if there is no monitoring entry associated. |
| | | */ |
| | | protected CustomSearchResult getMonitoringEntry(BackendDescriptor backend) |
| | | private CustomSearchResult getMonitoringEntry(BackendDescriptor backend) |
| | | { |
| | | return backend.getMonitoringEntry(); |
| | | } |
| | |
| | | } |
| | | return line; |
| | | } |
| | | |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | String getAttributeName(); |
| | | |
| | | /** |
| | | * Tells whether this is the number of aborted operations. |
| | | * @return <CODE>true</CODE> if this corresponds to the number of aborted |
| | | * operations and <CODE>false</CODE> otherwise. |
| | | */ |
| | | boolean isAborted(); |
| | | |
| | | /** |
| | | * Return whether this attribute contains a numeric value or not. |
| | | * @return <CODE>true</CODE> if the value is numeric and <CODE>false</CODE> |
| | | * otherwise. |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** An abstract class used to re-factor some code between the start, stop and restart tasks. */ |
| | | public abstract class StartStopTask extends Task |
| | | abstract class StartStopTask extends Task |
| | | { |
| | | Set<String> backendSet; |
| | | private final Set<String> backendSet; |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | getInfo().stopPooling(); |
| | | getInfo().regenerateDescriptor(); |
| | | |
| | | ArrayList<String> arguments = getCommandLineArguments(); |
| | | |
| | | String[] args = new String[arguments.size()]; |
| | | |
| | | arguments.toArray(args); |
| | | List<String> arguments = getCommandLineArguments(); |
| | | String[] args = arguments.toArray(new String[arguments.size()]); |
| | | returnCode = executeCommandLine(getCommandLinePath(), args); |
| | | |
| | | postCommandLine(); |
| | |
| | | */ |
| | | protected void postCommandLine() |
| | | { |
| | | if (returnCode != 0) |
| | | { |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | else |
| | | { |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | state = returnCode != 0 ? State.FINISHED_WITH_ERROR : State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | } |
| | |
| | | * a bug, because of the way the contents of logs is updated, using |
| | | * StringBuffer instead of StringBuilder is required. |
| | | */ |
| | | protected StringBuffer logs = new StringBuffer(); |
| | | private StringBuffer logs = new StringBuffer(); |
| | | /** The error logs of the task. */ |
| | | protected StringBuilder errorLogs = new StringBuilder(); |
| | | private StringBuilder errorLogs = new StringBuilder(); |
| | | /** The standard output logs of the task. */ |
| | | protected StringBuilder outputLogs = new StringBuilder(); |
| | | private StringBuilder outputLogs = new StringBuilder(); |
| | | /** The print stream for the error logs. */ |
| | | protected ApplicationPrintStream errorPrintStream = |
| | | new ApplicationPrintStream(); |
| | |
| | | * start server task, the process generated executing the start-ds |
| | | * command-line. |
| | | */ |
| | | protected Process process; |
| | | private Process process; |
| | | private ControlPanelInfo info; |
| | | |
| | | private ServerDescriptor server; |
| | |
| | | * 'Manage Indexes...' dialog when the user clicks on 'Indexes' or |
| | | * 'VLV Indexes'. |
| | | */ |
| | | public abstract class AbstractBackendIndexesPanel extends StatusGenericPanel |
| | | abstract class AbstractBackendIndexesPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 2702054131388877743L; |
| | | private String backendName; |
| | | /** The table model. */ |
| | | protected AbstractIndexTableModel tableModel; |
| | | /** The table contained by this panel. */ |
| | | protected JTable table; |
| | | private JTable table; |
| | | /** The scroll pane that contains the table. */ |
| | | protected JScrollPane tableScroll; |
| | | private Set<IndexSelectionListener> indexListeners = new HashSet<>(); |
| | | private JScrollPane tableScroll; |
| | | private final Set<IndexSelectionListener> indexListeners = new HashSet<>(); |
| | | private int lastRowMouseOver = -1; |
| | | |
| | | /** Default constructor. */ |
| | |
| | | * backend. |
| | | * @param backendName the backend name. |
| | | */ |
| | | public void update(String backendName) |
| | | void update(String backendName) |
| | | { |
| | | this.backendName = backendName; |
| | | |
| | |
| | | |
| | | /** Name of the index label. */ |
| | | final JLabel name = Utilities.createDefaultLabel(); |
| | | |
| | | /** Backends label. */ |
| | | final JLabel lBackend = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_BACKEND_LABEL.get()); |
| | | private final JLabel lBackend = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_BACKEND_LABEL.get()); |
| | | /** Read-only backend name label. */ |
| | | final JLabel backendName = Utilities.createDefaultLabel(); |
| | | |
| | | final JLabel lAttribute = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_LABEL.get()); |
| | | |
| | | final JLabel lEntryLimit = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ENTRY_LIMIT_LABEL.get()); |
| | | |
| | | final JTextField entryLimit = Utilities.createShortTextField(); |
| | | |
| | | final JLabel lType = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_INDEX_TYPE_LABEL.get()); |
| | | /** Panel containing all the index types. */ |
| | | final JPanel typesPanel = new JPanel(new GridBagLayout()); |
| | |
| | | /** Array of checkboxes. */ |
| | | final JCheckBox[] types = { approximate, equality, ordering, presence, substring }; |
| | | /** Array of index types that matches the array of checkboxes (types). */ |
| | | final IndexType[] configTypes = { APPROXIMATE, EQUALITY, ORDERING, PRESENCE, SUBSTRING }; |
| | | private final IndexType[] configTypes = { APPROXIMATE, EQUALITY, ORDERING, PRESENCE, SUBSTRING }; |
| | | |
| | | final JButton deleteIndex = Utilities.createButton(INFO_CTRL_PANEL_DELETE_INDEX_LABEL.get()); |
| | | final JButton saveChanges = Utilities.createButton(INFO_CTRL_PANEL_SAVE_CHANGES_LABEL.get()); |
| | |
| | | import java.awt.Insets; |
| | | import java.awt.Window; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import javax.swing.ImageIcon; |
| | |
| | | import javax.swing.tree.DefaultTreeModel; |
| | | import javax.swing.tree.TreePath; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.opends.guitools.controlpanel.browser.IconPool; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | |
| | | import org.opends.guitools.controlpanel.ui.renderer.TreeCellRenderer; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.guitools.controlpanel.util.ViewPositions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | |
| | | /** The pane that is displayed when the user clicks on 'General Monitoring'. */ |
| | | public class BrowseGeneralMonitoringPanel extends StatusGenericPanel |
| | | class BrowseGeneralMonitoringPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 6462914563746678830L; |
| | | |
| | |
| | | |
| | | private boolean ignoreSelectionEvents; |
| | | |
| | | private LocalizableMessage NO_ELEMENT_SELECTED = |
| | | private final LocalizableMessage NO_ELEMENT_SELECTED = |
| | | INFO_CTRL_PANEL_GENERAL_MONITORING_NO_ITEM_SELECTED.get(); |
| | | private LocalizableMessage MULTIPLE_ITEMS_SELECTED = |
| | | private final LocalizableMessage MULTIPLE_ITEMS_SELECTED = |
| | | INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED_LABEL.get(); |
| | | |
| | | /** The enumeration used to define the different static nodes of the tree. */ |
| | |
| | | } |
| | | |
| | | /** The panel displaying the informations about the selected node. */ |
| | | protected GeneralMonitoringRightPanel entryPane; |
| | | private GeneralMonitoringRightPanel entryPane; |
| | | |
| | | /** Default constructor. */ |
| | | public BrowseGeneralMonitoringPanel() |
| | |
| | | } |
| | | }); |
| | | JTree tree = treePane.getTree(); |
| | | repopulateTree(tree, true); |
| | | repopulateTree(tree); |
| | | tree.setRootVisible(true); |
| | | tree.setVisibleRowCount(20); |
| | | tree.expandPath(new TreePath(getRoot(tree))); |
| | |
| | | // Repopulate the tree to display a root node with server information |
| | | if (!serverName.equals(lastServerName)) |
| | | { |
| | | repopulateTree(treePane.getTree(), false); |
| | | repopulateTree(treePane.getTree()); |
| | | lastServerName = serverName; |
| | | } |
| | | if (firstTimeCalled) |
| | |
| | | * Populates the tree. Should be called only once since the tree in this |
| | | * panel is static. |
| | | * @param tree the tree to be repopulated. |
| | | * @param forceScroll whether the scroll must be reset or not. |
| | | */ |
| | | private void repopulateTree(JTree tree, boolean forceScroll) |
| | | private void repopulateTree(JTree tree) |
| | | { |
| | | ignoreSelectionEvents = true; |
| | | |
| | |
| | | { |
| | | GeneralMonitoringTreeNode node = |
| | | (GeneralMonitoringTreeNode)path.getLastPathComponent(); |
| | | NodeType type = (NodeType)node.getIdentifier(); |
| | | switch (type) |
| | | { |
| | | case ROOT: |
| | | entryPane.updateRoot(); |
| | | break; |
| | | case SYSTEM_INFORMATION: |
| | | entryPane.updateSystemInformation(); |
| | | break; |
| | | case WORK_QUEUE: |
| | | entryPane.updateWorkQueue(); |
| | | break; |
| | | case ENTRY_CACHES: |
| | | entryPane.updateEntryCaches(); |
| | | break; |
| | | case JE_DATABASES_INFORMATION: |
| | | entryPane.updateJEDatabaseInformation(); |
| | | break; |
| | | case PDB_DATABASES_INFORMATION: |
| | | entryPane.updatePDBDatbaseInformation(); |
| | | break; |
| | | case JAVA_INFORMATION: |
| | | entryPane.updateJavaInformation(); |
| | | break; |
| | | default: |
| | | throw new RuntimeException("Unknown node type: "+type); |
| | | } |
| | | entryPane.update((NodeType) node.getIdentifier()); |
| | | } |
| | | else if (paths != null && paths.length > 1) |
| | | { |
| | |
| | | && !Objects.equals(lastServer.getWorkQueueMonitor(), desc.getWorkQueueMonitor()); |
| | | } |
| | | |
| | | private HashMap<Object, ImageIcon> hmImages = new HashMap<>(); |
| | | private final Map<Object, ImageIcon> hmImages = new HashMap<>(); |
| | | { |
| | | NodeType[] identifiers = { |
| | | NodeType.ROOT, |
| | |
| | | } |
| | | |
| | | /** Specific class used to render the nodes in the tree. It uses specific icons for the nodes. */ |
| | | protected class GeneralMonitoringTreeCellRenderer extends TreeCellRenderer |
| | | private class GeneralMonitoringTreeCellRenderer extends TreeCellRenderer |
| | | { |
| | | private static final long serialVersionUID = -3390566664259441766L; |
| | | |
| | |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isMacOS; |
| | | |
| | |
| | | public static final Color mouseOverBackground = |
| | | UIManager.getColor("TextField.selectionBackground"); |
| | | /** Text color indicating that a field is valid. */ |
| | | public static final Color validFontColor = foreground; |
| | | static final Color validFontColor = foreground; |
| | | |
| | | /** |
| | | * The color of the text when the mouse is over (this is used in some |
| | |
| | | public static final Font headerFont = |
| | | UIManager.getFont("TableHeader.font").deriveFont(Font.BOLD); |
| | | /** The font to be used in the title of the error panes. */ |
| | | public static final Font errorTitleFont = |
| | | defaultFont.deriveFont(Font.BOLD).deriveFont(13f); |
| | | static final Font errorTitleFont = defaultFont.deriveFont(Font.BOLD).deriveFont(13f); |
| | | /** The font to be used in the CategoryButton component. */ |
| | | public static final Font categoryFont = |
| | | UIManager.getFont("Label.font").deriveFont(Font.BOLD); |
| | |
| | | public static final Font titleFont = |
| | | defaultFont.deriveFont(Font.BOLD).deriveFont(14f); |
| | | /** Text color indicating that a field is not valid. */ |
| | | public static final Color invalidFontColor = Color.red; |
| | | static final Color invalidFontColor = Color.red; |
| | | /** The font to be used when the field associated with a primary label is not valid. */ |
| | | public static final Font primaryInvalidFont = |
| | | static final Font primaryInvalidFont = |
| | | primaryFont.deriveFont(Font.ITALIC); |
| | | /** The font to be used when the field associated with a normal label is not valid. */ |
| | | public static final Font invalidFont = defaultFont.deriveFont(Font.ITALIC); |
| | | static final Font invalidFont = defaultFont.deriveFont(Font.ITALIC); |
| | | /** The font to be used in the progress dialog's 'Details' section. */ |
| | | public static final Font progressFont = UIManager.getFont("EditorPane.font"); |
| | | /** Specifies the font for the command-line output in the detail panel. */ |
| | | public static final Font outputFont = Font.decode("Monospaced-PLAIN-12"); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** The panel displaying the database monitoring filtered attributes. */ |
| | | public class DatabaseMonitoringPanel extends GeneralMonitoringPanel |
| | | class DatabaseMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563723229830L; |
| | | |
| | |
| | | private JLabel noDBsFound; |
| | | private JLabel noMonitoringFound; |
| | | private JButton showFields; |
| | | private LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | private LinkedHashSet<String> allAttributes = new LinkedHashSet<>(); |
| | | private Set<String> attributes = new LinkedHashSet<>(); |
| | | private final LinkedHashSet<String> allAttributes = new LinkedHashSet<>(); |
| | | |
| | | private MonitoringAttributesViewPanel<String> fieldsViewPanel; |
| | | private GenericDialog fieldsViewDlg; |
| | |
| | | * Default constructor. |
| | | * @param type the type of pluggable backend. |
| | | */ |
| | | public DatabaseMonitoringPanel(BackendDescriptor.PluggableType type) |
| | | DatabaseMonitoringPanel(BackendDescriptor.PluggableType type) |
| | | { |
| | | pluggableType = type; |
| | | createLayout(); |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** Updates the contents of the panel. The code assumes that this is being called from the event thread. */ |
| | | @Override |
| | | public void updateContents() |
| | | { |
| | | boolean backendsFound = false; |
| | |
| | | } |
| | | } |
| | | |
| | | private void setFieldsToDisplay(LinkedHashSet<String> attributes) |
| | | private void setFieldsToDisplay(Set<String> attributes) |
| | | { |
| | | this.attributes = attributes; |
| | | tableModel.setAttributes(attributes); |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | |
| | | import org.opends.guitools.controlpanel.task.Task; |
| | | import org.opends.guitools.controlpanel.ui.renderer.CustomListCellRenderer; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | |
| | | /** |
| | | * The panel displayed when the user clicks on 'Delete Base DN...' in the |
| | | * browse entries dialog. |
| | | */ |
| | | public class DeleteBaseDNPanel extends StatusGenericPanel |
| | | class DeleteBaseDNPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 2182662824496761087L; |
| | | |
| | | /** The list containing the base DNs. */ |
| | | protected JList list; |
| | | /** Label indicating that no element was found. */ |
| | | protected JLabel lNoElementsFound; |
| | | private JLabel lNoElementsFound; |
| | | /** The main panel. */ |
| | | protected JPanel mainPanel; |
| | | private JPanel mainPanel; |
| | | |
| | | /** Default constructor. */ |
| | | public DeleteBaseDNPanel() |
| | |
| | | import static org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes.*; |
| | | import static org.opends.guitools.controlpanel.util.Utilities.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | /** The panel displaying the entry caches monitor panel. */ |
| | | public class EntryCachesMonitoringPanel extends GeneralMonitoringPanel |
| | | class EntryCachesMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563700069830L; |
| | | private static List<MonitoringAttributes> ngOperations = CollectionUtils.<MonitoringAttributes> newArrayList( |
| | | private static final List<MonitoringAttributes> ngOperations = CollectionUtils.<MonitoringAttributes> newArrayList( |
| | | ENTRY_CACHE_TRIES, ENTRY_CACHE_HITS, ENTRY_CACHE_HIT_RATIO, CURRENT_ENTRY_CACHE_SIZE, MAX_ENTRY_CACHE_SIZE, |
| | | CURRENT_ENTRY_CACHE_COUNT, MAX_ENTRY_CACHE_COUNT); |
| | | |
| | | private ArrayList<JLabel> monitoringLabels = new ArrayList<>(); |
| | | private final List<JLabel> monitoringLabels = new ArrayList<>(); |
| | | { |
| | | for (int i=0; i<ngOperations.size(); i++) |
| | | { |
| | | monitoringLabels.add(Utilities.createDefaultLabel()); |
| | | } |
| | | } |
| | | private ArrayList<JLabel> labels = new ArrayList<>(); |
| | | private final List<JLabel> labels = new ArrayList<>(); |
| | | { |
| | | for (int i=0; i<ngOperations.size(); i++) |
| | | { |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** Updates the contents of the panel. */ |
| | | @Override |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | import javax.swing.border.Border; |
| | | import javax.swing.border.EmptyBorder; |
| | | |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | |
| | | /** |
| | | * Abstract class used to refactor some code among the panels that display the |
| | | * contents of the global monitoring. |
| | | */ |
| | | public abstract class GeneralMonitoringPanel extends StatusGenericPanel |
| | | abstract class GeneralMonitoringPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = 2840755228290832143L; |
| | | |
| | | /** The empty border shared by all the panels. */ |
| | | protected Border PANEL_BORDER = new EmptyBorder(10, 10, 10, 10); |
| | | protected final Border PANEL_BORDER = new EmptyBorder(10, 10, 10, 10); |
| | | |
| | | /** The message to express that the value was not found. */ |
| | | protected static LocalizableMessage NO_VALUE_SET = |
| | | protected final static LocalizableMessage NO_VALUE_SET = |
| | | INFO_CTRL_PANEL_NO_MONITORING_VALUE.get(); |
| | | |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** Updates the contents of the panel. */ |
| | | public abstract void updateContents(); |
| | | } |
| | |
| | | |
| | | import javax.swing.JPanel; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.opends.guitools.controlpanel.ui.BrowseGeneralMonitoringPanel.NodeType; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | /** The panel on the right of the 'General Information' panel. */ |
| | | public class GeneralMonitoringRightPanel extends StatusGenericPanel |
| | | class GeneralMonitoringRightPanel extends StatusGenericPanel |
| | | { |
| | | private static final long serialVersionUID = -4197460101279681042L; |
| | | |
| | | /** The panel with a CardLayout that contains all the panels. */ |
| | | protected JPanel mainPanel; |
| | | private JPanel mainPanel; |
| | | |
| | | private RootMonitoringPanel rootPanel = new RootMonitoringPanel(); |
| | | private WorkQueueMonitoringPanel workQueuePanel = new WorkQueueMonitoringPanel(); |
| | | private EntryCachesMonitoringPanel entryCachesPanel = new EntryCachesMonitoringPanel(); |
| | | private DatabaseMonitoringPanel jeMonitoringPanel = new DatabaseMonitoringPanel(BackendDescriptor.PluggableType.JE); |
| | | private DatabaseMonitoringPanel pdbMonitoringPanel = new DatabaseMonitoringPanel(BackendDescriptor.PluggableType.PDB); |
| | | private SystemInformationMonitoringPanel systemInformationPanel = new SystemInformationMonitoringPanel(); |
| | | private JavaInformationMonitoringPanel javaInformationPanel = new JavaInformationMonitoringPanel(); |
| | | private final RootMonitoringPanel rootPanel = new RootMonitoringPanel(); |
| | | private final WorkQueueMonitoringPanel workQueuePanel = new WorkQueueMonitoringPanel(); |
| | | private final EntryCachesMonitoringPanel entryCachesPanel = new EntryCachesMonitoringPanel(); |
| | | private final DatabaseMonitoringPanel jeMonitoringPanel = new DatabaseMonitoringPanel( |
| | | BackendDescriptor.PluggableType.JE); |
| | | private final DatabaseMonitoringPanel pdbMonitoringPanel = new DatabaseMonitoringPanel( |
| | | BackendDescriptor.PluggableType.PDB); |
| | | private final SystemInformationMonitoringPanel systemInformationPanel = new SystemInformationMonitoringPanel(); |
| | | private final JavaInformationMonitoringPanel javaInformationPanel = new JavaInformationMonitoringPanel(); |
| | | |
| | | private static final String rootPanelTitle = "RootMonitoringPanel"; |
| | | private static final String workQueuePanelTitle = "WorkQueueMonitoringPanel"; |
| | |
| | | private static final String javaInformationPanelTitle = "JavaInformationMonitoringPanel"; |
| | | |
| | | /** The panel used to update messages. */ |
| | | protected NoItemSelectedPanel noEntryPanel = new NoItemSelectedPanel(); |
| | | private final NoItemSelectedPanel noEntryPanel = new NoItemSelectedPanel(); |
| | | private static final String noEntryPanelTitle = "JavaInformationMonitoringPanel"; |
| | | |
| | | private final StatusGenericPanel[] panels = |
| | |
| | | } |
| | | |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | protected void createLayout() |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | | CardLayout cardLayout = new CardLayout(); |
| | |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the root monitoring information. */ |
| | | public void updateRoot() |
| | | void update(NodeType type) |
| | | { |
| | | rootPanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, rootPanelTitle); |
| | | switch (type) |
| | | { |
| | | case ROOT: |
| | | update(rootPanel, rootPanelTitle); |
| | | break; |
| | | case SYSTEM_INFORMATION: |
| | | update(systemInformationPanel, systemInformationPanelTitle); |
| | | break; |
| | | case WORK_QUEUE: |
| | | update(workQueuePanel, workQueuePanelTitle); |
| | | break; |
| | | case ENTRY_CACHES: |
| | | update(entryCachesPanel, entryCachesPanelTitle); |
| | | break; |
| | | case JE_DATABASES_INFORMATION: |
| | | update(jeMonitoringPanel, jeMonitoringPanelTitle); |
| | | break; |
| | | case PDB_DATABASES_INFORMATION: |
| | | update(pdbMonitoringPanel, pdbMonitoringPanelTitle); |
| | | break; |
| | | case JAVA_INFORMATION: |
| | | update(javaInformationPanel, javaInformationPanelTitle); |
| | | break; |
| | | default: |
| | | throw new RuntimeException("Unknown node type: " + type); |
| | | } |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the system information monitoring. */ |
| | | public void updateSystemInformation() |
| | | private void update(GeneralMonitoringPanel panel, String panelTitle) |
| | | { |
| | | systemInformationPanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, systemInformationPanelTitle); |
| | | panel.updateContents(); |
| | | ((CardLayout) mainPanel.getLayout()).show(mainPanel, panelTitle); |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the work queue monitoring information. */ |
| | | public void updateWorkQueue() |
| | | { |
| | | workQueuePanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, workQueuePanelTitle); |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the entry caches monitoring information. */ |
| | | public void updateEntryCaches() |
| | | { |
| | | entryCachesPanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, entryCachesPanelTitle); |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the je database monitoring information. */ |
| | | public void updateJEDatabaseInformation() |
| | | { |
| | | jeMonitoringPanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, jeMonitoringPanelTitle); |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the pdb database monitoring information. */ |
| | | public void updatePDBDatbaseInformation() |
| | | { |
| | | pdbMonitoringPanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, pdbMonitoringPanelTitle); |
| | | } |
| | | |
| | | /** Updates the contents of the panel with the JAVA information. */ |
| | | public void updateJavaInformation() |
| | | { |
| | | javaInformationPanel.updateContents(); |
| | | ((CardLayout)mainPanel.getLayout()).show(mainPanel, javaInformationPanelTitle); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.ui.components.BasicExpander; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.util.CollectionUtils; |
| | | |
| | | import static org.opends.guitools.controlpanel.util.Utilities.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | |
| | | public class JavaInformationMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563799969830L; |
| | | private List<BasicMonitoringAttributes> generalAttributes = new ArrayList<>(); |
| | | { |
| | | generalAttributes.add(BasicMonitoringAttributes.JVM_VERSION); |
| | | generalAttributes.add(BasicMonitoringAttributes.JVM_VENDOR); |
| | | generalAttributes.add(BasicMonitoringAttributes.JVM_ARCHITECTURE); |
| | | generalAttributes.add(BasicMonitoringAttributes.JVM_ARGUMENTS); |
| | | generalAttributes.add(BasicMonitoringAttributes.CLASS_PATH); |
| | | generalAttributes.add(BasicMonitoringAttributes.JAVA_VERSION); |
| | | generalAttributes.add(BasicMonitoringAttributes.JAVA_VENDOR); |
| | | } |
| | | private List<BasicMonitoringAttributes> extraAttributes = new ArrayList<>(); |
| | | { |
| | | extraAttributes.add(BasicMonitoringAttributes.CLASS_PATH); |
| | | extraAttributes.add(BasicMonitoringAttributes.JAVA_VERSION); |
| | | extraAttributes.add(BasicMonitoringAttributes.JAVA_VENDOR); |
| | | } |
| | | private ArrayList<JComponent> generalMonitoringComps = new ArrayList<>(); |
| | | |
| | | private final List<BasicMonitoringAttributes> generalAttributes = CollectionUtils.newArrayList( |
| | | BasicMonitoringAttributes.JVM_VERSION, |
| | | BasicMonitoringAttributes.JVM_VENDOR, |
| | | BasicMonitoringAttributes.JVM_ARCHITECTURE, |
| | | BasicMonitoringAttributes.JVM_ARGUMENTS, |
| | | BasicMonitoringAttributes.CLASS_PATH, |
| | | BasicMonitoringAttributes.JAVA_VERSION, |
| | | BasicMonitoringAttributes.JAVA_VENDOR); |
| | | private final List<BasicMonitoringAttributes> extraAttributes = CollectionUtils.newArrayList( |
| | | BasicMonitoringAttributes.CLASS_PATH, |
| | | BasicMonitoringAttributes.JAVA_VERSION, |
| | | BasicMonitoringAttributes.JAVA_VENDOR); |
| | | private final List<JComponent> generalMonitoringComps = new ArrayList<>(); |
| | | { |
| | | for (int i=0; i<generalAttributes.size(); i++) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private List<String> memoryAttributes = new ArrayList<>(); |
| | | private List<JLabel> memoryLabels = new ArrayList<>(); |
| | | private final List<String> memoryAttributes = new ArrayList<>(); |
| | | private final List<JLabel> memoryLabels = new ArrayList<>(); |
| | | private JPanel memoryPanel; |
| | | |
| | | /** Default constructor. */ |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** Updates the contents of the panel. */ |
| | | @Override |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | |
| | | /** The panel displaying the root monitor panel. */ |
| | | public class RootMonitoringPanel extends GeneralMonitoringPanel |
| | | class RootMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563746269830L; |
| | | |
| | | private JLabel openConnections = Utilities.createDefaultLabel(); |
| | | private JLabel maxConnections = Utilities.createDefaultLabel(); |
| | | private JLabel totalConnections = Utilities.createDefaultLabel(); |
| | | private JLabel startTime = Utilities.createDefaultLabel(); |
| | | private JLabel upTime = Utilities.createDefaultLabel(); |
| | | private JLabel version = Utilities.createDefaultLabel(); |
| | | private final JLabel openConnections = Utilities.createDefaultLabel(); |
| | | private final JLabel maxConnections = Utilities.createDefaultLabel(); |
| | | private final JLabel totalConnections = Utilities.createDefaultLabel(); |
| | | private final JLabel startTime = Utilities.createDefaultLabel(); |
| | | private final JLabel upTime = Utilities.createDefaultLabel(); |
| | | private final JLabel version = Utilities.createDefaultLabel(); |
| | | |
| | | /** Default constructor. */ |
| | | public RootMonitoringPanel() |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** Updates the contents of the panel. */ |
| | | @Override |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | */ |
| | | public void toBeDisplayed(final boolean visible) |
| | | { |
| | | // to be overridden |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param monitoringEntry |
| | | * the monitoring entry containing the information to be displayed. |
| | | */ |
| | | protected void updateMonitoringInfo(final List<MonitoringAttributes> monitoringAttrs, |
| | | protected void updateMonitoringInfo(final List<? extends MonitoringAttributes> monitoringAttrs, |
| | | final List<JLabel> monitoringLabels, final CustomSearchResult monitoringEntry) |
| | | { |
| | | for (int i = 0; i < monitoringAttrs.size(); i++) |
| | |
| | | import javax.swing.Box; |
| | | import javax.swing.JLabel; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.MonitoringAttributes; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** The panel displaying the system information monitoring panel. */ |
| | | public class SystemInformationMonitoringPanel extends GeneralMonitoringPanel |
| | | class SystemInformationMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563298069830L; |
| | | static List<MonitoringAttributes> operations = new ArrayList<>(); |
| | | private static final List<MonitoringAttributes> operations = new ArrayList<>(); |
| | | { |
| | | operations.add(BasicMonitoringAttributes.SYSTEM_NAME); |
| | | operations.add(BasicMonitoringAttributes.OPERATING_SYSTEM); |
| | |
| | | operations.add(BasicMonitoringAttributes.FREE_USED_MEMORY); |
| | | operations.add(BasicMonitoringAttributes.MAX_MEMORY); |
| | | } |
| | | private ArrayList<JLabel> monitoringLabels = new ArrayList<>(); |
| | | private final List<JLabel> monitoringLabels = new ArrayList<>(); |
| | | { |
| | | for (int i=0; i<operations.size(); i++) |
| | | { |
| | |
| | | setBorder(PANEL_BORDER); |
| | | } |
| | | |
| | | /** Updates the contents of the panel. */ |
| | | @Override |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** The panel displaying a table view of an LDAP entry. */ |
| | | public class TableViewEntryPanel extends ViewEntryPanel |
| | | class TableViewEntryPanel extends ViewEntryPanel |
| | | { |
| | | private static final long serialVersionUID = 2135331526526472175L; |
| | | private CustomSearchResult searchResult; |
| | |
| | | } |
| | | |
| | | /** The table model used by the tree in the panel. */ |
| | | protected class LDAPEntryTableModel extends SortableTableModel |
| | | private class LDAPEntryTableModel extends SortableTableModel |
| | | implements Comparator<AttributeValuePair> |
| | | { |
| | | private static final long serialVersionUID = -1240282431326505113L; |
| | | private ArrayList<AttributeValuePair> dataArray = new ArrayList<>(); |
| | | private SortedSet<AttributeValuePair> allSortedValues = new TreeSet<>(this); |
| | | private Set<String> requiredAttrs = new HashSet<>(); |
| | | private final List<AttributeValuePair> dataArray = new ArrayList<>(); |
| | | private final SortedSet<AttributeValuePair> allSortedValues = new TreeSet<>(this); |
| | | private final Set<String> requiredAttrs = new HashSet<>(); |
| | | private final String[] COLUMN_NAMES = new String[] { |
| | | getHeader(LocalizableMessage.raw("Attribute"), 40), |
| | | getHeader(LocalizableMessage.raw("Value", 40))}; |
| | |
| | | * Updates the contents of the table model with the |
| | | * {@code TableViewEntryPanel.searchResult} object. |
| | | */ |
| | | public void displayEntry() |
| | | private void displayEntry() |
| | | { |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | |
| | | * used by the table model to be able to retrieve more easily all the values |
| | | * for a given attribute. |
| | | */ |
| | | static class AttributeValuePair |
| | | private static class AttributeValuePair |
| | | { |
| | | /** The attribute name. */ |
| | | String attrName; |
| | | private final String attrName; |
| | | /** The value. */ |
| | | Object value; |
| | | private Object value; |
| | | /** |
| | | * Constructor. |
| | | * @param attrName the attribute name. |
| | | * @param value the value. |
| | | */ |
| | | public AttributeValuePair(String attrName, Object value) |
| | | private AttributeValuePair(String attrName, Object value) |
| | | { |
| | | this.attrName = attrName; |
| | | this.value = value; |
| | |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | |
| | | import javax.swing.JTextField; |
| | | import javax.swing.text.PlainDocument; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement; |
| | | import org.opends.guitools.controlpanel.datamodel.ScheduleType; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.opends.guitools.controlpanel.ui.components. |
| | | NumericLimitedSizeDocumentFilter; |
| | | import org.opends.guitools.controlpanel.ui.components.NumericLimitedSizeDocumentFilter; |
| | | import org.opends.guitools.controlpanel.ui.components.TimeDocumentFilter; |
| | | import org.opends.guitools.controlpanel.ui.renderer. |
| | | NoLeftInsetCategoryComboBoxRenderer; |
| | | import org.opends.guitools.controlpanel.ui.renderer.NoLeftInsetCategoryComboBoxRenderer; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.backends.task.RecurringTask; |
| | | |
| | | /** The panel that allows the user to specify when a task will be launched. */ |
| | |
| | | { |
| | | private static final long serialVersionUID = 6855081932432566784L; |
| | | |
| | | private String taskName; |
| | | private final String taskName; |
| | | |
| | | private JComboBox scheduleType; |
| | | |
| | | private JTextField time; |
| | | private JTextField day; |
| | | private JComboBox month; |
| | | private JComboBox year; |
| | | private JComboBox<String> month; |
| | | private JComboBox<String> year; |
| | | |
| | | private JLabel lTime; |
| | | private JLabel lDay; |
| | |
| | | private JLabel lWeeklyTime; |
| | | private JLabel lWeeklyDays; |
| | | private JTextField weeklyTime; |
| | | private JCheckBox sunday, monday, tuesday, wednesday, thursday, friday, |
| | | saturday; |
| | | private final JCheckBox sunday, monday, tuesday, wednesday, thursday, friday, saturday; |
| | | { |
| | | sunday = |
| | | Utilities.createCheckBox(INFO_CTRL_PANEL_TASK_TO_SCHEDULE_SUNDAY.get()); |
| | |
| | | Utilities.createCheckBox(INFO_CTRL_PANEL_TASK_TO_SCHEDULE_SATURDAY.get()); |
| | | } |
| | | |
| | | JCheckBox[] weekDays = |
| | | private final JCheckBox[] weekDays = |
| | | { |
| | | sunday, monday, tuesday, wednesday, thursday, friday, saturday |
| | | }; |
| | |
| | | private JLabel lMonthlyTime; |
| | | private JLabel lMonthlyDays; |
| | | private JTextField monthlyTime; |
| | | private JCheckBox[] monthDays = new JCheckBox[31]; |
| | | private final JCheckBox[] monthDays = new JCheckBox[31]; |
| | | |
| | | private JLabel lCronMinute; |
| | | private JLabel lCronHour; |
| | |
| | | private Component monthlyPanel; |
| | | private Component cronPanel; |
| | | |
| | | private LocalizableMessage LAUNCH_NOW = INFO_CTRL_PANEL_LAUNCH_NOW.get(); |
| | | private LocalizableMessage LAUNCH_LATER = INFO_CTRL_PANEL_LAUNCH_LATER.get(); |
| | | private LocalizableMessage LAUNCH_DAILY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_DAILY.get(); |
| | | private LocalizableMessage LAUNCH_WEEKLY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_WEEKLY.get(); |
| | | private LocalizableMessage LAUNCH_MONTHLY = |
| | | private final LocalizableMessage LAUNCH_NOW = INFO_CTRL_PANEL_LAUNCH_NOW.get(); |
| | | private final LocalizableMessage LAUNCH_LATER = INFO_CTRL_PANEL_LAUNCH_LATER.get(); |
| | | private final LocalizableMessage LAUNCH_DAILY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_DAILY.get(); |
| | | private final LocalizableMessage LAUNCH_WEEKLY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_WEEKLY.get(); |
| | | private final LocalizableMessage LAUNCH_MONTHLY = |
| | | INFO_CTRL_PANEL_TASK_TO_SCHEDULE_MONTHLY.get(); |
| | | private LocalizableMessage CRON = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_CRON.get(); |
| | | private final LocalizableMessage CRON = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_CRON.get(); |
| | | |
| | | private ScheduleType schedule; |
| | | |
| | |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | // no-op |
| | | } |
| | | |
| | | @Override |
| | |
| | | {currentYear, currentYear + 5} |
| | | }; |
| | | |
| | | JComboBox[] numericBoxes = |
| | | { |
| | | year |
| | | }; |
| | | JComboBox[] numericBoxes = { year }; |
| | | |
| | | int[] currentValues = |
| | | { |
| | |
| | | int min = maxMin[i][0]; |
| | | int max = maxMin[i][1]; |
| | | |
| | | DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(); |
| | | |
| | | int selectedIndex = 0; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | DefaultComboBoxModel model = new DefaultComboBoxModel(); |
| | | DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(); |
| | | month.setModel(model); |
| | | |
| | | LocalizableMessage[] monthMessages = |
| | |
| | | import javax.swing.Box; |
| | | import javax.swing.JLabel; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes; |
| | | import org.opends.guitools.controlpanel.datamodel.MonitoringAttributes; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.server.util.CollectionUtils; |
| | | |
| | | /** The panel displaying the work queue monitor panel. */ |
| | | public class WorkQueueMonitoringPanel extends GeneralMonitoringPanel |
| | | class WorkQueueMonitoringPanel extends GeneralMonitoringPanel |
| | | { |
| | | private static final long serialVersionUID = 9031734563700069830L; |
| | | static List<MonitoringAttributes> attributes = new ArrayList<>(); |
| | | { |
| | | attributes.add(BasicMonitoringAttributes.AVERAGE_REQUEST_BACKLOG); |
| | | attributes.add(BasicMonitoringAttributes.MAX_REQUEST_BACKLOG); |
| | | attributes.add(BasicMonitoringAttributes.CURRENT_REQUEST_BACKLOG); |
| | | attributes.add(BasicMonitoringAttributes.REQUESTS_SUBMITTED); |
| | | attributes.add(BasicMonitoringAttributes.REQUESTS_REJECTED); |
| | | } |
| | | private ArrayList<JLabel> monitoringLabels = new ArrayList<>(); |
| | | static final List<BasicMonitoringAttributes> attributes = CollectionUtils.newArrayList( |
| | | BasicMonitoringAttributes.AVERAGE_REQUEST_BACKLOG, |
| | | BasicMonitoringAttributes.MAX_REQUEST_BACKLOG, |
| | | BasicMonitoringAttributes.CURRENT_REQUEST_BACKLOG, |
| | | BasicMonitoringAttributes.REQUESTS_SUBMITTED, |
| | | BasicMonitoringAttributes.REQUESTS_REJECTED); |
| | | private final List<JLabel> monitoringLabels = new ArrayList<>(); |
| | | { |
| | | for (int i=0; i<attributes.size(); i++) |
| | | { |
| | |
| | | } |
| | | |
| | | /** Updates the contents of the panel. */ |
| | | @Override |
| | | public void updateContents() |
| | | { |
| | | ServerDescriptor server = null; |
| | |
| | | import java.awt.event.KeyEvent; |
| | | import java.text.ParseException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import javax.swing.Box; |
| | | import javax.swing.Icon; |
| | | import javax.swing.ImageIcon; |
| | |
| | | import javax.swing.JPanel; |
| | | import javax.swing.KeyStroke; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.guitools.controlpanel.browser.IconPool; |
| | | import org.opends.guitools.controlpanel.datamodel.BinaryValue; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | |
| | | */ |
| | | public class BinaryCellPanel extends JPanel |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | private static final long serialVersionUID = 6607973945986559802L; |
| | | private JButton iconButton; |
| | | private JLabel label; |
| | | private CellEditorButton editButton; |
| | | private CellEditorButton deleteButton; |
| | | private boolean displayDelete; |
| | | private JLabel lockLabel = Utilities.createDefaultLabel(); |
| | | private static final int THUMBNAIL_HEIGHT = 50; |
| | | |
| | | private ImageIcon lockIcon = |
| | | private final JButton iconButton; |
| | | private final JLabel label; |
| | | private final CellEditorButton editButton; |
| | | private final CellEditorButton deleteButton; |
| | | private boolean displayDelete; |
| | | private final JLabel lockLabel = Utilities.createDefaultLabel(); |
| | | |
| | | private final ImageIcon lockIcon = |
| | | Utilities.createImageIcon(IconPool.IMAGE_PATH+"/field-locked.png"); |
| | | |
| | | private Object value; |
| | | |
| | | private static final int THUMBNAIL_HEIGHT = 50; |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** Default constructor. */ |
| | | public BinaryCellPanel() |
| | |
| | | return value; |
| | | } |
| | | |
| | | /** Explicitly request the focus for the edit button of this panel. */ |
| | | public void requestFocusForButton() |
| | | { |
| | | editButton.requestFocusInWindow(); |
| | | } |
| | | |
| | | /** |
| | | * Adds an action listener to this panel. The action listener will be |
| | | * invoked when the user clicks on the 'Edit' button or the icon. |
| | |
| | | { |
| | | /** Node DN. */ |
| | | DN dn; |
| | | /** |
| | | * Storage object or null if this node exist |
| | | * only to support the DIT like structuring. |
| | | */ |
| | | /** Storage object or null if this node exist only to support the DIT like structuring. */ |
| | | T element; |
| | | /** Parent. */ |
| | | Node<T> parent; |
| | |
| | | /** Previous sibling. */ |
| | | Node<T> previous; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | if (element != null) |
| | | { |
| | | return "node(" + element + ")"; |
| | | } |
| | | else |
| | | { |
| | | return "glue"; |
| | | } |
| | | return element != null ? "node(" + element + ")" : "glue"; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Constructs a new DITCacheMap from a given Map. |
| | | * @param m existing Map to construct new |
| | | * DITCacheMap from. |
| | | */ |
| | | public DITCacheMap(Map<? extends DN, ? extends T> m) |
| | | { |
| | | this.putAll(m); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int size() |
| | | { |
| | | return size; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isEmpty() |
| | | { |
| | | return ditCacheMap.isEmpty(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsKey(Object key) |
| | | { |
| | | return get(key) != null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsValue(Object value) |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public T get(Object key) |
| | | { |
| | |
| | | return new DITSubtreeSet(key); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public T put(DN key, T value) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public T remove(Object key) |
| | | { |
| | |
| | | return returnValue; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Remove references to a node after it has been removed. |
| | | * @param node The node which has just been removed. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns {@code true} if there are stored objects subordinate to subtree DN. |
| | | * @param key subtree DN. |
| | |
| | | return ditCacheMap.containsKey(key); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Removes a set of stored objects subordinate to subtree DN. |
| | | * @param key subtree DN. |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Iterate through detached subtree counting and collecting any elements. |
| | | * |
| | |
| | | ditCacheMap.remove(node.dn); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void putAll(Map<? extends DN, ? extends T> m) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clear() |
| | | { |
| | |
| | | size = 0; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<Entry<DN, T>> entrySet() |
| | | { |
| | |
| | | hasNext = false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry<DN, T> next() |
| | | { |
| | |
| | | throw new NoSuchElementException(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int size() |
| | | { |
| | | return DITCacheMap.this.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Iterator<Entry<DN, T>> iterator() |
| | | { |
| | |
| | | this.value = value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getKey() |
| | | { |
| | | return key; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public T getValue() |
| | | { |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public T setValue(T value) |
| | | { |
| | |
| | | @Override |
| | | public boolean isEmpty() |
| | | { |
| | | return !(new SubtreeSetIterator(this.key).hasNext()); |
| | | return !new SubtreeSetIterator(this.key).hasNext(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.Group; |
| | | import org.opends.server.controls.GetEffectiveRightsRequestControl; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.protocols.ldap.LDAPClientConnection; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.AuthenticationType; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Operation; |
| | | |
| | | /** |
| | | * The AciContainer class contains all of the needed information to perform |
| | |
| | | * of testing if an ACI is applicable to an operation, and evaluation is |
| | | * the actual access evaluation of the ACI. |
| | | */ |
| | | public abstract class AciContainer |
| | | implements AciTargetMatchContext, AciEvalContext { |
| | | |
| | | /** |
| | | * The allow and deny lists. |
| | | */ |
| | | abstract class AciContainer implements AciTargetMatchContext, AciEvalContext { |
| | | /** The allow and deny lists. */ |
| | | private List<Aci> denyList, allowList; |
| | | |
| | | /** |
| | | * The attribute type in the resource entry currently being evaluated. |
| | | */ |
| | | /** The attribute type in the resource entry currently being evaluated. */ |
| | | private AttributeType attributeType; |
| | | |
| | | /** |
| | | * The attribute type value in the resource entry currently being |
| | | * evaluated. |
| | | */ |
| | | /** The attribute type value in the resource entry currently being evaluated. */ |
| | | private ByteString attributeValue; |
| | | |
| | | /** |
| | | * True if this is the first attribute type in the resource entry being |
| | | * evaluated. |
| | | */ |
| | | /** True if this is the first attribute type in the resource entry being evaluated. */ |
| | | private boolean isFirst; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private boolean isEntryTestRule; |
| | | |
| | | /** |
| | | * The right mask to use in the evaluation of the LDAP operation. |
| | | */ |
| | | /** The right mask to use in the evaluation of the LDAP operation. */ |
| | | private int rightsMask; |
| | | |
| | | /** |
| | | * The entry being evaluated (resource entry). |
| | | */ |
| | | private Entry resourceEntry; |
| | | /** The entry being evaluated (resource entry). */ |
| | | private final Entry resourceEntry; |
| | | |
| | | /** |
| | | * The client connection information. |
| | | */ |
| | | /** The client connection information. */ |
| | | private final ClientConnection clientConnection; |
| | | |
| | | /** |
| | | * The operation being evaluated. |
| | | */ |
| | | /** The operation being evaluated. */ |
| | | private final Operation operation; |
| | | |
| | | /** |
| | | * True if a targattrfilters match was found. |
| | | */ |
| | | /** True if a targattrfilters match was found. */ |
| | | private boolean targAttrFiltersMatch; |
| | | |
| | | /** |
| | |
| | | * switched back for non-proxy access checking. If proxied authentication |
| | | * is not being used then this entry never changes. |
| | | */ |
| | | private Entry authorizationEntry; |
| | | private final Entry authorizationEntry; |
| | | |
| | | /** |
| | | * True if proxied authorization is being used. |
| | | */ |
| | | private boolean proxiedAuthorization; |
| | | /** True if proxied authorization is being used. */ |
| | | private final boolean proxiedAuthorization; |
| | | |
| | | /** |
| | | * Used by proxied authorization processing. True if the entry has already |
| | |
| | | */ |
| | | private boolean seenEntry; |
| | | |
| | | /** |
| | | * True if geteffectiverights evaluation is in progress. |
| | | */ |
| | | /** True if geteffectiverights evaluation is in progress. */ |
| | | private boolean isGetEffectiveRightsEval; |
| | | |
| | | /** |
| | | * True if the operation has a geteffectiverights control. |
| | | */ |
| | | private boolean hasGetEffectiveRightsControl; |
| | | |
| | | /** |
| | | * The geteffectiverights authzID in DN format. |
| | | */ |
| | | private DN authzid; |
| | | /** True if the operation has a geteffectiverights control. */ |
| | | private final boolean hasGetEffectiveRightsControl; |
| | | /** The geteffectiverights authzID in DN format. */ |
| | | private final DN authzid; |
| | | |
| | | /** |
| | | * True if the authZid should be used as the client DN, only used in |
| | |
| | | * The list of specific attributes to get rights for, in addition to |
| | | * any attributes requested in the search. |
| | | */ |
| | | private List<AttributeType> specificAttrs; |
| | | private final List<AttributeType> specificAttrs; |
| | | |
| | | /** |
| | | * Table of ACIs that have targattrfilter keywords that matched. Used |
| | |
| | | */ |
| | | private int targAttrMatch; |
| | | |
| | | /** |
| | | * The ACI that decided the last evaluation. Used in geteffectiverights |
| | | * loginfo processing. |
| | | */ |
| | | /** The ACI that decided the last evaluation. Used in geteffectiverights loginfo processing. */ |
| | | private Aci decidingAci; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private String summaryString; |
| | | |
| | | /** |
| | | * Flag used to determine if ACI all attributes target matched. |
| | | */ |
| | | /** Flag used to determine if ACI all attributes target matched. */ |
| | | private int evalAllAttributes; |
| | | |
| | | /** |
| | | * String used to hold a control OID string. |
| | | */ |
| | | /** String used to hold a control OID string. */ |
| | | private String controlOID; |
| | | |
| | | /** |
| | | * String used to hold an extended operation OID string. |
| | | */ |
| | | /** String used to hold an extended operation OID string. */ |
| | | private String extOpOID; |
| | | |
| | | /** |
| | | * AuthenticationInfo class to use. |
| | | */ |
| | | private AuthenticationInfo authInfo; |
| | | /** AuthenticationInfo class to use. */ |
| | | private final AuthenticationInfo authInfo; |
| | | |
| | | /** |
| | | * This constructor is used by all currently supported LDAP operations |
| | |
| | | && operation instanceof SearchOperation) |
| | | { |
| | | hasGetEffectiveRightsControl = true; |
| | | if (getEffectiveRightsControl.getAuthzDN() == null) { |
| | | this.authzid = getClientDN(); |
| | | } else { |
| | | this.authzid = getEffectiveRightsControl.getAuthzDN(); |
| | | } |
| | | DN authzDN = getEffectiveRightsControl.getAuthzDN(); |
| | | this.authzid = authzDN != null ? authzDN : getClientDN(); |
| | | this.specificAttrs = getEffectiveRightsControl.getAttributes(); |
| | | } else { |
| | | hasGetEffectiveRightsControl = false; |
| | | authzid = null; |
| | | specificAttrs = null; |
| | | } |
| | | |
| | | //If an ACI evaluated because of an Targetattr="*", then the |
| | |
| | | { |
| | | evalAllAttributes |= ACI_OP_ATTR_PLUS_MATCHED; |
| | | } |
| | | } else { |
| | | hasGetEffectiveRightsControl = false; |
| | | authzid = null; |
| | | specificAttrs = null; |
| | | } |
| | | |
| | | //Reference the current authorization entry, so it can be put back |
| | |
| | | this.authInfo = authInfo; |
| | | this.authorizationEntry = authInfo.getAuthorizationEntry(); |
| | | this.rightsMask = rights; |
| | | proxiedAuthorization = false; |
| | | hasGetEffectiveRightsControl = false; |
| | | authzid = null; |
| | | specificAttrs = null; |
| | | } |
| | | |
| | | /** |
| | | * Returns true if an entry has already been processed by an access proxy |
| | | * check. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Set to true if an entry has already been processed by an access proxy |
| | | * check. |
| | | * Set to true if an entry has already been processed by an access proxy check. |
| | | * |
| | | * @param val The value to set the seenEntry boolean to. |
| | | */ |
| | |
| | | this.seenEntry=val; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isProxiedAuthorization() { |
| | | return this.proxiedAuthorization; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isGetEffectiveRightsEval() { |
| | | return this.isGetEffectiveRightsEval; |
| | |
| | | return this.specificAttrs; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addTargAttrFiltersMatchAci(Aci aci) { |
| | | this.targAttrFilterAcis.put(aci, aci); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasTargAttrFiltersMatchAci(Aci aci) { |
| | | return this.targAttrFilterAcis.containsKey(aci); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isTargAttrFilterMatchAciEmpty() { |
| | | return this.targAttrFilterAcis.isEmpty(); |
| | |
| | | this.targAttrMatch=0; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTargAttrFiltersAciName(String name) { |
| | | this.targAttrFiltersAciName=name; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getTargAttrFiltersAciName() { |
| | | return this.targAttrFiltersAciName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTargAttrFiltersMatchOp(int flag) { |
| | | this.targAttrMatch |= flag; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasTargAttrFiltersMatchOp(int flag) { |
| | | return (this.targAttrMatch & flag) != 0; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getDecidingAciName() { |
| | | if(this.decidingAci != null) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setEvaluationResult(EnumEvalReason reason, Aci decidingAci) |
| | | { |
| | |
| | | this.decidingAci = decidingAci; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public EnumEvalReason getEvalReason() { |
| | | return this.evalReason; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setEvalSummary(String summary) { |
| | | this.summaryString=summary; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getEvalSummary() { |
| | | return this.summaryString; |
| | |
| | | return this.authzid.equals(this.authorizationEntry.getName()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDenyList(List<Aci> denys) { |
| | | denyList=denys; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setAllowList(List<Aci> allows) { |
| | | allowList=allows; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AttributeType getCurrentAttributeType() { |
| | | return attributeType; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getCurrentAttributeValue() { |
| | | return attributeValue; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setCurrentAttributeType(AttributeType type) { |
| | | attributeType=type; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setCurrentAttributeValue(ByteString value) { |
| | | attributeValue=value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isFirstAttribute() { |
| | | return isFirst; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setIsFirstAttribute(boolean val) { |
| | | isFirst=val; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasEntryTestRule() { |
| | | return isEntryTestRule; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setEntryTestRule(boolean val) { |
| | | isEntryTestRule=val; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getResourceEntry() { |
| | | return resourceEntry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getClientEntry() { |
| | | return this.authorizationEntry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Aci> getDenyList() { |
| | | return denyList; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Aci> getAllowList() { |
| | | return allowList; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isDenyEval() { |
| | | return EnumEvalReason.NO_ALLOW_ACIS.equals(evalReason) |
| | | || EnumEvalReason.EVALUATED_DENY_ACI.equals(evalReason); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAnonymousUser() { |
| | | return !authInfo.isAuthenticated(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getClientDN() { |
| | | if(this.useAuthzid) |
| | |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN getResourceDN() { |
| | | return resourceEntry.getName(); |
| | |
| | | return (this.rightsMask & rights) != 0; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRights() { |
| | | return this.rightsMask; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setRights(int rights) { |
| | | this.rightsMask=rights; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getHostName() { |
| | | return clientConnection.getRemoteAddress().getCanonicalHostName(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public InetAddress getRemoteAddress() { |
| | | return clientConnection.getRemoteAddress(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isAddOperation() { |
| | | return operation instanceof AddOperation; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTargAttrFiltersMatch(boolean v) { |
| | | this.targAttrFiltersMatch=v; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean getTargAttrFiltersMatch() { |
| | | return targAttrFiltersMatch; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getControlOID() { |
| | | return controlOID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getExtOpOID() { |
| | | return extOpOID; |
| | |
| | | this.controlOID=oid; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set the extended operation OID value to the specified oid string. |
| | | * |
| | |
| | | this.extOpOID=oid; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public EnumEvalResult hasAuthenticationMethod(EnumAuthMethod authMethod, |
| | | String saslMech) { |
| | |
| | | return matched; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isMemberOf(Group<?> group) { |
| | | try { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setEvalUserAttributes(int v) { |
| | | if(rightsMask == ACI_READ) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setEvalOpAttributes(int v) { |
| | | if(rightsMask == ACI_READ) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasEvalUserAttributes() { |
| | | return hasAttribute(ACI_FOUND_USER_ATTR_RULE); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasEvalOpAttributes() { |
| | | return hasAttribute(ACI_FOUND_OP_ATTR_RULE); |
| | |
| | | return (evalAllAttributes & aciAttribute) == aciAttribute; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void clearEvalAttributes(int v) { |
| | | if(v == 0) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getCurrentSSF() { |
| | | return clientConnection.getSSF(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import static com.sleepycat.je.EnvironmentConfig.*; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | |
| | |
| | | import com.sleepycat.je.dbi.MemoryBudget; |
| | | |
| | | /** This class maps JE properties to configuration attributes. */ |
| | | public class ConfigurableEnvironment |
| | | class ConfigurableEnvironment |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | * The name of the attribute which configures the database cache size as a |
| | | * percentage of Java VM heap size. |
| | | */ |
| | | public static final String ATTR_DATABASE_CACHE_PERCENT = |
| | | private static final String ATTR_DATABASE_CACHE_PERCENT = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-cache-percent"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the database cache size as an |
| | | * approximate number of bytes. |
| | | */ |
| | | public static final String ATTR_DATABASE_CACHE_SIZE = |
| | | private static final String ATTR_DATABASE_CACHE_SIZE = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-cache-size"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures whether data updated by a |
| | | * database transaction is forced to disk. |
| | | */ |
| | | public static final String ATTR_DATABASE_TXN_NO_SYNC = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-txn-no-sync"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures whether data updated by a |
| | | * database transaction is written from the Java VM to the O/S. |
| | | */ |
| | | public static final String ATTR_DATABASE_TXN_WRITE_NO_SYNC = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-txn-write-no-sync"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures whether the database background |
| | | * cleaner thread runs. |
| | | */ |
| | | public static final String ATTR_DATABASE_RUN_CLEANER = |
| | | private static final String ATTR_DATABASE_RUN_CLEANER = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-run-cleaner"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the minimum percentage of log |
| | | * space that must be used in log files. |
| | | */ |
| | | public static final String ATTR_CLEANER_MIN_UTILIZATION = |
| | | private static final String ATTR_CLEANER_MIN_UTILIZATION = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-cleaner-min-utilization"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the maximum size of each |
| | | * individual JE log file, in bytes. |
| | | */ |
| | | public static final String ATTR_DATABASE_LOG_FILE_MAX = |
| | | private static final String ATTR_DATABASE_LOG_FILE_MAX = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-log-file-max"; |
| | | |
| | | /** The name of the attribute which configures the database cache eviction algorithm. */ |
| | | public static final String ATTR_EVICTOR_LRU_ONLY = |
| | | private static final String ATTR_EVICTOR_LRU_ONLY = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-evictor-lru-only"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the number of nodes in one scan |
| | | * of the database cache evictor. |
| | | */ |
| | | public static final String ATTR_EVICTOR_NODES_PER_SCAN = |
| | | private static final String ATTR_EVICTOR_NODES_PER_SCAN = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-evictor-nodes-per-scan"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the minimum number of threads |
| | | * of the database cache evictor pool. |
| | | */ |
| | | public static final String ATTR_EVICTOR_CORE_THREADS = |
| | | private static final String ATTR_EVICTOR_CORE_THREADS = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-evictor-core-threads"; |
| | | /** |
| | | * The name of the attribute which configures the maximum number of threads |
| | | * of the database cache evictor pool. |
| | | */ |
| | | public static final String ATTR_EVICTOR_MAX_THREADS = |
| | | private static final String ATTR_EVICTOR_MAX_THREADS = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-evictor-max-threads"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the time excess threads |
| | | * of the database cache evictor pool are kept alive. |
| | | */ |
| | | public static final String ATTR_EVICTOR_KEEP_ALIVE = |
| | | private static final String ATTR_EVICTOR_KEEP_ALIVE = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-evictor-keep-alive"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures whether the logging file |
| | | * handler will be on or off. |
| | | */ |
| | | public static final String ATTR_LOGGING_FILE_HANDLER_ON = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-logging-file-handler-on"; |
| | | |
| | | /** The name of the attribute which configures the trace logging message level. */ |
| | | public static final String ATTR_LOGGING_LEVEL = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-logging-level"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures how many bytes are written to |
| | | * the log before the checkpointer runs. |
| | | */ |
| | | public static final String ATTR_CHECKPOINTER_BYTES_INTERVAL = |
| | | private static final String ATTR_CHECKPOINTER_BYTES_INTERVAL = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-checkpointer-bytes-interval"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the amount of time between |
| | | * runs of the checkpointer. |
| | | */ |
| | | public static final String ATTR_CHECKPOINTER_WAKEUP_INTERVAL = |
| | | private static final String ATTR_CHECKPOINTER_WAKEUP_INTERVAL = |
| | | ConfigConstants.NAME_PREFIX_CFG + |
| | | "db-checkpointer-wakeup-interval"; |
| | | |
| | | /** The name of the attribute which configures the number of lock tables. */ |
| | | public static final String ATTR_NUM_LOCK_TABLES = |
| | | private static final String ATTR_NUM_LOCK_TABLES = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-num-lock-tables"; |
| | | |
| | | /** |
| | | * The name of the attribute which configures the number threads |
| | | * allocated by the cleaner for log file processing. |
| | | */ |
| | | public static final String ATTR_NUM_CLEANER_THREADS = |
| | | private static final String ATTR_NUM_CLEANER_THREADS = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-num-cleaner-threads"; |
| | | |
| | | /** The name of the attribute which configures the size of the file handle cache. */ |
| | | public static final String ATTR_LOG_FILECACHE_SIZE = |
| | | private static final String ATTR_LOG_FILECACHE_SIZE = |
| | | ConfigConstants.NAME_PREFIX_CFG + "db-log-filecache-size"; |
| | | |
| | | /** The name of the attribute which may specify any native JE properties. */ |
| | | public static final String ATTR_JE_PROPERTY = |
| | | ConfigConstants.NAME_PREFIX_CFG + "je-property"; |
| | | |
| | | /** A map of JE property names to the corresponding configuration attribute. */ |
| | | private static HashMap<String, String> attrMap = new HashMap<>(); |
| | | private static final Map<String, String> attrMap = new HashMap<>(); |
| | | |
| | | /** |
| | | * A map of configuration attribute names to the corresponding configuration object getter method. |
| | | */ |
| | | private static Map<String, Method> jebMethodMap = new HashMap<>(); |
| | | private static final Map<String, Method> jebMethodMap = new HashMap<>(); |
| | | /** A map of configuration attribute names to the corresponding configuration PropertyDefinition. */ |
| | | private static Map<String, PropertyDefinition<?>> jebDefnMap = new HashMap<>(); |
| | | private static final Map<String, PropertyDefinition<?>> jebDefnMap = new HashMap<>(); |
| | | |
| | | /** Pulled from resource/admin/ABBREVIATIONS.xsl. db is mose common. */ |
| | | private static final List<String> ABBREVIATIONS = Arrays.asList(new String[] |
| | |
| | | } |
| | | |
| | | /** |
| | | * Get the name of the configuration attribute associated with a JE property. |
| | | * @param jeProperty The name of the JE property. |
| | | * @return The name of the associated configuration attribute. |
| | | */ |
| | | public static String getAttributeForProperty(String jeProperty) |
| | | { |
| | | return attrMap.get(jeProperty); |
| | | } |
| | | |
| | | /** |
| | | * Get the value of a JE property that is mapped to a configuration attribute. |
| | | * @param cfg The configuration containing the property values. |
| | | * @param attrName The configuration attribute type name. |
| | |
| | | * |
| | | * @return A JE environment config containing default values. |
| | | */ |
| | | public static EnvironmentConfig defaultConfig() |
| | | private static EnvironmentConfig defaultConfig() |
| | | { |
| | | EnvironmentConfig envConfig = new EnvironmentConfig(); |
| | | |
| | |
| | | * @throws ConfigException If there is an error in the provided configuration |
| | | * entry. |
| | | */ |
| | | public static EnvironmentConfig parseConfigEntry(JEBackendCfg cfg) throws ConfigException |
| | | static EnvironmentConfig parseConfigEntry(JEBackendCfg cfg) throws ConfigException |
| | | { |
| | | validateDbCacheSize(cfg.getDBCacheSize()); |
| | | |
| | |
| | | * @throws ConfigException If there is an error while parsing, |
| | | * validating and setting any of the properties provided. |
| | | */ |
| | | public static EnvironmentConfig setJEProperties(EnvironmentConfig envConfig, |
| | | SortedSet<String> jeProperties, HashMap<String, String> configAttrMap) |
| | | private static EnvironmentConfig setJEProperties(EnvironmentConfig envConfig, |
| | | SortedSet<String> jeProperties, Map<String, String> configAttrMap) |
| | | throws ConfigException |
| | | { |
| | | if (jeProperties.isEmpty()) { |
| | |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStreamWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.util.TimeThread; |
| | |
| | | |
| | | private static final String UTF8_ENCODING= "UTF-8"; |
| | | |
| | | private CopyOnWriteArrayList<RotationPolicy> rotationPolicies = new CopyOnWriteArrayList<>(); |
| | | private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies = new CopyOnWriteArrayList<>(); |
| | | private final CopyOnWriteArrayList<RotationPolicy<?>> rotationPolicies = new CopyOnWriteArrayList<>(); |
| | | private final CopyOnWriteArrayList<RetentionPolicy<?>> retentionPolicies = new CopyOnWriteArrayList<>(); |
| | | |
| | | private FileNamingPolicy namingPolicy; |
| | | private FilePermission filePermissions; |
| | | private LogPublisherErrorHandler errorHandler; |
| | | /** TODO: Implement actions. */ |
| | | private ArrayList<ActionType> actions; |
| | | private final LogPublisherErrorHandler errorHandler; |
| | | |
| | | private String name; |
| | | private String encoding; |
| | | private final String name; |
| | | private final String encoding; |
| | | private int bufferSize; |
| | | private boolean autoFlush; |
| | | private boolean append; |
| | |
| | | private boolean stopRequested; |
| | | private long sizeLimit; |
| | | |
| | | private Thread rotaterThread; |
| | | private final Thread rotaterThread; |
| | | |
| | | private Calendar lastRotationTime = TimeThread.getCalendar(); |
| | | private Calendar lastCleanTime = TimeThread.getCalendar(); |
| | |
| | | * |
| | | * @param policy The rotation policy to add. |
| | | */ |
| | | public void addRotationPolicy(RotationPolicy policy) |
| | | public void addRotationPolicy(RotationPolicy<?> policy) |
| | | { |
| | | this.rotationPolicies.add(policy); |
| | | |
| | |
| | | * |
| | | * @param policy The retention policy to add. |
| | | */ |
| | | public void addRetentionPolicy(RetentionPolicy policy) |
| | | public void addRetentionPolicy(RetentionPolicy<?> policy) |
| | | { |
| | | this.retentionPolicies.add(policy); |
| | | } |
| | |
| | | /** Removes all the rotation policies currently enforced by this writer. */ |
| | | public void removeAllRotationPolicies() |
| | | { |
| | | for(RotationPolicy policy : rotationPolicies) |
| | | for (RotationPolicy<?> policy : rotationPolicies) |
| | | { |
| | | if(policy instanceof SizeBasedRotationPolicy) |
| | | { |
| | |
| | | long newSizeLimit = Integer.MAX_VALUE; |
| | | |
| | | // Go through all current size rotation policies and get the lowest size setting. |
| | | for(RotationPolicy policy : rotationPolicies) |
| | | for (RotationPolicy<?> policy : rotationPolicies) |
| | | { |
| | | if(policy instanceof SizeBasedRotationPolicy) |
| | | { |
| | |
| | | private class RotaterThread extends DirectoryThread |
| | | { |
| | | MultifileTextWriter writer; |
| | | /** Create a new rotater thread. */ |
| | | |
| | | public RotaterThread(MultifileTextWriter writer) |
| | | { |
| | | super(name); |
| | |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | for(RotationPolicy rotationPolicy : rotationPolicies) |
| | | for (RotationPolicy<?> rotationPolicy : rotationPolicies) |
| | | { |
| | | if(rotationPolicy.rotateFile(writer)) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | for(RetentionPolicy retentionPolicy : retentionPolicies) |
| | | for (RetentionPolicy<?> retentionPolicy : retentionPolicies) |
| | | { |
| | | try |
| | | { |
| | |
| | | errorHandler.handleOpenError(currentFile, e); |
| | | } |
| | | |
| | | //RotationActionThread rotThread = |
| | | // new RotationActionThread(newFile, actions, configEntry); |
| | | //rotThread.start(); |
| | | |
| | | logger.trace("Log file %s rotated and renamed to %s", |
| | | currentFile, newFile); |
| | | logger.trace("Log file %s rotated and renamed to %s", currentFile, newFile); |
| | | totalFilesRotated++; |
| | | lastRotationTime = TimeThread.getCalendar(); |
| | | } |
| | | |
| | | /** |
| | | * This method sets the actions that need to be executed after rotation. |
| | | * |
| | | * @param actions An array of actions that need to be executed on rotation. |
| | | */ |
| | | public void setPostRotationActions(ArrayList<ActionType> actions) |
| | | { |
| | | this.actions = actions; |
| | | } |
| | | |
| | | @Override |
| | | public long getBytesWritten() |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.*; |
| | | |
| | | import static org.forgerock.util.Utils.*; |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.messages.UtilityMessages.*; |
| | | |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.*; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import org.opends.quicksetup.CurrentInstallStatus; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.LicenseFile; |
| | | import org.opends.quicksetup.TempLogFile; |
| | | import org.opends.quicksetup.SecurityOptions; |
| | | import org.opends.quicksetup.TempLogFile; |
| | | import org.opends.quicksetup.UserData; |
| | | import org.opends.quicksetup.UserDataException; |
| | | import org.opends.quicksetup.event.ProgressUpdateEvent; |
| | |
| | | */ |
| | | public class InstallDS extends ConsoleApplication |
| | | { |
| | | |
| | | private final PlainTextProgressMessageFormatter formatter = new PlainTextProgressMessageFormatter(); |
| | | |
| | | /** Prefix for log files. */ |
| | | public static final String TMP_FILE_PREFIX = "opendj-setup-"; |
| | | |
| | | /** Suffix for log files. */ |
| | | public static final String LOG_FILE_SUFFIX = ".log"; |
| | | |
| | | /** |
| | | * The enumeration containing the different return codes that the command-line |
| | | * can have. |
| | | */ |
| | | /** The enumeration containing the different return codes that the command-line can have. */ |
| | | private enum InstallReturnCode |
| | | { |
| | | SUCCESSFUL(0), |
| | | |
| | | /** We did no have an error but the setup was not executed (displayed version or usage). */ |
| | | SUCCESSFUL_NOP(0), |
| | | |
| | | /** Unexpected error (potential bug). */ |
| | | ERROR_UNEXPECTED(1), |
| | | |
| | | /** Cannot parse arguments or data provided by user is not valid. */ |
| | | ERROR_USER_DATA(2), |
| | | |
| | | /** Error server already installed. */ |
| | | ERROR_SERVER_ALREADY_INSTALLED(3), |
| | | |
| | | /** Error initializing server. */ |
| | | ERROR_INITIALIZING_SERVER(4), |
| | | |
| | | /** The user failed providing password (for the keystore for instance). */ |
| | | ERROR_PASSWORD_LIMIT(5), |
| | | |
| | | /** The user cancelled the setup. */ |
| | | ERROR_USER_CANCELLED(6), |
| | | |
| | | /** The user doesn't accept the license. */ |
| | | ERROR_LICENSE_NOT_ACCEPTED(7); |
| | | |
| | |
| | | * The maximum number of times that we should ask the user to provide the |
| | | * password to access to a keystore. |
| | | */ |
| | | public static final int LIMIT_KEYSTORE_PASSWORD_PROMPT = 7; |
| | | private static final int LIMIT_KEYSTORE_PASSWORD_PROMPT = 7; |
| | | |
| | | private final BackendTypeHelper backendTypeHelper = new BackendTypeHelper(); |
| | | |
| | |
| | | * the list that will be updated with the nicknames found in the key |
| | | * store. |
| | | */ |
| | | public static void checkCertificateInKeystore(SecurityOptions.CertificateType type, String path, String pwd, |
| | | private static void checkCertificateInKeystore(SecurityOptions.CertificateType type, String path, String pwd, |
| | | Collection<String> certNicknames, Collection<LocalizableMessage> errorMessages, Collection<String> nicknameList) |
| | | { |
| | | boolean errorWithPath = false; |
| | |
| | | private SecurityOptions createSecurityOptionsPrompting(SecurityOptions.CertificateType type, boolean enableSSL, |
| | | boolean enableStartTLS, int ldapsPort) throws UserDataException, ClientException |
| | | { |
| | | SecurityOptions securityOptions; |
| | | String path; |
| | | Collection<String> certNicknames = argParser.certNicknameArg.getValues(); |
| | | String pwd = argParser.getKeyStorePassword(); |
| | |
| | | * to a problem with the key store path and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public static boolean containsKeyStorePathErrorMessage(Collection<LocalizableMessage> msgs) |
| | | private static boolean containsKeyStorePathErrorMessage(Collection<LocalizableMessage> msgs) |
| | | { |
| | | for (final LocalizableMessage msg : msgs) |
| | | { |
| | |
| | | * to a problem with the key store password and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public static boolean containsKeyStorePasswordErrorMessage(Collection<LocalizableMessage> msgs) |
| | | private static boolean containsKeyStorePasswordErrorMessage(Collection<LocalizableMessage> msgs) |
| | | { |
| | | for (final LocalizableMessage msg : msgs) |
| | | { |
| | |
| | | * to a problem with the certificate nickname and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public static boolean containsCertNicknameErrorMessage( |
| | | Collection<LocalizableMessage> msgs) |
| | | private static boolean containsCertNicknameErrorMessage(Collection<LocalizableMessage> msgs) |
| | | { |
| | | boolean found = false; |
| | | for (final LocalizableMessage msg : msgs) |
| | | { |
| | | if (StaticUtils.hasDescriptor(msg, ERR_INSTALLDS_CERTNICKNAME_NOT_FOUND) || |
| | | StaticUtils.hasDescriptor(msg, ERR_INSTALLDS_MUST_PROVIDE_CERTNICKNAME)) |
| | | { |
| | | found = true; |
| | | break; |
| | | return true; |
| | | } |
| | | } |
| | | return found; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2013-2015 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.tools.upgrade; |
| | | |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | |
| | | /** |
| | | * An upgrade task. |
| | | */ |
| | | public interface UpgradeTask |
| | | /** An upgrade task. */ |
| | | interface UpgradeTask |
| | | { |
| | | |
| | | /** |
| | | * Defines the different types of upgrade tasks. |
| | | */ |
| | | public enum TaskType { |
| | | /** |
| | | * Defines a standard task. |
| | | */ |
| | | NORMAL, |
| | | /** |
| | | * Defines a task which require a standard user interaction. |
| | | */ |
| | | NEED_USER_INTERACTION, |
| | | /** |
| | | * Defines a critical task which require an imperative user interaction. |
| | | */ |
| | | MANDATORY_USER_INTERACTION, |
| | | /** |
| | | * Defines a task which take a long time to complete. |
| | | */ |
| | | TAKE_LONG_TIME_TO_COMPLETE, |
| | | /** |
| | | * Defines a task which cannot be reverted once started. |
| | | */ |
| | | CANNOT_BE_REVERTED |
| | | } |
| | | |
| | | /** |
| | | * Performs any preparation work required before performing the upgrade task, including |
| | | * interacting with the user where needed (e.g. in order to ask for confirmation), and throw a |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | |
| | | if (fks.iterator().hasNext()) |
| | | { |
| | | FakeOperation fk = fks.iterator().next(); |
| | | assertEquals(new FakeOperationComparator().compare(fk, fk), 0); |
| | | assertTrue(new FakeOperationComparator().compare(null, fk) < 0); |
| | | assertEquals(fk.getCSN().compareTo(fk.getCSN()), 0); |
| | | ReplicationMsg generatedMsg = fk.generateMessage(); |
| | | if (generatedMsg instanceof LDAPUpdateMsg) |
| | | { |