kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkr...@apache.org
Subject svn commit: r1152970 [24/26] - in /incubator/kafka: branches/ site/ trunk/ trunk/bin/ trunk/clients/ trunk/clients/clojure/ trunk/clients/clojure/leiningen/ trunk/clients/clojure/resources/ trunk/clients/clojure/src/ trunk/clients/clojure/src/kafka/ tr...
Date Mon, 01 Aug 2011 23:42:17 GMT
Added: incubator/kafka/trunk/examples/README
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/README?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/README (added)
+++ incubator/kafka/trunk/examples/README Mon Aug  1 23:41:24 2011
@@ -0,0 +1,19 @@
+This directory contains examples of client code that uses kafka.
+
+The default target for ant is kafka.examples.KafkaConsumerProducerDemo which sends and receives

+messages from Kafka server.
+
+In order to run demo from SBT:
+   1. Start Zookeeper and the Kafka server
+   2. ./sbt from top-level kafka directory
+   3. Switch to the kafka java examples project -> project Kafka Java Examples
+   4. execute run -> run
+   5. For unlimited producer-consumer run, select option 1
+      For simple consumer demo, select option 2
+
+To run the demo using scripts: 
+
+   1. Start Zookeeper and the Kafka server
+   2. For simple consumer demo, run bin/java-simple-consumer-demo.sh
+   3. For unlimited producer-consumer run, run bin/java-producer-consumer-demo.sh
+

Added: incubator/kafka/trunk/examples/bin/java-producer-consumer-demo.sh
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/bin/java-producer-consumer-demo.sh?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/bin/java-producer-consumer-demo.sh (added)
+++ incubator/kafka/trunk/examples/bin/java-producer-consumer-demo.sh Mon Aug  1 23:41:24
2011
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+base_dir=$(dirname $0)/../..
+
+for file in $base_dir/project/boot/scala-2.8.0/lib/*.jar;
+do
+  if [ ${file##*/} != "sbt-launch.jar" ]; then
+    CLASSPATH=$CLASSPATH:$file
+  fi
+done
+
+for file in $base_dir/core/lib_managed/scala_2.8.0/compile/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+for file in $base_dir/core/lib/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+for file in $base_dir/core/target/scala_2.8.0/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+for file in $base_dir/examples/target/scala_2.8.0/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+echo $CLASSPATH
+
+if [ -z "$KAFKA_PERF_OPTS" ]; then
+  KAFKA_OPTS="-Xmx512M -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  JAVA="java"
+else
+  JAVA="$JAVA_HOME/bin/java"
+fi
+
+$JAVA $KAFKA_OPTS -cp $CLASSPATH kafka.examples.KafkaConsumerProducerDemo $@
+

