Author: stack Date: Mon Feb 4 18:32:22 2008 New Revision: 618517 URL: http://svn.apache.org/viewvc?rev=618517&view=rev Log: HBASE-403 Fix build after move of hbase in svn A lib/commons-httpclient-3.0.1.jar M src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java If not null, run shutdown of hbase cluster. A src/java/org/apache/hadoop/hbase/util/VersionInfo.java A src/java/org/apache/hadoop/hbase/VersionAnnotation.java A src/saveVersion.sh Bring down the hadoop version publishing system. M src/java/org/apache/hadoop/hbase/util/InfoServer.java Print out problematic path. M build.xml Need to put the hadoop jar in front of hbase else complaints that dfs webapps, etc., can't be found. (Need to fix HttpStatusServer in hadoop).
Added: hadoop/hbase/trunk/lib/commons-httpclient-3.0.1.jar (with props) hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/VersionAnnotation.java hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/VersionInfo.java hadoop/hbase/trunk/src/saveVersion.sh (with props) Modified: hadoop/hbase/trunk/build.xml hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/InfoServer.java hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java Modified: hadoop/hbase/trunk/build.xml URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/build.xml?rev=618517&r1=618516&r2=618517&view=diff ============================================================================== --- hadoop/hbase/trunk/build.xml (original) +++ hadoop/hbase/trunk/build.xml Mon Feb 4 18:32:22 2008 @@ -18,6 +18,9 @@ --> <project name="hbase" default="jar"> + <property name="version" value="0.1.0-dev"/> + <property name="final.name" value="${name}-${version}"/> + <!-- Load all the default properties, and any the user wants --> <!-- to contribute (without having to type -D or edit this file --> <property file="${user.home}/${name}.build.properties" /> @@ -37,7 +40,7 @@ <property name="build.dir" location="${basedir}/build"/> <property name="build.bin" location="${build.dir}/bin"/> <property name="build.conf" location="${build.dir}/conf"/> - <property name="build.webapps" location="${build.dir}/webpps"/> + <property name="build.webapps" location="${build.dir}/webapps"/> <property name="build.lib" location="${build.dir}/lib"/> <property name="build.classes" location="${build.dir}/classes"/> <property name="build.test" location="${build.dir}/test"/> @@ -47,8 +50,6 @@ <property name="test.log.dir" value="${test.build.dir}/logs"/> <property name="test.junit.output.format" value="plain"/> - - <!-- all jars together --> <property name="javac.deprecation" value="off"/> <property name="javac.debug" value="on"/> @@ -57,15 +58,20 @@ <property name="build.encoding" value="ISO-8859-1"/> - <!-- the normal classpath --> - <fileset id="lib.jars" dir="${basedir}" includes="lib/*.jar"/> + <!--We need to have the hadoop jars ride in front of the hbase classes or we + get the below exceptions: + + [junit] java.io.FileNotFoundException: file:/Users/stack/Documents/checkouts/hbase/trunk/build/webapps/dfs + When we move off 0.16.0 hadoop, fix HttpStatusServer + --> + <fileset id="lib.jars" dir="${basedir}" includes="lib/*.jar"/> <path id="classpath"> - <pathelement location="${build.classes}"/> <fileset refid="lib.jars"/> - <fileset dir="${basedir}/lib/jetty-ext/"> - <include name="*jar" /> + <fileset dir="${lib.dir}/jetty-ext/"> + <include name="*jar" /> </fileset> + <pathelement location="${build.classes}"/> <pathelement location="${conf.dir}"/> </path> @@ -75,12 +81,6 @@ <mkdir dir="${build.test}"/> <mkdir dir="${build.examples}"/> - <!--Version is set only if called from hadoop build.xml. Set a default--> - <condition property="version" value="0.1.0-dev"> - <not> - <isset property="version" /> - </not> - </condition> <!--Copy webapps over to build dir. Exclude jsp and generated-src java classes --> <mkdir dir="${build.webapps}"/> @@ -94,7 +94,7 @@ <!--Copy bin, lib, and conf. too--> <mkdir dir="${build.lib}"/> <copy todir="${build.lib}"> - <fileset dir="${basedir}/lib" /> + <fileset dir="${lib.dir}" /> </copy> <mkdir dir="${build.conf}"/> <copy todir="${build.conf}"> @@ -107,6 +107,9 @@ <chmod perm="ugo+x" type="file"> <fileset dir="${build.bin}" /> </chmod> + <exec executable="sh"> + <arg line="src/saveVersion.sh ${version}"/> + </exec> </target> <target name="javacc" if="javacc.home"> @@ -131,7 +134,6 @@ debug="${javac.debug}" deprecation="${javac.deprecation}"> <classpath refid="classpath"/> - <classpath path="path"/> </javac> </target> @@ -185,11 +187,12 @@ <!-- Run unit tests --> <!-- ================================================================== --> <path id="test.classpath"> + <path refid="classpath"/> <pathelement location="${build.test}" /> <pathelement location="${src.test}"/> <pathelement location="${conf.dir}"/> <pathelement location="${build.dir}"/> - <path refid="classpath"/> + <pathelement location="${build.webapps}"/> </path> <target name="compile-test" depends="compile" > Added: hadoop/hbase/trunk/lib/commons-httpclient-3.0.1.jar URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/lib/commons-httpclient-3.0.1.jar?rev=618517&view=auto ============================================================================== Binary file - no diff available. Propchange: hadoop/hbase/trunk/lib/commons-httpclient-3.0.1.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/VersionAnnotation.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/VersionAnnotation.java?rev=618517&view=auto ============================================================================== --- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/VersionAnnotation.java (added) +++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/VersionAnnotation.java Mon Feb 4 18:32:22 2008 @@ -0,0 +1,57 @@ +/* + * 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.hadoop.hbase; + +import java.lang.annotation.*; + +/** + * A package attribute that captures the version of hbase that was compiled. + * Copied down from hadoop. All is same except name of interface. + */ [EMAIL PROTECTED](RetentionPolicy.RUNTIME) [EMAIL PROTECTED](ElementType.PACKAGE) +public @interface VersionAnnotation { + + /** + * Get the Hadoop version + * @return the version string "0.6.3-dev" + */ + String version(); + + /** + * Get the username that compiled Hadoop. + */ + String user(); + + /** + * Get the date when Hadoop was compiled. + * @return the date in unix 'date' format + */ + String date(); + + /** + * Get the url for the subversion repository. + */ + String url(); + + /** + * Get the subversion revision. + * @return the revision number as a string (eg. "451451") + */ + String revision(); +} Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/InfoServer.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/InfoServer.java?rev=618517&r1=618516&r2=618517&view=diff ============================================================================== --- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/InfoServer.java (original) +++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/InfoServer.java Mon Feb 4 18:32:22 2008 @@ -178,7 +178,7 @@ private static String getWebAppsPath(final String path) throws IOException { URL url = InfoServer.class.getClassLoader().getResource(path); if (url == null) - throw new IOException("webapps not found in CLASSPATH"); + throw new IOException("webapps not found in CLASSPATH: " + path); return url.toString(); } Added: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/VersionInfo.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/VersionInfo.java?rev=618517&view=auto ============================================================================== --- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/VersionInfo.java (added) +++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/util/VersionInfo.java Mon Feb 4 18:32:22 2008 @@ -0,0 +1,88 @@ +/* + * 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.hadoop.hbase.util; + +import org.apache.hadoop.hbase.VersionAnnotation; + +/** + * This class finds the package info for hbase and the VersionAnnotation + * information. Taken from hadoop. Only name of annotation is different. + */ +public class VersionInfo { + private static Package myPackage; + private static VersionAnnotation version; + + static { + myPackage = VersionAnnotation.class.getPackage(); + version = myPackage.getAnnotation(VersionAnnotation.class); + } + + /** + * Get the meta-data for the hbase package. + * @return + */ + static Package getPackage() { + return myPackage; + } + + /** + * Get the hbase version. + * @return the hbase version string, eg. "0.6.3-dev" + */ + public static String getVersion() { + return version != null ? version.version() : "Unknown"; + } + + /** + * Get the subversion revision number for the root directory + * @return the revision number, eg. "451451" + */ + public static String getRevision() { + return version != null ? version.revision() : "Unknown"; + } + + /** + * The date that hbase was compiled. + * @return the compilation date in unix date format + */ + public static String getDate() { + return version != null ? version.date() : "Unknown"; + } + + /** + * The user that compiled hbase. + * @return the username of the user + */ + public static String getUser() { + return version != null ? version.user() : "Unknown"; + } + + /** + * Get the subversion URL for the root hbase directory. + */ + public static String getUrl() { + return version != null ? version.url() : "Unknown"; + } + + public static void main(String[] args) { + System.out.println("HBase " + getVersion()); + System.out.println("Subversion " + getUrl() + " -r " + getRevision()); + System.out.println("Compiled by " + getUser() + " on " + getDate()); + } +} Added: hadoop/hbase/trunk/src/saveVersion.sh URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/saveVersion.sh?rev=618517&view=auto ============================================================================== --- hadoop/hbase/trunk/src/saveVersion.sh (added) +++ hadoop/hbase/trunk/src/saveVersion.sh Mon Feb 4 18:32:22 2008 @@ -0,0 +1,39 @@ +#!/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. + + +# This file is used to generate the annotation of package info that +# records the user, url, revision and timestamp. +# +# Copied from hadoop. +version=$1 +revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'` +url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'` +user=`whoami` +date=`date` +mkdir -p build/src/org/apache/hadoop/hbase +cat << EOF | \ + sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \ + -e "s|URL|$url|" -e "s/REV/$revision/" \ + > build/src/org/apache/hadoop/hbase/package-info.java +/* + * Generated by src/saveVersion.sh + */ [EMAIL PROTECTED](version="VERSION", revision="REV", + user="USER", date="DATE", url="URL") +package org.apache.hadoop.hbase; +EOF Propchange: hadoop/hbase/trunk/src/saveVersion.sh ------------------------------------------------------------------------------ svn:executable = * Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java?rev=618517&r1=618516&r2=618517&view=diff ============================================================================== --- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java (original) +++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java Mon Feb 4 18:32:22 2008 @@ -233,7 +233,9 @@ * Shut down the mini HBase cluster */ public void shutdown() { - this.hbaseCluster.shutdown(); + if (this.hbaseCluster != null) { + this.hbaseCluster.shutdown(); + } if (shutdownDFS) { StaticTestEnvironment.shutdownDfs(cluster); }