Skip to content

Commit 109175e

Browse files
author
{马立杰}({060863})
committed
first commit aliyun open api sdk to github
0 parents  commit 109175e

1,252 files changed

Lines changed: 102770 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

License

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 1999-2015 Alibaba Group Holding Ltd.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Open API SDK for Java Developers
2+
3+
## Requirements
4+
5+
- Java 6+
6+
7+
## Build
8+
9+
```shell
10+
git clone ...
11+
cd aliyun-openapi-java-sdk
12+
mvn clean packge -DskipTests
13+
```
14+
15+
- to run unit tests, you will have to configure aliyun-sdk.properties files in your user directory, and make sure your project has corresponding service enabled, eg. openmr.
16+
17+
## Example
18+
public void sample() {
19+
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<your accessKey>", "<your accessSecret>");
20+
IAcsClient client = new DefaultAcsClient(profile);
21+
DescribeRegionsRequest describeRegionsRequest = new DescribeRegionsRequest();
22+
try {
23+
DescribeRegionsResponse describeRegionsResponse = client.getAcsResponse(describeRegionsRequest);
24+
//todo something.
25+
}
26+
catch (ServerException e) {
27+
//todo something.
28+
}
29+
catch (ClientException e) {
30+
//todo something.
31+
}
32+
}
33+
## Authors && Contributors
34+
- [Zuhe]()
35+
- [Ma Lijie](https://github.com/malijiefoxmail)
36+
37+
## License
38+
39+
licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
config_test.properties
3+
aliyun-java-sdk-batchcompute.iml
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
NO_TEST=-DfailIfNoTests
2+
SKIP_TEST=-Dmaven.test.skip=true
3+
REPO=-DaltDeploymentRepository=snapshots::default::http://mvnrepo.alibaba-inc.com/mvn/snapshots
4+
ENCODING=-Dfile.encoding=UTF-8
5+
clean:
6+
mvn clean
7+
install:
8+
mvn install $(NO_TEST)
9+
test:
10+
mvn test
11+
co:
12+
mvn cobertura:cobertura
13+
doc:
14+
mvn javadoc:javadoc $(ENCODING)
15+
16+
deploy:
17+
mvn clean deploy -e $(REPO) $(SKIP_TEST)
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
Batchcompute SDK For Java
2+
-------------------------
3+
4+
### 1. 环境
5+
6+
#### (1). 配置jdk
7+
8+
需要配置:JAVA_HOME 和 PATH 这个不再赘述。
9+
10+
#### (2). 配置maven
11+
12+
从官网下载一个maven(注意依赖的jdk版本),解压后配置 PATH.
13+
14+
配置 ~/.m2/settings.xml 文件。 可以从这里下载:[http://yunpan.alibaba-inc.com/share/link/N6PYGZVJq]
15+
需要注意, 一定不要用默认的这种方式:~/.m2/repository ,最好配置绝对路径。
16+
17+
```xml
18+
<!-- localRepository
19+
| The path to the local repository maven will use to store artifacts.
20+
|
21+
| Default: ~/.m2/repository
22+
-->
23+
<localRepository>/Users/zu/.m2/repository</localRepository>
24+
```
25+
26+
#### (3) 安装依赖
27+
28+
```
29+
mvn clean install # 安装依赖
30+
```
31+
32+
2. 开发常用命令
33+
34+
```bash
35+
mvn test # 运行测试case
36+
37+
make co # 生成代码覆盖率文档
38+
make doc # 生成Reference文档
39+
```
40+
41+
42+
3. 发布
43+
44+
* 1. 测试版本(SNAPSHOT)版本通过执行 mvn deploy 命令上传到 maven 仓库;
45+
46+
先修改version为SNAPSHOP
47+
48+
```xml
49+
<version>2.0.0-SNAPSHOP</version>
50+
```
51+
52+
发布命令(SNAPSHOT版本可以重复发)
53+
```bash
54+
make deploy
55+
```
56+
57+
* 2. 正式版本通过本地执行 mvn package 命令打包,然后通过 Aone2 发布到 maven 仓库, [发布地址](http://aone.alibaba-inc.com/aone2/library/upload),
58+
> 注意发布正式版之前需要把pom中core包引用改为正式版本,最新版本通过如下地址查询:[查询地址](http://repo.alibaba-inc.com/nexus/#nexus-search;gav~com.aliyun~aliyun-java-sdk-core~~~);
59+
* 3. 正式版本发布后请把发布包及SDK版本发邮件到lijie.ma@alibaba-inc.com,由马立杰发布到 maven 官方仓库;
60+
* 4. 公司maven库会代理maven官方库,所以如果需要发到maven官方库可以省略第二步。
61+
62+
63+
### 2. 如何使用
64+
65+
#### (0) pom.xml 中配置
66+
67+
前往[http://repo.alibaba-inc.com/nexus]中查找下面2个包。
68+
将其xml描述放到pom.xml的dependencies标签中。例如:
69+
70+
```xml
71+
<dependency>
72+
<groupId>com.aliyun</groupId>
73+
<artifactId>aliyun-java-sdk-core</artifactId>
74+
<version>2.1.4</version>
75+
</dependency>
76+
77+
78+
<dependency>
79+
<groupId>com.aliyun</groupId>
80+
<artifactId>aliyun-java-sdk-batchcompute</artifactId>
81+
<version>2.0.0</version>
82+
</dependency>
83+
```
84+
85+
#### (1) 构造 client 对象
86+
87+
```java
88+
89+
String regionId="cn-hangzhou";
90+
String accessKeyId="${your_access_key_id}";
91+
String accessKeySecret="${your_access_key_secret}";
92+
93+
/** 构造 BatchCompute 客户端 */
94+
BatchCompute client = new BatchComputeClient(regionId, accessKeyId, accessKeySecret);
95+
```
96+
97+
#### (2) 使用 client 对象的方法:
98+
99+
```java
100+
try {
101+
//使用客户端对象,创建Job
102+
CreateJobResponse response = client.createJob(job);
103+
104+
//创建成功后,返回jobId
105+
String jobId = response.getJobId();
106+
107+
System.out.println("Job created success, got jobId "+jobId);
108+
109+
} catch (ClientException e) {
110+
e.printStackTrace();
111+
112+
System.out.println("Job created failed, errorCode:"+ e.getErrCode()+", errorMessage:"+e.getErrMsg());
113+
}
114+
```
115+
116+
#### (3) client 对象支持的方法:
117+
118+
| 序号 | 方法 | 描述 |
119+
| ----- | ---- | ---- |
120+
| 1. | createJob(Job job) | 创建Job |
121+
| 2. | updateJobPriority(String jobId, int priority) | 设置Job优先级 |
122+
| 3. | deleteJob(String jobId) | 删除Job |
123+
| 4. | getJobStatus(String jobId) | 获取Job状态信息 |
124+
| 5. | listJobStatus() | 列举Job状态信息 |
125+
| 6. | getJob(String jobId) | 获取Job描述信息 |
126+
| 7. | stopJob(String jobId) | 停止job |
127+
| 8. | startJob(String jobId) | 重新启动job |
128+
| 9. | listTaskStatus(String jobId) | 列举一个job下所有task的状态信息 |
129+
| 10. | listImages() | 列举所有镜像 |
130+
131+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
控制台地址:http://100.69.163.214:18080/generator/html/index.html
3+
4+
帮助文档地址:http://docs.alibaba-inc.com:8090/pages/viewpage.action?pageId=244561359
5+
6+
SDK的使用文档在这里边,你申请下读写权限我给你批一下http://svn.develop.taobao.net/repos/pop-sdk/
7+
8+
地库的代码在这个地址:http://svn.develop.taobao.net/repos/pop-sdk/aliyun-sdk-java/aliyun-java-sdk-batchcompute/
9+
10+
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.aliyun</groupId>
4+
<artifactId>aliyun-java-sdk-batchcompute</artifactId>
5+
<packaging>jar</packaging>
6+
<version>2.0.2-SNAPSHOT</version>
7+
<name>aliyun-java-sdk-batchcompute</name>
8+
<url>http://www.aliyun.com</url>
9+
<description>Aliyun Open API SDK for Java
10+
11+
Copyright (C) Alibaba Cloud Computing
12+
All rights reserved.
13+
14+
版权所有 (C)阿里云计算有限公司
15+
16+
http://www.aliyun.com</description>
17+
<licenses>
18+
<license>
19+
<name></name>
20+
<url></url>
21+
<distribution></distribution>
22+
</license>
23+
</licenses>
24+
<scm>
25+
<url></url>
26+
<connection></connection>
27+
</scm>
28+
<developers>
29+
<developer>
30+
<id>aliyunproducts</id>
31+
<name>Aliyun SDK</name>
32+
<email>aliyunsdk@aliyun.com</email>
33+
</developer>
34+
</developers>
35+
<dependencies>
36+
<dependency>
37+
<groupId>com.aliyun</groupId>
38+
<artifactId>aliyun-java-sdk-core</artifactId>
39+
<optional>true</optional>
40+
<version>2.1.5-SNAPSHOT</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.codehaus.jackson</groupId>
44+
<artifactId>jackson-mapper-asl</artifactId>
45+
<version>1.9.13</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>junit</groupId>
49+
<artifactId>junit</artifactId>
50+
<version>4.10</version>
51+
<scope>test</scope>
52+
</dependency>
53+
</dependencies>
54+
55+
<build>
56+
57+
<testResources>
58+
<testResource>
59+
<directory>src/test/resources</directory>
60+
<targetPath>resources</targetPath>
61+
<filtering>true</filtering>
62+
</testResource>
63+
</testResources>
64+
65+
66+
<plugins>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-surefire-plugin</artifactId>
70+
<version>2.10</version>
71+
<configuration>
72+
<additionalClasspathElements>
73+
<additionalClasspathElement>
74+
${basedir}/target/test-classes
75+
</additionalClasspathElement>
76+
</additionalClasspathElements>
77+
<includes>
78+
<include>**/batchcompute/functiontest/*.java</include>
79+
<include>**/batchcompute/modelunittest/*.java</include>
80+
<include>**/batchcompute/transformunittest/*.java</include>
81+
</includes>
82+
</configuration>
83+
</plugin>
84+
85+
<!--代码覆盖率-->
86+
<plugin>
87+
<groupId>org.codehaus.mojo</groupId>
88+
<artifactId>cobertura-maven-plugin</artifactId>
89+
<version>2.7</version>
90+
<configuration>
91+
<check>
92+
<branchRate>0</branchRate>
93+
<lineRate>0</lineRate>
94+
<haltOnFailure>true</haltOnFailure>
95+
<totalBranchRate>0</totalBranchRate>
96+
<totalLineRate>0</totalLineRate>
97+
<packageLineRate>0</packageLineRate>
98+
<packageBranchRate>0</packageBranchRate>
99+
<regexes>
100+
<regex>
101+
<pattern>com.aliyuncs.batchcompute.*</pattern>
102+
<branchRate>0</branchRate>
103+
<lineRate>0</lineRate>
104+
</regex>
105+
</regexes>
106+
</check>
107+
</configuration>
108+
<executions>
109+
<execution>
110+
<goals>
111+
<goal>clean</goal>
112+
<goal>check</goal>
113+
</goals>
114+
</execution>
115+
</executions>
116+
</plugin>
117+
<plugin>
118+
<artifactId>maven-compiler-plugin</artifactId>
119+
<version>2.3.2</version>
120+
<configuration>
121+
<source>1.6</source>
122+
<target>1.6</target>
123+
<encoding>UTF-8</encoding>
124+
</configuration>
125+
</plugin>
126+
<plugin>
127+
<groupId>org.apache.maven.plugins</groupId>
128+
<artifactId>maven-jar-plugin</artifactId>
129+
<version>2.3.2</version>
130+
<configuration>
131+
<excludes>
132+
</excludes>
133+
</configuration>
134+
</plugin>
135+
<!--<plugin>-->
136+
<!--<groupId>org.apache.maven.plugins</groupId>-->
137+
<!--<artifactId>maven-surefire-plugin</artifactId>-->
138+
<!--<version>2.10</version>-->
139+
<!--<configuration>-->
140+
<!--<argLine>-Dfile.encoding=UTF-8</argLine>-->
141+
<!--</configuration>-->
142+
<!--</plugin>-->
143+
<plugin>
144+
<groupId>org.apache.maven.plugins</groupId>
145+
<artifactId>maven-javadoc-plugin</artifactId>
146+
<version>2.8</version>
147+
<configuration>
148+
<encoding>UTF-8</encoding>
149+
</configuration>
150+
</plugin>
151+
</plugins>
152+
</build>
153+
</project>

0 commit comments

Comments
 (0)