HugeGraph-1312: Add config to deploy to sonatype maven respority
Change-Id: I981ecc2486b8091b6c1b039d79da9c05ee3aaa14
diff --git a/pom.xml b/pom.xml
index b848223..b171be5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,19 +6,54 @@
<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-common</artifactId>
- <version>1.4.6-SNAPSHOT</version>
+ <version>1.4.6</version>
- <distributionManagement>
- <snapshotRepository>
- <id>Baidu_Local_Snapshots</id>
- <url>http://maven.scm.baidu.com:8081/nexus/content/repositories/Baidu_Local_Snapshots</url>
- </snapshotRepository>
- </distributionManagement>
+ <name>hugegraph-common</name>
+ <url>https://github.com/hugegraph/hugegraph-common</url>
+ <description>
+ hugegraph-common is a tool module for HugeGraph and its peripheral components.
+ hugegraph-common encapsulates locks, configurations, events, iterators, rest and some
+ numeric or collection util classes to simplify the development of HugeGraph and its components.
+ </description>
+
+ <parent>
+ <groupId>org.sonatype.oss</groupId>
+ <artifactId>oss-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <url>https://github.com/hugegraph/hugegraph-common</url>
+ <connection>https://github.com/hugegraph/hugegraph-common</connection>
+ <developerConnection>https://github.com/hugegraph/hugegraph-common</developerConnection>
+ </scm>
+
+ <developers>
+ <developer>
+ <name>lizhangmei</name>
+ <email>lizhangmei@baidu.com</email>
+ </developer>
+ <developer>
+ <name>zhoney</name>
+ <email>zhangyi89817@126.com</email>
+ </developer>
+ <developer>
+ <name>liningrui</name>
+ <email>liningrui@vip.qq.com</email>
+ </developer>
+ </developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<top.level.dir>${project.basedir}/..</top.level.dir>
- <final.name>hugegraph-bin</final.name>
<compiler.source>1.8</compiler.source>
<compiler.target>1.8</compiler.target>
<log4j2.version>2.8.2</log4j2.version>
@@ -81,14 +116,13 @@
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
- <version>1.10</version>
+ <version>${commons.configuration.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>${commons.configuration2.version}</version>
</dependency>
-
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
@@ -133,7 +167,6 @@
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
-
</dependencies>
<build>
@@ -154,25 +187,6 @@
</plugin>
<plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>3.0.0</version>
- <configuration>
- <filesets>
- <fileset>
- <directory>${top.level.dir}</directory>
- <includes>
- <include>*.tar.gz</include>
- </includes>
- <followSymlinks>false</followSymlinks>
- </fileset>
- <fileset>
- <directory>${final.name}</directory>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
-
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
@@ -195,7 +209,47 @@
</archive>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
-
</project>
diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java
index 1ed31cb..42e1329 100644
--- a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java
+++ b/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java
@@ -99,6 +99,9 @@
/**
* Lock two objects with sorted order
* NOTE: This is to optimize the performance of lockAll(keys)
+ * @param key1 The first object
+ * @param key2 The second object
+ * @return locks for the two objects
*/
public List<Lock> lockAll(Object key1, Object key2) {
Lock lock1 = this.locks.get(key1);
diff --git a/src/main/java/com/baidu/hugegraph/stats/MetricsManager.java b/src/main/java/com/baidu/hugegraph/stats/MetricsManager.java
index e198def..37a67a8 100644
--- a/src/main/java/com/baidu/hugegraph/stats/MetricsManager.java
+++ b/src/main/java/com/baidu/hugegraph/stats/MetricsManager.java
@@ -313,9 +313,9 @@
* provided arguments
*/
public synchronized void addGangliaReporter(
- String groupOrHost, int port, UDPAddressingMode addressingMode,
- int ttl, Boolean protocol31, UUID hostUUID, String spoof,
- Duration reportInterval) throws IOException {
+ String groupOrHost, int port, UDPAddressingMode addressingMode,
+ int ttl, Boolean protocol31, UUID hostUUID, String spoof,
+ Duration reportInterval) throws IOException {
Preconditions.checkNotNull(groupOrHost);
Preconditions.checkNotNull(addressingMode);
@@ -346,8 +346,7 @@
/**
* Stop a {@link GangliaReporter} previously created by a call to
- * {@link #addGangliaReporter(String, int, UDPAddressingMode, int, Boolean,
- * UUID, String, Duration)}
+ * {@link #addGangliaReporter}
* and release it for GC. Idempotent between calls to the associated add
* method. Does nothing before the first call to the associated add method.
*/
diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java
index 558cfb0..9fa7285 100644
--- a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java
+++ b/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java
@@ -74,7 +74,8 @@
* @param original original set
* @param from index of start position
* @param to index of end position(exclude), but -1 means the last element
- * @return sub-set of original set [from,to)
+ * @param <T> element type of set
+ * @return sub-set of original set [from, to)
*/
public static <T> Set<T> subSet(Set<T> original, int from, int to) {
List<T> list = new ArrayList<>(original);
diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java
index 09e822d..de05d7e 100644
--- a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java
+++ b/src/main/java/com/baidu/hugegraph/util/LongEncoding.java
@@ -21,8 +21,7 @@
/**
* Utility class for encoding longs in strings based on:
- * {@linktourl http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java}
- *
+ * @see <a href="http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java">encode decode long to string</a>
*/
public final class LongEncoding {
diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java
index 6677870..d9693fe 100644
--- a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java
+++ b/src/main/java/com/baidu/hugegraph/util/NumericUtil.java
@@ -41,7 +41,8 @@
* precision is not reduced, but the value can easily used as a long. The
* sort order (including {@link Double#NaN}) is defined by
* {@link Double#compareTo}; {@code NaN} is greater than positive infinity.
- *
+ * @param val input double value
+ * @return output sortable long value
* @see #sortableLongToDouble
*/
public static long doubleToSortableLong(double val) {
@@ -50,7 +51,8 @@
/**
* Converts a sortable <code>long</code> back to a <code>double</code>.
- *
+ * @param val input double value
+ * @return output sortable long value
* @see #doubleToSortableLong
*/
public static double sortableLongToDouble(long val) {
@@ -65,7 +67,8 @@
* is not reduced, but the value can easily used as an int. The sort order
* (including {@link Float#NaN}) is defined by {@link Float#compareTo};
* {@code NaN} is greater than positive infinity.
- *
+ * @param val input float value
+ * @return output sortable int value
* @see #sortableIntToFloat
*/
public static int floatToSortableInt(float val) {
@@ -74,7 +77,8 @@
/**
* Converts a sortable <code>int</code> back to a <code>float</code>.
- *
+ * @param val input int value
+ * @return output sortable float value
* @see #floatToSortableInt
*/
public static float sortableIntToFloat(int val) {
@@ -84,6 +88,8 @@
/**
* Converts IEEE 754 representation of a double to sortable order (or back
* to the original)
+ * @param bits The long format of a double value
+ * @return The sortable long value
*/
public static long sortableDoubleBits(long bits) {
return bits ^ (bits >> 63) & 0x7fffffffffffffffL;
@@ -92,13 +98,13 @@
/**
* Converts IEEE 754 representation of a float to sortable order (or back to
* the original)
+ * @param bits The int format of an float value
+ * @return The sortable int value
*/
public static int sortableFloatBits(int bits) {
return bits ^ (bits >> 31) & 0x7fffffff;
}
- /*************************************************************************/
-
public static byte[] numberToSortableBytes(Number number) {
if (number instanceof Long) {
return longToBytes(number.longValue());
@@ -137,8 +143,6 @@
return null;
}
- /*************************************************************************/
-
public static byte[] longToBytes(long value) {
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
buffer.putLong(value);
@@ -161,8 +165,6 @@
return ByteBuffer.wrap(bytes).getInt();
}
- /*************************************************************************/
-
public static boolean isNumber(Object value) {
if (value == null) {
return false;
@@ -174,8 +176,6 @@
return Number.class.isAssignableFrom(clazz);
}
- /*************************************************************************/
-
public static Object convertToNumber(Object value) {
if (!isNumber(value) && value != null) {
if (value instanceof Date) {
@@ -193,6 +193,10 @@
* or it can be converted to a BigDecimal
* @param first might be number or string
* @param second must be number
+ * @return the value 0 if first is numerically equal to second;
+ * a value less than 0 if first is numerically less than
+ * second; and a value greater than 0 if first is
+ * numerically greater than second.
*/
@SuppressWarnings("unchecked")
public static int compareNumber(Object first, Number second) {
diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java
index 494ce4f..a6fd43f 100644
--- a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java
+++ b/src/main/java/com/baidu/hugegraph/util/VersionUtil.java
@@ -27,7 +27,11 @@
public final class VersionUtil {
/**
- * Compare if a version is inside a range: begin <= version < end
+ * Compare if a version is inside a range [begin, end)
+ * @param version The version to be compared
+ * @param begin The lower bound of the range
+ * @param end The upper bound of the range
+ * @return true if belong to the range, otherwise false
*/
public static boolean match(Version version, String begin, String end) {
E.checkArgumentNotNull(version, "The version to match is null");
@@ -38,6 +42,10 @@
/**
* Check whether a component version is matched expected range,
* throw an exception if it's not matched.
+ * @param version The version to be checked
+ * @param begin The lower bound of the range
+ * @param end The upper bound of the range
+ * @param component The owner component of version
*/
public static void check(Version version, String begin, String end,
String component) {
@@ -48,6 +56,8 @@
/**
* Get implementation version from manifest in jar
+ * @param clazz The class to be load from jar package
+ * @return The implementation version
*/
public static String getImplementationVersion(Class<?> clazz) {
/*