Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ current version: __1.2-SNAPSHOT__

An improved zookeeper inspector

- single executable jar, java8, ZooKeeper 3.4.13
- single executable jar, java8, ZooKeeper 3.9.3
- Supports export zookeeper data to .zk, XML and folder [ctapmex/zkTreeUtil][1]
(planned ability to restore dump from file: [fork kostapc/zkTreeUtil][2])
- centered GUI forms and dialogs
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.13</version>
<version>3.9.3</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,21 @@ protected void done() {
}
aclDataPanel.removeAll();
aclDataPanel.setLayout(new GridBagLayout());
int j = 0;
int rowPos = 0;
for (Map<String, String> data : acls) {
int rowPos = 2 * j + 1;
JPanel aclPanel = new JPanel();
aclPanel.setBorder(BorderFactory
.createLineBorder(Color.BLACK));
aclPanel.setBackground(Color.WHITE);
aclPanel.setLayout(new GridBagLayout());
int i = 0;
int rowPosACL = 0;
for (Map.Entry<String, String> entry : data.entrySet()) {
int rowPosACL = 2 * i + 1;
JLabel label = new JLabel(entry.getKey());
label.setPreferredSize(new Dimension(60, 30));
JTextField text = new JTextField(entry.getValue());
text.setEditable(false);
GridBagConstraints c1 = new GridBagConstraints();
c1.gridx = 1;
c1.gridx = 0;
c1.gridy = rowPosACL;
c1.gridwidth = 1;
c1.gridheight = 1;
Expand All @@ -127,36 +126,38 @@ protected void done() {
c1.ipady = 0;
aclPanel.add(label, c1);
GridBagConstraints c2 = new GridBagConstraints();
c2.gridx = 3;
c2.gridx = 1;
c2.gridy = rowPosACL;
c2.gridwidth = 1;
c2.gridheight = 1;
c2.weightx = 0;
c2.weightx = 1;
c2.weighty = 0;
c2.anchor = GridBagConstraints.NORTHWEST;
c2.fill = GridBagConstraints.BOTH;
c2.insets = new Insets(5, 5, 5, 5);
c2.ipadx = 0;
c2.ipady = 0;
aclPanel.add(text, c2);
i++;
rowPosACL++;
}
GridBagConstraints c = new GridBagConstraints();
c.gridx = 1;
c.gridx = 0;
c.gridy = rowPos;
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = 1;
c.weighty = 1;
c.weighty = rowPos == acls.size() - 1 ? 1 : 0;
c.anchor = GridBagConstraints.NORTHWEST;
c.fill = GridBagConstraints.NONE;
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(5, 5, 5, 5);
c.ipadx = 0;
c.ipady = 0;
aclDataPanel.add(aclPanel, c);
rowPos++;
}
NodeViewerACL.this.aclDataPanel.revalidate();
NodeViewerACL.this.aclDataPanel.repaint();

aclDataPanel.revalidate();
aclDataPanel.repaint();
}
};
worker.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZKUtil;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooDefs.Perms;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.ZooKeeper.States;
import org.apache.zookeeper.data.ACL;
Expand Down Expand Up @@ -416,42 +416,7 @@ public List<Map<String, String>> getACLs(String nodePath) {
Map<String, String> aclMap = new LinkedHashMap<String, String>();
aclMap.put(ACL_SCHEME, acl.getId().getScheme());
aclMap.put(ACL_ID, acl.getId().getId());
StringBuilder sb = new StringBuilder();
int perms = acl.getPerms();
boolean addedPerm = false;
if ((perms & Perms.READ) == Perms.READ) {
sb.append("Read");
addedPerm = true;
}
if (addedPerm) {
sb.append(", ");
}
if ((perms & Perms.WRITE) == Perms.WRITE) {
sb.append("Write");
addedPerm = true;
}
if (addedPerm) {
sb.append(", ");
}
if ((perms & Perms.CREATE) == Perms.CREATE) {
sb.append("Create");
addedPerm = true;
}
if (addedPerm) {
sb.append(", ");
}
if ((perms & Perms.DELETE) == Perms.DELETE) {
sb.append("Delete");
addedPerm = true;
}
if (addedPerm) {
sb.append(", ");
}
if ((perms & Perms.ADMIN) == Perms.ADMIN) {
sb.append("Admin");
addedPerm = true;
}
aclMap.put(ACL_PERMS, sb.toString());
aclMap.put(ACL_PERMS, ZKUtil.getPermString(acl.getPerms()));
returnACLs.add(aclMap);
}
}
Expand Down