Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static void |
addClickTooltipListener(JComponent comp)
Adds a click tool tip listener to the provided component.
|
static String |
applyFont(CharSequence html,
Font font)
Returns a String that contains the html passed as parameter with a span
applied.
|
static void |
centerGoldenMean(Window comp,
Component ref)
Center the component location of the ref component.
|
static void |
centerOnScreen(Component comp)
Center the component location based on its preferred size.
|
static void |
computeMonitoringPossibleResults(org.forgerock.opendj.ldap.messages.SearchResultEntry monitor1,
org.forgerock.opendj.ldap.messages.SearchResultEntry monitor2,
List<Integer> possibleResults,
Collection<String> attrNames)
Computes the possible comparison results for monitoring information.
|
static JScrollPane |
createBorderLessScrollBar(Component comp)
Returns a JScrollPane that contains the provided component.
|
static JButton |
createButton(LocalizableMessage text)
Creates a button.
|
static JCheckBox |
createCheckBox(LocalizableMessage text)
Creates a check box.
|
static <T> JComboBox<T> |
createComboBox()
Creates a combo box.
|
static JLabel |
createDefaultLabel()
Creates a label (with default font) with no text.
|
static JLabel |
createDefaultLabel(LocalizableMessage text)
Creates a label (with default font).
|
static JFrame |
createFrame()
Creates a frame.
|
static ImageIcon |
createImageIcon(byte[] bytes,
int maxHeight,
LocalizableMessage description,
boolean useFast)
Creates an image icon using an array of bytes that contain the image and
specifying the maximum height of the image.
|
static ImageIcon |
createImageIcon(String path)
Returns an ImageIcon or
null if the path was invalid. |
static ImageIcon |
createImageIcon(String path,
ClassLoader loader)
Returns an ImageIcon or
null if the path was invalid. |
static JLabel |
createInlineHelpLabel(LocalizableMessage text)
Creates a label of type 'inline help' (with smaller font).
|
static JTextField |
createLongTextField()
Creates a long text field.
|
static JTextField |
createMediumTextField()
Creates a medium sized text field.
|
static JMenu |
createMenu(LocalizableMessage msg,
LocalizableMessage description)
Creates a menu with the provided text.
|
static JMenuItem |
createMenuItem(LocalizableMessage msg)
Creates a menu item with the provided text.
|
static JTextArea |
createNonEditableTextArea(LocalizableMessage text,
int rows,
int cols)
Creates a non-editable text area.
|
static JPasswordField |
createPasswordField()
Creates a password text field.
|
static JPasswordField |
createPasswordField(int cols)
Creates a password text field.
|
static JLabel |
createPrimaryLabel()
Creates a label of type 'primary' (with bigger font than usual) with no text.
|
static JLabel |
createPrimaryLabel(LocalizableMessage text)
Creates a label of type 'primary' (with bigger font than usual).
|
static JRadioButton |
createRadioButton(LocalizableMessage text)
Creates a radio button.
|
static JScrollPane |
createScrollPane(Component comp)
Returns a JScrollPane that contains the provided component.
|
static JTextField |
createShortTextField()
Creates a short text field.
|
static JTable |
createSortableTable(SortableTableModel tableModel,
TableCellRenderer renderer)
Returns a table created with the provided model and renderers.
|
static JTextArea |
createTextArea(LocalizableMessage text,
int rows,
int cols)
Creates a text area.
|
static JTextArea |
createTextAreaWithBorder(LocalizableMessage text,
int rows,
int cols)
Creates a text area with borders similar to the ones of a text field.
|
static JTextField |
createTextField()
Creates a text field with the default size.
|
static JTextField |
createTextField(String text,
int cols)
Creates a text field.
|
static JLabel |
createTitleLabel(LocalizableMessage text)
Creates a label of type 'title' (with bigger font).
|
static void |
deleteConfigSubtree(ConfigurationHandler confHandler,
org.forgerock.opendj.ldap.Dn dn)
Deletes a configuration subtree using the provided configuration handler.
|
static Color |
deriveColorHSB(Color base,
float dH,
float dS,
float dB)
Derives a color by adding the specified offsets to the base color's
hue, saturation, and brightness values.
|
static boolean |
displayConfirmationDialog(Component parentComponent,
LocalizableMessage title,
LocalizableMessage msg)
Displays a confirmation dialog.
|
static void |
displayErrorDialog(Component parentComponent,
Collection<LocalizableMessage> errors)
Displays an error dialog that contains a set of error messages.
|
static void |
displayWarningDialog(Component parentComponent,
LocalizableMessage title,
LocalizableMessage msg)
Displays a warning dialog.
|
static ConnectionWrapper |
getAdminConnection(ControlPanelInfo controlInfo,
org.forgerock.opendj.ldap.Dn bindDN,
String pwd)
Returns the connection to connect to the administration connector
of the server using the information in the ControlCenterInfo object (which
provides the host and administration connector port to be used) and some
LDAP credentials.
|
static String |
getAttributeConfigName(org.forgerock.opendj.ldap.schema.SchemaElement element)
Returns the name of configuration attribute corresponding to the provided element.
|
static String |
getAttributeNameWithoutOptions(String attrDesc)
Returns the attribute name with no options (or subtypes).
|
static JScrollPane |
getContainingScroll(Component comp)
Returns the scrollpane where the provided component is contained.
|
static String |
getElementNameOrOID(org.forgerock.opendj.ldap.schema.SchemaElement element)
Returns the name or OID of provided element.
|
static String |
getElementOID(org.forgerock.opendj.ldap.schema.SchemaElement element)
Returns the OID of provided element.
|
static String |
getFirstValueAsString(org.forgerock.opendj.ldap.Entry sr,
String attrName)
Returns the first value as a String for a given attribute in the provided
entry.
|
static String |
getFormattedConfirmation(LocalizableMessage title,
Font titleFont,
LocalizableMessage details,
Font detailsFont)
Returns the HTML representation of a confirmation for a given text.
|
static String |
getFormattedError(LocalizableMessage title,
Font titleFont,
LocalizableMessage details,
Font detailsFont)
Returns the HTML representation of an error for a given text.
|
static String |
getFormattedSuccess(LocalizableMessage title,
Font titleFont,
LocalizableMessage details,
Font detailsFont)
Returns the HTML representation of a success for a given text.
|
static String |
getFormattedWarning(LocalizableMessage title,
Font titleFont,
LocalizableMessage details,
Font detailsFont)
Returns the HTML representation of a warning for a given text.
|
static JFrame |
getFrame(Component comp)
Returns the parent frame of a component.
|
static String |
getInstallPathFromClasspath()
Returns the path of the installation of the directory server.
|
static File |
getInstanceRootDirectory(String installPath)
Returns the instance root directory (the path where the instance is
installed).
|
static String |
getMatchingRuleText(org.forgerock.opendj.ldap.schema.MatchingRule matchingRule)
Returns the string representation of a matching rule.
|
static String |
getMonitoringValue(MonitoringAttributes attr,
org.forgerock.opendj.ldap.messages.SearchResultEntry monitoringEntry)
Returns the monitoring value in a String form to be displayed to the user.
|
static org.forgerock.opendj.ldap.schema.AttributeType |
getNewAttributeTypeWithNewSuperiorType(org.forgerock.opendj.ldap.schema.AttributeType attributeType,
org.forgerock.opendj.ldap.schema.AttributeType newSuperiorType)
Return a new attribute type with the provided new superior type.
|
static Window |
getParentDialog(Component comp)
Returns the parent dialog of a component.
|
static String |
getProgressDone(Font progressFont)
Returns the HTML representation of the 'Done' string.
|
static String |
getProgressWithPoints(LocalizableMessage plainText,
Font progressFont)
Returns the HTML representation of a message to which some points have
been appended.
|
static File |
getServerRootDirectory()
Returns the server root directory (the path where the server is installed).
|
static String |
getStringFromCollection(Collection<String> col,
String separator)
This is a helper method that gets a String representation of the elements
in the Collection.
|
static String |
getSyntaxText(org.forgerock.opendj.ldap.schema.Syntax syntax)
Returns the string representation of an attribute syntax.
|
static ConnectionWrapper |
getUserDataConnection(ControlPanelInfo controlInfo,
org.forgerock.opendj.ldap.Dn bindDN,
String pwd)
Returns the connection to connect to the server using the
information in the ControlCenterInfo object (which provides the host, port
and protocol to be used) and some LDAP credentials.
|
static ViewPositions |
getViewPositions(Component comp)
Gets the view positions object for the provided component.
|
static String |
getVLVNameInCellRenderer(VLVIndexDescriptor index)
Returns a string representing the VLV index in a cell.
|
static String |
getVLVNameInCommandLine(VLVIndexDescriptor index)
Returns the representation of the VLV index as it must be used in the
command-line.
|
static boolean |
hasBinarySyntax(String attrName,
org.forgerock.opendj.ldap.schema.Schema schema)
Returns whether the provided attribute has binary syntax.
|
static boolean |
hasControlCharaters(String s)
Checks if a string contains control characters.
|
static boolean |
hasImageSyntax(String attrName,
org.forgerock.opendj.ldap.schema.Schema schema)
Returns whether the provided attribute has image syntax.
|
static boolean |
hasPasswordSyntax(String attrName,
org.forgerock.opendj.ldap.schema.Schema schema)
Returns whether the provided attribute has password syntax.
|
static boolean |
isAttributeType(org.forgerock.opendj.ldap.schema.SchemaElement element)
Test whether provided schema element is an attribute type.
|
static boolean |
isConfiguration(org.forgerock.opendj.ldap.schema.SchemaElement fileElement)
Returns whether the provided schema element is part of the configuration.
|
static boolean |
isServerRunning(File serverRootDirectory)
Returns whether the server located in the provided path is running.
|
static boolean |
isStandard(org.forgerock.opendj.ldap.schema.SchemaElement fileElement)
Returns whether the provided schema element is part of the standard.
|
static boolean |
isValidAttributeName(String s)
Returns whether the provided string can be used as attribute name.
|
static JEditorPane |
makeHtmlPane(CharSequence text,
Font font)
Creates a JEditorPane that displays a message.
|
static JEditorPane |
makePlainTextPane(String text,
Font font)
Creates a JEditorPane that displays a message.
|
static Border |
makeTitledBorder(LocalizableMessage msg)
Creates a titled border.
|
static boolean |
mustObfuscate(String attrName,
org.forgerock.opendj.ldap.schema.Schema schema)
Returns whether an attribute value must be obfuscated because
it contains sensitive information (like passwords).
|
static void |
ping(ConnectionWrapper connWrapper)
Ping the specified connection.
|
static void |
setBorder(JComponent comp,
Border border)
Sets the border in a given component.
|
static void |
setNotAvailable(LabelWithHelpIcon l)
Sets the not available text to a label with no icon nor tooltip.
|
static void |
setNotAvailable(SelectableLabelWithHelpIcon l)
Sets the not available text to a label with no icon nor tooltip.
|
static void |
setNotAvailableBecauseAuthenticationIsRequired(LabelWithHelpIcon l)
Sets the not available text to a label and associates a help icon and
a tooltip explaining that the data is not available because authentication
is required.
|
static void |
setNotAvailableBecauseAuthenticationIsRequired(SelectableLabelWithHelpIcon l)
Sets the not available text to a label and associates a help icon and
a tooltip explaining that the data is not available because authentication
is required.
|
static void |
setNotAvailableBecauseServerIsDown(LabelWithHelpIcon l)
Sets the not available text to a label and associates a help icon and
a tooltip explaining that the data is not available because the server is
down.
|
static void |
setNotAvailableBecauseServerIsDown(SelectableLabelWithHelpIcon l)
Sets the not available text to a label and associates a help icon and
a tooltip explaining that the data is not available because the server is
down.
|
static void |
setRequiredIcon(JLabel label)
Sets the required icon to the provided label.
|
static void |
setTextValue(LabelWithHelpIcon l,
String text)
Sets the a text to a label with no icon nor tooltip.
|
static void |
setTextValue(SelectableLabelWithHelpIcon l,
String text)
Sets the a text to a label with no icon nor tooltip.
|
static void |
setWarningLabel(JLabel l,
LocalizableMessage text)
Updates a label by setting a warning icon and a text.
|
static String |
stripHtmlToSingleLine(String s)
Strips any potential HTML markup from a given string.
|
static <E extends Exception> |
throwFirstFrom(List<? extends E> exceptions)
Throw the first exception of the list (if any).
|
static String |
unescapeUtf8(String v)
Unescapes UTF-8 text and generates a String from it.
|
static void |
updateComboBoxModel(Collection<?> newElements,
DefaultComboBoxModel model)
Updates a combo box model with a number of items.
|
static void |
updateComboBoxModel(Collection<?> newElements,
DefaultComboBoxModel model,
Comparator<Object> comparator)
Updates a combo box model with a number of items.
|
static void |
updatePreferredSize(JEditorPane pane,
int nCols,
String plainText,
Font font,
boolean applyBackground)
Updates the preferred size of an editor pane.
|
static org.forgerock.opendj.ldap.schema.SchemaElement |
updateSchemaElementExtraPropertyMultiplesValues(ServerContext serverContext,
org.forgerock.opendj.ldap.schema.SchemaElement element,
String property,
List<String> values)
Updates an extra property of provided schema element with several values.
|
static org.forgerock.opendj.ldap.schema.SchemaElement |
updateSchemaElementExtraPropertySingleValue(ServerContext serverContext,
org.forgerock.opendj.ldap.schema.SchemaElement element,
String property,
String value)
Updates an extra property of provided schema element with a single value.
|
static void |
updateScrollMode(JScrollPane scroll,
JTable table)
Checks the size of the table and of the scroll bar where it is contained,
and depending on it updates the auto resize mode.
|
static void |
updateTableSizes(JTable table)
Updates the size of the table rows according to the size of the
rendered component.
|
static void |
updateTableSizes(JTable table,
int rows)
Updates the size of the table rows according to the size of the
rendered component.
|
static void |
updateViewPositions(ViewPositions pos)
Updates the scrolls with the provided points.
|
static LocalizableMessage |
wrapHTML(LocalizableMessage msg,
int nCols)
Wraps the contents of the provided message using the specified number of
columns.
|
public Utilities()
public static <T> JComboBox<T> createComboBox()
T
- The combo box data type.public static JFrame createFrame()
public static boolean mustObfuscate(String attrName, org.forgerock.opendj.ldap.schema.Schema schema)
attrName
- the attribute name.schema
- the schema of the server.true
if an attribute value must be obfuscated because
it contains sensitive information (like passwords) and false
otherwise.public static Color deriveColorHSB(Color base, float dH, float dS, float dB)
base
- the color to which the HSV offsets will be addeddH
- the offset for huedS
- the offset for saturationdB
- the offset for brightnesspublic static void displayErrorDialog(Component parentComponent, Collection<LocalizableMessage> errors)
parentComponent
- the parent component relative to which the dialog
will be displayed.errors
- the set of error messages that the dialog must display.public static boolean displayConfirmationDialog(Component parentComponent, LocalizableMessage title, LocalizableMessage msg)
parentComponent
- the parent component relative to which the dialog
will be displayed.title
- the title of the dialog.msg
- the message to be displayed.true
if the user accepts the message, false
otherwise.public static void displayWarningDialog(Component parentComponent, LocalizableMessage title, LocalizableMessage msg)
parentComponent
- the parent component relative to which the dialog
will be displayed.title
- the title of the dialog.msg
- the message to be displayed.public static JEditorPane makeHtmlPane(CharSequence text, Font font)
text
- the message of the editor pane in HTML format.font
- the font to be used in the message.public static JEditorPane makePlainTextPane(String text, Font font)
text
- the message of the editor pane in plain text format.font
- the font to be used in the message.public static Border makeTitledBorder(LocalizableMessage msg)
msg
- the message to be displayed in the titled border.public static JScrollPane createBorderLessScrollBar(Component comp)
comp
- the component contained in the scroll pane.public static JScrollPane createScrollPane(Component comp)
comp
- the component contained in the scroll pane.public static JButton createButton(LocalizableMessage text)
text
- the message to be displayed by the button.public static JRadioButton createRadioButton(LocalizableMessage text)
text
- the message to be displayed by the radio button.public static JCheckBox createCheckBox(LocalizableMessage text)
text
- the message to be displayed by the check box.public static JMenuItem createMenuItem(LocalizableMessage msg)
msg
- the text.public static JMenu createMenu(LocalizableMessage msg, LocalizableMessage description)
msg
- the text.description
- the accessible description.public static JLabel createPrimaryLabel()
public static JLabel createPrimaryLabel(LocalizableMessage text)
text
- the message to be displayed by the label.public static JLabel createInlineHelpLabel(LocalizableMessage text)
text
- the message to be displayed by the label.public static JLabel createTitleLabel(LocalizableMessage text)
text
- the message to be displayed by the label.public static JLabel createDefaultLabel()
public static JLabel createDefaultLabel(LocalizableMessage text)
text
- the message to be displayed by the label.public static JTable createSortableTable(SortableTableModel tableModel, TableCellRenderer renderer)
tableModel
- the table model.renderer
- the cell renderer.public static JTextArea createTextAreaWithBorder(LocalizableMessage text, int rows, int cols)
text
- the text of the text area.rows
- the rows of the text area.cols
- the columns of the text area.public static JTextArea createNonEditableTextArea(LocalizableMessage text, int rows, int cols)
text
- the text of the text area.rows
- the rows of the text area.cols
- the columns of the text area.public static JTextArea createTextArea(LocalizableMessage text, int rows, int cols)
text
- the text of the text area.rows
- the rows of the text area.cols
- the columns of the text area.public static JTextField createTextField(String text, int cols)
text
- the text of the text field.cols
- the columns of the text field.public static JTextField createShortTextField()
public static JTextField createMediumTextField()
public static JTextField createLongTextField()
public static JTextField createTextField()
public static JPasswordField createPasswordField()
public static JPasswordField createPasswordField(int cols)
cols
- the columns of the password text field.public static void setBorder(JComponent comp, Border border)
comp
- the component.border
- the border to be set.public static void updateScrollMode(JScrollPane scroll, JTable table)
scroll
- the scroll pane containing the table.table
- the table.public static void updateTableSizes(JTable table)
table
- the table to handle.public static void updateTableSizes(JTable table, int rows)
table
- the table to handle.rows
- the maximum rows to be displayed (-1 for unlimited)public static String applyFont(CharSequence html, Font font)
html
- the original html text.font
- the font to be used to generate the new HTML.public static ImageIcon createImageIcon(String path, ClassLoader loader)
null
if the path was invalid.path
- the path of the image.loader
- the class loader to use to load the image. If
null
this class class loader will be used.null
if the path was invalid.public static ImageIcon createImageIcon(String path)
null
if the path was invalid.path
- the path of the image.null
if the path was invalid.public static ImageIcon createImageIcon(byte[] bytes, int maxHeight, LocalizableMessage description, boolean useFast)
bytes
- the byte array.maxHeight
- the maximum height of the image.description
- the description of the image.useFast
- whether a fast algorithm must be used to transform the image
or an algorithm with a better result.public static void updatePreferredSize(JEditorPane pane, int nCols, String plainText, Font font, boolean applyBackground)
pane
- the panel to be updated.nCols
- the number of columns that the panel must have.plainText
- the text to be displayed (plain text).font
- the font to be used.applyBackground
- whether an error/warning background must be applied
to the text or not.public static String stripHtmlToSingleLine(String s)
s
- string to strippublic static LocalizableMessage wrapHTML(LocalizableMessage msg, int nCols)
msg
- the message to be wrapped.nCols
- the number of columns.public static void centerOnScreen(Component comp)
comp
- the component to be centered.public static void centerGoldenMean(Window comp, Component ref)
comp
- the component to be centered.ref
- the component to be used as reference.public static JFrame getFrame(Component comp)
null
if this
component is not contained in any frame.comp
- the component.null
if this
component is not contained in any frame.public static Window getParentDialog(Component comp)
null
if this
component is not contained in any dialog.comp
- the component.null
if this
component is not contained in any dialog.public static String unescapeUtf8(String v)
v
- the string in UTF-8 format.public static String getAttributeNameWithoutOptions(String attrDesc)
Note: normal code should use AttributeDescription.valueOf(attrName).getNameOrOID()
However this method is used by UI code which sometimes receives strings which are not valid attribute descriptions.
attrDesc
- the complete attribute name.public static boolean hasControlCharaters(String s)
s
- : the string to checkpublic static String getStringFromCollection(Collection<String> col, String separator)
col
- the collection containing the String.separator
- the separator String to be used.public static String getProgressDone(Font progressFont)
progressFont
- the font to be used.public static String getProgressWithPoints(LocalizableMessage plainText, Font progressFont)
plainText
- the plain text.progressFont
- the font to be used.public static String getFormattedError(LocalizableMessage title, Font titleFont, LocalizableMessage details, Font detailsFont)
title
- the title.titleFont
- the font for the title.details
- the details.detailsFont
- the font to be used for the details.public static String getFormattedSuccess(LocalizableMessage title, Font titleFont, LocalizableMessage details, Font detailsFont)
title
- the title.titleFont
- the font for the title.details
- the details.detailsFont
- the font to be used for the details.public static String getFormattedConfirmation(LocalizableMessage title, Font titleFont, LocalizableMessage details, Font detailsFont)
title
- the title.titleFont
- the font for the title.details
- the details.detailsFont
- the font to be used for the details.public static String getFormattedWarning(LocalizableMessage title, Font titleFont, LocalizableMessage details, Font detailsFont)
title
- the title.titleFont
- the font for the title.details
- the details.detailsFont
- the font to be used for the details.public static void setNotAvailableBecauseServerIsDown(LabelWithHelpIcon l)
l
- the label.public static void setNotAvailableBecauseAuthenticationIsRequired(LabelWithHelpIcon l)
l
- the label.public static void setNotAvailableBecauseServerIsDown(SelectableLabelWithHelpIcon l)
l
- the label.public static void setNotAvailableBecauseAuthenticationIsRequired(SelectableLabelWithHelpIcon l)
l
- the label.public static void setWarningLabel(JLabel l, LocalizableMessage text)
l
- the label to be updated.text
- the text to be set on the label.public static void setNotAvailable(LabelWithHelpIcon l)
l
- the label.public static void setTextValue(LabelWithHelpIcon l, String text)
l
- the label.text
- the text.public static void setNotAvailable(SelectableLabelWithHelpIcon l)
l
- the label.public static void setTextValue(SelectableLabelWithHelpIcon l, String text)
l
- the label.text
- the text.public static File getServerRootDirectory()
Note: this method is called by SNMP code.
public static File getInstanceRootDirectory(String installPath)
installPath
- The installRoot path.public static String getInstallPathFromClasspath()
public static boolean isServerRunning(File serverRootDirectory)
serverRootDirectory
- the path where the server is installed.true
if the server located in the provided path is running,
false
otherwise.public static boolean isValidAttributeName(String s)
s
- the string to be analyzed.true
if the provided string can be used as attribute name,
false
otherwise.public static String getVLVNameInCommandLine(VLVIndexDescriptor index)
index
- the VLV index.public static String getVLVNameInCellRenderer(VLVIndexDescriptor index)
index
- the VLV index to be represented.public static boolean isStandard(org.forgerock.opendj.ldap.schema.SchemaElement fileElement)
fileElement
- the schema element.true
if the provided schema element is part of the standard,
false
otherwise.public static boolean isConfiguration(org.forgerock.opendj.ldap.schema.SchemaElement fileElement)
fileElement
- the schema element.true
if the provided schema element is part of the configuration,
false
otherwise.public static String getSyntaxText(org.forgerock.opendj.ldap.schema.Syntax syntax)
syntax
- the attribute syntax.public static boolean hasImageSyntax(String attrName, org.forgerock.opendj.ldap.schema.Schema schema)
attrName
- the name of the attribute.schema
- the schema.true
if the provided attribute has image syntax, false
otherwise.public static boolean hasBinarySyntax(String attrName, org.forgerock.opendj.ldap.schema.Schema schema)
attrName
- the name of the attribute.schema
- the schema.true
if the provided attribute has binary syntax, false
otherwise.public static boolean hasPasswordSyntax(String attrName, org.forgerock.opendj.ldap.schema.Schema schema)
attrName
- the name of the attribute.schema
- the schema.true
if the provided attribute has password syntax, false
otherwise.public static String getMatchingRuleText(org.forgerock.opendj.ldap.schema.MatchingRule matchingRule)
matchingRule
- the matching rule.public static ConnectionWrapper getAdminConnection(ControlPanelInfo controlInfo, org.forgerock.opendj.ldap.Dn bindDN, String pwd) throws IOException, ConfigReadException
controlInfo
- the object which provides the connection parameters.bindDN
- the base DN to be used to bind.pwd
- the password to be used to bind.IOException
- if there was a problem connecting to the server
or the provided credentials do not have enough rights.ConfigReadException
- if there is an error reading the configuration.public static ConnectionWrapper getUserDataConnection(ControlPanelInfo controlInfo, org.forgerock.opendj.ldap.Dn bindDN, String pwd) throws IOException, ConfigReadException
controlInfo
- the object which provides the connection parameters.bindDN
- the base DN to be used to bind.pwd
- the password to be used to bind.IOException
- if there was a problem connecting to the server
or the provided credentials do not have enough rights.ConfigReadException
- if there is an error reading the configuration.public static void ping(ConnectionWrapper connWrapper)
connWrapper
- the connection to be "pinged".public static void deleteConfigSubtree(ConfigurationHandler confHandler, org.forgerock.opendj.ldap.Dn dn) throws OpenDsException, org.forgerock.opendj.config.server.ConfigException
confHandler
- the configuration handler to be used to delete the subtree.dn
- the DN of the subtree to be deleted.OpenDsException
- if an error occurs.org.forgerock.opendj.config.server.ConfigException
- if an error occurs.public static void setRequiredIcon(JLabel label)
label
- the label to be updated.public static void updateViewPositions(ViewPositions pos)
pos
- the scroll and points.public static ViewPositions getViewPositions(Component comp)
comp
- the component.public static JScrollPane getContainingScroll(Component comp)
null
if the component is not contained in any scrollpane.comp
- the component.public static String getFirstValueAsString(org.forgerock.opendj.ldap.Entry sr, String attrName)
sr
- the entry. It may be null
.attrName
- the attribute name.public static String getMonitoringValue(MonitoringAttributes attr, org.forgerock.opendj.ldap.messages.SearchResultEntry monitoringEntry)
attr
- the attribute to analyze.monitoringEntry
- the monitoring entry.public static void addClickTooltipListener(JComponent comp)
comp
- the component.public static void updateComboBoxModel(Collection<?> newElements, DefaultComboBoxModel model)
newElements
- the new items for the combo box model.model
- the combo box model to be updated.public static void updateComboBoxModel(Collection<?> newElements, DefaultComboBoxModel model, Comparator<Object> comparator)
newElements
- the new items for the combo box model.model
- the combo box model to be updated.comparator
- the object that will be used to compare the objects in
the model. If null
, the equals method will be used.public static void computeMonitoringPossibleResults(org.forgerock.opendj.ldap.messages.SearchResultEntry monitor1, org.forgerock.opendj.ldap.messages.SearchResultEntry monitor2, List<Integer> possibleResults, Collection<String> attrNames)
monitor1
- the first monitor to comparemonitor2
- the second monitor to comparepossibleResults
- where possible results are outputattrNames
- the names for which to compute possible comparison resultspublic static <E extends Exception> void throwFirstFrom(List<? extends E> exceptions) throws E extends Exception
E
- The exception typeexceptions
- A list of exceptions.E
- The first element of the provided list (if the list is not empty).E extends Exception
public static boolean isAttributeType(org.forgerock.opendj.ldap.schema.SchemaElement element)
element
- Element to check.true
iff element is an attribute type.public static String getAttributeConfigName(org.forgerock.opendj.ldap.schema.SchemaElement element)
element
- Either an attribute type or an object class.
Using any other schema element will return invalid result.public static String getElementNameOrOID(org.forgerock.opendj.ldap.schema.SchemaElement element)
element
- Either an attribute type or an object class.
Using any other schema element will yield an exception.public static String getElementOID(org.forgerock.opendj.ldap.schema.SchemaElement element)
element
- Either an attribute type or an object class.
Using any other schema element will yield an exception.public static org.forgerock.opendj.ldap.schema.AttributeType getNewAttributeTypeWithNewSuperiorType(org.forgerock.opendj.ldap.schema.AttributeType attributeType, org.forgerock.opendj.ldap.schema.AttributeType newSuperiorType)
attributeType
- Initial attribute type.newSuperiorType
- new superior type to use.public static org.forgerock.opendj.ldap.schema.SchemaElement updateSchemaElementExtraPropertySingleValue(ServerContext serverContext, org.forgerock.opendj.ldap.schema.SchemaElement element, String property, String value)
serverContext
- the server contextelement
- Either an attribute type or an object class.
Using any other schema element will yield an exception.property
- the property to setvalue
- the value to setpublic static org.forgerock.opendj.ldap.schema.SchemaElement updateSchemaElementExtraPropertyMultiplesValues(ServerContext serverContext, org.forgerock.opendj.ldap.schema.SchemaElement element, String property, List<String> values)
serverContext
- the server contextelement
- Either an attribute type or an object class.
Using any other schema element will yield an exception.property
- the property to setvalues
- the list of values to setCopyright © 2010-2017 ForgeRock AS. All Rights Reserved.