Skip to content

Dns host first #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#Changelog

## 7.1.3 (2016-09-02)
### 增加
* 下载方法
* 支持x:foo变量
* batch 增加force
* host first

## 7.1.2 (2016-07-14)
### 增加
* 内部dns 解析支持
Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'
[compileJava,compileTestJava,javadoc]*.options*.encoding = 'UTF-8'
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

repositories {
mavenCentral()
Expand All @@ -18,10 +18,10 @@ dependencies {
// if (c < 0) {
// compile fileTree(dir: 'libs', include: '*.jar')
// } else {
compile group:'com.squareup.okhttp3', name:'okhttp', version:'3.3.1'
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.3.1'
// }
compile group:'com.google.code.gson', name:'gson', version:'2.6.2'
compile group:'com.qiniu', name:'happy-dns-java', version:'0.1.4'
compile group: 'com.google.code.gson', name: 'gson', version: '2.6.2'
compile group: 'com.qiniu', name: 'happy-dns-java', version: '0.1.4'
testCompile group: 'junit', name: 'junit', version: '4.12'
}

Expand Down Expand Up @@ -57,8 +57,8 @@ apply from: 'mvn_push.gradle'

apply plugin: 'eclipse'

task gen_eclipse(dependsOn:[
'cleanEclipseProject', 'cleanEclipseClasspath',
'eclipseProject', 'eclipseClasspath'])
task gen_eclipse(dependsOn: [
'cleanEclipseProject', 'cleanEclipseClasspath',
'eclipseProject', 'eclipseClasspath'])
eclipseProject.mustRunAfter cleanEclipseProject
eclipseClasspath.mustRunAfter cleanEclipseClasspath
250 changes: 125 additions & 125 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,136 +1,136 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
<module name="NewlineAtEndOfFile"/>
<module name="FileLength"/>
<module name="FileTabCharacter"/>

<!-- Trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<!-- Space after 'for' and 'if' -->
<module name="RegexpSingleline">
<property name="format" value="^\s*(for|if)\b[^ ]"/>
<property name="message" value="Space needed before opening parenthesis."/>
</module>

<!-- For each spacing -->
<module name="RegexpSingleline">
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/>
<property name="message" value="Space needed around ':' character."/>
</module>

<module name="SuppressionCommentFilter">
</module>

<module name="TreeWalker">
<module name="FileContentsHolder"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--module name="JavadocMethod"/-->
<!--module name="JavadocType"/-->
<!--module name="JavadocVariable"/-->
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
<module name="NewlineAtEndOfFile"/>
<module name="FileLength"/>
<module name="FileTabCharacter"/>

<!-- Trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<!-- Space after 'for' and 'if' -->
<module name="RegexpSingleline">
<property name="format" value="^\s*(for|if)\b[^ ]"/>
<property name="message" value="Space needed before opening parenthesis."/>
</module>

<!-- For each spacing -->
<module name="RegexpSingleline">
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/>
<property name="message" value="Space needed around ':' character."/>
</module>

<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<!--<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>-->
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<!--<module name="ParameterName"/>-->
<module name="StaticVariableName"/>
<module name="TypeName"/>


<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<!--<module name="AvoidStarImport"/> -->
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
<module name="SuppressionCommentFilter">
</module>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="LineLength">
<property name="max" value="120"/>
<module name="TreeWalker">
<module name="FileContentsHolder"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--module name="JavadocMethod"/-->
<!--module name="JavadocType"/-->
<!--module name="JavadocVariable"/-->
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
</module>


<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<!--<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>-->
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<!--<module name="ParameterName"/>-->
<module name="StaticVariableName"/>
<module name="TypeName"/>


<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<!--<module name="AvoidStarImport"/> -->
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="LineLength">
<property name="max" value="120"/>
</module>
<module name="MethodLength"/>


<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="GenericWhitespace"/>
<!--<module name="EmptyForIteratorPad"/>-->
<module name="MethodParamPad"/>
<!--<module name="NoWhitespaceAfter"/>-->
<!--<module name="NoWhitespaceBefore"/>-->
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>


<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>


<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<!--module name="EmptyBlock"/-->
<module name="LeftCurly"/>
<!--<module name="NeedBraces"/>-->
<module name="RightCurly"/>


<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!--module name="AvoidInlineConditionals"/-->
<module name="CovariantEquals"/>
<module name="EmptyStatement"/>
<!--<module name="EqualsAvoidNull"/>-->
<module name="EqualsHashCode"/>
<!--module name="HiddenField"/-->
<module name="IllegalInstantiation"/>
<!--module name="InnerAssignment"/-->
<!--module name="MagicNumber"/-->
<!--module name="MissingSwitchDefault"/-->
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!--module name="DesignForExtension"/-->
<!--<module name="FinalClass"/>-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<!--module name="VisibilityModifier"/-->


<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<!--module name="FinalParameters"/-->
<!--module name="TodoComment"/-->
<module name="UpperEll"/>
</module>
<module name="MethodLength"/>


<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="GenericWhitespace"/>
<!--<module name="EmptyForIteratorPad"/>-->
<module name="MethodParamPad"/>
<!--<module name="NoWhitespaceAfter"/>-->
<!--<module name="NoWhitespaceBefore"/>-->
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>


<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>


<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<!--module name="EmptyBlock"/-->
<module name="LeftCurly"/>
<!--<module name="NeedBraces"/>-->
<module name="RightCurly"/>


<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!--module name="AvoidInlineConditionals"/-->
<module name="CovariantEquals"/>
<module name="EmptyStatement"/>
<!--<module name="EqualsAvoidNull"/>-->
<module name="EqualsHashCode"/>
<!--module name="HiddenField"/-->
<module name="IllegalInstantiation"/>
<!--module name="InnerAssignment"/-->
<!--module name="MagicNumber"/-->
<!--module name="MissingSwitchDefault"/-->
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!--module name="DesignForExtension"/-->
<!--<module name="FinalClass"/>-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<!--module name="VisibilityModifier"/-->


<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<!--module name="FinalParameters"/-->
<!--module name="TodoComment"/-->
<module name="UpperEll"/>
</module>
</module>
78 changes: 38 additions & 40 deletions examples/BatchDemo.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
import com.qiniu.common.QiniuException;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.model.FileInfo;
import com.qiniu.storage.model.FileListing;
import com.qiniu.util.Auth;


public class BatchDemo {
public static void main(String args[]){
//设置需要操作的账号的AK和SK
String ACCESS_KEY = "Access_Key";
String SECRET_KEY = "Secret_Key";
Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
//实例化一个BucketManager对象
BucketManager bucketManager = new BucketManager(auth);
//创建Batch类型的operations对象
BucketManager.Batch operations = new BucketManager.Batch();
//第一组源空间名、原文件名,目的空间名、目的文件名
String bucketFrom1 = "yourbucket";
String keyFrom1 = "srckey1";
String bucketTo1 = "yourbucket";
String keyTo1 = "destkey1";
//第二组源空间名、原文件名,目的空间名、目的文件名
String bucketFrom2 = "yourbucket";
String keyFrom2 = "srckey2";
String bucketTo2 = "yourbucket";
String keyTo2 = "destkey2";
try {
//调用批量操作的batch方法
Response res = bucketManager.batch(operations.move(bucketFrom1, keyFrom1, bucketTo1, keyTo1)
.move(bucketFrom2, keyFrom2, bucketTo2, keyTo2));
System.out.println(res.toString());
} catch (QiniuException e) {
//捕获异常信息
Response r = e.response;
System.out.println(r.toString());
}
}
public static void main(String args[]) {
//设置需要操作的账号的AK和SK
String ACCESS_KEY = "Access_Key";
String SECRET_KEY = "Secret_Key";
Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);

//实例化一个BucketManager对象
BucketManager bucketManager = new BucketManager(auth);

//创建Batch类型的operations对象
BucketManager.Batch operations = new BucketManager.Batch();

//第一组源空间名、原文件名,目的空间名、目的文件名
String bucketFrom1 = "yourbucket";
String keyFrom1 = "srckey1";
String bucketTo1 = "yourbucket";
String keyTo1 = "destkey1";

//第二组源空间名、原文件名,目的空间名、目的文件名
String bucketFrom2 = "yourbucket";
String keyFrom2 = "srckey2";
String bucketTo2 = "yourbucket";
String keyTo2 = "destkey2";


try {
//调用批量操作的batch方法
Response res = bucketManager.batch(operations.move(bucketFrom1, keyFrom1, bucketTo1, keyTo1)
.move(bucketFrom2, keyFrom2, bucketTo2, keyTo2));

System.out.println(res.toString());

} catch (QiniuException e) {
//捕获异常信息
Response r = e.response;
System.out.println(r.toString());
}
}
}
Loading