Merge branch 'release/1.0.5-M3'

This commit is contained in:
Taro L. Saito 2012-09-28 12:05:01 +09:00
commit 1cc4d0a0c6
9 changed files with 520 additions and 506 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
# IntelliJ # IntelliJ
.idea .idea
.idea_modules .idea_modules
*.iml
# sbt specific # sbt specific
bin/.lib bin/.lib

View File

@ -77,13 +77,6 @@ test:
ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)" ssh $(AMD_SERVER) "source .zprofile && cd $(WORK) && $(TEST_CMD)"
release: release:
mvn release:prepare mvn deploy -DperformRelease=true
mvn release:perform
release-xerial:
mvn release:perform -Dtag=snappy-java-$(VERSION)
release-sourceforge:
mvn release:perform -Darguments="-P sourceforge" -Dtag=snappy-java-$(VERSION)

View File

@ -2,6 +2,9 @@
* `SnappyIndexer` for parallel compression/decompression * `SnappyIndexer` for parallel compression/decompression
* CUI commands (snap/unsnap) * CUI commands (snap/unsnap)
## snappy-java-1.0.5-M2 (27 September 2012)
* Upgrade release for snappy-1.0.5
## snappy-java-1.0.4.1 (5 September 2011) ## snappy-java-1.0.4.1 (5 September 2011)
* Fixes issue 33: Fixes a problem when reading incomplete input stream * Fixes issue 33: Fixes a problem when reading incomplete input stream

View File

