规范maven项目结构并升级版本号(1.27-SNAPSHOT)
This commit is contained in:
parent
51914bf1ac
commit
69417006f4
@ -1,27 +1,27 @@
|
|||||||
Copyright (C) 2008 Happy Fish / YuQing
|
Copyright (C) 2008 Happy Fish / YuQing
|
||||||
|
|
||||||
FastDFS Java Client API may be copied only under the terms of
|
FastDFS Java Client API may be copied only under the terms of
|
||||||
the BSD license.
|
the BSD license.
|
||||||
Please visit the FastDFS Home Page for more detail.
|
Please visit the FastDFS Home Page for more detail.
|
||||||
English language: http://english.csource.org/
|
English language: http://english.csource.org/
|
||||||
Chinese language: http://www.csource.org/
|
Chinese language: http://www.csource.org/
|
||||||
|
|
||||||
|
|
||||||
The jar file is compiled by JDK1.5, you can download the last version
|
The jar file is compiled by JDK1.5, you can download the last version
|
||||||
from google code: http://code.google.com/p/fastdfs/downloads/list
|
from google code: http://code.google.com/p/fastdfs/downloads/list
|
||||||
|
|
||||||
run the FastDFS Java Client test:
|
run the FastDFS Java Client test:
|
||||||
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.TestClient <config_filename> <upload_filename>
|
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.TestClient <config_filename> <upload_filename>
|
||||||
|
|
||||||
eg.:
|
eg.:
|
||||||
java -cp fastdfs_client_v1.25.jar org.csource.fastdfs.test.TestClient fdfs_client.conf c:\windows\system32\notepad.exe
|
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.TestClient fdfs_client.conf c:\windows\system32\notepad.exe
|
||||||
|
|
||||||
or:
|
or:
|
||||||
java -cp fastdfs_client_v1.25.jar org.csource.fastdfs.test.TestClient fdfs_client.conf /usr/include/stdlib.h
|
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.TestClient fdfs_client.conf /usr/include/stdlib.h
|
||||||
|
|
||||||
|
|
||||||
run the FastDFS monitor:
|
run the FastDFS monitor:
|
||||||
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.Monitor <config_filename>
|
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.Monitor <config_filename>
|
||||||
|
|
||||||
eg.:
|
eg.:
|
||||||
java -cp fastdfs_client_v1.25.jar org.csource.fastdfs.test.Monitor fdfs_client.conf
|
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.Monitor fdfs_client.conf
|
37
build.xml
Normal file
37
build.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<project name="fastdfs-client-java" default="package" basedir=".">
|
||||||
|
|
||||||
|
<target name="init">
|
||||||
|
<property name="project.name" value="fastdfs-client-java"/>
|
||||||
|
<property name="project.version" value="1.27-SNAPSHOT"/>
|
||||||
|
<property name="project.java" value="${basedir}/src/main/java"/>
|
||||||
|
<property name="project.resources" value="${basedir}/src/main/resources"/>
|
||||||
|
<property name="project.build" value="${basedir}/build"/>
|
||||||
|
<property name="project.classes" value="${project.build}/classes"/>
|
||||||
|
<property name="target.jar.file" value="${project.build}/${project.name}-${project.version}.jar"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" depends="init">
|
||||||
|
<mkdir dir="${project.classes}"/>
|
||||||
|
<javac destdir="${project.classes}" encoding="UTF-8" failonerror="true" debug="on">
|
||||||
|
<src path="${project.java}"/>
|
||||||
|
</javac>
|
||||||
|
<copy todir="${project.classes}">
|
||||||
|
<fileset dir="${project.resources}" includes="**/*"/>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="package" depends="compile">
|
||||||
|
<jar jarfile="${target.jar.file}"
|
||||||
|
basedir="${project.classes}"
|
||||||
|
includes="**/*">
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean" depends="init">
|
||||||
|
<delete dir="${project.build}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
10
fdfs_client.conf
Normal file
10
fdfs_client.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
connect_timeout = 2
|
||||||
|
network_timeout = 30
|
||||||
|
charset = UTF-8
|
||||||
|
http.tracker_http_port = 8080
|
||||||
|
http.anti_steal_token = no
|
||||||
|
http.secret_key = FastDFS1234567890
|
||||||
|
|
||||||
|
tracker_server = 10.0.11.247:22122
|
||||||
|
tracker_server = 10.0.11.248:22122
|
||||||
|
tracker_server = 10.0.11.249:22122
|
75
pom.xml
75
pom.xml
@ -1,52 +1,35 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.csource</groupId>
|
<groupId>org.csource</groupId>
|
||||||
<artifactId>fastdfs-client-java</artifactId>
|
<artifactId>fastdfs-client-java</artifactId>
|
||||||
<version>1.26</version>
|
<version>1.27-SNAPSHOT</version>
|
||||||
<name>fastdfs-client-java</name>
|
<name>fastdfs-client-java</name>
|
||||||
<description>fastdfs client with java</description>
|
<description>fastdfs client for java</description>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
<maven.test.failure.ignore>true</maven.test.failure.ignore>
|
||||||
</properties>
|
<maven.test.skip>true</maven.test.skip>
|
||||||
|
<jdk.version>1.5</jdk.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<source>${jdk.version}</source>
|
||||||
|
<target>${jdk.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<build>
|
|
||||||
<sourceDirectory>src</sourceDirectory>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<skip>true</skip>
|
|
||||||
<source>1.5</source>
|
|
||||||
<target>1.5</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>2.4</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<excludes>
|
|
||||||
<exclude>**/test/*.class</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!-- obfuscate -->
|
|
||||||
<project name="fastdfs_client" default="jar" basedir=".">
|
|
||||||
|
|
||||||
<target name="init">
|
|
||||||
<!-- The root directory of the workspace -->
|
|
||||||
<property name="fastdfs_client.home" value="."/>
|
|
||||||
|
|
||||||
<!-- The destination directory for the build -->
|
|
||||||
<property name="fastdfs_client.build" value="${fastdfs_client.home}/build"/>
|
|
||||||
|
|
||||||
<!-- The source directory for the build -->
|
|
||||||
<property name="fastdfs_client.src" value="${fastdfs_client.home}"/>
|
|
||||||
|
|
||||||
<!-- The destination directory for all the compiled classes. -->
|
|
||||||
<property name="fastdfs_client.bin_dir" value="${fastdfs_client.build}/classes"/>
|
|
||||||
|
|
||||||
<!-- The classpath used for building the workspace. -->
|
|
||||||
<property name="jar" value="${fastdfs_client.build}/fastdfs_client.jar"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="compile" depends="init">
|
|
||||||
<mkdir dir="${fastdfs_client.bin_dir}"/>
|
|
||||||
<javac srcdir="${fastdfs_client.src}"
|
|
||||||
destdir="${fastdfs_client.bin_dir}"
|
|
||||||
includes="org/**/*.java"
|
|
||||||
debug="on"
|
|
||||||
encoding="UTF-8"
|
|
||||||
failonerror="true"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="components" depends="init">
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- create .jar -->
|
|
||||||
<target name="jar" depends="compile">
|
|
||||||
<jar jarfile="${jar}"
|
|
||||||
basedir="${fastdfs_client.bin_dir}"
|
|
||||||
includes="org/csource/**">
|
|
||||||
<fileset dir="${fastdfs_client.src}">
|
|
||||||
<include name="*.conf"/>
|
|
||||||
</fileset>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" depends="init">
|
|
||||||
<delete dir="${fastdfs_client.build}"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!--<target name="core" depends="compile, components"/>-->
|
|
||||||
<target name="core" depends="compile"/>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,50 +1,50 @@
|
|||||||
package org.csource.fastdfs;
|
package org.csource.fastdfs;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import org.csource.fastdfs.DownloadCallback;
|
import org.csource.fastdfs.DownloadCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download file by stream (download callback class)
|
* Download file by stream (download callback class)
|
||||||
* @author zhouzezhong & Happy Fish / YuQing
|
* @author zhouzezhong & Happy Fish / YuQing
|
||||||
* @version Version 1.11
|
* @version Version 1.11
|
||||||
*/
|
*/
|
||||||
public class DownloadStream implements DownloadCallback
|
public class DownloadStream implements DownloadCallback
|
||||||
{
|
{
|
||||||
private OutputStream out;
|
private OutputStream out;
|
||||||
private long currentBytes = 0;
|
private long currentBytes = 0;
|
||||||
|
|
||||||
public DownloadStream(OutputStream out)
|
public DownloadStream(OutputStream out)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.out = out;
|
this.out = out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* recv file content callback function, may be called more than once when the file downloaded
|
* recv file content callback function, may be called more than once when the file downloaded
|
||||||
* @param fileSize file size
|
* @param fileSize file size
|
||||||
* @param data data buff
|
* @param data data buff
|
||||||
* @param bytes data bytes
|
* @param bytes data bytes
|
||||||
* @return 0 success, return none zero(errno) if fail
|
* @return 0 success, return none zero(errno) if fail
|
||||||
*/
|
*/
|
||||||
public int recv(long fileSize, byte[] data, int bytes)
|
public int recv(long fileSize, byte[] data, int bytes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
out.write(data, 0, bytes);
|
out.write(data, 0, bytes);
|
||||||
}
|
}
|
||||||
catch(IOException ex)
|
catch(IOException ex)
|
||||||
{
|
{
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBytes += bytes;
|
currentBytes += bytes;
|
||||||
if (this.currentBytes == fileSize)
|
if (this.currentBytes == fileSize)
|
||||||
{
|
{
|
||||||
this.currentBytes = 0;
|
this.currentBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,4 @@
|
|||||||
package org.csource.fastdfs.test;
|
package org.csource.common;
|
||||||
|
|
||||||
import org.csource.common.IniFileReader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by James on 2017/5/16.
|
* Created by James on 2017/5/16.
|
||||||
@ -18,7 +16,7 @@ public class IniFileReaderTests {
|
|||||||
System.out.println("http.anti_steal_token: " + iniFileReader.getBoolValue("http.anti_steal_token", false));
|
System.out.println("http.anti_steal_token: " + iniFileReader.getBoolValue("http.anti_steal_token", false));
|
||||||
System.out.println("http.secret_key: " + iniFileReader.getStrValue("http.secret_key"));
|
System.out.println("http.secret_key: " + iniFileReader.getStrValue("http.secret_key"));
|
||||||
String[] tracker_servers = iniFileReader.getValues("tracker_server");
|
String[] tracker_servers = iniFileReader.getValues("tracker_server");
|
||||||
if(tracker_servers != null) {
|
if (tracker_servers != null) {
|
||||||
System.out.println("tracker_servers.length: " + tracker_servers.length);
|
System.out.println("tracker_servers.length: " + tracker_servers.length);
|
||||||
for (int i = 0; i < tracker_servers.length; i++) {
|
for (int i = 0; i < tracker_servers.length; i++) {
|
||||||
System.out.println(String.format("tracker_servers[%s]: %s", i, tracker_servers[i]));
|
System.out.println(String.format("tracker_servers[%s]: %s", i, tracker_servers[i]));
|
9
src/test/resources/fdfs_client.conf
Normal file
9
src/test/resources/fdfs_client.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
connect_timeout = 2
|
||||||
|
network_timeout = 30
|
||||||
|
charset = UTF-8
|
||||||
|
http.tracker_http_port = 8080
|
||||||
|
http.anti_steal_token = no
|
||||||
|
http.secret_key = FastDFS1234567890
|
||||||
|
|
||||||
|
tracker_server = 10.0.11.245:22122
|
||||||
|
tracker_server = 10.0.11.246:22122
|
Loading…
x
Reference in New Issue
Block a user