| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | private boolean displayReplicationInformation; |
| | | |
| | | /** Key value to identify the case of a value not available because the server is down. */ |
| | | public static String NOT_AVAILABLE_SERVER_DOWN = "NOT_AVAILABLE_SERVER_DOWN"; |
| | | public static final String NOT_AVAILABLE_SERVER_DOWN = "NOT_AVAILABLE_SERVER_DOWN"; |
| | | |
| | | /** Key value to identify the case of a value not available because authentication is required. */ |
| | | public static String NOT_AVAILABLE_AUTHENTICATION_REQUIRED = |
| | | public static final String NOT_AVAILABLE_AUTHENTICATION_REQUIRED = |
| | | "NOT_AVAILABLE_AUTHENTICATION_REQUIRED"; |
| | | |
| | | /** Key value to identify the case of a value not available. */ |
| | | public static String NOT_AVAILABLE = "NOT_AVAILABLE"; |
| | | public static final String NOT_AVAILABLE = "NOT_AVAILABLE"; |
| | | |
| | | /** |
| | | * Constructor for this table model. |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | |
| | | { |
| | | String start = firstValueAsString(rootMonitor, START_DATE.getAttributeName()); |
| | | String current = firstValueAsString(rootMonitor, CURRENT_DATE.getAttributeName()); |
| | | Date startTime = ConfigFromConnection.utcParser.parse(start); |
| | | Date currentTime = ConfigFromConnection.utcParser.parse(current); |
| | | SimpleDateFormat utcParser = ConfigFromConnection.newUtcParser(); |
| | | Date startTime = utcParser.parse(start); |
| | | Date currentTime = utcParser.parse(current); |
| | | return currentTime.getTime() - startTime.getTime(); |
| | | } |
| | | catch (Throwable t) |
| | |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.GridBagConstraints; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import javax.swing.Box; |
| | |
| | | { |
| | | String start = firstValueAsString(sr, START_DATE.getAttributeName()); |
| | | String current = firstValueAsString(sr, CURRENT_DATE.getAttributeName()); |
| | | Date startTime = ConfigFromConnection.utcParser.parse(start); |
| | | Date currentTime = ConfigFromConnection.utcParser.parse(current); |
| | | SimpleDateFormat utcParser = ConfigFromConnection.newUtcParser(); |
| | | Date startTime = utcParser.parse(start); |
| | | Date currentTime = utcParser.parse(current); |
| | | |
| | | long upSeconds = (currentTime.getTime() - startTime.getTime()) / 1000; |
| | | long upDays = upSeconds / 86400; |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui.renderer; |
| | | |
| | |
| | | public Component getTableCellRendererComponent(JTable table, Object value, |
| | | boolean isSelected, boolean hasFocus, int row, int column) { |
| | | String text = (String)value; |
| | | if (text == BaseDNTableModel.NOT_AVAILABLE) |
| | | if (BaseDNTableModel.NOT_AVAILABLE.equals(text)) |
| | | { |
| | | Utilities.setNotAvailable(this); |
| | | } |
| | | else if (text == BaseDNTableModel.NOT_AVAILABLE_AUTHENTICATION_REQUIRED) |
| | | else if (BaseDNTableModel.NOT_AVAILABLE_AUTHENTICATION_REQUIRED.equals(text)) |
| | | { |
| | | Utilities.setNotAvailableBecauseAuthenticationIsRequired(this); |
| | | } |
| | | else if (text == BaseDNTableModel.NOT_AVAILABLE_SERVER_DOWN) |
| | | else if (BaseDNTableModel.NOT_AVAILABLE_SERVER_DOWN.equals(text)) |
| | | { |
| | | Utilities.setNotAvailableBecauseServerIsDown(this); |
| | | } |
| | |
| | | * |
| | | * Copyright 2008-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** The date formatter to be used to parse GMT dates. */ |
| | | public static final SimpleDateFormat utcParser = new SimpleDateFormat(ServerConstants.DATE_FORMAT_GMT_TIME); |
| | | /** |
| | | * Returns a date formatter to be used to parse GMT dates. |
| | | * <p> |
| | | * A new instance is returned by each call because {@link SimpleDateFormat} is not thread-safe and |
| | | * this method is called from several threads. |
| | | * |
| | | * @return a date formatter to be used to parse GMT dates |
| | | */ |
| | | public static SimpleDateFormat newUtcParser() |
| | | { |
| | | SimpleDateFormat utcParser = new SimpleDateFormat(ServerConstants.DATE_FORMAT_GMT_TIME); |
| | | utcParser.setTimeZone(TimeZone.getTimeZone("UTC")); |
| | | return utcParser; |
| | | } |
| | | |
| | | /** The date formatter to be used to format dates. */ |
| | | public static final DateFormat formatter = DateFormat.getDateTimeInstance(); |
| | | /** |
| | | * Returns a date formatter to be used to format dates. |
| | | * <p> |
| | | * A new instance is returned by each call because {@link DateFormat} is not thread-safe and this |
| | | * method is called from several threads. |
| | | * |
| | | * @return a date formatter to be used to format dates |
| | | */ |
| | | public static DateFormat newDateFormatter() |
| | | { |
| | | return DateFormat.getDateTimeInstance(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the monitoring entry for the entry caches. |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | |
| | | } |
| | | Long l = Long.parseLong(monitoringValue); |
| | | Date date = new Date(l); |
| | | return ConfigFromConnection.formatter.format(date); |
| | | return ConfigFromConnection.newDateFormatter().format(date); |
| | | } |
| | | else if (attr.isTime()) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | Date date = ConfigFromConnection.utcParser.parse(monitoringValue); |
| | | return ConfigFromConnection.formatter.format(date); |
| | | Date date = ConfigFromConnection.newUtcParser().parse(monitoringValue); |
| | | return ConfigFromConnection.newDateFormatter().format(date); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | if (loginContext == null) |
| | | { |
| | | loginContext = new LoginContext( |
| | | // Only publish the login context once the login has completed, otherwise another thread |
| | | // could obtain it through the unsynchronized check above before it is usable. |
| | | final LoginContext newLoginContext = new LoginContext( |
| | | GSSAPISASLMechanismHandler.class.getName(), this); |
| | | loginContext.login(); |
| | | newLoginContext.login(); |
| | | loginContext = newLoginContext; |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; |
| | | |
| | | /** |
| | | * Source of randomness used to generate salts. A single shared instance is used because |
| | | * {@code SecureRandom} is thread-safe and reseeding it for every value would weaken it. |
| | | */ |
| | | private static final SecureRandom SALT_RANDOM = new SecureRandom(); |
| | | |
| | | /** |
| | | * Base64 like conversion of bytes to ASCII chars. |
| | | * |
| | | * @param b2 |
| | |
| | | static String getRandomSalt(int num) { |
| | | StringBuilder saltString = new StringBuilder(); |
| | | for (int i = 1; i <= num; i++) { |
| | | saltString.append(B64T.charAt(new Random(). |
| | | nextInt(B64T.length()))); |
| | | saltString.append(B64T.charAt(SALT_RANDOM.nextInt(B64T.length()))); |
| | | } |
| | | return saltString.toString(); |
| | | } |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | { |
| | | this.name = name; |
| | | this.autoFlush = autoFlush; |
| | | this.writer = writer; |
| | | this.writer = Reject.checkNotNull(writer); |
| | | |
| | | this.queue = new LinkedBlockingQueue<>(capacity); |
| | | this.capacity = capacity; |
| | |
| | | @Override |
| | | public void writeRecord(String record) |
| | | { |
| | | // No writer? Off to the bit bucket. |
| | | if (writer != null) { |
| | | while (!stopRequested.get()) |
| | | while (!stopRequested.get()) |
| | | { |
| | | // Put request on queue for writer |
| | | try |
| | | { |
| | | // Put request on queue for writer |
| | | try |
| | | { |
| | | queue.put(record); |
| | | break; |
| | | } |
| | | catch(InterruptedException e) |
| | | { |
| | | // We expect this to happen. Just ignore it and hopefully |
| | | // drop out in the next try. |
| | | } |
| | | queue.put(record); |
| | | break; |
| | | } |
| | | catch(InterruptedException e) |
| | | { |
| | | // We expect this to happen. Just ignore it and hopefully |
| | | // drop out in the next try. |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // Shutdown the wrapped writer. |
| | | if (shutdownWrapped && writer != null) |
| | | if (shutdownWrapped) |
| | | { |
| | | writer.shutdown(); |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2015-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | */ |
| | | public void removePublisher(LogPublisherCfg config) throws ConfigException |
| | | { |
| | | logger.trace(String.format("Shutting down common audit for configuration entry:", config.dn())); |
| | | logger.trace(String.format("Shutting down common audit for configuration entry: %s", config.dn())); |
| | | String normalizedName = getConfigNormalizedName(config); |
| | | try |
| | | { |