http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/settings.py
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/settings.py b/src/contrib/huebrowser/zkui/src/zkui/settings.py
deleted file mode 100644
index 844c695..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/settings.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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.
-
-DJANGO_APPS = [ "zkui" ]
-NICE_NAME = "ZooKeeper Browser"
-REQUIRES_HADOOP = False
-
-CLUSTERS = [{
- 'nice_name': 'Default',
- 'hostport': 'localhost:2181,localhost:2182,localhost:2183',
- 'rest_gateway': 'http://localhost:9998'
- }
-]
-
-DEPENDER_PACKAGE_YMLS = [
- "src/zkui/static/js/package.yml",
-]
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/art/line_icons.png
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/art/line_icons.png b/src/contrib/huebrowser/zkui/src/zkui/static/art/line_icons.png
deleted file mode 100644
index 1da4a29..0000000
Binary files a/src/contrib/huebrowser/zkui/src/zkui/static/art/line_icons.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/art/zkui.png
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/art/zkui.png b/src/contrib/huebrowser/zkui/src/zkui/static/art/zkui.png
deleted file mode 100644
index cb40df3..0000000
Binary files a/src/contrib/huebrowser/zkui/src/zkui/static/art/zkui.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/bootstrap.js
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/bootstrap.js b/src/contrib/huebrowser/zkui/src/zkui/static/bootstrap.js
deleted file mode 100644
index 8e3fbfb..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/static/bootstrap.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.
-CCS.Desktop.register({
- Zkui : {
- name : 'ZooKeeper Browser',
- css : '/zkui/static/css/zkui.css',
- require: [ 'Zkui' ],
- launch: function(path, options){
- return new Zkui(path || '/zkui/', options);
- },
- menu: {
- id: 'ccs-zkui-menu',
- img: {
- src: '/zkui/static/art/zkui.png'
- }
- },
- help: '/help/zkui/'
- }
-});
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/css/zkui.css
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/css/zkui.css b/src/contrib/huebrowser/zkui/src/zkui/static/css/zkui.css
deleted file mode 100644
index c49f392..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/static/css/zkui.css
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- 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.
-*/
-
-.zkui img.zkui_icon {
- width: 55px;
- height: 55px;
- position: absolute;
- top: 27px;
- left: 3px;
-}
-
-div.zkui .left_col li {
- margin: 5px 0px;
- font-size: 16px;
- background-color: white;
- color: black;
- padding: 2px 1px 1px 5px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border: solid black 1px;
-}
-
-div.zkui .left_col li:hover {
- background-color: lightBlue;
- color: white;
-}
-
-div.zkui .left_col li a {
- color: black;
- display: block;
-}
-
-div.zkui .left_col li a:hover {
- text-decoration: none;
-}
-
-div.zkui .createZnodeForm td,
-div.zkui .editZnodeForm td {
- padding: 5px;
-}
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/help/index.html
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/help/index.html b/src/contrib/huebrowser/zkui/src/zkui/static/help/index.html
deleted file mode 100644
index 355c8cd..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/static/help/index.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
- 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.
--->
-
-<h1>ZooKeeper Browser</h1>
-
-
-<p>ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services</p>
-
-<h2>About</h2>
-
-<p>The ZooKeeper Browser application allows you to see how the cluster nodes are working and also allows you to do CRUD operations on the znode hierarchy.</p>
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/js/Source/Zkui/Zkui.js
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/js/Source/Zkui/Zkui.js b/src/contrib/huebrowser/zkui/src/zkui/static/js/Source/Zkui/Zkui.js
deleted file mode 100644
index c8bf383..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/static/js/Source/Zkui/Zkui.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-/*
----
-
-script: Zkui.js
-
-description: Defines Zkui; a Hue application that extends CCS.JBrowser.
-
-authors:
-- Unknown
-
-requires:
-- ccs-shared/CCS.JBrowser
-
-provides: [Zkui]
-
-...
-*/
-ART.Sheet.define('window.art.browser.zkui', {
- 'min-width': 620
-});
-
-var Zkui = new Class({
-
- Extends: CCS.JBrowser,
-
- options: {
- className: 'art browser logo_header zkui'
- },
-
- initialize: function(path, options){
- this.parent(path || '/zkui/', options);
- }
-
-});
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/static/js/package.yml
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/static/js/package.yml b/src/contrib/huebrowser/zkui/src/zkui/static/js/package.yml
deleted file mode 100644
index c2c07ad..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/static/js/package.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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.
-copyright: Apache License v2.0
-version: 0.1
-description: ZooKeeper Browser
-name: ZooKeeper Browser
-sources: [Source/Zkui/Zkui.js]
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/stats.py
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/stats.py b/src/contrib/huebrowser/zkui/src/zkui/stats.py
deleted file mode 100644
index 48f35dd..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/stats.py
+++ /dev/null
@@ -1,170 +0,0 @@
-# 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.
-
-import socket
-import re
-
-from StringIO import StringIO
-
-class Session(object):
-
- class BrokenLine(Exception): pass
-
- def __init__(self, session):
- m = re.search('/(\d+\.\d+\.\d+\.\d+):(\d+)\[(\d+)\]\((.*)\)', session)
- if m:
- self.host = m.group(1)
- self.port = m.group(2)
- self.interest_ops = m.group(3)
- for d in m.group(4).split(","):
- k,v = d.split("=")
- self.__dict__[k] = v
- else:
- raise Session.BrokenLine()
-
-class ZooKeeperStats(object):
-
- def __init__(self, host='localhost', port='2181', timeout=1):
- self._address = (host, int(port))
- self._timeout = timeout
-
- def get_stats(self):
- """ Get ZooKeeper server stats as a map """
- data = self._send_cmd('mntr')
- if data:
- return self._parse(data)
- else:
- data = self._send_cmd('stat')
- return self._parse_stat(data)
-
- def get_clients(self):
- """ Get ZooKeeper server clients """
- clients = []
-
- stat = self._send_cmd('stat')
- if not stat:
- return clients
-
- sio = StringIO(stat)
-
- #skip two lines
- sio.readline()
- sio.readline()
-
- for line in sio:
- if not line.strip():
- break
- try:
- clients.append(Session(line.strip()))
- except Session.BrokenLine:
- continue
-
- return clients
-
- def _create_socket(self):
- return socket.socket()
-
- def _send_cmd(self, cmd):
- """ Send a 4letter word command to the server """
- s = self._create_socket()
- s.settimeout(self._timeout)
-
- s.connect(self._address)
- s.send(cmd)
-
- data = s.recv(2048)
- s.close()
-
- return data
-
- def _parse(self, data):
- """ Parse the output from the 'mntr' 4letter word command """
- h = StringIO(data)
-
- result = {}
- for line in h.readlines():
- try:
- key, value = self._parse_line(line)
- result[key] = value
- except ValueError:
- pass # ignore broken lines
-
- return result
-
- def _parse_stat(self, data):
- """ Parse the output from the 'stat' 4letter word command """
- h = StringIO(data)
-
- result = {}
-
- version = h.readline()
- if version:
- result['zk_version'] = version[version.index(':')+1:].strip()
-
- # skip all lines until we find the empty one
- while h.readline().strip(): pass
-
- for line in h.readlines():
- m = re.match('Latency min/avg/max: (\d+)/(\d+)/(\d+)', line)
- if m is not None:
- result['zk_min_latency'] = int(m.group(1))
- result['zk_avg_latency'] = int(m.group(2))
- result['zk_max_latency'] = int(m.group(3))
- continue
-
- m = re.match('Received: (\d+)', line)
- if m is not None:
- result['zk_packets_received'] = int(m.group(1))
- continue
-
- m = re.match('Sent: (\d+)', line)
- if m is not None:
- result['zk_packets_sent'] = int(m.group(1))
- continue
-
- m = re.match('Outstanding: (\d+)', line)
- if m is not None:
- result['zk_outstanding_requests'] = int(m.group(1))
- continue
-
- m = re.match('Mode: (.*)', line)
- if m is not None:
- result['zk_server_state'] = m.group(1)
- continue
-
- m = re.match('Node count: (\d+)', line)
- if m is not None:
- result['zk_znode_count'] = int(m.group(1))
- continue
-
- return result
-
- def _parse_line(self, line):
- try:
- key, value = map(str.strip, line.split('\t'))
- except ValueError:
- raise ValueError('Found invalid line: %s' % line)
-
- if not key:
- raise ValueError('The key is mandatory and should not be empty')
-
- try:
- value = int(value)
- except (TypeError, ValueError):
- pass
-
- return key, value
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/clients.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/clients.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/clients.mako
deleted file mode 100644
index 2bee9a7..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/clients.mako
+++ /dev/null
@@ -1,51 +0,0 @@
-<%!
-# 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.
-%>
-
-<%namespace name="shared" file="shared_components.mako" />
-
-${shared.header("ZooKeeper Browser > Clients > %s:%s" % (host, port))}
-
-<h1>${host}:${port} :: client connections</h1>
-<br />
-
-% if clients:
- <table data-filters="HtmlTable">
- <thead>
- <tr>
- <th>Host</th>
- <th>Port</th>
- <th>Interest Ops</th>
- <th>Queued</th>
- <th>Received</th>
- <th>Sent</th>
- </thead>
- % for client in clients:
- <tr>
- <td>${client.host}</td>
- <td>${client.port}</td>
- <td>${client.interest_ops}</td>
- <td>${client.queued}</td>
- <td>${client.recved}</td>
- <td>${client.sent}</td>
- </tr>
- % endfor
- </table>
-% endif
-
-${shared.footer()}
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/create.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/create.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/create.mako
deleted file mode 100644
index 2a8b8cc..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/create.mako
+++ /dev/null
@@ -1,34 +0,0 @@
-<%!
-# 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.
-%>
-<%namespace name="shared" file="shared_components.mako" />
-
-${shared.header("ZooKeeper Browser > Create Znode")}
-
-<h2>Create New Znode :: ${path}</h2>
-<hr /><br />
-
-<form class="createZnodeForm" action="" method="POST">
-<table align="center">
- ${form.as_table()|n}
-<tr><td colspan="2" align="right">
- <button type="submit">Create</button>
-</td></tr>
-</table>
-</form>
-
-${shared.footer()}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/edit.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/edit.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/edit.mako
deleted file mode 100644
index 997bd07..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/edit.mako
+++ /dev/null
@@ -1,34 +0,0 @@
-<%!
-# 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.
-%>
-<%namespace name="shared" file="shared_components.mako" />
-
-${shared.header("ZooKeeper Browser > Edit Znode > %s" % path)}
-
-<h2>Edit Znode Data :: ${path}</h2>
-<hr /><br />
-
-<form class="editZnodeForm" action="" method="POST">
-<table align="center">
- ${form.as_table()|n}
-<tr><td colspan="2" align="right">
- <button type="submit">Save</button>
-</td></tr>
-</table>
-</form>
-
-${shared.footer()}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/index.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/index.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/index.mako
deleted file mode 100644
index 567919d..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/index.mako
+++ /dev/null
@@ -1,54 +0,0 @@
-<%!
-# 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.
-%>
-<%namespace name="shared" file="shared_components.mako" />
-
-${shared.header("ZooKeeper Browser")}
-
-<h2>Overview</h2>
-
-<br />
-
-% for i, c in enumerate(overview):
- <h3> ${i+1}. <a href="${url('zkui.views.view', id=i)}">${c['nice_name']} Cluster Overview</a></h3><br />
-
- <table data-filters="HtmlTable">
- <thead>
- <tr>
- <th>Node</th>
- <th>Role</th>
- <th>Avg Latency</th>
- <th>Watch Count</th>
- <th>Version</th>
- </tr>
- </thead>
- % for host, stats in c['stats'].items():
- <tr>
- <td>${host}</td>
- <td>${stats.get('zk_server_state', '')}</td>
- <td>${stats.get('zk_avg_latency', '')}</td>
- <td>${stats.get('zk_watch_count', '')}</td>
- <td>${stats.get('zk_version', '')}</td>
- </tr>
- % endfor
- </table>
-
- <br /><br />
-% endfor
-
-${shared.footer()}
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/shared_components.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/shared_components.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/shared_components.mako
deleted file mode 100644
index f9a4589..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/shared_components.mako
+++ /dev/null
@@ -1,66 +0,0 @@
-<%!
-# 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.
-%>
-
-<%!
-import datetime
-from django.template.defaultfilters import urlencode, escape
-from zkui import settings
-%>
-
-<%def name="header(title='ZooKeeper Browser', toolbar=True)">
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
- <html>
- <head>
- <title>${title}</title>
- </head>
- <body>
- % if toolbar:
- <div class="toolbar">
- <a href="${url('zkui.views.index')}"><img src="/zkui/static/art/zkui.png" class="zkui_icon"/></a>
- </div>
- % endif
-
- <div data-filters="SplitView">
- <div class="left_col jframe_padded" style="width:150px;">
- <ul>
- <li><a href="${url("zkui.views.index")}">Overview</a></li>
- </ul>
- <br />
-
- <h2>Clusters</h2>
- <ul>
- % for id, c in enumerate(settings.CLUSTERS):
- <li><a href="${url("zkui.views.view", id=id)}">
- ${c['nice_name']}</a></li>
- % endfor
- </ul>
- </div>
-
- <div class="right_col jframe_padded">
-</%def>
-
-<%def name="info_button(url, text)">
- <a data-filters="ArtButton" href="${url}" style="background: url(/static/art/info.png) left 50%; padding: 6px 6px 6px 20px; margin: 10px;" data-icon-styles="{'width': 14, 'height': 14}">${text}</a>
-</%def>
-
-<%def name="footer()">
- </div>
- </div>
- </body>
- </html>
-</%def>
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/tree.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/tree.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/tree.mako
deleted file mode 100644
index c74c202..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/tree.mako
+++ /dev/null
@@ -1,75 +0,0 @@
-<%!
-# 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.
-%>
-<%namespace name="shared" file="shared_components.mako" />
-
-${shared.header("ZooKeeper Browser > Tree > %s > %s" % (cluster['nice_name'], path))}
-
-<h1>${cluster['nice_name'].lower()} :: ${path}</h1>
-<br />
-
-<table data-filters="HtmlTable">
- <thead>
- <th colspan="2">Children</th>
- </thead>
- % for child in children:
- <tr><td width="100%">
- <a href="${url('zkui.views.tree', id=cluster['id'], \
- path=("%s/%s" % (path, child)).replace('//', '/'))}">
- ${child}</a>
- </td><td>
- <a title="Delete ${child}" class="delete frame_tip confirm_and_post" alt="Are you sure you want to delete ${child}?" href="${url('zkui.views.delete', id=cluster['id'], \
- path=("%s/%s" % (path, child)).replace('//', '/'))}">Delete</a>
- </td></tr>
- % endfor
-</table>
-<br />
-<span style="float: right">
- ${shared.info_button(url('zkui.views.create', id=cluster['id'], path=path), 'Create New')}
-</span>
-
-<div style="clear: both"></div>
-
-<h2>data :: base64 :: length :: ${znode.get('dataLength', 0)}</h2>
-<br />
-
-<textarea name="data64" style="width: 100%;" rows="5" readonly="readonly">${znode.get('data64', '')}</textarea>
-<div style="clear: both"></div>
-<span style="float: right">
- ${shared.info_button(url('zkui.views.edit_as_base64', id=cluster['id'], path=path), 'Edit as Base64')}
- ${shared.info_button(url('zkui.views.edit_as_text', id=cluster['id'], path=path), 'Edit as Text')}
-</span>
-<div style="clear: both"></div>
-<br />
-
-<h2>stat information</h2>
-<br />
-
-<table data-filters="HtmlTable">
- <thead><tr><th>Key</th>
- <th width="80%">Value</th></tr></thead>
- % for key in ('pzxid', 'ctime', 'aversion', 'mzxid', \
- 'ephemeralOwner', 'version', 'mtime', 'cversion', 'czxid'):
- <tr><td>${key}</td><td>${znode[key]}</td></tr>
- % endfor
-</table>
-
-<br />
-<a target="_blank" href="http://zookeeper.apache.org/docs/current/zookeeperProgrammers.html#sc_zkStatStructure">Details on stat information.</a>
-
-${shared.footer()}
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/templates/view.mako
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/templates/view.mako b/src/contrib/huebrowser/zkui/src/zkui/templates/view.mako
deleted file mode 100644
index e046afc..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/templates/view.mako
+++ /dev/null
@@ -1,128 +0,0 @@
-<%!
-# 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.
-%>
-<%namespace name="shared" file="shared_components.mako" />
-
-${shared.header("ZooKeeper Browser > %s" % cluster['nice_name'])}
-
-<%def name="show_stats(stats)">
- <thead>
- <tr><th>Key</th>
- <th width="100%">Value</th></tr>
- </thead>
-
- <tr><td>Version</td>
- <td>${stats.get('zk_version')}</td>
- </tr>
-
- <tr><td>Latency</td><td>
- Min: ${stats.get('zk_min_latency', '')}
- Avg: ${stats.get('zk_avg_latency', '')}
- Max: ${stats.get('zk_max_latency', '')}
- </td></tr>
-
- <tr><td>Packets</td>
- <td>Sent: ${stats.get('zk_packets_sent', '')}
- Received: ${stats.get('zk_packets_received', '')}
- </td>
- </tr>
-
- <tr><td>Outstanding Requests</td>
- <td>${stats.get('zk_outstanding_requests', '')}</td>
- </tr>
-
- <tr><td>Watch Count</td>
- <td>${stats.get('zk_watch_count', '')}</td>
- </tr>
-
- <tr><td>Open FD Count</td>
- <td>${stats.get('zk_open_file_descriptor_count', '')}</td>
- </tr>
-
- <tr><td>Max FD Count</td>
- <td>${stats.get('zk_max_file_descriptor_count', '')}</td>
- </tr>
-
-</%def>
-
-<h2> ${cluster['nice_name']} Cluster Overview </h2>
-
-${shared.info_button(url('zkui.views.tree', id=cluster['id'], path='/'), 'View Znode Hierarchy')}
-
-<br /><br />
-
-% if leader:
-<h2>General</h2>
-
-<table data-filters="HtmlTable">
- <thead>
- <tr><th>Key</th><th width="100%">Value</th></tr>
- </thead>
-
- <tr><td>ZNode Count</td>
- <td>${leader.get('zk_znode_count', '')}</td></tr>
-
- <tr><td>Ephemerals Count</td>
- <td>${leader.get('zk_ephemerals_count', '')}</td></tr>
-
- <tr><td>Approximate Data Size</td>
- <td>${leader.get('zk_approximate_data_size', '')} bytes</td></tr>
-
-</table>
-<br /><br />
-% endif
-
-% if leader:
- <h2>node :: ${leader['host']} :: leader</h2>
-
- ${shared.info_button(url('zkui.views.clients', host=leader['host']), 'View Client Connections')}
-
- <br /><br />
- <table data-filters="HtmlTable">
- ${show_stats(leader)}
-
- <tr><td>Followers</td>
- <td>${leader.get('zk_followers', '')}</td>
- </tr>
-
- <tr><td>Synced Followers</td>
- <td>${leader.get('zk_synced_followers', '')}</td>
- </tr>
-
- <tr><td>Pending Syncs</td>
- <td>${leader.get('zk_pending_syncs', '')}</td>
- </tr>
-
- </table>
-<br /><br />
-% endif
-
-% for stats in followers:
- <h2>node :: ${stats['host']} :: follower</h2>
- <br />
-
- ${shared.info_button(url('zkui.views.clients', host=stats['host']), 'View Client Connections')}
-
- <br /><br />
- <table data-filters="HtmlTable">
- ${show_stats(stats)}
- </table>
- <br /><br />
-% endfor
-
-${shared.footer()}
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/urls.py
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/urls.py b/src/contrib/huebrowser/zkui/src/zkui/urls.py
deleted file mode 100644
index f795f7e..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/urls.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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.
-
-from django.conf.urls.defaults import patterns, url
-
-urlpatterns = patterns('zkui',
- url(r'^$', 'views.index'),
- url(r'view/(?P<id>\d+)$', 'views.view'),
- url(r'clients/(?P<host>.+)$', 'views.clients'),
- url(r'tree/(?P<id>\d+)(?P<path>.+)$', 'views.tree'),
- url(r'create/(?P<id>\d+)(?P<path>.*)$', 'views.create'),
- url(r'delete/(?P<id>\d+)(?P<path>.*)$', 'views.delete'),
- url(r'edit/base64/(?P<id>\d+)(?P<path>.*)$', 'views.edit_as_base64'),
- url(r'edit/text/(?P<id>\d+)(?P<path>.*)$', 'views.edit_as_text')
-)
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/utils.py
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/utils.py b/src/contrib/huebrowser/zkui/src/zkui/utils.py
deleted file mode 100644
index fb01317..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/utils.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-from zkui import settings
-
-from django.http import Http404
-
-def get_cluster_or_404(id):
- try:
- id = int(id)
- if not (0 <= id < len(settings.CLUSTERS)):
- raise ValueError, 'Undefined cluster id.'
- except (TypeError, ValueError):
- raise Http404()
-
- cluster = settings.CLUSTERS[id]
- cluster['id'] = id
-
- return cluster
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/views.py
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/views.py b/src/contrib/huebrowser/zkui/src/zkui/views.py
deleted file mode 100644
index 64d926b..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/views.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# 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.
-
-from desktop.lib.django_util import render
-from django.http import Http404
-
-from zkui import settings
-from zkui.stats import ZooKeeperStats
-from zkui.rest import ZooKeeper
-from zkui.utils import get_cluster_or_404
-from zkui.forms import CreateZNodeForm, EditZNodeForm
-
-def _get_global_overview():
- overview = []
- for c in settings.CLUSTERS:
- overview.append(_get_overview(c))
- return overview
-
-def _get_overview(cluster):
- stats = {}
- for s in cluster['hostport'].split(','):
- host, port = map(str.strip, s.split(':'))
-
- zks = ZooKeeperStats(host, port)
- stats[s] = zks.get_stats() or {}
-
- cluster['stats'] = stats
- return cluster
-
-def _group_stats_by_role(cluster):
- leader, followers = None, []
- for host, stats in cluster['stats'].items():
- stats['host'] = host
-
- if stats.get('zk_server_state') == 'leader':
- leader = stats
-
- elif stats.get('zk_server_state') == 'follower':
- followers.append(stats)
-
- return leader, followers
-
-def index(request):
- overview = _get_global_overview()
- return render('index.mako', request,
- dict(overview=overview))
-
-def view(request, id):
- cluster = get_cluster_or_404(id)
-
- cluster = _get_overview(cluster)
- leader, followers = _group_stats_by_role(cluster)
-
- return render('view.mako', request,
- dict(cluster=cluster, leader=leader, followers=followers))
-
-def clients(request, host):
- parts = host.split(':')
- if len(parts) != 2:
- raise Http404
-
- host, port = parts
- zks = ZooKeeperStats(host, port)
- clients = zks.get_clients()
-
- return render('clients.mako', request,
- dict(host=host, port=port, clients=clients))
-
-def tree(request, id, path):
- cluster = get_cluster_or_404(id)
- zk = ZooKeeper(cluster['rest_gateway'])
-
- znode = zk.get(path)
- children = sorted(zk.get_children_paths(path))
-
- return render('tree.mako', request,
- dict(cluster=cluster, path=path, \
- znode=znode, children=children))
-
-def delete(request, id, path):
- cluster = get_cluster_or_404(id)
- if request.method == 'POST':
- zk = ZooKeeper(cluster['rest_gateway'])
- try:
- zk.recursive_delete(path)
- except ZooKeeper.NotFound:
- pass
-
- return tree(request, id, path[:path.rindex('/')] or '/')
-
-def create(request, id, path):
- cluster = get_cluster_or_404(id)
-
- if request.method == 'POST':
- form = CreateZNodeForm(request.POST)
- if form.is_valid():
- zk = ZooKeeper(cluster['rest_gateway'])
-
- full_path = ("%s/%s" % (path, form.cleaned_data['name']))\
- .replace('//', '/')
-
- zk.create(full_path, \
- form.cleaned_data['data'], \
- sequence = form.cleaned_data['sequence'])
- return tree(request, id, path)
- else:
- form = CreateZNodeForm()
-
- return render('create.mako', request,
- dict(path=path, form=form))
-
-def edit_as_base64(request, id, path):
- cluster = get_cluster_or_404(id)
- zk = ZooKeeper(cluster['rest_gateway'])
- node = zk.get(path)
-
- if request.method == 'POST':
- form = EditZNodeForm(request.POST)
- if form.is_valid():
- # TODO is valid base64 string?
- data = form.cleaned_data['data'].decode('base64')
- zk.set(path, data, form.cleaned_data['version'])
-
- return tree(request, id, path)
- else:
- form = EditZNodeForm(dict(\
- data=node.get('data64', ''),
- version=node.get('version', '-1')))
-
- return render('edit.mako', request,
- dict(path=path, form=form))
-
-def edit_as_text(request, id, path):
- cluster = get_cluster_or_404(id)
- zk = ZooKeeper(cluster['rest_gateway'])
- node = zk.get(path)
-
- if request.method == 'POST':
- form = EditZNodeForm(request.POST)
- if form.is_valid():
- zk.set(path, form.cleaned_data['data'])
-
- return tree(request, id, path)
- else:
- form = EditZNodeForm(dict(data=node.get('data64', '')\
- .decode('base64').strip(),
- version=node.get('version', '-1')))
-
- return render('edit.mako', request,
- dict(path=path, form=form))
-
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/huebrowser/zkui/src/zkui/windmilltests.py
----------------------------------------------------------------------
diff --git a/src/contrib/huebrowser/zkui/src/zkui/windmilltests.py b/src/contrib/huebrowser/zkui/src/zkui/windmilltests.py
deleted file mode 100644
index ba44e26..0000000
--- a/src/contrib/huebrowser/zkui/src/zkui/windmilltests.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.
-
-from desktop.lib.windmill_util import logged_in_client
-
-def test_zkui():
- """ launches the default view for zkui """
- client = logged_in_client()
- client.click(id='ccs-zkui-menu')
- client.waits.forElement(classname='CCS-ZKUI', timeout='2000')
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/README.txt
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/README.txt b/src/contrib/loggraph/README.txt
deleted file mode 100644
index 1865fa5..0000000
--- a/src/contrib/loggraph/README.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-LogGraph README
-
-1 - About
-LogGraph is an application for viewing and filtering zookeeper logs. It can handle transaction logs and message logs.
-
-2 - Compiling
-
-Run "ant jar" in src/contrib/loggraph/. This will download all dependencies and compile all the loggraph code.
-
-Once compilation has finished, you can run it the the loggraph.sh script in src/contrib/loggraph/bin. This will start and embedded web server on your machine.
-Navigate to http://localhost:8182/graph/main.html
-
-3 - Usage
-LogGraph presents the user with 4 views,
-
- a) Simple log view
- This view simply displays the log text. This isn't very useful without filters (see "Filtering the logs").
-
- b) Server view
- The server view shows the interactions between the different servers in an ensemble. The X axis represents time.
- * Exceptions show up as red dots. Hovering your mouse over them will give you more details of the exception
- * The colour of the line represents the election state of the server.
- - orange means LOOKING for leader
- - dark green means the server is the leader
- - light green means the server is following a leader
- - yellow means there isn't enough information to determine the state of the server.
- * The gray arrows denote election messages between servers. Pink dashed arrows are messages that were sent but never delivered.
-
- c) Session view
- The session view shows the lifetime of sessions on a server. Use the time filter to narrow down the view. Any more than about 2000 events will take a long time to view in your browser.
- The X axis represents time. Each line is a session. The black dots represent events on the session. You can click on the black dots for more details of the event.
-
- d) Stats view
- There is currently only one statistics view, Transactions/minute. Suggestions for other statistic views are very welcome.
-
-4 - Filtering the logs
-The logs can be filtered in 2 ways, by time and by content.
-
-To filter by time simply move the slider to the desired start time. The time window specifies how many milliseconds after and including the start time will be displayed.
-
-Content filtering uses a adhoc filtering language, using prefix notation. The language looks somewhat similar to lisp. A statement in the language takes the form (op arg arg ....). A statement resolves to a boolean value. Statements can be nested.
-
-4.1 - Filter arguments
-An argument can be a number, a string or a symbol. A number is any argument which starts with -, + or 0 to 9. If the number starts with 0x it is interpretted as hexidecimal. Otherwise it is interpretted as decimal. If the argument begins with a double-quote, (") it is interpretted as a string. Anything else is interpretted as a symbol.
-
-4.2 - Filter symbols
-The possible filter symbols are:
-
-client-id : number, the session id of the client who initiated a transaction.
-cxid : number, the cxid of a transaction
-zxid : number, the zxid of a transaction
-operation : string, the operation being performed, for example "setData", "createSession", "closeSession", "error", "create"
-
-4.3 - Filter operations
-The possible filter operations are:
-
-or : logical or, takes 1 or more arguments which must be other statements.
-and : logical and, takes 1 or more arguments which must be other statements.
-not : logical not, takes 1 argument which must be another statement.
-xor : exclusive or, takes 1 or more arguments which must be other statements.
-= : equals, takes 1 or more arguments, which must all be equal to each other to return true.
-> : greater than, takes 1 or more arguments, to return true the 1st argument must be greater than the 2nd argument which must be greater than the 3rd argument and so on...
-< : less than, takes 1 or more arguments, to return true the 1st argument must be less than the 2nd argument which must be less than the 3rd argument and so on...
-
-4.3 - Filter examples
-Give me all the setData operations with session id 0xdeadbeef or 0xcafeb33r but not with zxid 0x12341234 ->
-
-(and (= operation "setData") (or (= client-id 0xdeadbeef) (= client-id 0xcafeb33r)) (not (= zxid 0x12341234)))
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/bin/loggraph-dev.sh
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/bin/loggraph-dev.sh b/src/contrib/loggraph/bin/loggraph-dev.sh
deleted file mode 100755
index 0b82efa..0000000
--- a/src/contrib/loggraph/bin/loggraph-dev.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-make_canonical () {
- cd $1; pwd;
-}
-
-SCRIPTDIR=`dirname $0`
-BUILDDIR=`make_canonical $SCRIPTDIR/../../../../build/contrib/loggraph`
-LIBDIR=`make_canonical $BUILDDIR/lib`
-WEBDIR=`make_canonical $SCRIPTDIR/../web`
-ZKDIR=`make_canonical $SCRIPTDIR/../../../../build/`
-
-if [ ! -x $BUILDDIR ]; then
- echo "\n\n*** You need to build loggraph before running it ***\n\n";
- exit;
-fi
-
-for i in `ls $LIBDIR`; do
- CLASSPATH=$LIBDIR/$i:$CLASSPATH
-done
-
-for i in $ZKDIR/zookeeper-*.jar; do
- CLASSPATH="$i:$CLASSPATH"
-done
-
-CLASSPATH=$BUILDDIR/classes:$WEBDIR:$CLASSPATH
-echo $CLASSPATH
-java -Dlog4j.configuration=org/apache/zookeeper/graph/log4j.properties -Xdebug -Xrunjdwp:transport=dt_socket,address=4444,server=y,suspend=n -cp $CLASSPATH org.apache.zookeeper.graph.LogServer $*
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/bin/loggraph.sh
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/bin/loggraph.sh b/src/contrib/loggraph/bin/loggraph.sh
deleted file mode 100755
index 381e5ad..0000000
--- a/src/contrib/loggraph/bin/loggraph.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-make_canonical () {
- cd $1; pwd;
-}
-
-SCRIPTDIR=`dirname $0`
-BUILDDIR=`make_canonical $SCRIPTDIR/../../../../build/contrib/loggraph`
-LIBDIR=`make_canonical $BUILDDIR/lib`
-ZKDIR=`make_canonical $SCRIPTDIR/../../../../build/`
-
-if [ ! -x $BUILDDIR ]; then
- echo "\n\n*** You need to build loggraph before running it ***\n\n";
- exit;
-fi
-
-for i in `ls $LIBDIR`; do
- CLASSPATH=$LIBDIR/$i:$CLASSPATH
-done
-
-for i in `ls $BUILDDIR/*.jar`; do
- CLASSPATH=$i:$CLASSPATH
-done
-
-for i in $ZKDIR/zookeeper-*.jar; do
- CLASSPATH="$i:$CLASSPATH"
-done
-
-java -cp $CLASSPATH org.apache.zookeeper.graph.LogServer $*
-
-
-
-
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/build.xml
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/build.xml b/src/contrib/loggraph/build.xml
deleted file mode 100644
index 5be6970..0000000
--- a/src/contrib/loggraph/build.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- 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.
--->
-
-<project name="loggraph" default="jar">
-
- <import file="../build-contrib.xml"/>
-
- <target name="init" depends="check-contrib,zookeeperbuildcontrib.init" unless="skip.contrib">
- <echo message="contrib: ${name}"/>
- <mkdir dir="${build.dir}"/>
- <antcall target="init-contrib"/>
- </target>
-
- <target name="compile" depends="init,ivy-retrieve,zookeeperbuildcontrib.compile" unless="skip.contrib">
- </target>
-
- <target name="setjarname">
- <property name="jarname" value="${build.dir}/zookeeper-${version}-${name}.jar"/>
- </target>
-
- <target name="jar" depends="setjarname,compile" >
- <jar destfile="${jarname}">
- <fileset file="${zk.root}/LICENSE.txt" />
- <fileset dir="${build.classes}" />
- <fileset dir="web"/>
- <manifest>
- <attribute name="Built-By" value="${user.name}"/>
- <attribute name="Built-At" value="${build.time}"/>
- <attribute name="Built-On" value="${host.name}" />
- <attribute name="Implementation-Title" value="org.apache.zookeeper.graph"/>
- <attribute name="Implementation-Version" value="${revision}"/>
- <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
- </manifest>
- </jar>
- </target>
-
- <target name="test">
- <echo message="No test target defined for this package" />
- </target>
-
-
- <target name="package" depends="compile, zookeeperbuildcontrib.package" unless="skip.contrib">
- <echo message="contrib: ${name}"/>
-
- <copy file="${basedir}/build.xml" todir="${dist.dir}/contrib/${name}"/>
-
- <mkdir dir="${dist.dir}/contrib/${name}/src"/>
- <copy todir="${dist.dir}/contrib/${name}/src">
- <fileset dir="${basedir}/src"/>
- </copy>
-
- </target>
-
-</project>
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/ivy.xml
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/ivy.xml b/src/contrib/loggraph/ivy.xml
deleted file mode 100644
index e3a1b48..0000000
--- a/src/contrib/loggraph/ivy.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
- 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.
--->
-
-<ivy-module version="2.0"
- xmlns:e="http://ant.apache.org/ivy/extra">
-
- <info organisation="org.apache.zookeeper"
- module="${name}" revision="${version}">
- <license name="Apache 2.0"/>
- <ivyauthor name="Apache ZooKeeper" url="http://zookeeper.apache.org"/>
- <description>ZooKeeper Graphing</description>
- </info>
-
- <configurations defaultconfmapping="default">
- <conf name="default"/>
- <conf name="test"/>
- </configurations>
-
- <dependencies>
- <dependency org="org.slf4j" name="slf4j-api" rev="1.7.5"/>
- <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.5" transitive="false"/>
-
- <!-- transitive false turns off dependency checking, log4j deps seem borked -->
- <dependency org="log4j" name="log4j" rev="1.2.17" transitive="false"/>
- <dependency org="org.eclipse.jetty" name="jetty-server" rev="9.2.18.v20160721" />
- <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="9.2.18.v20160721" />
- <dependency org="com.googlecode.json-simple" name="json-simple" rev="1.1" />
- </dependencies>
-
-</ivy-module>
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterException.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterException.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterException.java
deleted file mode 100644
index c0912fa..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * 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.graph;
-
-public class FilterException extends Exception {
- public FilterException(String s) { super(s); }
-};
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterOp.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterOp.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterOp.java
deleted file mode 100644
index b29c846..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterOp.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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.graph;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zookeeper.graph.filterops.*;
-
-public abstract class FilterOp {
- protected List<FilterOp> subOps;
- protected List<Arg> args;
-
- public enum ArgType {
- STRING, NUMBER, SYMBOL
- }
-
- public FilterOp() {
- subOps = new ArrayList<FilterOp>();
- args = new ArrayList<Arg>();
- }
-
- public static FilterOp newOp(String op) throws FilterException {
- if (op.equals("or"))
- return new OrOp();
- if (op.equals("and"))
- return new AndOp();
- if (op.equals("not"))
- return new NotOp();
- if (op.equals("xor"))
- return new XorOp();
- if (op.equals("="))
- return new EqualsOp();
- if (op.equals("<"))
- return new LessThanOp();
- if (op.equals(">"))
- return new GreaterThanOp();
-
- throw new FilterException("Invalid operation '"+op+"'");
- }
-
- public void addSubOp(FilterOp op) {
- subOps.add(op);
- }
-
- public void addArg(Arg arg) {
- args.add(arg);
- }
-
- public abstract boolean matches(LogEntry entry) throws FilterException;
-
- public String toString() {
- String op = "(" + getClass().getName();
- for (FilterOp f : subOps) {
- op += " " + f;
- }
- for (Arg a : args) {
- op += " " + a;
- }
- return op + ")";
- }
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterParser.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterParser.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterParser.java
deleted file mode 100644
index cf12e3a..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/FilterParser.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * 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.graph;
-
-import java.io.PushbackReader;
-import java.io.StringReader;
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.apache.zookeeper.graph.filterops.*;
-
-public class FilterParser {
- private PushbackReader reader;
-
- public FilterParser(String s) {
- reader = new PushbackReader(new StringReader(s));
- }
-
- private String readUntilSpace() throws IOException {
- StringBuffer buffer = new StringBuffer();
-
- int c = reader.read();
- while (!Character.isWhitespace(c) && c != ')' && c != '(') {
- buffer.append((char)c);
- c = reader.read();
- if (c == -1) {
- break;
- }
- }
- reader.unread(c);
-
- return buffer.toString().trim();
- }
-
- private StringArg readStringArg() throws IOException, FilterException {
- int c = reader.read();
- int last = 0;
- if (c != '"') {
- throw new FilterException("Check the parser, trying to read a string that doesn't begin with quotes");
- }
- StringBuffer buffer = new StringBuffer();
- while (reader.ready()) {
- last = c;
- c = reader.read();
- if (c == -1) {
- break;
- }
-
- if (c == '"' && last != '\\') {
- return new StringArg(buffer.toString());
- } else {
- buffer.append((char)c);
- }
- }
- throw new FilterException("Unterminated string");
- }
-
- private NumberArg readNumberArg() throws IOException, FilterException {
- String strval = readUntilSpace();
-
- try {
- if (strval.startsWith("0x")) {
- return new NumberArg(Long.valueOf(strval.substring(2), 16));
- } else {
- return new NumberArg(Long.valueOf(strval));
- }
- } catch (NumberFormatException e) {
- throw new FilterException("Not a number [" + strval + "]\n" + e);
- }
- }
-
- private SymbolArg readSymbolArg() throws IOException, FilterException {
- return new SymbolArg(readUntilSpace());
- }
-
- public FilterOp parse() throws IOException, FilterException {
- int c = reader.read();
- if (c != '(') {
- throw new FilterException("Invalid format");
- }
-
- String opstr = readUntilSpace();
- FilterOp op = FilterOp.newOp(opstr);
-
- while (reader.ready()) {
- c = reader.read();
- if (c == -1) {
- break;
- }
- if (c == '(') {
- reader.unread(c);
- op.addSubOp(parse());
- } else if (c == ')') {
- return op;
- } else if (c == '"') {
- reader.unread(c);
- op.addArg(readStringArg());
- } else if (Character.isDigit(c) || c == '-' || c == '+') {
- reader.unread(c);
- op.addArg(readNumberArg());
- } else if (Character.isJavaIdentifierStart(c)) {
- reader.unread(c);
- op.addArg(readSymbolArg());
- }
- }
- throw new FilterException("Incomplete filter");
- }
-
- public static void main(String[] args) throws IOException, FilterException {
- if (args.length == 1) {
- System.out.println(new FilterParser(args[0]).parse());
- } else {
- System.out.println(new FilterParser("(or (and (= session foobar) (= session barfoo)) (= session sdfs))").parse());
- }
- }
-};
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/JsonGenerator.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/JsonGenerator.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/JsonGenerator.java
deleted file mode 100644
index 8215833..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/JsonGenerator.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/**
- * 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.graph;
-
-
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-
-import java.io.Writer;
-import java.io.OutputStreamWriter;
-import java.io.IOException;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.ListIterator;
-import java.util.Set;
-
-public class JsonGenerator {
- private JSONObject root;
- private Set<Integer> servers;
-
- private class Message {
- private int from;
- private int to;
- private long zxid;
-
- public Message(int from, int to, long zxid) {
- this.from = from;
- this.to = to;
- this.zxid = zxid;
- }
-
- public boolean equals(Message m) {
- return (m.from == this.from
- && m.to == this.to
- && m.zxid == this.zxid);
- }
- };
-
- public JSONObject txnEntry(TransactionEntry e) {
- JSONObject event = new JSONObject();
-
- event.put("time", Long.toString(e.getTimestamp()));
- event.put("client", Long.toHexString(e.getClientId()));
- event.put("cxid", Long.toHexString(e.getCxid()));
- event.put("zxid", Long.toHexString(e.getZxid()));
- event.put("op", e.getOp());
- event.put("extra", e.getExtra());
- event.put("type", "transaction");
-
- return event;
- }
-
- /**
- Assumes entries are sorted by timestamp.
- */
- public JsonGenerator(LogIterator iter) {
- servers = new HashSet<Integer>();
-
- Pattern stateChangeP = Pattern.compile("- (LOOKING|FOLLOWING|LEADING)");
- Pattern newElectionP = Pattern.compile("New election. My id = (\\d+), Proposed zxid = (\\d+)");
- Pattern receivedProposalP = Pattern.compile("Notification: (\\d+) \\(n.leader\\), (\\d+) \\(n.zxid\\), (\\d+) \\(n.round\\), .+ \\(n.state\\), (\\d+) \\(n.sid\\), .+ \\(my state\\)");
- Pattern exceptionP = Pattern.compile("xception");
-
- root = new JSONObject();
- Matcher m = null;
- JSONArray events = new JSONArray();
- root.put("events", events);
-
- long starttime = Long.MAX_VALUE;
- long endtime = 0;
-
- int leader = 0;
- long curEpoch = 0;
- boolean newEpoch = false;
-
- while (iter.hasNext()) {
- LogEntry ent = iter.next();
-
- if (ent.getTimestamp() < starttime) {
- starttime = ent.getTimestamp();
- }
- if (ent.getTimestamp() > endtime) {
- endtime = ent.getTimestamp();
- }
-
- if (ent.getType() == LogEntry.Type.TXN) {
- events.add(txnEntry((TransactionEntry)ent));
- } else {
- Log4JEntry e = (Log4JEntry)ent;
- servers.add(e.getNode());
-
- if ((m = stateChangeP.matcher(e.getEntry())).find()) {
- JSONObject stateChange = new JSONObject();
- stateChange.put("type", "stateChange");
- stateChange.put("time", e.getTimestamp());
- stateChange.put("server", e.getNode());
- stateChange.put("state", m.group(1));
- events.add(stateChange);
-
- if (m.group(1).equals("LEADING")) {
- leader = e.getNode();
- }
- } else if ((m = newElectionP.matcher(e.getEntry())).find()) {
- Iterator<Integer> iterator = servers.iterator();
- long zxid = Long.valueOf(m.group(2));
- int count = (int)zxid;// & 0xFFFFFFFFL;
- int epoch = (int)Long.rotateRight(zxid, 32);// >> 32;
-
- if (leader != 0 && epoch > curEpoch) {
- JSONObject stateChange = new JSONObject();
- stateChange.put("type", "stateChange");
- stateChange.put("time", e.getTimestamp());
- stateChange.put("server", leader);
- stateChange.put("state", "INIT");
- events.add(stateChange);
- leader = 0;
- }
-
- while (iterator.hasNext()) {
- int dst = iterator.next();
- if (dst != e.getNode()) {
- JSONObject msg = new JSONObject();
- msg.put("type", "postmessage");
- msg.put("src", e.getNode());
- msg.put("dst", dst);
- msg.put("time", e.getTimestamp());
- msg.put("zxid", m.group(2));
- msg.put("count", count);
- msg.put("epoch", epoch);
-
- events.add(msg);
- }
- }
- } else if ((m = receivedProposalP.matcher(e.getEntry())).find()) {
- // Pattern.compile("Notification: \\d+, (\\d+), (\\d+), \\d+, [^,]*, [^,]*, (\\d+)");//, LOOKING, LOOKING, 2
- int src = Integer.valueOf(m.group(4));
- long zxid = Long.valueOf(m.group(2));
- int dst = e.getNode();
- long epoch2 = Long.valueOf(m.group(3));
-
- int count = (int)zxid;// & 0xFFFFFFFFL;
- int epoch = (int)Long.rotateRight(zxid, 32);// >> 32;
-
- if (leader != 0 && epoch > curEpoch) {
- JSONObject stateChange = new JSONObject();
- stateChange.put("type", "stateChange");
- stateChange.put("time", e.getTimestamp());
- stateChange.put("server", leader);
- stateChange.put("state", "INIT");
- events.add(stateChange);
- leader = 0;
- }
-
- if (src != dst) {
- JSONObject msg = new JSONObject();
- msg.put("type", "delivermessage");
- msg.put("src", src);
- msg.put("dst", dst);
- msg.put("time", e.getTimestamp());
- msg.put("zxid", zxid);
- msg.put("epoch", epoch);
- msg.put("count", count);
- msg.put("epoch2", epoch2);
-
- events.add(msg);
- }
- } else if ((m = exceptionP.matcher(e.getEntry())).find()) {
- JSONObject ex = new JSONObject();
- ex.put("type", "exception");
- ex.put("server", e.getNode());
- ex.put("time", e.getTimestamp());
- ex.put("text", e.getEntry());
- events.add(ex);
- }
- }
- JSONObject ex = new JSONObject();
- ex.put("type", "text");
- ex.put("time", ent.getTimestamp());
- String txt = ent.toString();
- ex.put("text", txt);
- events.add(ex);
- }
- // System.out.println("pending messages: "+pendingMessages.size());
- root.put("starttime", starttime);
- root.put("endtime", endtime);
-
- JSONArray serversarray = new JSONArray();
- root.put("servers", serversarray);
-
- Iterator<Integer> iterator = servers.iterator();
- while (iterator.hasNext()) {
- serversarray.add(iterator.next());
- }
- }
-
- public String toString() {
- return JSONValue.toJSONString(root);
- }
-
- public static void main(String[] args) throws Exception {
- MergedLogSource src = new MergedLogSource(args);
- LogIterator iter = src.iterator();
- System.out.println(new JsonGenerator(iter));
- }
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JEntry.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JEntry.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JEntry.java
deleted file mode 100644
index 0edc146..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JEntry.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.graph;
-
-public class Log4JEntry extends LogEntry {
- public Log4JEntry(long timestamp, int node, String entry) {
- super(timestamp);
- setAttribute("log-text", entry);
- setAttribute("node", new Integer(node));
- }
-
- public String getEntry() {
- return (String) getAttribute("log-text");
- }
-
- public String toString() {
- return "" + getTimestamp() + "::::" + getNode() + "::::" + getEntry();
- }
-
- public int getNode() {
- return (Integer) getAttribute("node");
- }
-
- public Type getType() { return LogEntry.Type.LOG4J; }
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JSource.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JSource.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JSource.java
deleted file mode 100644
index 84a9d98..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/Log4JSource.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/**
- * 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.graph;
-
-import java.io.File;
-import java.io.InputStreamReader;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.ArrayList;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import java.text.ParseException;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import java.io.EOFException;
-import java.io.Closeable;
-import java.io.FileNotFoundException;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Log4JSource implements LogSource {
- private static final Logger LOG = LoggerFactory.getLogger(Log4JSource.class);
-
- private static final int skipN = 10000;
- private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss,SSS";
-
- private LogSkipList skiplist = null;
-
- private String file = null;
- private long starttime = 0;
- private long endtime = 0;
- private int serverid = 0;
- private long size = 0;
-
- private Pattern timep;
-
- public boolean overlapsRange(long starttime, long endtime) {
- return (starttime <= this.endtime && endtime >= this.starttime);
- }
-
- public long size() { return size; }
- public long getStartTime() { return starttime; }
- public long getEndTime() { return endtime; }
- public LogSkipList getSkipList() { return skiplist; }
-
- private class Log4JSourceIterator implements LogIterator {
- private RandomAccessFileReader in;
- private LogEntry next = null;
- private long starttime = 0;
- private long endtime = 0;
- private String buf = "";
- private Log4JSource src = null;
- private long skippedAtStart = 0;
- private SimpleDateFormat dateformat = null;
- private FilterOp filter = null;
-
- public Log4JSourceIterator(Log4JSource src, long starttime, long endtime) throws IllegalArgumentException, FilterException {
- this(src, starttime, endtime, null);
- }
-
- public Log4JSourceIterator(Log4JSource src, long starttime, long endtime, FilterOp filter) throws IllegalArgumentException, FilterException {
-
- this.dateformat = new SimpleDateFormat(DATE_FORMAT);
- this.src = src;
- this.starttime = starttime;
- this.endtime = endtime;
-
- File f = new File(src.file);
- try {
- in = new RandomAccessFileReader(f);
- } catch (FileNotFoundException e) {
- throw new IllegalArgumentException("Bad file passed in (" + src.file +") cannot open:" + e);
- }
-
- // skip to the offset of latest skip point before starttime
- LogSkipList.Mark start = src.getSkipList().findMarkBefore(starttime);
- try {
- in.seek(start.getBytes());
- skippedAtStart = start.getEntriesSkipped();
- } catch (IOException ioe) {
- // if we can't skip, we should just read from the start
- }
-
- LogEntry e;
- while ((e = readNextEntry()) != null && e.getTimestamp() < endtime) {
- if (e.getTimestamp() >= starttime && (filter == null || filter.matches(e))) {
- next = e;
- return;
- }
- skippedAtStart++;
- }
- this.filter = filter;
- }
-
- synchronized public long size() throws IOException {
- if (LOG.isTraceEnabled()) {
- LOG.trace("size() called");
- }
-
- if (this.endtime >= src.getEndTime()) {
- return src.size() - skippedAtStart;
- }
-
- long pos = in.getPosition();
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("saved pos () = " + pos);
- }
-
- LogEntry e;
-
- LogSkipList.Mark lastseg = src.getSkipList().findMarkBefore(this.endtime);
- in.seek(lastseg.getBytes());
- buf = ""; // clear the buf so we don't get something we read before we sought
- // number of entries skipped to get to the end of the iterator, less the number skipped to get to the start
- long count = lastseg.getEntriesSkipped() - skippedAtStart;
-
- while ((e = readNextEntry()) != null) {
- if (LOG.isTraceEnabled()) {
- //LOG.trace(e);
- }
- if (e.getTimestamp() > this.endtime) {
- break;
- }
- count++;
- }
- in.seek(pos);
- buf = "";
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("size() = " + count);
- }
-
- return count;
- }
-
- synchronized private LogEntry readNextEntry() {
- try {
- try {
- while (true) {
- String line = in.readLine();
- if (line == null) {
- break;
- }
-
- Matcher m = src.timep.matcher(line);
- if (m.lookingAt()) {
- if (buf.length() > 0) {
- LogEntry e = new Log4JEntry(src.timestampFromText(dateformat, buf), src.getServerId(), buf);
- buf = line;
- return e;
- }
- buf = line;
- } else if (buf.length() > 0) {
- buf += line + "\n";
- }
- }
- } catch (EOFException eof) {
- // ignore, we've simply come to the end of the file
- }
- if (buf.length() > 0) {
- LogEntry e = new Log4JEntry(src.timestampFromText(dateformat, buf), src.getServerId(), buf);
- buf = "";
- return e;
- }
- } catch (Exception e) {
- LOG.error("Error reading next entry in file (" + src.file + "): " + e);
- return null;
- }
- return null;
- }
-
- public boolean hasNext() {
- return next != null;
- }
-
- public LogEntry next() throws NoSuchElementException {
- LogEntry ret = next;
- LogEntry e = readNextEntry();
-
- if (filter != null) {
- try {
- while (e != null && !filter.matches(e)) {
- e = readNextEntry();
- }
- } catch (FilterException fe) {
- throw new NoSuchElementException(e.toString());
- }
- }
-
- if (e != null && e.getTimestamp() < endtime) {
- next = e;
- } else {
- next = null;
- }
- return ret;
- }
-
- public void remove() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("remove not supported for L4J logs");
- }
-
- public void close() throws IOException {
- in.close();
- }
-
- public String toString() {
- String size;
- try {
- size = new Long(size()).toString();
- } catch (IOException ioe) {
- size = "Unable to read";
- }
- return "Log4JSourceIterator(start=" + starttime + ", end=" + endtime + ", size=" + size + ")";
- }
- }
-
- public LogIterator iterator(long starttime, long endtime) throws IllegalArgumentException {
- try {
- return iterator(starttime, endtime, null);
- } catch (FilterException fe) {
- assert(false); //"This should never happen, you can't have a filter exception without a filter");
- return null;
- }
- }
-
- public LogIterator iterator(long starttime, long endtime, FilterOp filter) throws IllegalArgumentException, FilterException{
- // sanitise start and end times
- if (endtime < starttime) {
- throw new IllegalArgumentException("End time (" + endtime + ") must be greater or equal to starttime (" + starttime + ")");
- }
-
- return new Log4JSourceIterator(this, starttime, endtime, filter);
- }
-
- public LogIterator iterator() throws IllegalArgumentException {
- return iterator(starttime, endtime+1);
- }
-
- public Log4JSource(String file) throws IOException {
- this.file=file;
-
- timep = Pattern.compile("^(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3})");
- skiplist = new LogSkipList();
- init();
- }
-
- private static long timestampFromText(SimpleDateFormat format, String s) {
- Date d = null;
- try {
- d = format.parse(s);
- } catch (ParseException e) {
- return 0;
- }
- Calendar c = new GregorianCalendar();
- c.setTime(d);
- return c.getTimeInMillis();
- }
-
- private void init() throws IOException {
- File f = new File(file);
- RandomAccessFileReader in = new RandomAccessFileReader(f);
- SimpleDateFormat dateformat = new SimpleDateFormat(DATE_FORMAT);
- Pattern idp = Pattern.compile("\\[myid:(\\d+)\\]");
-
- long lastFp = in.getPosition();
- String line = in.readLine();
- Matcher m = null;
-
- // if we have read data from the file, and it matchs the timep pattern
- if ((line != null) && (m = timep.matcher(line)).lookingAt()) {
- starttime = timestampFromText(dateformat, m.group(1));
- } else {
- throw new IOException("Invalid log4j format. First line doesn't start with time");
- }
-
- /*
- Count number of log entries. Any line starting with a timestamp counts as an entry
- */
- String lastentry = line;
- try {
- while (line != null) {
- m = timep.matcher(line);
- if (m.lookingAt()) {
- if (size % skipN == 0) {
- long time = timestampFromText(dateformat, m.group(1));
- skiplist.addMark(time, lastFp, size);
- }
- size++;
- lastentry = line;
- }
- if (serverid == 0 && (m = idp.matcher(line)).find()) {
- serverid = Integer.valueOf(m.group(1));
- }
-
- lastFp = in.getPosition();
- line = in.readLine();
- }
- } catch (EOFException eof) {
- // ignore, simply end of file, though really (line!=null) should have caught this
- } finally {
- in.close();
- }
-
- m = timep.matcher(lastentry);
- if (m.lookingAt()) {
- endtime = timestampFromText(dateformat, m.group(1));
- } else {
- throw new IOException("Invalid log4j format. Last line doesn't start with time");
- }
- }
-
- public String toString() {
- return "Log4JSource(file=" + file + ", size=" + size + ", start=" + starttime + ", end=" + endtime +", id=" + serverid +")";
- }
-
- public static void main(String[] args) throws IOException {
- final Log4JSource s = new Log4JSource(args[0]);
- System.out.println(s);
-
- LogIterator iter;
-
- if (args.length == 3) {
- final long starttime = Long.valueOf(args[1]);
- final long endtime = Long.valueOf(args[2]);
- iter = s.iterator(starttime, endtime);
-
- Thread t1 = new Thread() { public void run () {
-
- LogIterator iter = s.iterator(starttime, endtime);
- System.out.println(iter);
- try {
- iter.close();
- } catch (IOException ioe) {
- System.out.println(ioe.getMessage());
- }
- }; };
- Thread t2 = new Thread() { public void run () {
-
- LogIterator iter = s.iterator(starttime, endtime);
- System.out.println(iter);
- try {
- iter.close();
- } catch (IOException ioe) {
- System.out.println(ioe.getMessage());
- }
- }; };
- Thread t3 = new Thread() { public void run () {
-
- LogIterator iter = s.iterator(starttime, endtime);
- System.out.println(iter);
- }; };
- t1.start();
- t2.start();
- // t3.start();
- } else {
- iter = s.iterator();
- }
-
- /*while (iter.hasNext()) {
- System.out.println(iter.next());
- }*/
- iter.close();
- }
-
- public int getServerId() {
- return serverid;
- }
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b0df8fe1/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/LogEntry.java
----------------------------------------------------------------------
diff --git a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/LogEntry.java b/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/LogEntry.java
deleted file mode 100644
index 27973ba..0000000
--- a/src/contrib/loggraph/src/java/org/apache/zookeeper/graph/LogEntry.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.graph;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class LogEntry implements Serializable {
- private Map attributes;
-
- public enum Type { UNKNOWN, LOG4J, TXN };
-
- public LogEntry(long timestamp) {
- attributes = new HashMap();
- setAttribute("timestamp", new Long(timestamp));
- }
-
- public long getTimestamp() {
- return (Long)getAttribute("timestamp");
- }
-
- public abstract Type getType();
-
- public void setAttribute(String key, Object v) {
- attributes.put(key, v);
- }
-
- public Object getAttribute(String key) {
- return attributes.get(key);
- }
-}
|