Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Commit

Permalink
merge from julieZhang
Browse files Browse the repository at this point in the history
  • Loading branch information
tjake committed Feb 23, 2011
1 parent 2fa05c7 commit aeecebf
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 147 deletions.
298 changes: 157 additions & 141 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

<property name="app" location="solandra-app" />
<property name="resources" location="resources" />

<property name="autogen" location="auto-gen" />
<property name="autogen.thrift.dir" location="${autogen}/thrift" />

<!-- ivy properties -->
<property name="ivy.version" value="2.2.0" />
Expand All @@ -51,20 +54,21 @@
<mkdir dir="${ivy.dir}" />
<mkdir dir="${ivy.lib.dir}" />
<mkdir dir="${app}" />
<mkdir dir="${autogen.thrift.dir}" />
<!--
Allow Ivy to be disabled with "-Dnoivy=".
It is kind of a hack to pretend that we already found it,
but Ant doesn't provide an easy way of blocking dependencies
from executing or checking multiple conditions.
-->
<condition property="ivy.found">
<isset property="noivy" />
<isset property="noivy" />
</condition>
<condition property="offline">
<isset property="noivy" />
<isset property="noivy" />
</condition>
<condition property="cassandra.found">
<isset property="cassandra" />
<isset property="cassandra" />
</condition>
</target>

Expand All @@ -81,16 +85,16 @@

<target name="ivy-init-antlib" depends="ivy-download,ivy-probe-antlib" unless="ivy.found">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}" />
</classpath>
<classpath>
<pathelement location="${ivy.jar}" />
</classpath>
</typedef>
<fail>
<condition>
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</not>
</condition>
<condition>
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
Expand All @@ -101,62 +105,63 @@
</target>

<path id="autoivy.classpath">
<fileset dir="${ivy.lib.dir}">
<include name="**/*.jar" />
<exclude name="**/*cassandra*.jar" if="cassandra.found"/>
</fileset>
<fileset dir="${ivy.lib.dir}">
<include name="**/*.jar" />
<exclude name="**/*cassandra*.jar" if="cassandra.found"/>
</fileset>
</path>

<!-- =========================== -->

<path id="solandra.classpath">
<pathelement location="${build.classes}" />
<pathelement location="${build.test.classes}" />
<pathelement location="${resources}" />
<pathelement location="${resources}/solr" />
<fileset dir="${lib}">
<include name="**/*.jar" />
<exclude name="**/*cassandra*.jar" if="cassandra.found"/>
</fileset>
<fileset dir="${cassandra}" erroronmissingdir="false">
<include name="lib/*.jar"/>
<include name="build/*.jar"/>
</fileset>
<path refid="autoivy.classpath" />
<pathelement location="${cassandra}/build/classes"/>
<pathelement location="${build.classes}" />
<pathelement location="${build.test.classes}" />
<pathelement location="${resources}" />
<pathelement location="${resources}/solr" />
<fileset dir="${lib}">
<include name="**/*.jar" />
<exclude name="**/*cassandra*.jar" if="cassandra.found"/>
</fileset>
<fileset dir="${cassandra}" erroronmissingdir="false">
<include name="lib/*.jar"/>
<include name="build/*.jar"/>
</fileset>
<path refid="autoivy.classpath" />
<pathelement location="${cassandra}/build/classes"/>
</path>


<target name="compile" depends="init,resolve">
<javac debug="true" destdir="${build.classes}">
<src path="${src}" />
<classpath refid="solandra.classpath" />
</javac>
<javac debug="true" destdir="${build.classes}">
<src path="${src}" />
<src path="${autogen.thrift.dir}/gen-java"/>
<classpath refid="solandra.classpath" />
</javac>
</target>

<target name="compile.tests" depends="compile">
<javac debug="true" destdir="${build.test.classes}">
<src path="${test}" />
<classpath refid="solandra.classpath" />
</javac>
<javac debug="true" destdir="${build.test.classes}">
<src path="${test}" />
<classpath refid="solandra.classpath" />
</javac>
</target>


<target name="test" depends="compile.tests">
<echo message="running tests" />
<mkdir dir="${build}/output" />
<junit fork="on" failureproperty="testfailed">
<classpath refid="solandra.classpath" />
<formatter type="xml" usefile="true" />
<formatter type="brief" usefile="false" />

<batchtest todir="${build}/output">
<fileset dir="${build.test.classes}" includes="**/SolandraTests.class" />
</batchtest>

<jvmarg value="-Xmx1G" />
</junit>
<fail if="testfailed" message="Some test(s) failed." />
<echo message="running tests" />
<mkdir dir="${build}/output" />
<junit fork="on" failureproperty="testfailed">
<classpath refid="solandra.classpath" />
<formatter type="xml" usefile="true" />
<formatter type="brief" usefile="false" />
<batchtest todir="${build}/output">
<fileset dir="${build.test.classes}" includes="**/SolandraTests.class" />
</batchtest>
<jvmarg value="-Xmx1G" />
</junit>
<fail if="testfailed" message="Some test(s) failed." />
</target>

