| | |
| | | */ |
| | | public class Utils |
| | | { |
| | | private static final int DEFAULT_LDAP_CONNECT_TIMEOUT = 3000; |
| | | |
| | | private static final int BUFFER_SIZE = 1024; |
| | | |
| | | private static final int MAX_LINE_WIDTH = 80; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns a String representation of the OS we are running. |
| | | * @return a String representation of the OS we are running. |
| | | */ |
| | | public static String getOSString() |
| | | { |
| | | return SetupUtils.getOSString(); |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the parent directory for the provided path |
| | | * exists and <CODE>false</CODE> otherwise. |
| | | * @param path the path that we are analyzing. |
| | |
| | | try |
| | | { |
| | | InitialLdapContext ctx = |
| | | Utils.createLdapContext(ldapUrl, dn, pwd, 3000, null); |
| | | Utils.createLdapContext(ldapUrl, dn, pwd, |
| | | Utils.getDefaultLDAPTimeout(), null); |
| | | |
| | | /* |
| | | * Search for the config to check that it is the directory manager. |
| | |
| | | * Displays an error message dialog. |
| | | * |
| | | * @param parent |
| | | * the parent frame of the error dialog. |
| | | * the parent component of the error dialog. |
| | | * @param msg |
| | | * the error message. |
| | | * @param title |
| | | * the title for the dialog. |
| | | */ |
| | | public static void displayError(JFrame parent, String msg, String title) |
| | | public static void displayError(Component parent, String msg, String title) |
| | | { |
| | | JOptionPane.showMessageDialog(parent, msg, title, |
| | | JOptionPane.ERROR_MESSAGE); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the default LDAP timeout in milliseconds when we try to connect to |
| | | * a server. |
| | | * @return the default LDAP timeout in milliseconds when we try to connect to |
| | | * a server. |
| | | */ |
| | | public static int getDefaultLDAPTimeout() |
| | | { |
| | | return DEFAULT_LDAP_CONNECT_TIMEOUT; |
| | | } |
| | | |
| | | /** |
| | | * Returns the max size in character of a line to be displayed in the command |
| | | * line. |
| | | * @return the max size in character of a line to be displayed in the command |