Skip to content

Commit

Permalink
Backport ZOOKEEPER-2829 to cdh6.x (apache#5)
Browse files Browse the repository at this point in the history
Reason: Maintainability
Author: Abraham Fine
Ref: CDH-58017
  • Loading branch information
abefine authored and GitHub Enterprise committed Aug 21, 2017
1 parent ac77aac commit 447baf5
Show file tree
Hide file tree
Showing 26 changed files with 272 additions and 172 deletions.
57 changes: 30 additions & 27 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<pathelement location="${basedir}/cloudera/maven-packaging/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>

<!-- Initializes ivy/libraries.properties and build.properties with CDH versions -->
<if>
<and>
Expand Down Expand Up @@ -138,6 +138,8 @@
<property name="ivy.jdiff.lib" value="${build.dir}/jdiff/lib"/>
<property name="ivysettings.xml" value="${basedir}/ivysettings.xml"/>

<property name="audience-annotations.version" value="0.5.0" />

<available property="clover.present"
file="${clover.home}/lib/clover.jar"
classpath="${clover.home}/lib"/>
Expand Down Expand Up @@ -248,7 +250,7 @@
<!-- ====================================================== -->
<!-- Generate and compile the Java files -->
<!-- ====================================================== -->
<target name="init" depends="jvm-check">
<target name="init" depends="jvm-check">
<mkdir dir="${build.classes}" />

<mkdir dir="${ivy.lib}"/>
Expand All @@ -267,7 +269,7 @@
<target name="jute" depends="init">
<javac srcdir="${java.src.dir}" destdir="${build.classes}" includeantruntime="false"
target="${javac.target}" source="${javac.source}"
includes="org/apache/jute/**" debug="on" />
includes="org/apache/jute/**" debug="on" classpath="${ivy.lib}/audience-annotations-${audience-annotations.version}.jar" />
</target>

<target name="compile_jute_uptodate">
Expand Down Expand Up @@ -334,9 +336,9 @@
</java>
</target>

<target name="build-generated" depends="compile_jute,version-info" >
<target name="build-generated" depends="compile_jute,version-info,ivy-retrieve" >
<javac srcdir="${src_generated.dir}" destdir="${build.classes}" includeantruntime="false"
target="${javac.target}" source="${javac.source}" debug="on" />
target="${javac.target}" source="${javac.source}" debug="on" classpath="${ivy.lib}/audience-annotations-${audience-annotations.version}.jar" />
</target>

<target name="ivy-download" unless="ivy.jar.exists" depends="init">
Expand Down Expand Up @@ -487,23 +489,24 @@
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &amp;copy; ${year} The Apache Software Foundation"
doclet="org.apache.yetus.audience.tools.IncludePublicAnnotationsStandardDoclet"
docletpath="${ivy.lib}/audience-annotations-${audience-annotations.version}.jar"
>
<fileset dir="${java.src.dir}">
<include name="org/apache/**/*Main.java"/>
<include name="org/apache/zookeeper/AsyncCallback.java"/>
<include name="org/apache/zookeeper/CreateMode.java"/>
<include name="org/apache/zookeeper/KeeperException.java"/>
<include name="org/apache/zookeeper/ServerAdminClient.java"/>
<include name="org/apache/zookeeper/Watcher.java"/>
<include name="org/apache/zookeeper/WatchedEvent.java"/>
<include name="org/apache/zookeeper/ZooDefs.java"/>
<include name="org/apache/zookeeper/ZooKeeper.java"/>

<fileset dir="${java.src.dir}">
<include name="org/apache/zookeeper/server/quorum/QuorumPeerMain.java"/>
<include name="org/apache/zookeeper/server/ZooKeeperServerMain.java"/>
<include name="org/apache/zookeeper/server/LogFormatter.java"/>
<include name="org/apache/zookeeper/server/SnapshotFormatter.java"/>
<include name="org/apache/zookeeper/server/PurgeTxnLog.java"/>
<exclude name="org/apache/zookeeper/server/quorum/QuorumPacket"/>
</fileset>
<include name="org/apache/zookeeper/server/SnapshotFormatter.java"/>
<include name="org/apache/zookeeper/server/upgrade/UpgradeMain.java"/>
</fileset>
<packageset dir="${java.src.dir}">
<include name="org/apache/**"/>
<exclude name="org/apache/zookeeper/server/**"/>
</packageset>
<packageset dir="${src_generated.dir}">
<include name="org/apache/**"/>
<exclude name="org/apache/zookeeper/proto"/>
<exclude name="org/apache/zookeeper/txn"/>
<exclude name="org/apache/zookeeper/version"/>
Expand Down Expand Up @@ -713,7 +716,7 @@
<fileset file="${build.dir}/${final.name}-sources.jar"/>
<fileset file="${build.dir}/${final.name}-javadoc.jar"/>
</copy>

<checksum file="${dist.maven.dir}/${final.name}.jar" algorithm="md5"/>
<checksum file="${dist.maven.dir}/${final.name}.jar" algorithm="sha1"/>
<checksum file="${dist.maven.dir}/${final.name}-sources.jar" algorithm="md5"/>
Expand All @@ -728,7 +731,7 @@
</ivy:makepom>
<checksum file="${dist.maven.dir}/${final.name}.pom" algorithm="md5"/>
<checksum file="${dist.maven.dir}/${final.name}.pom" algorithm="sha1"/>

<copy file="${build.dir}/${final.name}-test.jar"
tofile="${dist.maven.dir}/${final.name}-tests.jar"/>
<checksum file="${dist.maven.dir}/${final.name}-tests.jar" algorithm="sha1"/>
Expand Down Expand Up @@ -801,7 +804,7 @@
<property name="package.share" value="/share/zookeeper"/>
<fileset file="${contrib.dir}/build.xml"/>
<fileset file="${recipes.dir}/build.xml"/>
</subant>
</subant>

<copy todir="${dist.dir}/share/zookeeper">
<fileset file="${build.dir}/${final.name}.jar"/>
Expand Down Expand Up @@ -836,7 +839,7 @@


<copy file="${build.dir}/${final.name}-test.jar"
tofile="${dist.maven.dir}/${final.name}-test.jar"/>
tofile="${dist.maven.dir}/${final.name}-test.jar"/>
<checksum file="${dist.maven.dir}/${final.name}-test.jar" algorithm="sha1"/>
<checksum file="${dist.maven.dir}/${final.name}-test.jar" algorithm="md5"/>
<ivy:makepom settingsRef="${ant.project.name}" ivyfile="${basedir}/ivy.xml"
Expand Down Expand Up @@ -1180,7 +1183,7 @@
<copy todir="${test.data.buffersize.dir}">
<fileset dir="${basedir}/src/java/test/data/buffersize"/>
</copy>

</target>

<condition property="quicktest">
Expand Down Expand Up @@ -1495,7 +1498,7 @@
</cobertura-report>
</target>

<target name="checkstyle" depends="checkstyle.check, set-checkstyle-classpath" if="checkstyle.home"
<target name="checkstyle" depends="checkstyle.check, set-checkstyle-classpath" if="checkstyle.home"
description="Run optional third-party tool targets">
<taskdef resource="checkstyletask.properties">
<classpath refid="checkstyle-classpath"/>
Expand All @@ -1510,17 +1513,17 @@
</target>

<target name="checkstyle.check" unless="checkstyle.home">
<fail message="'checkstyle.home' is not defined. Please pass -Dcheckstyle.home=&lt;base of checkstyle installation&gt;
<fail message="'checkstyle.home' is not defined. Please pass -Dcheckstyle.home=&lt;base of checkstyle installation&gt;
to Ant on the command-line." />
</target>

<target name="set-checkstyle-classpath">
<path id="checkstyle-classpath">
<fileset dir="${checkstyle.home}">
<include name="**/*.jar"/>
</fileset>
</path>
</target>
</target>

<!-- ================================================================== -->
<!-- Perform audit activities for the release -->
Expand Down
6 changes: 6 additions & 0 deletions cloudera/maven-packaging/zookeeper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
<version>${cdh.netty.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.yetus</groupId>
<artifactId>audience-annotations</artifactId>
<version>0.5.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<dependency org="log4j" name="log4j" rev="1.2.16" transitive="false" conf="default"/>
<dependency org="jline" name="jline" rev="2.11" transitive="false" conf="default"/>

<dependency org="org.apache.yetus" name="audience-annotations" rev="${audience-annotations.version}"/>

<dependency org="io.netty" name="netty" conf="default" rev="3.10.5.Final">
<artifact name="netty" type="jar" conf="default"/>
</dependency>
Expand Down
3 changes: 3 additions & 0 deletions src/java/main/org/apache/jute/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

package org.apache.jute;

import org.apache.yetus.audience.InterfaceAudience;

import java.io.IOException;

/**
* Interface that is implemented by generated classes.
*
*/
@InterfaceAudience.Public
public interface Record {
public void serialize(OutputArchive archive, String tag)
throws IOException;
Expand Down
4 changes: 3 additions & 1 deletion src/java/main/org/apache/jute/compiler/JRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ public void genJavaCode(File outputDirectory) throws IOException {
jj.write("\n");
jj.write("package "+getJavaPackage()+";\n\n");
jj.write("import org.apache.jute.*;\n");
jj.write("import org.apache.yetus.audience.InterfaceAudience;\n");
jj.write("@InterfaceAudience.Public\n");
jj.write("public class "+getName()+" implements Record {\n");
for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
JField jf = i.next();
Expand Down Expand Up @@ -599,7 +601,7 @@ public void genCsharpCode(File outputDirectory) throws IOException {
cs.write("\n");
cs.write("using System;\n");
cs.write("using Org.Apache.Jute;\n");
cs.write("\n");
cs.write("\n");
cs.write("namespace "+getCsharpNameSpace()+"\n");
cs.write("{\n");

Expand Down
21 changes: 15 additions & 6 deletions src/java/main/org/apache/zookeeper/AsyncCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,47 @@

import java.util.List;

import org.apache.yetus.audience.InterfaceAudience;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;

@InterfaceAudience.Public
public interface AsyncCallback {
@InterfaceAudience.Public
interface StatCallback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx, Stat stat);
}


@InterfaceAudience.Public
interface DataCallback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx, byte data[],
Stat stat);
}


@InterfaceAudience.Public
interface ACLCallback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx,
List<ACL> acl, Stat stat);
}


@InterfaceAudience.Public
interface ChildrenCallback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx,
List<String> children);
}


@InterfaceAudience.Public
interface Children2Callback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx,
List<String> children, Stat stat);
}


@InterfaceAudience.Public
interface StringCallback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx, String name);
}


@InterfaceAudience.Public
interface VoidCallback extends AsyncCallback {
public void processResult(int rc, String path, Object ctx);
}
Expand Down
2 changes: 2 additions & 0 deletions src/java/main/org/apache/zookeeper/CreateMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
*/
package org.apache.zookeeper;

import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.zookeeper.KeeperException;

/***
* CreateMode value determines how the znode is created on ZooKeeper.
*/
@InterfaceAudience.Public
public enum CreateMode {

/**
Expand Down
Loading

0 comments on commit 447baf5

Please sign in to comment.