<target name="solandra.jar" depends="compile,compile.tests">
Expand All @@ -168,112 +173,123 @@
<delete dir="${build}" />
<delete dir="${lib}" />
<delete dir="${app}" />
<delete dir="${autogen}" />
<delete file="solandra.jar" />
<delete file="solandra-tests.jar" />
<delete file="solandra.war" />
</target>

<!-- ============================= -->
<target name="war" depends="solandra.jar">
<war destfile="solandra.war"
<!-- ============================= -->
<target name="war" depends="solandra.jar">
<war destfile="solandra.war"
webxml="${resources}/solr/web.xml">
<lib dir="${lib}">
<exclude name="jetty*.jar" />
<exclude name="servlet-api*.jar" />
<exclude name="easymock.jar" />
</lib>
<lib dir="${cassandra.base}/lib">
<include name="**/*.jar" />
</lib>
<lib dir="${cassandra.base}/build">
<include name="**/*.jar" />
</lib>
<classes dir="${resources}">
<include name="*.properties"/>
</classes>
<lib file="solandra.jar"/>
</war>
</target>
<target name="dist" depends="war">
<delete dir="${app}" />
<mkdir dir="${app}"/>
<mkdir dir="${app}/cassandra-tools"/>
<mkdir dir="${app}/cassandra-tools/lib"/>
<mkdir dir="${app}/logs" />
<mkdir dir="${app}/etc" />
<mkdir dir="${app}/lib" />
<mkdir dir="${app}/work" />
<copy todir="${app}/lib">
<fileset dir="${lib}" includes="jetty*.jar,servlet*.jar,jsp*.jar"/>
</copy>
<copy todir="${app}/etc">
<fileset dir="${resources}/solr" includes="jetty.xml,jetty-logging.xml,webdefault.xml"/>
</copy>
<copy file="solandra.war" tofile="${app}/webapps/solandra.war"/>
<copy todir="${app}/solr/conf" overwrite="false">
<fileset dir="${resources}/solr" includes="solrconfig.xml,schema.xml,*.txt"/>
</copy>
<chmod dir="${app}/solr/conf" perm="644" includes="**,*"/>
<copy todir="${app}">
<fileset dir="${resources}" includes="cassandra.yaml,solandra.in.sh,start.jar,start-solandra.sh,log4j.properties,solandra.properties"/>
</copy>
<copy todir="${app}/cassandra-tools">
<fileset dir="${resources}/cassandra" includes="solandra.cml,cassandra-cli,nodetool,cassandra.in.sh,log4j-tools.properties"/>
</copy>
<copy todir="${app}/cassandra-tools/lib">
<fileset dir="${lib}" includes="*.jar"/>
</copy>
<chmod dir="${app}" perm="755" includes="start-solandra.sh"/>
<chmod dir="${app}/cassandra-tools" perm="755" includes="cassandra-cli,nodetool"/>

<echo>Solandra successfully built</echo>
<echo>You can excute the following command to start the server.</echo>
<lib dir="${lib}">
<exclude name="jetty*.jar" />
<exclude name="servlet-api*.jar" />
<exclude name="easymock.jar" />
</lib>
<lib dir="${cassandra.base}/lib">
<include name="**/*.jar" />
</lib>
<lib dir="${cassandra.base}/build">
<include name="**/*.jar" />
</lib>
<classes dir="${resources}">
<include name="*.properties"/>
</classes>
<lib file="solandra.jar"/>
</war>
</target>
<target name="dist" depends="war">
<delete dir="${app}" />
<mkdir dir="${app}"/>
<mkdir dir="${app}/cassandra-tools"/>
<mkdir dir="${app}/cassandra-tools/lib"/>
<mkdir dir="${app}/logs" />
<mkdir dir="${app}/etc" />
<mkdir dir="${app}/lib" />
<mkdir dir="${app}/work" />
<copy todir="${app}/lib">
<fileset dir="${lib}" includes="jetty*.jar,servlet*.jar,jsp*.jar"/>
</copy>
<copy todir="${app}/etc">
<fileset dir="${resources}/solr" includes="jetty.xml,jetty-logging.xml,webdefault.xml"/>
</copy>
<copy file="solandra.war" tofile="${app}/webapps/solandra.war"/>
<copy todir="${app}/solr/conf" overwrite="false">
<fileset dir="${resources}/solr" includes="solrconfig.xml,schema.xml,*.txt"/>
</copy>
<chmod dir="${app}/solr/conf" perm="644" includes="**,*"/>
<copy todir="${app}">
<fileset dir="${resources}" includes="cassandra.yaml,solandra.in.sh,start.jar,start-solandra.sh,log4j.properties,solandra.properties"/>
</copy>
<copy todir="${app}/cassandra-tools">
<fileset dir="${resources}/cassandra" includes="solandra.cml,cassandra-cli,nodetool,cassandra.in.sh,log4j-tools.properties"/>
</copy>
<copy todir="${app}/cassandra-tools/lib">
<fileset dir="${lib}" includes="*.jar"/>
</copy>
<chmod dir="${app}" perm="755" includes="start-solandra.sh"/>
<chmod dir="${app}/cassandra-tools" perm="755" includes="cassandra-cli,nodetool"/>
<echo>Solandra successfully built</echo>
<echo>You can excute the following command to start the server.</echo>
<echo>cd ${app}; start-solandra.sh</echo>
</target>
</target>