@ -23,10 +23,10 @@ The snappy-java is a Java port of the snappy
## Download ## Download
The current stable version is available from here: The current stable version is available from here:
* Release version: http://maven.xerial.org/repository/artifact/org/xerial/snappy/snappy-java * Release version: http://code.google.com/p/snappy-java/downloads/list
* [release plans](./snappy-java/Milestone.md) * [Release plans](https://github.com/xerial/snappy-java/blob/develop/Milestone.md)
* Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/org/xerial/snappy/snappy-java/ * Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/org/xerial/snappy/snappy-java/
If you are a Maven user, see [#Using_with_Maven] If you are a Maven user, see [pom.xml example](#using-with-maven).
## Usage ## Usage
First, import `org.xerial.snapy.Snappy` in your Java code: First, import `org.xerial.snapy.Snappy` in your Java code:

522
pom.xml
View File

@ -1,283 +1,289 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.xerial.snappy</groupId> <groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId> <artifactId>snappy-java</artifactId>
<version>1.0.5-M2</version> <version>1.0.5-M3</version>
<name>Snappy for Java</name> <name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description> <description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<parent> <parent>
<groupId>org.sonatype.oss</groupId> <groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId> <artifactId>oss-parent</artifactId>
<version>7</version> <version>7</version>
</parent> </parent>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<licenses> <licenses>
<license> <license>
<name>The Apache Software License, Version 2.0</name> <name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>
<id>leo</id> <id>leo</id>
<name>Taro L. Saito</name> <name>Taro L. Saito</name>
<email>leo@xerial.org</email> <email>leo@xerial.org</email>
<organization>Xerial Project</organization> <organization>Xerial Project</organization>
<roles> <roles>
<role>Architect</role> <role>Architect</role>
<role>Project Manager</role> <role>Project Manager</role>
<role>Chief Developer</role> <role>Chief Developer</role>
</roles> </roles>
<timezone>+9</timezone> <timezone>+9</timezone>
</developer> </developer>
</developers> </developers>
<organization> <organization>
<name>xerial.org</name> <name>xerial.org</name>
<url>http://www.xerial.org/</url> <url>http://www.xerial.org/</url>
</organization> </organization>
<build> <build>
<resources> <resources>
<resource> <resource>
<directory>src/main/java</directory> <directory>src/main/java</directory>
<includes> <includes>
<include>org/xerial/snappy/VERSION</include> <include>org/xerial/snappy/VERSION</include>
</includes> </includes>
</resource> </resource>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<includes> <includes>
<include>org/xerial/snappy/*.bytecode</include> <include>org/xerial/snappy/*.bytecode</include>
<include>org/xerial/snappy/native/**</include> <include>org/xerial/snappy/native/**</include>
</includes> </includes>
</resource> </resource>
<resource> <resource>
<directory>${basedir}</directory> <directory>${basedir}</directory>
<targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath> <targetPath>META-INF/maven/${project.groupId}/${project.artifactId}</targetPath>
<includes> <includes>
<include>LICENSE*</include> <include>LICENSE*</include>
</includes> </includes>
</resource> </resource>
</resources> </resources>
<testResources> <testResources>
<testResource> <testResource>
<directory>src/test/java</directory> <directory>src/test/java</directory>
<excludes> <excludes>
<exclude>**/*.java</exclude> <exclude>**/*.java</exclude>
</excludes> </excludes>
</testResource> </testResource>
<testResource> <testResource>
<directory>src/test/resources</directory> <directory>src/test/resources</directory>
</testResource> </testResource>
</testResources> </testResources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.5</version> <version>2.5</version>
<configuration> <configuration>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.0.2</version> <version>2.7</version>
<configuration> </plugin>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-release-plugin</artifactId> <groupId>org.apache.maven.plugins</groupId>
<version>2.1</version> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <version>2.0.2</version>
<!-- do not run site-deploy goal, included in the default settings --> <configuration>
<goals>deploy</goals> <source>1.5</source>
<pushChanges>false</pushChanges> <target>1.5</target>
<localCheckout>true</localCheckout> </configuration>
</configuration> </plugin>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId>
<artifactId>maven-gpg-plugin</artifactId> <version>2.1</version>
<version>1.4</version> <configuration>
<configuration> <!-- do not run site-deploy goal, included in the default settings -->
<useAgent>true</useAgent> <goals>deploy</goals>
</configuration> <pushChanges>false</pushChanges>
<executions> <localCheckout>true</localCheckout>
<execution> </configuration>
<id>sign-artifacts</id> </plugin>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>2.8</version> <version>1.4</version>
<configuration> <configuration>
<charset>UTF-8</charset> <useAgent>true</useAgent>
<locale>en_US</locale> </configuration>
<show>public</show> <executions>
<stylesheetfile>stylesheet.css</stylesheetfile> <execution>
</configuration> <id>sign-artifacts</id>
</plugin> <phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.1.2</version> <version>2.8</version>
<configuration> <configuration>
<excludeResources>true</excludeResources> <charset>UTF-8</charset>
</configuration> <locale>en_US</locale>
<executions> <show>public</show>
<execution> <stylesheetfile>stylesheet.css</stylesheetfile>
<id>attach-sources</id> </configuration>
<phase>verify</phase> </plugin>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-bundle-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>2.3.4</version> <version>2.1.2</version>
<extensions>true</extensions> <configuration>
<configuration> <excludeResources>true</excludeResources>
<instructions> </configuration>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName> <executions>
<Bundle-Name>${pproject.name}</Bundle-Name> <execution>
<Bundle-Version>${project.version}</Bundle-Version> <id>attach-sources</id>
<Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator> <phase>verify</phase>
<Export-Package>org.xerial.snappy</Export-Package> <goals>
<Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package> <goal>jar-no-fork</goal>
</instructions> </goals>
</configuration> </execution>
</plugin> </executions>
</plugin>
<plugin> <plugin>
<artifactId>maven-assembly-plugin</artifactId> <groupId>org.apache.felix</groupId>
<version>2.2.1</version> <artifactId>maven-bundle-plugin</artifactId>
<configuration> <version>2.3.4</version>
<descriptors> <extensions>true</extensions>
<descriptor>src/assembly/project.xml</descriptor> <configuration>
</descriptors> <instructions>
<appendAssemblyId>false</appendAssemblyId> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<attach>false</attach> <Bundle-Name>${pproject.name}</Bundle-Name>
</configuration> <Bundle-Version>${project.version}</Bundle-Version>
<executions> <Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
<execution> <Export-Package>org.xerial.snappy</Export-Package>
<id>make-assembly</id> <Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package>
<phase>package</phase> </instructions>
<goals> </configuration>
<goal>single</goal> </plugin>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions> <plugin>
<extension> <artifactId>maven-assembly-plugin</artifactId>
<groupId>org.apache.maven.wagon</groupId> <version>2.2.1</version>
<artifactId>wagon-ssh-external</artifactId> <configuration>
<version>1.0-beta-7</version> <descriptors>
</extension> <descriptor>src/assembly/project.xml</descriptor>
</extensions> </descriptors>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> <extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>
<url>http://github.com/xerial/snappy-java/</url> <url>http://github.com/xerial/snappy-java/</url>
<issueManagement> <issueManagement>
<system>GitHub</system> <system>GitHub</system>
<url>http://github.com/xerial/snappy-java/issues/list</url> <url>http://github.com/xerial/snappy-java/issues/list</url>
</issueManagement> </issueManagement>
<inceptionYear>2011</inceptionYear> <inceptionYear>2011</inceptionYear>
<scm> <scm>
<connection>scm:git@github.com:xerial/snappy-java.git</connection> <connection>scm:git@github.com:xerial/snappy-java.git</connection>
<developerConnection>scm:git:git@github.com:xerial/snappy-java.git</developerConnection> <developerConnection>scm:git:git@github.com:xerial/snappy-java.git</developerConnection>
<url>git@github.com:xerial/snappy-java.git</url> <url>git@github.com:xerial/snappy-java.git</url>
</scm> </scm>
<profiles> <profiles>
<!-- for local updates --> <!-- for local updates -->
<profile> <profile>
<id>xerial.local</id> <id>xerial.local</id>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>xerial.local</id> <id>xerial.local</id>
<name>Xerial Maven Repository</name> <name>Xerial Maven Repository</name>
<url>file:///home/web/maven.xerial.org/repository/artifact</url> <url>file:///home/web/maven.xerial.org/repository/artifact</url>
</repository> </repository>
<snapshotRepository> <snapshotRepository>
<id>xerial.local</id> <id>xerial.local</id>
<name>Xerial Maven Snapshot Repository</name> <name>Xerial Maven Snapshot Repository</name>
<url>file:///home/web/maven.xerial.org/repository/snapshot</url> <url>file:///home/web/maven.xerial.org/repository/snapshot</url>
<uniqueVersion>false</uniqueVersion> <uniqueVersion>false</uniqueVersion>
</snapshotRepository> </snapshotRepository>
<site> <site>
<id>xerial.local</id> <id>xerial.local</id>
<url>file:///home/web/maven.xerial.org/repository/site</url> <url>file:///home/web/maven.xerial.org/repository/site</url>
</site> </site>
</distributionManagement> </distributionManagement>
</profile> </profile>
</profiles> </profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependencies> <dependency>
<dependency> <groupId>org.codehaus.plexus</groupId>
<groupId>junit</groupId> <artifactId>plexus-classworlds</artifactId>
<artifactId>junit</artifactId> <version>2.4</version>
<version>4.8.2</version> <type>jar</type>
<type>jar</type> <scope>test</scope>
<scope>test</scope> </dependency>
</dependency> <dependency>
<groupId>org.osgi</groupId>
<dependency> <artifactId>core</artifactId>
<groupId>org.codehaus.plexus</groupId> <version>4.3.0</version>
<artifactId>plexus-classworlds</artifactId> <type>jar</type>
<version>2.4</version> <scope>provided</scope>
<type>jar</type> </dependency>
<scope>test</scope> <dependency>
</dependency> <groupId>org.xerial</groupId>
<dependency> <artifactId>xerial-core</artifactId>
<groupId>org.osgi</groupId> <version>1.0.21</version>
<artifactId>core</artifactId> <type>jar</type>
<version>4.3.0</version> <scope>test</scope>
<type>jar</type> </dependency>
<scope>provided</scope> </dependencies>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>xerial-core</artifactId>
<version>1.0.21</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project> </project>

View File

@ -78,9 +78,9 @@ public class OSInfo
// ignored: fall back to "arm" arch (soft-float ABI) // ignored: fall back to "arm" arch (soft-float ABI)
} }
} }
else if(getOSName().equals("Mac") && osArch.equals("universal")) { else if(getOSName().equals("Mac") && (osArch.equals("universal") || osArch.equals("amd64"))) {
return "x86_64"; // Fix for openjdk7 return "x86_64"; // Fix for openjdk7
} }
return translateArchNameToFolderName(osArch); return translateArchNameToFolderName(osArch);
} }

View File

@ -24,13 +24,7 @@
//-------------------------------------- //--------------------------------------
package org.xerial.snappy; package org.xerial.snappy;
import java.io.BufferedInputStream; import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URL; import java.net.URL;
@ -411,13 +405,10 @@ public class SnappyLoader
static File findNativeLibrary() { static File findNativeLibrary() {
boolean useSystemLib = Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_USE_SYSTEMLIB, "false")); boolean useSystemLib = Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_USE_SYSTEMLIB, "false"));
if (useSystemLib)
return null;
boolean disabledBundledLibs = Boolean boolean disabledBundledLibs = Boolean
.parseBoolean(System.getProperty(KEY_SNAPPY_DISABLE_BUNDLED_LIBS, "false")); .parseBoolean(System.getProperty(KEY_SNAPPY_DISABLE_BUNDLED_LIBS, "false"));
if (disabledBundledLibs) if (useSystemLib || disabledBundledLibs)
return null; return null; // Use a pre-installed libsnappyjava
// Try to load the library in org.xerial.snappy.lib.path */ // Try to load the library in org.xerial.snappy.lib.path */
String snappyNativeLibraryPath = System.getProperty(KEY_SNAPPY_LIB_PATH); String snappyNativeLibraryPath = System.getProperty(KEY_SNAPPY_LIB_PATH);
@ -433,23 +424,43 @@ public class SnappyLoader
return nativeLib; return nativeLib;
} }
{
// Load an OS-dependent native library inside a jar file
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
if (SnappyLoader.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) != null) { // Load an OS-dependent native library inside a jar file
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR, boolean hasNativeLib = hasResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName);
System.getProperty("java.io.tmpdir"))).getAbsolutePath(); if(!hasNativeLib) {
if(OSInfo.getOSName().equals("Mac")) {
// Extract and load a native library inside the jar file // Fix for openjdk7 for Mac
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder); String altName = "libsnappyjava.jnilib";
if(hasResource(snappyNativeLibraryPath + "/" + altName)) {
snappyNativeLibraryName = altName;
hasNativeLib = true;
}
} }
} }
return null; // Use a pre-installed libsnappyjava if(!hasNativeLib) {
String errorMessage = String.format("no native library is found for os.name=%s and os.arch=%s", OSInfo.getOSName(), OSInfo.getArchName());
throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, errorMessage);
}
// Temporary library folder. Use the value of org.xerial.snappy.tempdir or java.io.tmpdir
String tempFolder = new File(System.getProperty(KEY_SNAPPY_TEMPDIR,
System.getProperty("java.io.tmpdir"))).getAbsolutePath();
// Extract and load a native library inside the jar file
return extractLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder);
} }
private static boolean hasResource(String path) {
return SnappyLoader.class.getResource(path) != null;
}
/** /**
* Get the snappy-java version by reading pom.properties embedded in jar. * Get the snappy-java version by reading pom.properties embedded in jar.
* This version data is used as a suffix of a dll file extracted from the * This version data is used as a suffix of a dll file extracted from the