Showing posts with label eclipse/4.4. Show all posts
Showing posts with label eclipse/4.4. Show all posts

Friday, June 16, 2017

Journey on cassandra development part1

To go into cassandra development has always been part of my wish during spare time but due to hectic work and life, this wish never really get kick off.... Until now. I found a very fine documentation and just start immediately once the spare time is available. In this article, I will describe my journey on developing in cassandra.

Let's clone the cassandra repository using git. Wait a while on my slow line at 436KBps with 136MB.

 user@localhost:~/$ git clone http://git-wip-us.apache.org/repos/asf/cassandra.git cassandra-trunk  
 Cloning into 'cassandra-trunk'...  
 remote: Counting objects: 273406, done.  
 remote: Compressing objects: 100% (45601/45601), done.  
 remote: Total 273406 (delta 164011), reused 269444 (delta 161446)  
 Receiving objects: 100% (273406/273406), 136.60 MiB | 436.00 KiB/s, done.  
 Resolving deltas: 100% (164011/164011), done.  
 Checking connectivity... done.  
   

Once repository was cloned, let's check out the directory.

 user@localhost:~/$ cd cassandra-trunk/  
 user@localhost:~/cassandra-trunk$ ls  
 total 596K  
 -rw-r--r-- 1 user user 3.5K Sep 6 21:28 README.asc  
 -rw-r--r-- 1 user user 2.8K Sep 6 21:28 NOTICE.txt  
 -rw-r--r-- 1 user user 99K Sep 6 21:28 NEWS.txt  
 -rw-r--r-- 1 user user 12K Sep 6 21:28 LICENSE.txt  
 -rw-r--r-- 1 user user 1.3K Sep 6 21:28 CONTRIBUTING.md  
 -rw-r--r-- 1 user user 320K Sep 6 21:28 CHANGES.txt  
 drwxr-xr-x 3 user user 4.0K Sep 6 21:28 conf  
 -rw-r--r-- 1 user user 91K Sep 6 21:28 build.xml  
 -rw-r--r-- 1 user user 516 Sep 6 21:28 build.properties.default  
 drwxr-xr-x 2 user user 4.0K Sep 6 21:28 bin  
 drwxr-xr-x 4 user user 4.0K Sep 6 21:28 doc  
 drwxr-xr-x 3 user user 4.0K Sep 6 21:28 debian  
 drwxr-xr-x 3 user user 4.0K Sep 6 21:28 interface  
 drwxr-xr-x 3 user user 4.0K Sep 6 21:28 ide  
 drwxr-xr-x 4 user user 4.0K Sep 6 21:28 examples  
 -rw-r--r-- 1 user user 5.8K Sep 6 21:28 eclipse_compiler.properties  
 drwxr-xr-x 3 user user 4.0K Sep 6 21:28 pylib  
 drwxr-xr-x 5 user user 4.0K Sep 6 21:28 lib  
 drwxr-xr-x 6 user user 4.0K Sep 6 21:28 src  
 drwxr-xr-x 9 user user 4.0K Sep 6 21:28 test  
 drwxr-xr-x 4 user user 4.0K Sep 6 21:28 tools  
 user@localhost:~/cassandra-trunk$ git branch  
 * trunk  
 user@localhost:~/cassandra-trunk$ git branch -a  
 * trunk  
  remotes/origin/HEAD -> origin/trunk  
  remotes/origin/cassandra-1.0  
  remotes/origin/cassandra-1.1  
  remotes/origin/cassandra-1.2  
  remotes/origin/cassandra-2.0  
  remotes/origin/cassandra-2.1  
  remotes/origin/cassandra-2.2  
  remotes/origin/cassandra-3.0  
  remotes/origin/cassandra-3.9  
  remotes/origin/trunk  

okay, looks almost the same sets of files when you downloaded the binary tarball package except this is much more. But that is expected because we are  in development environment. As of this moment, we have cassandra up to version 3.9