Propchange: incubator/kafka/trunk/examples/bin/java-producer-consumer-demo.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/kafka/trunk/examples/bin/java-simple-consumer-demo.sh
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/bin/java-simple-consumer-demo.sh?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/bin/java-simple-consumer-demo.sh (added)
+++ incubator/kafka/trunk/examples/bin/java-simple-consumer-demo.sh Mon Aug  1 23:41:24 2011
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+base_dir=$(dirname $0)/../..
+
+for file in $base_dir/project/boot/scala-2.8.0/lib/*.jar;
+do
+  if [ ${file##*/} != "sbt-launch.jar" ]; then
+    CLASSPATH=$CLASSPATH:$file
+  fi
+done
+
+for file in $base_dir/core/lib_managed/scala_2.8.0/compile/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+for file in $base_dir/core/lib/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+for file in $base_dir/core/target/scala_2.8.0/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+for file in $base_dir/examples/target/scala_2.8.0/*.jar;
+do
+  CLASSPATH=$CLASSPATH:$file
+done
+
+echo $CLASSPATH
+
+if [ -z "$KAFKA_PERF_OPTS" ]; then
+  KAFKA_OPTS="-Xmx512M -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  JAVA="java"
+else
+  JAVA="$JAVA_HOME/bin/java"
+fi
+
+$JAVA $KAFKA_OPTS -cp $CLASSPATH kafka.examples.SimpleConsumerDemo $@
+

Propchange: incubator/kafka/trunk/examples/bin/java-simple-consumer-demo.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/kafka/trunk/examples/src/main/java/kafka/examples/Consumer.java
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/src/main/java/kafka/examples/Consumer.java?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/src/main/java/kafka/examples/Consumer.java (added)
+++ incubator/kafka/trunk/examples/src/main/java/kafka/examples/Consumer.java Mon Aug  1 23:41:24
2011
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2010 LinkedIn
+ * 
+ * Licensed 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 kafka.examples;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import kafka.consumer.ConsumerConfig;
+import kafka.consumer.ConsumerIterator;
+import kafka.consumer.KafkaMessageStream;
+import kafka.javaapi.consumer.ConsumerConnector;
+
+public class Consumer extends Thread
+{
+  private final ConsumerConnector consumer;
+  private final String topic;
+  
+  public Consumer(String topic)
+  {
+    consumer = kafka.consumer.Consumer.createJavaConsumerConnector(createConsumerConfig());
+    this.topic = topic;
+  }
+
+  private static ConsumerConfig createConsumerConfig()
+  {
+    Properties props = new Properties();
+    props.put("zk.connect", KafkaProperties.zkConnect);
+    props.put("groupid", KafkaProperties.groupId);
+    props.put("zk.sessiontimeout.ms", "400");
+    props.put("zk.synctime.ms", "200");
+    props.put("autocommit.interval.ms", "1000");
+
+    return new ConsumerConfig(props);
+
+  }
+ 
+  public void run() {
+    Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
+    topicCountMap.put(topic, new Integer(1));
+    Map<String, List<KafkaMessageStream>> consumerMap = consumer.createMessageStreams(topicCountMap);
+    KafkaMessageStream stream =  consumerMap.get(topic).get(0);
+    ConsumerIterator it = stream.iterator();
+    while(it.hasNext())
+      System.out.println(ExampleUtils.getMessage(it.next()));
+  }
+}

Added: incubator/kafka/trunk/examples/src/main/java/kafka/examples/ExampleUtils.java
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/src/main/java/kafka/examples/ExampleUtils.java?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/src/main/java/kafka/examples/ExampleUtils.java (added)
+++ incubator/kafka/trunk/examples/src/main/java/kafka/examples/ExampleUtils.java Mon Aug
 1 23:41:24 2011
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2010 LinkedIn
+ * 
+ * Licensed 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 kafka.examples;
+
+import java.nio.ByteBuffer;
+
+import kafka.message.Message;
+
+public class ExampleUtils
+{
+  public static String getMessage(Message message)
+  {
+    ByteBuffer buffer = message.payload();
+    byte [] bytes = new byte[buffer.remaining()];
+    buffer.get(bytes);
+    return new String(bytes);
+  }
+}

Added: incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java
(added)
+++ incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java
Mon Aug  1 23:41:24 2011
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 LinkedIn
+ * 
+ * Licensed 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 kafka.examples;
+
+public class KafkaConsumerProducerDemo implements KafkaProperties
+{
+  public static void main(String[] args)
+  {
+    Producer producerThread = new Producer(KafkaProperties.topic);
+    producerThread.start();
+
+    Consumer consumerThread = new Consumer(KafkaProperties.topic);
+    consumerThread.start();
+    
+  }
+}

Added: incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaProperties.java
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaProperties.java?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaProperties.java (added)
+++ incubator/kafka/trunk/examples/src/main/java/kafka/examples/KafkaProperties.java Mon Aug
 1 23:41:24 2011
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2010 LinkedIn
+ * 
+ * Licensed 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 kafka.examples;
+
+public interface KafkaProperties
+{
+  final static String zkConnect = "127.0.0.1:2181";
+  final static  String groupId = "group1";
+  final static String topic = "topic1";
+  final static String kafkaServerURL = "localhost";
+  final static int kafkaServerPort = 9092;
+  final static int kafkaProducerBufferSize = 64*1024;
+  final static int connectionTimeOut = 100000;
+  final static int reconnectInterval = 10000;
+  final static String topic2 = "topic2";
+  final static String topic3 = "topic3";
+}

Added: incubator/kafka/trunk/examples/src/main/java/kafka/examples/Producer.java
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/src/main/java/kafka/examples/Producer.java?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/src/main/java/kafka/examples/Producer.java (added)
+++ incubator/kafka/trunk/examples/src/main/java/kafka/examples/Producer.java Mon Aug  1 23:41:24
2011
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2010 LinkedIn
+ * 
+ * Licensed 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 kafka.examples;
+
+import kafka.javaapi.producer.ProducerData;
+import kafka.producer.ProducerConfig;
+import java.util.Properties;
+
+public class Producer extends Thread
+{
+  private final kafka.javaapi.producer.Producer<Integer, String> producer;
+  private final String topic;
+  private final Properties props = new Properties();
+
+  public Producer(String topic)
+  {
+    props.put("serializer.class", "kafka.serializer.StringEncoder");
+    props.put("zk.connect", "localhost:2181");
+    // Use random partitioner. Don't need the key type. Just set it to Integer.
+    // The message is of type String.
+    producer = new kafka.javaapi.producer.Producer<Integer, String>(new ProducerConfig(props));
+    this.topic = topic;
+  }
+  
+  public void run() {
+    int messageNo = 1;
+    while(true)
+    {
+      String messageStr = new String("Message_" + messageNo);
+      producer.send(new ProducerData<Integer, String>(topic, messageStr));
+      messageNo++;
+    }
+  }
+
+}

Added: incubator/kafka/trunk/examples/src/main/java/kafka/examples/SimpleConsumerDemo.java
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/examples/src/main/java/kafka/examples/SimpleConsumerDemo.java?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/examples/src/main/java/kafka/examples/SimpleConsumerDemo.java (added)
+++ incubator/kafka/trunk/examples/src/main/java/kafka/examples/SimpleConsumerDemo.java Mon
Aug  1 23:41:24 2011
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2010 LinkedIn
+ * 
+ * Licensed 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 kafka.examples;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import kafka.javaapi.MultiFetchResponse;
+import kafka.javaapi.consumer.SimpleConsumer;
+import kafka.javaapi.message.ByteBufferMessageSet;
+import kafka.message.MessageAndOffset;
+import scala.collection.Iterator;
+
+import kafka.api.FetchRequest;
+import kafka.message.Message;
+
+
+public class SimpleConsumerDemo
+{
+  private static void printMessages(ByteBufferMessageSet messageSet)
+  {
+    for (MessageAndOffset messageAndOffset : messageSet) {
+      System.out.println(ExampleUtils.getMessage(messageAndOffset.message()));
+    }
+  }
+
+  private static void generateData()
+  {
+    Producer producer2 = new Producer(KafkaProperties.topic2);
+    producer2.start();
+    Producer producer3 = new Producer(KafkaProperties.topic3);
+    producer3.start();
+    try
+    {
+      Thread.sleep(1000);
+    }
+    catch (InterruptedException e)
+    {
+      e.printStackTrace();
+    }
+  }
+  
+  public static void main(String[] args)
+  {
+    
+    generateData();
+    SimpleConsumer simpleConsumer = new SimpleConsumer(KafkaProperties.kafkaServerURL,
+                                                       KafkaProperties.kafkaServerPort,
+                                                       KafkaProperties.connectionTimeOut,
+                                                       KafkaProperties.kafkaProducerBufferSize);
+
+    System.out.println("Testing single fetch");
+    FetchRequest req = new FetchRequest(KafkaProperties.topic2, 0, 0L, 100);
+    ByteBufferMessageSet messageSet = simpleConsumer.fetch(req);
+    printMessages(messageSet);
+
+    System.out.println("Testing single multi-fetch");
+    req = new FetchRequest(KafkaProperties.topic2, 0, 0L, 100);
+    List<FetchRequest> list = new ArrayList<FetchRequest>();
+    list.add(req);
+    req = new FetchRequest(KafkaProperties.topic3, 0, 0L, 100);
+    list.add(req);
+    MultiFetchResponse response = simpleConsumer.multifetch(list);
+    int fetchReq = 0;
+    for (ByteBufferMessageSet resMessageSet : response )
+    {
+      System.out.println("Response from fetch request no: " + ++fetchReq);
+      printMessages(resMessageSet);
+    }
+  }
+
+}

Added: incubator/kafka/trunk/lib/sbt-launch.jar
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/lib/sbt-launch.jar?rev=1152970&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/kafka/trunk/lib/sbt-launch.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/kafka/trunk/perf/.classpath
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/perf/.classpath?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/perf/.classpath (added)
+++ incubator/kafka/trunk/perf/.classpath Mon Aug  1 23:41:24 2011
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="/Kafka-example/lib/log4j-1.2.15.jar"/>
+	<classpathentry kind="lib" path="lib/jopt-simple-3.1.jar"/>
+	<classpathentry kind="lib" path="/Users/femekci/linkedInSrc/kafka-multifetch/lib/scala-library-2.8.0.jar"/>
+	<classpathentry kind="lib" path="/Users/femekci/linkedInSrc/kafka-multifetch/dist/kafka-0.04.6.0.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: incubator/kafka/trunk/perf/.project
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/perf/.project?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/perf/.project (added)
+++ incubator/kafka/trunk/perf/.project Mon Aug  1 23:41:24 2011
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>kafka-perf</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: incubator/kafka/trunk/perf/README.md
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/perf/README.md?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/perf/README.md (added)
+++ incubator/kafka/trunk/perf/README.md Mon Aug  1 23:41:24 2011
@@ -0,0 +1,23 @@
+# Profiling Kafka #
+
+See here: http://sna-projects.com/kafka/performance.php
+
+## Getting Started Locally ##
+
+1. Build Kafka itself, start servers etc.
+2. ./sbt 
+   project perf
+   package-all
+3. Make sure report-html/data (or whichever dir you want to dump simulator data to) exists.
+4. ./run-simulator.sh
+
+## Getting Started With Remote Tests ##
+
+1. Look at util-bin/remote-kafka-env.sh and the constants there.
+2. Scripts assume that you have kafka built and installed on the
+remote hosts.
+3. Example: `./util-bin/run-fetchsize-test.sh user@host user@host 1 dir/report-html/fetch_size_test`.
+4.  Start a web-server or copy the results somewhere you can view with
+a browser.You can view the results of a specific test run by setting
+`report.html?dataDir=my_test`.
+

Added: incubator/kafka/trunk/perf/lib/jopt-simple-3.1.jar
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/perf/lib/jopt-simple-3.1.jar?rev=1152970&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/kafka/trunk/perf/lib/jopt-simple-3.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/kafka/trunk/perf/report-html/js/exporting.js
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/perf/report-html/js/exporting.js?rev=1152970&view=auto
==============================================================================
--- incubator/kafka/trunk/perf/report-html/js/exporting.js (added)
+++ incubator/kafka/trunk/perf/report-html/js/exporting.js Mon Aug  1 23:41:24 2011
@@ -0,0 +1,21 @@
+/*
+ Highcharts JS v2.0.5 (2010-09-17)
+ Exporting module
+
+ (c) 2010 Torstein H√łnsi
+
+ License: www.highcharts.com/license
+*/
+(function(){var j=Highcharts,F=j.Chart,C=j.addEvent,v=j.defaultOptions,p=j.createElement,G=j.discardElement,y=j.css,D=j.merge,q=j.each,r=j.extend;v=Math;var
J=v.max,s=document,K=window,w="M",x="L",z="div",L="hidden",A="none",M="highcharts-",H="absolute",o="px";v=j.setOptions({lang:{downloadPNG:"Download
PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download
SVG vector image",exportButtonTitle:"Export to raster or vector image",printButtonTitle:"Print
the chart"}});
+v.navigation={menuStyle:{border:"1px solid #A0A0A0",background:"#FFFFFF"},menuItemStyle:{padding:"0
5px",background:A,color:"#303030"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{align:"right",backgroundColor:{linearGradient:[0,0,0,20],stops:[[0.4,"#F7F7F7"],[0.6,"#E3E3E3"]]},borderColor:"#B0B0B0",borderRadius:3,borderWidth:1,height:20,hoverBorderColor:"#909090",hoverSymbolFill:"#81A7CF",hoverSymbolStroke:"#4572A5",symbolFill:"#E0E0E0",symbolStroke:"#A0A0A0",symbolX:11.5,
+symbolY:10.5,verticalAlign:"top",width:24,y:10}};v.exporting={type:"image/png",url:"http://export.highcharts.com/",width:800,buttons:{exportButton:{symbol:"exportIcon",x:-10,symbolFill:"#A8BF77",hoverSymbolFill:"#768F3E",_titleKey:"exportButtonTitle",menuItems:[{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",
+onclick:function(){this.exportChart({type:"image/svg+xml"})}}]},printButton:{symbol:"printIcon",x:-36,symbolFill:"#B5C9DF",hoverSymbolFill:"#779ABF",_titleKey:"printButtonTitle",onclick:function(){this.print()}}}};r(F.prototype,{getSVG:function(b){var
c=this,a,e,d,h,f,g=D(c.options,b);if(!s.createElementNS)s.createElementNS=function(k,i){var
m=s.createElement(i);m.getBBox=function(){return c.renderer.Element.prototype.getBBox.apply({element:m})};return
m};a=p(z,null,{position:H,top:"-9999em",width:c.chartWidth+
+o,height:c.chartHeight+o},s.body);r(g.chart,{renderTo:a,renderer:"SVG"});g.exporting.enabled=false;g.chart.plotBackgroundImage=null;g.series=[];q(c.series,function(k){d=k.options;d.animation=false;d.showCheckbox=false;d.data=[];q(k.data,function(i){h=i.config==null||typeof
i.config=="number"?{y:i.y}:i.config;h.x=i.x;d.data.push(h);(f=i.config&&i.config.marker)&&/^url\(/.test(f.symbol)&&delete
f.symbol});g.series.push(d)});b=new Highcharts.Chart(g);e=b.container.innerHTML;g=null;b.destroy();G(a);e=
+e.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/isTracker="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/id=([^"
>]+)/g,'id="$1"').replace(/class=([^" ]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:path/g,"path").replace(/style="([^"]+)"/g,function(k){return
k.toLowerCase()});e=e.replace(/(url\(#highcharts-[0-9]+)&quot;/g,"$1").replace(/&quot;/g,"'");if(e.match(/
xmlns="/g).length==2)e=
+e.replace(/xmlns="[^"]+"/,"");return e},exportChart:function(b,c){var a,e=this,d=e.getSVG(c);b=D(e.options.exporting,b);a=p("form",{method:"post",action:b.url},{display:A},s.body);q(["filename","type","width","svg"],function(h){p("input",{type:L,name:h,value:{filename:b.filename||"chart",type:b.type,width:b.width,svg:d}[h]},null,a)});a.submit();G(a)},print:function(){var
b=this,c=b.container,a=[],e=c.parentNode,d=s.body,h=d.childNodes;if(!b.isPrinting){b.isPrinting=true;q(h,function(f,g){if(f.nodeType==
+1){a[g]=f.style.display;f.style.display=A}});d.appendChild(c);K.print();setTimeout(function(){e.appendChild(c);q(h,function(f,g){if(f.nodeType==1)f.style.display=a[g]});b.isPrinting=false},1E3)}},contextMenu:function(b,c,a,e,d,h){var
f=this,g=f.options.navigation,k=g.menuItemStyle,i=f.chartWidth,m=f.chartHeight,t="cache-"+b,l=f[t],n=J(d,h),u="3px
3px 10px #888",I,E;if(!l){f[t]=l=p(z,{className:M+b},{position:H,zIndex:1E3,padding:n+o},f.container);I=p(z,null,r({MozBoxShadow:u,WebkitBoxShadow:u,boxShadow:u},
+g.menuStyle),l);E=function(){y(l,{display:A})};C(l,"mouseleave",E);q(c,function(B){if(B)p(z,{onclick:function(){E();B.onclick.apply(f,arguments)},onmouseover:function(){y(this,g.menuItemHoverStyle)},onmouseout:function(){y(this,k)},innerHTML:B.text||j.getOptions().lang[B.textKey]},r({cursor:"pointer"},k),I)});f.exportMenuWidth=l.offsetWidth;f.exportMenuHeight=l.offsetHeight}b={display:"block"};if(a+f.exportMenuWidth>i)b.right=i-a-d-n+o;else
b.left=a-n+o;if(e+h+f.exportMenuHeight>m)b.bottom=m-e-n+
+o;else b.top=e+h-n+o;y(l,b)},addButton:function(b){function c(){l.attr(u);t.attr(n)}var a=this,e=a.renderer,d=D(a.options.navigation.buttonOptions,b),h=d.onclick,f=d.menuItems;b=a.getAlignment(d);var
g=b.x,k=b.y,i=d.width,m=d.height,t,l;b=d.borderWidth;var n={stroke:d.borderColor},u={stroke:d.symbolStroke,fill:d.symbolFill};if(d.enabled!==false){t=e.rect(0,0,i,m,d.borderRadius,b).translate(g,k).attr(r({fill:d.backgroundColor,"stroke-width":b,zIndex:19},n)).add();b=e.rect(g,k,i,m,0).attr({fill:"rgba(255,
255, 255, 0.001)",
+title:j.getOptions().lang[d._titleKey],zIndex:21}).css({cursor:"pointer"}).on("mouseover",function(){l.attr({stroke:d.hoverSymbolStroke,fill:d.hoverSymbolFill});t.attr({stroke:d.hoverBorderColor})}).on("mouseout",c).add();C(b.element,"click",c);if(f)h=function(){a.contextMenu("export-menu",f,g,k,i,m)};C(b.element,"click",function(){h.apply(a,arguments)});l=e.symbol(d.symbol,g+d.symbolX,k+d.symbolY,(d.symbolSize||12)/2).attr(r(u,{"stroke-width":d.symbolStrokeWidth||1,zIndex:20})).add()}}});j.Renderer.prototype.symbols.exportIcon=
+function(b,c,a){return[w,b-a,c+a,x,b+a,c+a,b+a,c+a*0.5,b-a,c+a*0.5,"Z",w,b,c+a*0.5,x,b-a*0.5,c-a/3,b-a/6,c-a/3,b-a/6,c-a,b+a/6,c-a,b+a/6,c-a/3,b+a*0.5,c-a/3,"Z"]};j.Renderer.prototype.symbols.printIcon=function(b,c,a){return[w,b-a,c+a*0.5,x,b+a,c+a*0.5,b+a,c-a/3,b-a,c-a/3,"Z",w,b-a*0.5,c-a/3,x,b-a*0.5,c-a,b+a*0.5,c-a,b+a*0.5,c-a/3,"Z",w,b-a*0.5,c+a*0.5,x,b-a*0.75,c+a,b+a*0.75,c+a,b+a*0.5,c+a*0.5,"Z"]};j.Chart=function(b,c){return
new F(b,function(a){var e,d=a.options.exporting,h=d.buttons;if(d.enabled!==
+false)for(e in h)a.addButton(h[e]);c&&c()})}})();

Propchange: incubator/kafka/trunk/perf/report-html/js/exporting.js
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message