<target name="set.cassandra">
<fail unless="cassandra.found">path to cassandra not found use -Dcassandra=...</fail>
</target>

<target name="set.cassandra">
<fail unless="cassandra.found">path to cassandra not found use -Dcassandra=...</fail>
</target>

<!-- Construct the path to the cassandra distribution. Taken from the command
<!-- Construct the path to the cassandra distribution. Taken from the command
line if set like this
ant cassandra-dist -Dcassandra=apache-cassandra-0.7.1
-->


<!-- Copy our required runtime file the cassandra extracted directory -->
<target name="cassandra-dist" depends="init,set.cassandra,solandra.jar">

<!-- copy over all the new jar files -->

<copy todir="${cassandra}/lib">
<fileset dir="${lib}" includes="jetty*.jar,servlet*.jar,jsp*.jar, solr*.jar, lucene*.jar, commons*.jar" />
<fileset dir="${basedir}" includes="solandra.jar" />
</copy>

<!-- copy the solr data -->

<copy todir="${cassandra}/conf" overwrite="false">
<fileset dir="${resources}/solr" includes="solrconfig.xml,schema.xml,*.txt" />
<fileset dir="${resources}" includes="solandra.properties" />
</copy>


<copy overwrite="true" file="${cassandra}/bin/cassandra" tofile="${cassandra}/bin/solandra"/>

<replace file="${cassandra}/bin/solandra" failOnNoReplacements="true">
<replacetoken>classname="org.apache.cassandra.thrift.CassandraDaemon"</replacetoken>
<replacevalue>classname="solandra.CassandraStarter"</replacevalue>
</replace>

<chmod dir="${cassandra}/bin" perm="755" includes="solandra"/>

<echo>Libraries successfully copied into cassandra distribution</echo>
<echo>Start the cassandra server with ${cassandra}/bin/solandra command</echo>

<!-- Copy our required runtime file the cassandra extracted directory -->
<target name="cassandra-dist" depends="init,set.cassandra,solandra.jar">

<!-- copy over all the new jar files -->

<copy todir="${cassandra}/lib">
<fileset dir="${lib}" includes="jetty*.jar,servlet*.jar,jsp*.jar, solr*.jar, lucene*.jar, commons*.jar" />
<fileset dir="${basedir}" includes="solandra.jar" />
</copy>

<!-- copy the solr data -->

<copy todir="${cassandra}/conf" overwrite="false">
<fileset dir="${resources}/solr" includes="solrconfig.xml,schema.xml,*.txt" />
<fileset dir="${resources}" includes="solandra.properties" />
</copy>


<copy overwrite="true" file="${cassandra}/bin/cassandra" tofile="${cassandra}/bin/solandra"/>

<replace file="${cassandra}/bin/solandra" failOnNoReplacements="true">
<replacetoken>classname="org.apache.cassandra.thrift.CassandraDaemon"</replacetoken>
<replacevalue>classname="solandra.CassandraStarter"</replacevalue>
</replace>

<chmod dir="${cassandra}/bin" perm="755" includes="solandra"/>

<echo>Libraries successfully copied into cassandra distribution</echo>
<echo>Start the cassandra server with ${cassandra}/bin/solandra command</echo>

</target>

<!-- Generate thrift code.-->
<target name="gen-thrift-java" description="Generate Thrift Java artifacts">
<echo>Generating Thrift Java code from ${basedir}/schema/thrift/lucandra.thrift ....</echo>
<exec executable="thrift" dir="${basedir}/schema" failonerror="true">
<arg line="--gen java:hashcode" />
<arg line="-o ${autogen.thrift.dir}" />
<arg line="lucandra.thrift" />
</exec>
</target>
</project>
18 changes: 18 additions & 0 deletions schema/lucandra.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace java lucandra.serializers.thrift

typedef i32 int
typedef i64 long


/**
* Term Information..
*/
struct ThriftTerm {
1: required string field,
2: required string text,
}

struct DocumentMetadata {
1: required list<ThriftTerm> terms,
}

Loading

0 comments on commit aeecebf

Please sign in to comment.