Return-Path: X-Original-To: apmail-zookeeper-commits-archive@www.apache.org Delivered-To: apmail-zookeeper-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3B74611C40 for ; Fri, 4 Apr 2014 01:25:30 +0000 (UTC) Received: (qmail 86343 invoked by uid 500); 4 Apr 2014 01:25:28 -0000 Delivered-To: apmail-zookeeper-commits-archive@zookeeper.apache.org Received: (qmail 86227 invoked by uid 500); 4 Apr 2014 01:25:28 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 86204 invoked by uid 99); 4 Apr 2014 01:25:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 01:25:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 01:25:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C57762388AB8; Fri, 4 Apr 2014 01:24:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1584497 [6/9] - in /zookeeper/trunk: bin/ src/c/ src/contrib/loggraph/web/org/apache/zookeeper/graph/resources/ src/contrib/zooinspector/ src/contrib/zooinspector/lib/ src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/ src/c... Date: Fri, 04 Apr 2014 01:24:38 -0000 To: commits@zookeeper.apache.org From: michim@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140404012440.C57762388AB8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java Fri Apr 4 01:24:37 2014 @@ -1,143 +1,143 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.gui.nodeviewer; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.List; -import java.util.concurrent.ExecutionException; - -import javax.swing.JButton; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTextPane; -import javax.swing.JToolBar; -import javax.swing.SwingWorker; - -import org.apache.zookeeper.inspector.ZooInspector; -import org.apache.zookeeper.inspector.gui.IconResource; -import org.apache.zookeeper.inspector.logger.LoggerFactory; -import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager; - -/** - * A node viewer for displaying the data for the currently selected node - */ -public class NodeViewerData extends ZooInspectorNodeViewer { - private ZooInspectorNodeManager zooInspectorManager; - private final JTextPane dataArea; - private final JToolBar toolbar; - private String selectedNode; - - public NodeViewerData() { - this.setLayout(new BorderLayout()); - this.dataArea = new JTextPane(); - this.toolbar = new JToolBar(); - this.toolbar.setFloatable(false); - JScrollPane scroller = new JScrollPane(this.dataArea); - scroller - .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - this.add(scroller, BorderLayout.CENTER); - this.add(this.toolbar, BorderLayout.NORTH); - JButton saveButton = new JButton(ZooInspector.iconResource.get(IconResource.ICON_SAVE,"")); - saveButton.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - if (selectedNode != null) { - if (JOptionPane.showConfirmDialog(NodeViewerData.this, - "Are you sure you want to save this node?" - + " (this action cannot be reverted)", - "Confirm Save", JOptionPane.YES_NO_OPTION, - JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { - zooInspectorManager.setData(selectedNode, dataArea - .getText()); - } - } - } - }); - this.toolbar.add(saveButton); - - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# - * getTitle() - */ - @Override - public String getTitle() { - return "Node Data"; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# - * nodeSelectionChanged(java.util.Set) - */ - @Override - public void nodeSelectionChanged(List selectedNodes) { - if (selectedNodes.size() > 0) { - this.selectedNode = selectedNodes.get(0); - SwingWorker worker = new SwingWorker() { - - @Override - protected String doInBackground() throws Exception { - return NodeViewerData.this.zooInspectorManager - .getData(NodeViewerData.this.selectedNode); - } - - @Override - protected void done() { - String data = ""; - try { - data = get(); - } catch (InterruptedException e) { - LoggerFactory.getLogger().error( - "Error retrieving data for node: " - + NodeViewerData.this.selectedNode, e); - } catch (ExecutionException e) { - LoggerFactory.getLogger().error( - "Error retrieving data for node: " - + NodeViewerData.this.selectedNode, e); - } - NodeViewerData.this.dataArea.setText(data); - } - }; - worker.execute(); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# - * setZooInspectorManager - * (org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager) - */ - @Override - public void setZooInspectorManager( - ZooInspectorNodeManager zooInspectorManager) { - this.zooInspectorManager = zooInspectorManager; - } - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.gui.nodeviewer; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; +import java.util.concurrent.ExecutionException; + +import javax.swing.JButton; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; +import javax.swing.JToolBar; +import javax.swing.SwingWorker; + +import org.apache.zookeeper.inspector.ZooInspector; +import org.apache.zookeeper.inspector.gui.IconResource; +import org.apache.zookeeper.inspector.logger.LoggerFactory; +import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager; + +/** + * A node viewer for displaying the data for the currently selected node + */ +public class NodeViewerData extends ZooInspectorNodeViewer { + private ZooInspectorNodeManager zooInspectorManager; + private final JTextPane dataArea; + private final JToolBar toolbar; + private String selectedNode; + + public NodeViewerData() { + this.setLayout(new BorderLayout()); + this.dataArea = new JTextPane(); + this.toolbar = new JToolBar(); + this.toolbar.setFloatable(false); + JScrollPane scroller = new JScrollPane(this.dataArea); + scroller + .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + this.add(scroller, BorderLayout.CENTER); + this.add(this.toolbar, BorderLayout.NORTH); + JButton saveButton = new JButton(ZooInspector.iconResource.get(IconResource.ICON_SAVE,"")); + saveButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + if (selectedNode != null) { + if (JOptionPane.showConfirmDialog(NodeViewerData.this, + "Are you sure you want to save this node?" + + " (this action cannot be reverted)", + "Confirm Save", JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { + zooInspectorManager.setData(selectedNode, dataArea + .getText()); + } + } + } + }); + this.toolbar.add(saveButton); + + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# + * getTitle() + */ + @Override + public String getTitle() { + return "Node Data"; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# + * nodeSelectionChanged(java.util.Set) + */ + @Override + public void nodeSelectionChanged(List selectedNodes) { + if (selectedNodes.size() > 0) { + this.selectedNode = selectedNodes.get(0); + SwingWorker worker = new SwingWorker() { + + @Override + protected String doInBackground() throws Exception { + return NodeViewerData.this.zooInspectorManager + .getData(NodeViewerData.this.selectedNode); + } + + @Override + protected void done() { + String data = ""; + try { + data = get(); + } catch (InterruptedException e) { + LoggerFactory.getLogger().error( + "Error retrieving data for node: " + + NodeViewerData.this.selectedNode, e); + } catch (ExecutionException e) { + LoggerFactory.getLogger().error( + "Error retrieving data for node: " + + NodeViewerData.this.selectedNode, e); + } + NodeViewerData.this.dataArea.setText(data); + } + }; + worker.execute(); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# + * setZooInspectorManager + * (org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager) + */ + @Override + public void setZooInspectorManager( + ZooInspectorNodeManager zooInspectorManager) { + this.zooInspectorManager = zooInspectorManager; + } + +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerMetaData.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerMetaData.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerMetaData.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerMetaData.java Fri Apr 4 01:24:37 2014 @@ -1,186 +1,186 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.gui.nodeviewer; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.SwingWorker; - -import org.apache.zookeeper.data.Stat; -import org.apache.zookeeper.inspector.logger.LoggerFactory; -import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager; - -/** - * A node viewer for displaying the meta data for the currently selected node. - * The meta data is essentially the information from the {@link Stat} for the - * node - */ -public class NodeViewerMetaData extends ZooInspectorNodeViewer { - private ZooInspectorNodeManager zooInspectorManager; - private final JPanel metaDataPanel; - private String selectedNode; - - /** - * - */ - public NodeViewerMetaData() { - this.setLayout(new BorderLayout()); - this.metaDataPanel = new JPanel(); - this.metaDataPanel.setBackground(Color.WHITE); - JScrollPane scroller = new JScrollPane(this.metaDataPanel); - this.add(scroller, BorderLayout.CENTER); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# - * getTitle() - */ - @Override - public String getTitle() { - return "Node Metadata"; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# - * nodeSelectionChanged(java.util.Set) - */ - @Override - public void nodeSelectionChanged(List selectedNodes) { - this.metaDataPanel.removeAll(); - if (selectedNodes.size() > 0) { - this.selectedNode = selectedNodes.get(0); - SwingWorker, Void> worker = new SwingWorker, Void>() { - - @Override - protected Map doInBackground() throws Exception { - return NodeViewerMetaData.this.zooInspectorManager - .getNodeMeta(NodeViewerMetaData.this.selectedNode); - } - - @Override - protected void done() { - Map data = null; - try { - data = get(); - } catch (InterruptedException e) { - data = new HashMap(); - LoggerFactory.getLogger().error( - "Error retrieving meta data for node: " - + NodeViewerMetaData.this.selectedNode, - e); - } catch (ExecutionException e) { - data = new HashMap(); - LoggerFactory.getLogger().error( - "Error retrieving meta data for node: " - + NodeViewerMetaData.this.selectedNode, - e); - } - NodeViewerMetaData.this.metaDataPanel - .setLayout(new GridBagLayout()); - JPanel infoPanel = new JPanel(); - infoPanel.setBackground(Color.WHITE); - infoPanel.setLayout(new GridBagLayout()); - int i = 0; - int rowPos = 0; - for (Map.Entry entry : data.entrySet()) { - rowPos = 2 * i + 1; - JLabel label = new JLabel(entry.getKey()); - JTextField text = new JTextField(entry.getValue()); - text.setEditable(false); - GridBagConstraints c1 = new GridBagConstraints(); - c1.gridx = 0; - c1.gridy = rowPos; - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weightx = 0; - c1.weighty = 0; - c1.anchor = GridBagConstraints.WEST; - c1.fill = GridBagConstraints.HORIZONTAL; - c1.insets = new Insets(5, 5, 5, 5); - c1.ipadx = 0; - c1.ipady = 0; - infoPanel.add(label, c1); - GridBagConstraints c2 = new GridBagConstraints(); - c2.gridx = 2; - c2.gridy = rowPos; - c2.gridwidth = 1; - c2.gridheight = 1; - c2.weightx = 0; - c2.weighty = 0; - c2.anchor = GridBagConstraints.WEST; - c2.fill = GridBagConstraints.HORIZONTAL; - c2.insets = new Insets(5, 5, 5, 5); - c2.ipadx = 0; - c2.ipady = 0; - infoPanel.add(text, c2); - i++; - } - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = rowPos; - c.gridwidth = 1; - c.gridheight = 1; - c.weightx = 1; - c.weighty = 1; - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(5, 5, 5, 5); - c.ipadx = 0; - c.ipady = 0; - NodeViewerMetaData.this.metaDataPanel.add(infoPanel, c); - NodeViewerMetaData.this.metaDataPanel.revalidate(); - NodeViewerMetaData.this.metaDataPanel.repaint(); - } - }; - worker.execute(); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# - * setZooInspectorManager - * (org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager) - */ - @Override - public void setZooInspectorManager( - ZooInspectorNodeManager zooInspectorManager) { - this.zooInspectorManager = zooInspectorManager; - } - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.gui.nodeviewer; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.SwingWorker; + +import org.apache.zookeeper.data.Stat; +import org.apache.zookeeper.inspector.logger.LoggerFactory; +import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager; + +/** + * A node viewer for displaying the meta data for the currently selected node. + * The meta data is essentially the information from the {@link Stat} for the + * node + */ +public class NodeViewerMetaData extends ZooInspectorNodeViewer { + private ZooInspectorNodeManager zooInspectorManager; + private final JPanel metaDataPanel; + private String selectedNode; + + /** + * + */ + public NodeViewerMetaData() { + this.setLayout(new BorderLayout()); + this.metaDataPanel = new JPanel(); + this.metaDataPanel.setBackground(Color.WHITE); + JScrollPane scroller = new JScrollPane(this.metaDataPanel); + this.add(scroller, BorderLayout.CENTER); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# + * getTitle() + */ + @Override + public String getTitle() { + return "Node Metadata"; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# + * nodeSelectionChanged(java.util.Set) + */ + @Override + public void nodeSelectionChanged(List selectedNodes) { + this.metaDataPanel.removeAll(); + if (selectedNodes.size() > 0) { + this.selectedNode = selectedNodes.get(0); + SwingWorker, Void> worker = new SwingWorker, Void>() { + + @Override + protected Map doInBackground() throws Exception { + return NodeViewerMetaData.this.zooInspectorManager + .getNodeMeta(NodeViewerMetaData.this.selectedNode); + } + + @Override + protected void done() { + Map data = null; + try { + data = get(); + } catch (InterruptedException e) { + data = new HashMap(); + LoggerFactory.getLogger().error( + "Error retrieving meta data for node: " + + NodeViewerMetaData.this.selectedNode, + e); + } catch (ExecutionException e) { + data = new HashMap(); + LoggerFactory.getLogger().error( + "Error retrieving meta data for node: " + + NodeViewerMetaData.this.selectedNode, + e); + } + NodeViewerMetaData.this.metaDataPanel + .setLayout(new GridBagLayout()); + JPanel infoPanel = new JPanel(); + infoPanel.setBackground(Color.WHITE); + infoPanel.setLayout(new GridBagLayout()); + int i = 0; + int rowPos = 0; + for (Map.Entry entry : data.entrySet()) { + rowPos = 2 * i + 1; + JLabel label = new JLabel(entry.getKey()); + JTextField text = new JTextField(entry.getValue()); + text.setEditable(false); + GridBagConstraints c1 = new GridBagConstraints(); + c1.gridx = 0; + c1.gridy = rowPos; + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weightx = 0; + c1.weighty = 0; + c1.anchor = GridBagConstraints.WEST; + c1.fill = GridBagConstraints.HORIZONTAL; + c1.insets = new Insets(5, 5, 5, 5); + c1.ipadx = 0; + c1.ipady = 0; + infoPanel.add(label, c1); + GridBagConstraints c2 = new GridBagConstraints(); + c2.gridx = 2; + c2.gridy = rowPos; + c2.gridwidth = 1; + c2.gridheight = 1; + c2.weightx = 0; + c2.weighty = 0; + c2.anchor = GridBagConstraints.WEST; + c2.fill = GridBagConstraints.HORIZONTAL; + c2.insets = new Insets(5, 5, 5, 5); + c2.ipadx = 0; + c2.ipady = 0; + infoPanel.add(text, c2); + i++; + } + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 1; + c.gridy = rowPos; + c.gridwidth = 1; + c.gridheight = 1; + c.weightx = 1; + c.weighty = 1; + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.NONE; + c.insets = new Insets(5, 5, 5, 5); + c.ipadx = 0; + c.ipady = 0; + NodeViewerMetaData.this.metaDataPanel.add(infoPanel, c); + NodeViewerMetaData.this.metaDataPanel.revalidate(); + NodeViewerMetaData.this.metaDataPanel.repaint(); + } + }; + worker.execute(); + } + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer# + * setZooInspectorManager + * (org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager) + */ + @Override + public void setZooInspectorManager( + ZooInspectorNodeManager zooInspectorManager) { + this.zooInspectorManager = zooInspectorManager; + } + +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerMetaData.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/ZooInspectorNodeViewer.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/ZooInspectorNodeViewer.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/ZooInspectorNodeViewer.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/ZooInspectorNodeViewer.java Fri Apr 4 01:24:37 2014 @@ -1,138 +1,138 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.gui.nodeviewer; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.IOException; -import java.util.List; - -import javax.swing.JPanel; - -import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager; - -/** - * A {@link JPanel} for displaying information about the currently selected - * node(s) - */ -public abstract class ZooInspectorNodeViewer extends JPanel implements - Transferable { - /** - * The {@link DataFlavor} used for DnD in the node viewer configuration - * dialog - */ - public static final DataFlavor nodeViewerDataFlavor = new DataFlavor( - ZooInspectorNodeViewer.class, "nodeviewer"); - - /** - * @param zooInspectorManager - */ - public abstract void setZooInspectorManager( - ZooInspectorNodeManager zooInspectorManager); - - /** - * Called whenever the selected nodes in the tree view changes. - * - * @param selectedNodes - * - the nodes currently selected in the tree view - * - */ - public abstract void nodeSelectionChanged(List selectedNodes); - - /** - * @return the title of the node viewer. this will be shown on the tab for - * this node viewer. - */ - public abstract String getTitle(); - - /* - * (non-Javadoc) - * - * @see - * java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer - * .DataFlavor) - */ - public Object getTransferData(DataFlavor flavor) - throws UnsupportedFlavorException, IOException { - if (flavor.equals(nodeViewerDataFlavor)) { - return this.getClass().getCanonicalName(); - } else { - return null; - } - } - - /* - * (non-Javadoc) - * - * @see java.awt.datatransfer.Transferable#getTransferDataFlavors() - */ - public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor[] { nodeViewerDataFlavor }; - } - - /* - * (non-Javadoc) - * - * @seejava.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt. - * datatransfer.DataFlavor) - */ - public boolean isDataFlavorSupported(DataFlavor flavor) { - return flavor.equals(nodeViewerDataFlavor); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((getTitle() == null) ? 0 : getTitle().hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ZooInspectorNodeViewer other = (ZooInspectorNodeViewer) obj; - if (getClass().getCanonicalName() != other.getClass() - .getCanonicalName()) { - return false; - } - if (getTitle() == null) { - if (other.getTitle() != null) - return false; - } else if (!getTitle().equals(other.getTitle())) - return false; - return true; - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.gui.nodeviewer; + +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import java.util.List; + +import javax.swing.JPanel; + +import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager; + +/** + * A {@link JPanel} for displaying information about the currently selected + * node(s) + */ +public abstract class ZooInspectorNodeViewer extends JPanel implements + Transferable { + /** + * The {@link DataFlavor} used for DnD in the node viewer configuration + * dialog + */ + public static final DataFlavor nodeViewerDataFlavor = new DataFlavor( + ZooInspectorNodeViewer.class, "nodeviewer"); + + /** + * @param zooInspectorManager + */ + public abstract void setZooInspectorManager( + ZooInspectorNodeManager zooInspectorManager); + + /** + * Called whenever the selected nodes in the tree view changes. + * + * @param selectedNodes + * - the nodes currently selected in the tree view + * + */ + public abstract void nodeSelectionChanged(List selectedNodes); + + /** + * @return the title of the node viewer. this will be shown on the tab for + * this node viewer. + */ + public abstract String getTitle(); + + /* + * (non-Javadoc) + * + * @see + * java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer + * .DataFlavor) + */ + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + if (flavor.equals(nodeViewerDataFlavor)) { + return this.getClass().getCanonicalName(); + } else { + return null; + } + } + + /* + * (non-Javadoc) + * + * @see java.awt.datatransfer.Transferable#getTransferDataFlavors() + */ + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { nodeViewerDataFlavor }; + } + + /* + * (non-Javadoc) + * + * @seejava.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt. + * datatransfer.DataFlavor) + */ + public boolean isDataFlavorSupported(DataFlavor flavor) { + return flavor.equals(nodeViewerDataFlavor); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((getTitle() == null) ? 0 : getTitle().hashCode()); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ZooInspectorNodeViewer other = (ZooInspectorNodeViewer) obj; + if (getClass().getCanonicalName() != other.getClass() + .getCanonicalName()) { + return false; + } + if (getTitle() == null) { + if (other.getTitle() != null) + return false; + } else if (!getTitle().equals(other.getTitle())) + return false; + return true; + } +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/ZooInspectorNodeViewer.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/logger/LoggerFactory.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/logger/LoggerFactory.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/logger/LoggerFactory.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/logger/LoggerFactory.java Fri Apr 4 01:24:37 2014 @@ -1,36 +1,36 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.logger; - -/** - * Provides a {@link Logger} for use across the entire application - * - */ -public class LoggerFactory -{ - private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("org.apache.zookeeper.inspector"); //$NON-NLS-1$ - - /** - * @return {@link Logger} for ZooInspector - */ - public static org.slf4j.Logger getLogger() - { - return logger; - } - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.logger; + +/** + * Provides a {@link Logger} for use across the entire application + * + */ +public class LoggerFactory +{ + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("org.apache.zookeeper.inspector"); //$NON-NLS-1$ + + /** + * @return {@link Logger} for ZooInspector + */ + public static org.slf4j.Logger getLogger() + { + return logger; + } + +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/logger/LoggerFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/NodeListener.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/NodeListener.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/NodeListener.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/NodeListener.java Fri Apr 4 01:24:37 2014 @@ -1,37 +1,37 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.manager; - -import java.util.Map; - -/** - * A Listener for Events on zookeeper nodes - */ -public interface NodeListener { - /** - * @param nodePath - * - the path of the node - * @param eventType - * - the event type - * @param eventInfo - * - a {@link Map} containing any other information about this - * event - */ - public void processEvent(String nodePath, String eventType, - Map eventInfo); -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.manager; + +import java.util.Map; + +/** + * A Listener for Events on zookeeper nodes + */ +public interface NodeListener { + /** + * @param nodePath + * - the path of the node + * @param eventType + * - the event type + * @param eventInfo + * - a {@link Map} containing any other information about this + * event + */ + public void processEvent(String nodePath, String eventType, + Map eventInfo); +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/NodeListener.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/Pair.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/Pair.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/Pair.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/Pair.java Fri Apr 4 01:24:37 2014 @@ -1,120 +1,120 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.manager; - -/** - * A utility class for storing a pair of objects - * - * @param - * @param - */ -public class Pair { - private K key; - private V value; - - /** - * @param key - * @param value - */ - public Pair(K key, V value) { - this.key = key; - this.value = value; - } - - /** - * - */ - public Pair() { - // Do Nothing - } - - /** - * @return key - */ - public K getKey() { - return key; - } - - /** - * @param key - */ - public void setKey(K key) { - this.key = key; - } - - /** - * @return value - */ - public V getValue() { - return value; - } - - /** - * @param value - */ - public void setValue(V value) { - this.value = value; - } - - @Override - public String toString() { - return "Pair [" + key + ", " + value + "]"; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Pair other = (Pair) obj; - if (key == null) { - if (other.key != null) - return false; - } else if (!key.equals(other.key)) - return false; - if (value == null) { - if (other.value != null) - return false; - } else if (!value.equals(other.value)) - return false; - return true; - } - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.manager; + +/** + * A utility class for storing a pair of objects + * + * @param + * @param + */ +public class Pair { + private K key; + private V value; + + /** + * @param key + * @param value + */ + public Pair(K key, V value) { + this.key = key; + this.value = value; + } + + /** + * + */ + public Pair() { + // Do Nothing + } + + /** + * @return key + */ + public K getKey() { + return key; + } + + /** + * @param key + */ + public void setKey(K key) { + this.key = key; + } + + /** + * @return value + */ + public V getValue() { + return value; + } + + /** + * @param value + */ + public void setValue(V value) { + this.value = value; + } + + @Override + public String toString() { + return "Pair [" + key + ", " + value + "]"; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + ((value == null) ? 0 : value.hashCode()); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Pair other = (Pair) obj; + if (key == null) { + if (other.key != null) + return false; + } else if (!key.equals(other.key)) + return false; + if (value == null) { + if (other.value != null) + return false; + } else if (!value.equals(other.value)) + return false; + return true; + } + +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/Pair.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManager.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManager.java?rev=1584497&r1=1584496&r2=1584497&view=diff ============================================================================== --- zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManager.java (original) +++ zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManager.java Fri Apr 4 01:24:37 2014 @@ -1,139 +1,139 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zookeeper.inspector.manager; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.swing.JComboBox; -import javax.swing.JTextField; - -/** - * A Manager for all interactions between the application and the Zookeeper - * instance - */ -public interface ZooInspectorManager extends ZooInspectorNodeManager, - ZooInspectorNodeTreeManager { - - /** - * @param connectionProps - * @return true if successfully connected - */ - public boolean connect(Properties connectionProps); - - /** - * @return true if successfully disconnected - */ - public boolean disconnect(); - - /** - * @return a {@link Pair} containing the following: - *
    - *
  • a {@link Map} of property keys to list of possible values. If - * the list size is 1 the value is taken to be the default value for - * a {@link JTextField}. If the list size is greater than 1, the - * values are taken to be the possible options to show in a - * {@link JComboBox} with the first selected as default.
  • - *
  • a {@link Map} of property keys to the label to show on the UI - *
  • - *
      - * - */ - public Pair>, Map> getConnectionPropertiesTemplate(); - - /** - * @param selectedNodes - * - the nodes to add the watcher to - * @param nodeListener - * - the node listener for this watcher - */ - public void addWatchers(Collection selectedNodes, - NodeListener nodeListener); - - /** - * @param selectedNodes - * - the nodes to remove the watchers from - */ - public void removeWatchers(Collection selectedNodes); - - /** - * @param selectedFile - * - the file to load which contains the node viewers - * configuration - * @return nodeViewers - the class names of the node viewers from the - * configuration - * @throws IOException - * - if the configuration file cannot be loaded - */ - public List loadNodeViewersFile(File selectedFile) - throws IOException; - - /** - * @param selectedFile - * - the file to save the configuration to - * @param nodeViewersClassNames - * - the class names of the node viewers - * @throws IOException - * - if the configuration file cannot be saved - */ - public void saveNodeViewersFile(File selectedFile, - List nodeViewersClassNames) throws IOException; - - /** - * @param nodeViewersClassNames - * - the class names of the node viewers - * @throws IOException - * - if the default configuration file cannot be loaded - */ - public void setDefaultNodeViewerConfiguration( - List nodeViewersClassNames) throws IOException; - - /** - * @return nodeViewers - the class names of the node viewers from the - * configuration - * @throws IOException - * - if the default configuration file cannot be loaded - */ - List getDefaultNodeViewerConfiguration() throws IOException; - - /** - * @param connectionProps - * - the connection properties last used to connect to the - * zookeeeper instance - */ - public void setLastConnectionProps(Properties connectionProps); - - /** - * @return last connection Properties - the connection properties last used - * to connect to the zookeeeper instance - */ - public Properties getLastConnectionProps(); - - /** - * @param props - * - the properties to use as the default connection settings - * @throws IOException - * - if the default configuration file cannot be saved - */ - public void saveDefaultConnectionFile(Properties props) throws IOException; - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zookeeper.inspector.manager; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.swing.JComboBox; +import javax.swing.JTextField; + +/** + * A Manager for all interactions between the application and the Zookeeper + * instance + */ +public interface ZooInspectorManager extends ZooInspectorNodeManager, + ZooInspectorNodeTreeManager { + + /** + * @param connectionProps + * @return true if successfully connected + */ + public boolean connect(Properties connectionProps); + + /** + * @return true if successfully disconnected + */ + public boolean disconnect(); + + /** + * @return a {@link Pair} containing the following: + *
        + *
      • a {@link Map} of property keys to list of possible values. If + * the list size is 1 the value is taken to be the default value for + * a {@link JTextField}. If the list size is greater than 1, the + * values are taken to be the possible options to show in a + * {@link JComboBox} with the first selected as default.
      • + *
      • a {@link Map} of property keys to the label to show on the UI + *
      • + *
          + * + */ + public Pair>, Map> getConnectionPropertiesTemplate(); + + /** + * @param selectedNodes + * - the nodes to add the watcher to + * @param nodeListener + * - the node listener for this watcher + */ + public void addWatchers(Collection selectedNodes, + NodeListener nodeListener); + + /** + * @param selectedNodes + * - the nodes to remove the watchers from + */ + public void removeWatchers(Collection selectedNodes); + + /** + * @param selectedFile + * - the file to load which contains the node viewers + * configuration + * @return nodeViewers - the class names of the node viewers from the + * configuration + * @throws IOException + * - if the configuration file cannot be loaded + */ + public List loadNodeViewersFile(File selectedFile) + throws IOException; + + /** + * @param selectedFile + * - the file to save the configuration to + * @param nodeViewersClassNames + * - the class names of the node viewers + * @throws IOException + * - if the configuration file cannot be saved + */ + public void saveNodeViewersFile(File selectedFile, + List nodeViewersClassNames) throws IOException; + + /** + * @param nodeViewersClassNames + * - the class names of the node viewers + * @throws IOException + * - if the default configuration file cannot be loaded + */ + public void setDefaultNodeViewerConfiguration( + List nodeViewersClassNames) throws IOException; + + /** + * @return nodeViewers - the class names of the node viewers from the + * configuration + * @throws IOException + * - if the default configuration file cannot be loaded + */ + List getDefaultNodeViewerConfiguration() throws IOException; + + /** + * @param connectionProps + * - the connection properties last used to connect to the + * zookeeeper instance + */ + public void setLastConnectionProps(Properties connectionProps); + + /** + * @return last connection Properties - the connection properties last used + * to connect to the zookeeeper instance + */ + public Properties getLastConnectionProps(); + + /** + * @param props + * - the properties to use as the default connection settings + * @throws IOException + * - if the default configuration file cannot be saved + */ + public void saveDefaultConnectionFile(Properties props) throws IOException; + +} Propchange: zookeeper/trunk/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManager.java ------------------------------------------------------------------------------ svn:eol-style = native