Before we go further, let's checkout the package required by cassandra.

 user@localhost:~/cassandra-trunk$ ant -version  
 Apache Ant(TM) version 1.9.7 compiled on May 16 2016  
 user@localhost:~/cassandra-trunk$ export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_45/  

So I'm using trunk cassandra , ant version 1.9.7 and oracle jdk version8 update 45. Eclipse I'm a bit behind, I'm still sticking with eclipse luna, I should  upgrade to eclipse neon soon!

Okay, our tools are all checked at this point, let's start ant build.

 user@localhost:~/cassandra-trunk$ ant  
 Buildfile: /home/user/cassandra-trunk/build.xml  
   
 init:  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/classes/main  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/classes/thrift  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/test/lib  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/test/classes  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/test/stress-classes  
   [mkdir] Created dir: /home/user/cassandra-trunk/src/gen-java  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/lib  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/jacoco  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/jacoco/partials  
   
 maven-ant-tasks-localrepo:  
   
 maven-ant-tasks-download:  
    [echo] Downloading Maven ANT Tasks...  
    [get] Getting: http://repo2.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar  
    [get] To: /home/user/cassandra-trunk/build/maven-ant-tasks-2.1.3.jar  
    [copy] Copying 1 file to /home/user/.m2/repository/org/apache/maven/maven-ant-tasks/2.1.3  
   
 maven-ant-tasks-init:  
   
 maven-declare-dependencies:  
   
 maven-ant-tasks-retrieve-build:  
 [artifact:dependencies] Downloading: com/datastax/cassandra/cassandra-driver-core/3.0.1/cassandra-driver-core-3.0.1.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 15K from central  
 [artifact:dependencies] Downloading: com/datastax/cassandra/cassandra-driver-parent/3.0.1/cassandra-driver-parent-3.0.1.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 18K from central  
 [artifact:dependencies] Downloading: io/dropwizard/metrics/metrics-core/3.1.2/metrics-core-3.1.2.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1K from central  
 [artifact:dependencies] Downloading: io/dropwizard/metrics/metrics-parent/3.1.2/metrics-parent-3.1.2.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 12K from central  
 [artifact:dependencies] Downloading: org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 3K from central  
 [artifact:dependencies] Downloading: org/slf4j/slf4j-parent/1.7.7/slf4j-parent-1.7.7.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 12K from central  
 [artifact:dependencies] Downloading: org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2K from central  
 [artifact:dependencies] Downloading: org/caffinitas/ohc/ohc-core/0.4.4/ohc-core-0.4.4.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 11K from central  
 [artifact:dependencies] Downloading: org/caffinitas/ohc/ohc-parent/0.4.4/ohc-parent-0.4.4.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 16K from central  
 [artifact:dependencies] Downloading: org/caffinitas/ohc/ohc-core-j8/0.4.4/ohc-core-j8-0.4.4.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 5K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-core/1.13/jmh-core-1.13.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 10K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-parent/1.13/jmh-parent-1.13.pom from repository java.net at http://download.java.net/maven/2  
 [artifact:dependencies] Unable to locate resource in repository  
 [artifact:dependencies] [INFO] Unable to find resource 'org.openjdk.jmh:jmh-parent:pom:1.13' in repository java.net (http://download.java.net/maven/2)  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-parent/1.13/jmh-parent-1.13.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 6K from central  
 [artifact:dependencies] Downloading: net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 11K from central  
 [artifact:dependencies] Downloading: org/apache/commons/commons-math3/3.2/commons-math3-3.2.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 17K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-generator-annprocess/1.13/jmh-generator-annprocess-1.13.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 4K from central  
 [artifact:dependencies] Downloading: net/ju-n/compile-command-annotations/compile-command-annotations/1.2.0/compile-command-annotations-1.2.0.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 5K from central  
 [artifact:dependencies] Downloading: net/ju-n/net-ju-n-parent/32/net-ju-n-parent-32.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 21K from central  
 [artifact:dependencies] Downloading: org/apache/ant/ant-junit/1.9.4/ant-junit-1.9.4.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 4K from central  
 [artifact:dependencies] Downloading: org/caffinitas/ohc/ohc-core/0.4.4/ohc-core-0.4.4.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: org/apache/ant/ant-junit/1.9.4/ant-junit-1.9.4.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: io/dropwizard/metrics/metrics-core/3.1.2/metrics-core-3.1.2.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: net/ju-n/compile-command-annotations/compile-command-annotations/1.2.0/compile-command-annotations-1.2.0.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 132K from central  
 [artifact:dependencies] Transferring 16K from central  
 [artifact:dependencies] Transferring 110K from central  
 [artifact:dependencies] Transferring 1653K from central  
 [artifact:dependencies] Downloading: org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2256K from central  
 [artifact:dependencies] Downloading: net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 115K from central  
 [artifact:dependencies] Downloading: com/datastax/cassandra/cassandra-driver-core/3.0.1/cassandra-driver-core-3.0.1-shaded.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 61K from central  
 [artifact:dependencies] Transferring 2388K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-core/1.13/jmh-core-1.13.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 454K from central  
 [artifact:dependencies] Downloading: org/caffinitas/ohc/ohc-core-j8/0.4.4/ohc-core-j8-0.4.4.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 5K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-generator-annprocess/1.13/jmh-generator-annprocess-1.13.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 30K from central  
 ^Y[artifact:dependencies] Building ant file: /home/user/cassandra-trunk/build/build-dependencies.xml  
 [artifact:dependencies] Downloading: io/netty/netty-all/4.0.39.Final/netty-all-4.0.39.Final.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 17K from central  
 [artifact:dependencies] Downloading: io/netty/netty-parent/4.0.39.Final/netty-parent-4.0.39.Final.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 44K from central  
 [artifact:dependencies] Downloading: io/netty/netty-all/4.0.39.Final/netty-all-4.0.39.Final.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2218K from central  
 [artifact:dependencies] Downloading: com/datastax/cassandra/cassandra-driver-core/3.0.1/cassandra-driver-core-3.0.1-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 552K from central  
 [artifact:dependencies] Downloading: io/dropwizard/metrics/metrics-core/3.1.2/metrics-core-3.1.2-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 52K from central  
 [artifact:dependencies] Downloading: org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 50K from central  
 [artifact:dependencies] Downloading: io/netty/netty-all/4.0.39.Final/netty-all-4.0.39.Final-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1749K from central  
 [artifact:dependencies] Downloading: org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1724K from central  
 [artifact:dependencies] Downloading: org/caffinitas/ohc/ohc-core/0.4.4/ohc-core-0.4.4-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 83K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-core/1.13/jmh-core-1.13-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 357K from central  
 [artifact:dependencies] Downloading: net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 73K from central  
 [artifact:dependencies] Downloading: org/apache/commons/commons-math3/3.2/commons-math3-3.2-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1958K from central  
 [artifact:dependencies] Downloading: org/openjdk/jmh/jmh-generator-annprocess/1.13/jmh-generator-annprocess-1.13-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 26K from central  
 [artifact:dependencies] Downloading: net/ju-n/compile-command-annotations/compile-command-annotations/1.2.0/compile-command-annotations-1.2.0-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 15K from central  
 [artifact:dependencies] Downloading: org/apache/ant/ant-junit/1.9.4/ant-junit-1.9.4-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 92K from central  
 [artifact:dependencies] Downloading: org/apache/ant/ant/1.9.4/ant-1.9.4-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1889K from central  
 [artifact:dependencies] Downloading: org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4-sources.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 19K from central  
 [artifact:dependencies] Building ant file: /home/user/cassandra-trunk/build/build-dependencies-sources.xml  
    [copy] Copying 62 files to /home/user/cassandra-trunk/build/lib/jars  
    [copy] Copying 17 files to /home/user/cassandra-trunk/build/lib/sources  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 3K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.build/0.7.5.201505241946/org.jacoco.build-0.7.5.201505241946.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 36K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.ant/0.7.5.201505241946/org.jacoco.ant-0.7.5.201505241946.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.core/0.7.5.201505241946/org.jacoco.core-0.7.5.201505241946.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1K from central  
 [artifact:dependencies] Downloading: org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2K from central  
 [artifact:dependencies] Downloading: org/ow2/asm/asm-parent/5.0.1/asm-parent-5.0.1.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 5K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.report/0.7.5.201505241946/org.jacoco.report-0.7.5.201505241946.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman/3.0.3/byteman-3.0.3.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 91K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-root/3.0.3/byteman-root-3.0.3.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 18K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-submit/3.0.3/byteman-submit-3.0.3.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-bmunit/3.0.3/byteman-bmunit-3.0.3.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 6K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-install/3.0.3/byteman-install-3.0.3.pom from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: org/ow2/asm/asm-debug-all/5.0.1/asm-debug-all-5.0.1.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman/3.0.3/byteman-3.0.3.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 251K from central  
 [artifact:dependencies] Transferring 743K from central  
 [artifact:dependencies] Transferring 371K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-submit/3.0.3/byteman-submit-3.0.3.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 14K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-bmunit/3.0.3/byteman-bmunit-3.0.3.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.ant/0.7.5.201505241946/org.jacoco.ant-0.7.5.201505241946.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 38K from central  
 [artifact:dependencies] Transferring 37K from central  
 [artifact:dependencies] Downloading: org/jboss/byteman/byteman-install/3.0.3/byteman-install-3.0.3.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 9K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.core/0.7.5.201505241946/org.jacoco.core-0.7.5.201505241946.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 130K from central  
 [artifact:dependencies] Downloading: org/jacoco/org.jacoco.report/0.7.5.201505241946/org.jacoco.report-0.7.5.201505241946.jar from repository central at http://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 137K from central  
    [copy] Copying 9 files to /home/user/cassandra-trunk/build/lib/jars  
   [unzip] Expanding: /home/user/cassandra-trunk/build/lib/jars/org.jacoco.agent-0.7.5.201505241946.jar into /home/user/cassandra-trunk/build/lib/jars  
   
 check-gen-cql3-grammar:  
   
 gen-cql3-grammar:  
    [echo] Building Grammar /home/user/cassandra-trunk/src/antlr/Cql.g ...  
   
 generate-cql-html:  
 [artifact:dependencies] Downloading: com/datastax/wikitext/wikitext-core-ant/1.3/wikitext-core-ant-1.3.pom from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 3K from central  
 [artifact:dependencies] Downloading: org/fusesource/wikitext/wikitext-core/1.3/wikitext-core-1.3.pom from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 2K from central  
 [artifact:dependencies] Downloading: org/fusesource/wikitext/wikitext-project/1.3/wikitext-project-1.3.pom from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 4K from central  
 [artifact:dependencies] Downloading: org/fusesource/fusesource-pom/1.3/fusesource-pom-1.3.pom from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 13K from central  
 [artifact:dependencies] Downloading: org/fusesource/wikitext/textile-core/1.3/textile-core-1.3.pom from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 1K from central  
 [artifact:dependencies] Downloading: org/fusesource/wikitext/wikitext-core/1.3/wikitext-core-1.3.jar from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Downloading: com/datastax/wikitext/wikitext-core-ant/1.3/wikitext-core-ant-1.3.jar from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 237K from central  
 [artifact:dependencies] Transferring 32K from central  
 [artifact:dependencies] Downloading: org/fusesource/wikitext/textile-core/1.3/textile-core-1.3.jar from repository central at https://repo1.maven.org/maven2  
 [artifact:dependencies] Transferring 54K from central  
   
 generate-jflex-java:  
   [jflex] Generated: StandardTokenizerImpl.java  
   
 build-project:  
    [echo] apache-cassandra: /home/user/cassandra-trunk/build.xml  
   [javac] Compiling 45 source files to /home/user/cassandra-trunk/build/classes/thrift  
   [javac] Note: /home/user/cassandra-trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java uses or overrides a deprecated API.  
   [javac] Note: Recompile with -Xlint:deprecation for details.  
   [javac] Note: Some input files use unchecked or unsafe operations.  
   [javac] Note: Recompile with -Xlint:unchecked for details.  
   [javac] Compiling 1459 source files to /home/user/cassandra-trunk/build/classes/main  
   [javac] Note: Processing compiler hints annotations  
   [javac] Note: Processing compiler hints annotations  
   [javac] Note: Writing compiler command file at META-INF/hotspot_compiler  
   [javac] Note: Done processing compiler hints annotations  
   [javac] Note: Some input files use or override a deprecated API.  
   [javac] Note: Recompile with -Xlint:deprecation for details.  
   [javac] Note: Some input files use unchecked or unsafe operations.  
   [javac] Note: Recompile with -Xlint:unchecked for details.  
   [javac] Creating empty /home/user/cassandra-trunk/build/classes/main/org/apache/cassandra/hints/package-info.class  
   
 createVersionPropFile:  
   [mkdir] Created dir: /home/user/cassandra-trunk/src/resources/org/apache/cassandra/config  
 [propertyfile] Creating new property file: /home/user/cassandra-trunk/src/resources/org/apache/cassandra/config/version.properties  
    [copy] Copying 18 files to /home/user/cassandra-trunk/build/classes/main  
    [copy] Copying 1 file to /home/user/cassandra-trunk/conf  
   
 build:  
   
 build-test:  
   [javac] Compiling 481 source files to /home/user/cassandra-trunk/build/test/classes  
   [javac] Note: Some input files use or override a deprecated API.  
   [javac] Note: Recompile with -Xlint:deprecation for details.  
   [javac] Note: Some input files use unchecked or unsafe operations.  
   [javac] Note: Recompile with -Xlint:unchecked for details.  
    [copy] Copying 22 files to /home/user/cassandra-trunk/build/test/classes  
   
 stress-build:  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/classes/stress  
   [javac] Compiling 118 source files to /home/user/cassandra-trunk/build/classes/stress  
   [javac] Note: Some input files use or override a deprecated API.  
   [javac] Note: Recompile with -Xlint:deprecation for details.  
   [javac] Note: Some input files use unchecked or unsafe operations.  
   [javac] Note: Recompile with -Xlint:unchecked for details.  
    [copy] Copying 1 file to /home/user/cassandra-trunk/build/classes/stress  
   
 write-poms:  
   
 init:  
   
 maven-ant-tasks-localrepo:  
   
 maven-ant-tasks-download:  
   
 maven-ant-tasks-init:  
   
 maven-declare-dependencies:  
   
 _write-poms:  
   
 jar:  
    [copy] Copying 1 file to /home/user/cassandra-trunk/build/classes/main/META-INF  
    [copy] Copying 1 file to /home/user/cassandra-trunk/build/classes/thrift/META-INF  
    [copy] Copying 1 file to /home/user/cassandra-trunk/build/classes/main/META-INF  
    [copy] Copying 1 file to /home/user/cassandra-trunk/build/classes/thrift/META-INF  
    [jar] Building jar: /home/user/cassandra-trunk/build/apache-cassandra-thrift-3.10-SNAPSHOT.jar  
    [jar] Building jar: /home/user/cassandra-trunk/build/apache-cassandra-3.10-SNAPSHOT.jar  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/classes/stress/META-INF  
   [mkdir] Created dir: /home/user/cassandra-trunk/build/tools/lib  
    [jar] Building jar: /home/user/cassandra-trunk/build/tools/lib/stress.jar  
   
 BUILD SUCCESSFUL  
 Total time: 4 minutes 45 secondsuser@localhost:~/cassandra-trunk$ ant -version  
 Apache Ant(TM) version 1.9.7 compiled on May 16 2016  
 user@localhost:~/cassandra-trunk$ export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_45/  

Wow, build is success! Next launch your eclipse and create cassandra eclipse development descriptors.

 user@localhost:~/cassandra-trunk$ ant generate-eclipse-files  
 Buildfile: /home/user/cassandra-trunk/build.xml  
   
 init:  
   
 maven-ant-tasks-localrepo:  
   
 maven-ant-tasks-download:  
   
 maven-ant-tasks-init:  
   
 maven-declare-dependencies:  
   
 maven-ant-tasks-retrieve-build:  
   
 init-dependencies:  
    [echo] Loading dependency paths from file: /home/user/cassandra-trunk/build/build-dependencies.xml  
   
 init-dependencies:  
    [echo] Loading dependency paths from file: /home/user/cassandra-trunk/build/build-dependencies-sources.xml  
   [unzip] Expanding: /home/user/cassandra-trunk/build/lib/jars/org.jacoco.agent-0.7.5.201505241946.jar into /home/user/cassandra-trunk/build/lib/jars  
   
 check-gen-cql3-grammar:  
   
 gen-cql3-grammar:  
   
 generate-cql-html:  
   
 generate-jflex-java:  
   
 build-project:  
    [echo] apache-cassandra: /home/user/cassandra-trunk/build.xml  
   
 createVersionPropFile:  
 [propertyfile] Updating property file: /home/user/cassandra-trunk/src/resources/org/apache/cassandra/config/version.properties  
    [copy] Copying 1 file to /home/user/cassandra-trunk/build/classes/main  
   
 build:  
   
 build-test:  
   
 generate-eclipse-files:  
   [mkdir] Created dir: /home/user/cassandra-trunk/.settings  
   
 BUILD SUCCESSFUL  
 Total time: 1 second  

Everything is good and assuming eclipse is also started, now let's import the eclipse settings. Using this sequence,'File' ->  'Import...' -> 'Existing Projects into Workspace'. Click, next and in the 'Select root directory:' textbox , browse to the git repository cloned earlier and select it. Leave the remaining as is and click Finish.

If you get error, fix it :D for me, the default java configured for eclipse is 7 and hence, code compile is java 7, so I have to change that and move java lib to the top of the project. Particulary you can move to java lib in 'Order and Export' in project's properties.



There are two class file which give compile errors, which I have to commented out the code.


since both classes are unit test, I don't actually bothered.

Okay, we take a pause here, in the next article, I will explain testing in cassandra. Stay tune!


Sunday, June 21, 2015

Learning JavaFX on eclipse luna

Today, we will learn JavaFX using eclipse luna as the IDE. It's a start learning journey to get acquainted with the basic of JavaFX in the eclipse development environment. Essentially it is a 'hello world' application. First, let's take a look what is JavaFX. From wikipedia,

JavaFX is a software platform for creating and delivering rich internet applications (RIAs) that can run across a wide variety of devices. JavaFX is intended to replace Swing as the standard GUI library for Java SE, but both will be included for the foreseeable future.[3] JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linux, and Mac OS X.

Okay, so javaFX is a GUI related development arena. With that said, let's start with a simple hello world GUI application for JavaFX. This article assume your java project is using java 8 and eclipse luna and you have setup already. Below is a sample code.

1:  package play.learn.java.fx;  
2:    
3:  import javafx.application.Application;  
4:  import javafx.event.ActionEvent;  
5:  import javafx.event.EventHandler;  
6:  import javafx.scene.Scene;  
7:  import javafx.scene.control.Button;  
8:  import javafx.scene.layout.StackPane;  
9:  import javafx.stage.Stage;  
10:    
11:  public class HelloWorld extends Application {  
12:    
13:     @Override  
14:     public void start(Stage primaryStage) throws Exception {  
15:        Button btn = new Button();  
16:      btn.setText("Say 'Hello World'");  
17:      btn.setOnAction(new EventHandler<ActionEvent>() {  
18:     
19:        @Override  
20:        public void handle(ActionEvent event) {  
21:          System.out.println("Hello World!");  
22:        }  
23:      });  
24:        
25:      StackPane root = new StackPane();  
26:      root.getChildren().add(btn);  
27:        
28:      Scene scene = new Scene(root, 300, 250);  
29:    
30:      primaryStage.setTitle("Hello World!");  
31:      primaryStage.setScene(scene);  
32:      primaryStage.show();  
33:          
34:     }  
35:       
36:     public static void main(String[] args) {  
37:        launch(args);  
38:    
39:     }  
40:  }  


As you can see above, there is a warning about restrict access to the api. To summarize the warning short, it is because non java library is not import by default into the project. So in this situation, you will have to manually add it. It's simple, on the project, right click and then select Properties, then a window pop up and in the Java Build Path tree, click on the 'Add External JARs...' , now you will have to locate where is the java 8 installed, and then select a jar file name jfxrt.jar. It will be relative to where the JAVA_HOME install such that, <JAVA_HOME>/jre/lib/ext/




When that is done, the warning should be dissapear. Now run the application, a window should pop up and click on it, look at the eclipse console, you should see "Hello World!". A little remarks to understand the basic of this application.

Here are the important things to know about the basic structure of a JavaFX application:


  •     The main class for a JavaFX application extends the javafx.application.Application class. The start() method is the main entry point for all JavaFX applications.
  •     A JavaFX application defines the user interface container by means of a stage and a scene. The JavaFX Stage class is the top-level JavaFX container. The JavaFX Scene class is the container for all content. Example 3-1 creates the stage and scene and makes the scene visible in a given pixel size.
  •     In JavaFX, the content of the scene is represented as a hierarchical scene graph of nodes. In this example, the root node is a StackPane object, which is a resizable layout node. This means that the root node's size tracks the scene's size and changes when the stage is resized by a user.
  •     The root node contains one child node, a button control with text, plus an event handler to print a message when the button is pressed.
  •     The main() method is not required for JavaFX applications when the JAR file for the application is created with the JavaFX Packager tool, which embeds the JavaFX Launcher in the JAR file. However, it is useful to include the main() method so you can run JAR files that were created without the JavaFX Launcher, such as when using an IDE in which the JavaFX tools are not fully integrated. Also, Swing applications that embed JavaFX code require the main() method.


The above are excerpt from official documentation. The code can also be found here. That's it, have fun to explore more of JavaFX.

Saturday, December 20, 2014

Speed up android emulator startup in eclipse

When exploring hello world android development app in eclipse, the emulator just painfully slow to even launch. To me, the speed matter because if it is slow, the test and development cycle will be affected and thus, the development experience will not be pleasant. So today, before we go into hello world article, we will first explore if it is possible to improve the speed of android emulator startup in eclipse.

I have google and found a few links, there are as of following.

To summarize the solution used to the links above, there are Intel Hardware Accelerated Execution Manager (HAXM), linux kvm or virtualbox, android virtual device (AVD) snapshot, increase device ram, GPU acceleration, disable antivirus ?!, 3rd party android emulator, using actual android device instead of emulator, etc.

Because every developer has different development environment and every sdk and improvement over time may render these method describe later in this article invalid. Thus, the speed gain in your environment when android emulator start may vary and thus create unnecessary confusion. Thus, you should always read on the links and find a solution that work best in your environment. The following steps improved my environment in such a way.

  1. Before it start need 10minutes and then even after waited 10minutes, then it crashed. With this, on my i3 intel cpu, with 8GB of ram, the speed increase in within less than 2minutes and response is emulator is manageable.

  2. The emulator start over time is persistence. There are situation when once the android virtual device is created, the second time it boot, the android screen in the emulator get gibberish and unclickable. So with my method describe later, this will not be a problem.


Before we go into the solution, let's understand what emulator is. Emulator according to wikipedia

In computing, an emulator is hardware or software or both that duplicates (or emulates) the functions of one computer system (the guest) in another computer system (the host), different from the first one, so that the emulated behavior closely resembles the behavior of the real system (the guest).

In android sense, this emulator actually emulate a smartphone environment including hardware instruction, from workstation cpu x86 to the android device which uses arm. Because of Android Emulator emulates a real ARM processor on top of an x86 processor, this create a lot of overhead. Connection of real device through usb via eclipse integration is not available for linux environment. Thus, for initial learning phase, a android emulator is a good start.

eclipse-android-sdk-manager

Launch Android Virtual Device Manager from eclipse.

eclipse-android-virtual-device-manager

create a new android virtual device, as seem below with this setting.

android-virtual-device-setting

As you can see, the target for the application is being currently latest at Android 5.0 - API Level 21. The important part now is to choose CPU/ABI to Intel Atom(x86_64). Of cause smartphone device mostly with arm cpu but as mentioned previously, we want emulator be a quick test environment.

If you notice, I have left Use Host GPU uncheck. When this is check with my environment, there is no speed up and when the android evironment started, the colour became gibberish and not clickable. Now start the device and experience the clicking in the environment.

Happy develop in android.

 

Friday, December 19, 2014

Setting up eclipse with Android development environment

Today, we will explore something different. Android is a very well known brand in the public now and can be found in devices such as smartphone, tablet, wearable like watch and glass, any end user device like tv or smart appliances. So we will take a look from programming point of view. This is a fresh start article and if you come from java development background and has zero knowledge on android development then this is an article for you. More on android development articles will come later.

To reduce the learning curve and to have a better learning and development experience in android, you should really setup android developer toolkit plugin in an IDE. If you have been develop Java for sometime now, IDE such as eclipse or netbeans should come in mind. Eclipse has always been my favourite IDE for java development and in this article, I will share on how to install ADT plugin in eclipse for android environment.

This article is based on this instruction. You should refer that for any changes or error encountered if you read this article in the future. As of this writing, I'm using eclipse luna for this ADT plugin installation. Let's start the installation.

  1. Launch eclipse and click Help then Install New Software... then click on Add button.

  2. We will add ADT plugin repository to this eclipse IDE. In the pop up window, add as following and then click on OK.
    Name: ADT Plugin
    Location: https://dl-ssl.google.com/android/eclipse/
    eclipse_add_repository_adt

  3. Wait a while for the update to pull in by eclipse and the in the Available Software dialog, select the checkbox next to Developer Tools and click on Next.
    eclipse_available_software

  4. In the next window, you'll see a list of the tools to be downloaded. Click Next.

  5. Read and accept the license agreements, then click Finish.
    If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.

  6. When the installation completes, restart Eclipse.

  7. Once Eclipse restarts, you must specify the location of your Android SDK directory. Because this is a new installation, there is no android sdk installed and click on Open Preferences.
    eclipse_welcome_to_android_development eclipse_android_sdk

  8. In the "Welcome to Android Development" window that appears, select Install new SDK. Then wait until the installation is complete.
    eclipse_welcome_to_android_development_install_new_sdk
    eclipse_welcome_to_android_development_installing_new_sdk

  9. When sdk is installed, a new window popup requesting to install new build tool. Click on Open SDK Manager.
    eclipse_android_sdk_install_build-tools

  10. There are preselected build-tools and as of this moment, just accept the default preselected tools and click Install button. We can install more tools later.
    eclipse_android_sdk_managereclipse_android_sdk_manager_confirm_install_packages

  11. Wait until the installation is complete and it is done.


That's it, now start the first session for android hello world development.