| | |
| | | |
| | | private Set<JavaArgumentsDescriptor> readJavaArguments = new HashSet<>(); |
| | | private Set<JavaArgumentsDescriptor> currentJavaArguments = new HashSet<>(); |
| | | private Set<String> allScriptNames = newHashSet( |
| | | private final Set<String> allScriptNames = newHashSet( |
| | | "start-ds", "import-ldif.offline", "backup.online", "base64", |
| | | "create-rc-script", "dsconfig", "dsreplication", |
| | | "export-ldif.online", "import-ldif.online", "ldapcompare", |
| | |
| | | "backup.offline", "encode-password", "export-ldif.offline", |
| | | "ldif-diff", "ldifmodify", "ldifsearch", "make-ldif", |
| | | "rebuild-index", "restore.offline", "upgrade", |
| | | "verify-index", "dbtest" |
| | | "verify-index", "backendstat" |
| | | ); |
| | | private Set<String> relevantScriptNames = newHashSet( |
| | | private final Set<String> relevantScriptNames = newHashSet( |
| | | "start-ds", "import-ldif.offline", "backup.offline", |
| | | "export-ldif.offline", |
| | | "ldif-diff", "make-ldif", "rebuild-index", "restore.offline", |
| | | "verify-index", "dbtest" |
| | | "verify-index", "backendstat" |
| | | ); |
| | | |
| | | private String readJavaHome; |
| | |
| | | |
| | | private boolean previousLocal = true; |
| | | |
| | | private LocalizableMessage READING_JAVA_SETTINGS = |
| | | private final LocalizableMessage READING_JAVA_SETTINGS = |
| | | INFO_CTRL_PANEL_READING_JAVA_SETTINGS_SUMMARY.get(); |
| | | |
| | | JComponent[] comps; |
| | | private JComponent[] comps; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public JavaPropertiesPanel() |
| | | { |
| | | super(); |
| | | createLayout(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_JAVA_PROPERTIES_TITLE.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | | return javaHome; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean requiresScroll() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setInfo(ControlPanelInfo info) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates the layout of the panel (but the contents are not populated here). |
| | | */ |
| | | /** Creates the layout of the panel (but the contents are not populated here). */ |
| | | private void createLayout() |
| | | { |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | |
| | | }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | |
| | | previousLocal = isLocal; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | |
| | | * @return the names of all the command-line that can be displayed by this |
| | | * panel. |
| | | */ |
| | | protected Set<String> getAllCommandLineNames() |
| | | private Set<String> getAllCommandLineNames() |
| | | { |
| | | return allScriptNames; |
| | | } |
| | |
| | | * @return the names of the most important command-line to be displayed by |
| | | * this panel. |
| | | */ |
| | | protected Set<String> getRelevantCommandLineNames() |
| | | private Set<String> getRelevantCommandLineNames() |
| | | { |
| | | return relevantScriptNames; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Inits the contents of the table in the background. |
| | | * |
| | | */ |
| | | /** Inits the contents of the table in the background. */ |
| | | private void initContents() |
| | | { |
| | | disableComponents(); |
| | | |
| | | BackgroundTask<Void> worker = new BackgroundTask<Void>() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Void processBackgroundTask() throws Throwable |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(Void returnValue, Throwable t) |
| | | { |
| | |
| | | /** |
| | | * Disables all the components. This is used when we are reading the |
| | | * java settings in the background. |
| | | * |
| | | */ |
| | | private void disableComponents() |
| | | { |
| | |
| | | /** |
| | | * Enables all the components. This is used when we are reading the |
| | | * java settings in the background. |
| | | * |
| | | */ |
| | | private void enableComponents() |
| | | { |
| | |
| | | setEnabledOK(true); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | |
| | | super.cancelClicked(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(List<LocalizableMessage> returnValue, |
| | | Throwable t) |
| | |
| | | filterJavaArguments(currentJavaArguments)); |
| | | } |
| | | |
| | | /** |
| | | * Class containing the command-name and the associated java |
| | | * arguments. |
| | | * |
| | | */ |
| | | /** Class containing the command-name and the associated java arguments. */ |
| | | private class JavaArgumentsDescriptor |
| | | { |
| | | private String commandName; |
| | |
| | | return javaArguments; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return toString; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The table model used to display the java arguments. |
| | | */ |
| | | protected class JavaArgumentsTableModel extends SortableTableModel |
| | | /** The table model used to display the java arguments. */ |
| | | private class JavaArgumentsTableModel extends SortableTableModel |
| | | implements Comparator<JavaArgumentsDescriptor> |
| | | { |
| | | private static final long serialVersionUID = 8288418995255677560L; |
| | | private Set<JavaArgumentsDescriptor> data = new HashSet<>(); |
| | | private ArrayList<String[]> dataArray = new ArrayList<>(); |
| | | private ArrayList<JavaArgumentsDescriptor> argsArray = new ArrayList<>(); |
| | | private final Set<JavaArgumentsDescriptor> data = new HashSet<>(); |
| | | private final ArrayList<String[]> dataArray = new ArrayList<>(); |
| | | private final ArrayList<JavaArgumentsDescriptor> argsArray = new ArrayList<>(); |
| | | private final String[] COLUMN_NAMES = new String[] { |
| | | getHeader(INFO_CTRL_PANEL_COMMAND_LINE_NAME_COLUMN.get(), 40), |
| | | getHeader(INFO_CTRL_PANEL_JAVA_ARGUMENTS_COLUMN.get(), 40)}; |
| | |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getColumnCount() |
| | | { |
| | | return COLUMN_NAMES.length; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | |
| | | * @param row the row number. |
| | | * @return the java argument descriptor in the provided row. |
| | | */ |
| | | public JavaArgumentsDescriptor getJavaArguments(int row) |
| | | private JavaArgumentsDescriptor getJavaArguments(int row) |
| | | { |
| | | return argsArray.get(row); |
| | | } |
| | |
| | | this.sortColumn = sortColumn; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCellEditable(int row, int col) { |
| | | return col != 0; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setValueAt(Object value, int row, int col) |
| | | { |
| | |
| | | * @return an array of String with the String representation of the cells |
| | | * in the table. |
| | | */ |
| | | protected String[] getLine(JavaArgumentsDescriptor desc) |
| | | private String[] getLine(JavaArgumentsDescriptor desc) |
| | | { |
| | | String cmd = desc.getCommandName(); |
| | | if (cmd.equalsIgnoreCase("start-ds")) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The task in charge of updating the java properties. |
| | | * |
| | | */ |
| | | protected class JavaPropertiesTask extends Task |
| | | /** The task in charge of updating the java properties. */ |
| | | private class JavaPropertiesTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | | private final Set<String> backendSet; |
| | | private String defaultJavaHome; |
| | | private boolean overwriteOpenDSJavaHome; |
| | | private boolean overwriteOpenDSJavaArgs; |
| | | Set<JavaArgumentsDescriptor> arguments = new HashSet<>(); |
| | | private final boolean overwriteOpenDSJavaHome; |
| | | private final boolean overwriteOpenDSJavaArgs; |
| | | private final Set<JavaArgumentsDescriptor> arguments; |
| | | |
| | | /** |
| | | * The constructor of the task. |
| | | * @param info the control panel info. |
| | | * @param dlg the progress dialog that shows the progress of the task. |
| | | */ |
| | | public JavaPropertiesTask(ControlPanelInfo info, ProgressDialog dlg) |
| | | private JavaPropertiesTask(ControlPanelInfo info, ProgressDialog dlg) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<>(); |
| | |
| | | arguments = getCurrentJavaArguments(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Type getType() |
| | | { |
| | | return Type.JAVA_SETTINGS_UPDATE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_UPDATE_JAVA_SETTINGS_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void runTask() |
| | | { |
| | |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |