Skip to content

Commit

Permalink
DEV: convert to gradle project,
Browse files Browse the repository at this point in the history
UPDATE: update jackson(to 2.8.5), netty(to 5.0-alpha) library
  • Loading branch information
isac322 committed Dec 9, 2016
1 parent c2aaaaf commit f6f6ffe
Show file tree
Hide file tree
Showing 95 changed files with 477 additions and 76 deletions.
3 changes: 1 addition & 2 deletions README.kor.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

- 파일 or 폴더 검색 (by name or content)
- 공유 기능
- Maven
- 문서화
- support custom redirect url when login
- REST-api response error handling
Expand All @@ -39,7 +38,7 @@

### Dependency

*lib 폴더에 이미 포함됨*
*gradle 설정 파일 (build.gradle)에 이미 포함됨*

- [Jackson](https://github.com/FasterXML/jackson)
- [Lombok](https://projectlombok.org/)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ purse fast, easy to use, intuitive API.

- searching file or folder (by name or content)
- sharing folder or file
- Maven
- documentation
- support custom redirect url when login
- REST-api response error handling
Expand All @@ -39,7 +38,7 @@ purse fast, easy to use, intuitive API.

### Dependency

*These are already included in directory 'lib'.*
*These are already included in gradle configuration file 'build.gradle'.*

- [Jackson](https://github.com/FasterXML/jackson)
- [Lombok](https://projectlombok.org/)
Expand Down
33 changes: 33 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
group 'org.onedrive'
version '0.9-beta'

apply plugin: 'java'
apply plugin: 'idea'

sourceCompatibility = 1.7

repositories {
mavenCentral()
}

dependencies {
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.5+'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.5+'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.5+'

compile 'com.fasterxml.jackson.module:jackson-module-afterburner:2.8.5+'

compile 'io.netty:netty-buffer:5.0.0.Alpha2+'
compile 'io.netty:netty-codec:5.0.0.Alpha2+'
compile 'io.netty:netty-codec-http:5.0.0.Alpha2+'
compile 'io.netty:netty-common:5.0.0.Alpha2+'
compile 'io.netty:netty-handler:5.0.0.Alpha2+'
compile 'io.netty:netty-resolver:5.0.0.Alpha2+'
compile 'io.netty:netty-transport:5.0.0.Alpha2+'

compile 'org.projectlombok:lombok:1.16.12+'

compile 'org.jetbrains:annotations:15.0+'

testCompile group: 'junit', name: 'junit', version: '4.11+'
}
Binary file removed lib/annotations-java8.jar
Binary file not shown.
Binary file removed lib/hamcrest-core-1.3.jar
Binary file not shown.
Binary file removed lib/jackson-annotations-2.8.3-javadoc.jar
Binary file not shown.
Binary file removed lib/jackson-annotations-2.8.3-sources.jar
Binary file not shown.
Binary file removed lib/jackson-annotations-2.8.3.jar
Binary file not shown.
Binary file removed lib/jackson-core-2.8.3-javadoc.jar
Binary file not shown.
Binary file removed lib/jackson-core-2.8.3-sources.jar
Binary file not shown.
Binary file removed lib/jackson-core-2.8.3.jar
Binary file not shown.
Binary file removed lib/jackson-databind-2.8.3-javadoc.jar
Binary file not shown.
Binary file removed lib/jackson-databind-2.8.3-sources.jar
Binary file not shown.
Binary file removed lib/jackson-databind-2.8.3.jar
Binary file not shown.
Binary file removed lib/jackson-module-afterburner-2.8.3-javadoc.jar
Binary file not shown.
Binary file removed lib/jackson-module-afterburner-2.8.3-sources.jar
Binary file not shown.
Binary file removed lib/jackson-module-afterburner-2.8.3.jar
Binary file not shown.
Binary file removed lib/junit-4.12.jar
Binary file not shown.
Binary file removed lib/lombok.jar
Binary file not shown.
Binary file removed lib/netty-buffer-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-buffer-4.1.5.Final.jar
Binary file not shown.
Binary file removed lib/netty-codec-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-codec-4.1.5.Final.jar
Binary file not shown.
Binary file removed lib/netty-codec-http-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-codec-http-4.1.5.Final.jar
Binary file not shown.
Binary file removed lib/netty-common-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-common-4.1.5.Final.jar
Binary file not shown.
Binary file removed lib/netty-handler-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-handler-4.1.5.Final.jar
Binary file not shown.
Binary file removed lib/netty-resolver-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-resolver-4.1.5.Final.jar
Binary file not shown.
Binary file removed lib/netty-transport-4.1.5.Final-sources.jar
Binary file not shown.
Binary file removed lib/netty-transport-4.1.5.Final.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'onedrive-sdk-java'

Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class Client {
* @param redirectURL Redirect URL that programmer already set in Application setting. It must matches with set
* one!
* @param clientSecret Client secret key that MS gave to programmer.
*
* @throws InternalException If fail to create {@link URI} object in auth process.
* if it happens it's probably bug, so please report to
* <a href="mailto:[email protected]" target="_top">author</a>.
Expand All @@ -115,6 +116,7 @@ public Client(@NotNull String clientId, @NotNull String[] scope,
* one!
* @param clientSecret Client secret key that MS gave to programmer.
* @param autoLogin if {@code true} construct with auto login.
*
* @throws InternalException If fail to create {@link URI} object in auth process.
* if it happens it's probably bug, so please report to
* <a href="mailto:[email protected]" target="_top">author</a>.
Expand Down Expand Up @@ -202,6 +204,7 @@ public void login() {
* {@link Client#Client(String, String[], String, String)}.)
*
* @return <b>Access Code</b>({@code this.accessToken}) if successful. Otherwise throw {@link RuntimeException}.
*
* @throws InternalException If fail to create {@link URI} object in auth process.
* if it happens it's probably bug, so please report to
* <a href="mailto:[email protected]" target="_top">author</a>.
Expand Down Expand Up @@ -262,6 +265,7 @@ private String getCode() {
* <a href="https://dev.onedrive.com/auth/msa_oauth.htm#step-3-get-a-new-access-token-or-refresh-token">detail</a>
*
* @return access token {@code String} that given from server.
*
* @throws InvalidJsonException If fail to parse response of login request into json, or even if success to parse,
* if there're unexpected value. both caused by server side not by SDK.
* @throws InternalException if the underlying input source has problems during parsing response body.
Expand All @@ -278,13 +282,14 @@ private String redeemToken() {
* <a href="https://dev.onedrive.com/auth/msa_oauth.htm#step-3-get-a-new-access-token-or-refresh-token">detail</a>
*
* @return refreshed access token {@code String}.
*
* @throws IllegalStateException If caller {@code Client} object isn't login yet.
* @throws InvalidJsonException If fail to parse response of login request into json, or even if success to parse,
* if there're unexpected value. both caused by server side not by SDK.
* @throws InternalException if the underlying input source has problems during parsing response body.
*/
@NotNull
public String refreshToken() {
public String refreshLogin() {
if (!isLogin()) throw LOGIN_FIRST;

return getToken(
Expand All @@ -298,7 +303,9 @@ public String refreshToken() {
* {@code Client} object.
*
* @param httpBody HTTP POST's body that will be sent to server for being granted.
*
* @return access token {@code String} that given from server.
*
* @throws InvalidJsonException If fail to parse response of login request into json, or even if success to parse,
* if there're unexpected value. both caused by server side not by SDK.
* @throws InternalException if the underlying input source has problems during parsing response body.
Expand Down Expand Up @@ -361,7 +368,7 @@ private void saveToken(String accessToken, String refreshToken, String userId, S
}

/**
* Check expiration of authentication. if expired, refresh it with {@link Client#refreshToken()}.
* Check expiration of authentication. if expired, refresh it with {@link Client#refreshLogin()}.
*
* @throws IllegalStateException If caller {@code Client} object isn't login yet.
* @throws InvalidJsonException If fail to parse response of login request into json, or even if success to parse,
Expand All @@ -371,7 +378,7 @@ private void saveToken(String accessToken, String refreshToken, String userId, S
private void checkExpired() {
if (!isLogin()) throw LOGIN_FIRST;

if (isExpired()) refreshToken();
if (isExpired()) refreshLogin();
}


Expand Down Expand Up @@ -458,6 +465,7 @@ public FolderItem getRootDir() throws ErrorResponseException {
* {@// TODO: handling error if `id`'s item isn't folder item. }
*
* @param id folder's id.
*
* @return folder object
*/
@NotNull
Expand Down Expand Up @@ -517,6 +525,7 @@ public FolderItem getFolder(@NotNull BasePointer pointer, boolean childrenFetchi
* {@// TODO: Enhance javadoc }
*
* @param id file id.
*
* @return file object
*/
@NotNull
Expand Down Expand Up @@ -633,7 +642,9 @@ public BaseItem[] getShared() throws ErrorResponseException {
*
* @param srcId item's id that wants to be copied
* @param destId location's id that wants to be placed the copied item
*
* @return URL {@code String} that can monitor status of copying process
*
* @throws ErrorResponseException if error happens while requesting copying operation. such as invalid copying
* request
* @throws InvalidJsonException if fail to parse response of copying request into json. it caused by server side
Expand All @@ -649,6 +660,7 @@ public String copyItem(@NotNull String srcId, @NotNull String destId) throws Err
* Works just like {@link Client#copyItem(String, String)}} except new name of item can be designated.
*
* @param newName new name of item that will be copied
*
* @see Client#copyItem(String, String)
*/
@NotNull
Expand Down Expand Up @@ -702,8 +714,10 @@ public String copyItem(@NotNull BasePointer src, @NotNull BasePointer dest, @Not
* @param api OneDrive copying api that contains item's location. Note that it must be ensured that
* {@code api} is a escaped {@code String}
* @param content HTTP body
*
* @return URL {@code String} that can monitor status of copying process
* {@// TODO: end of copying process, is this link will be useless or inaccessible ? }
*
* @throws ErrorResponseException if error happens while requesting copying operation. such as invalid copying
* request
* @throws InvalidJsonException if fail to parse response of copying request into json. it caused by server side
Expand Down Expand Up @@ -804,7 +818,9 @@ private BaseItem moveItem(@NotNull String api, @NotNull byte[] content) throws E
*
* @param parentId Parent ID that creating folder inside.
* @param name New folder name.
*
* @return New folder's object.
*
* @throws RuntimeException If creating folder or converting response is fails.
*/
@NotNull
Expand All @@ -821,7 +837,9 @@ public FolderItem createFolder(@NotNull String parentId, @NotNull String name) t
*
* @param parent Parent pointer that creating folder inside. (either ID or path)
* @param name New folder name.
*
* @return New folder's object.
*
* @throws RuntimeException If creating folder or converting response is fails.
*/
@NotNull
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

/**
* <a href="https://dev.onedrive.com/facets/image_facet.htm">https://dev.onedrive.com/facets/image_facet.htm</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import org.onedrive.network.sync.SyncRequest;

/**
* <a href="https://dev.onedrive.com/facets/video_facet.htm">https://dev.onedrive.com/facets/video_facet.htm</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected FileItem(@JacksonInject("OneDriveClient") Client client,
*
* @param path Folder path. It could be relative path (like . or ..). Note that this parameter <b>isn't
* path of item that will be downloaded</b>. It must point parent directory of the item.
*
* @see FileItem#download(Path, String)
*/
public void download(@NotNull String path) throws IOException, ErrorResponseException {
Expand All @@ -96,6 +97,7 @@ public void download(@NotNull String path) throws IOException, ErrorResponseExce
* @param path Folder path. It could be relative path (like . or ..). Note that this parameter <b>isn't
* path of item that will be downloaded</b>. It must point parent directory of the item.
* @param newName new file name.
*
* @see FileItem#download(Path, String)
*/
public void download(@NotNull String path, @NotNull String newName) throws IOException, ErrorResponseException {
Expand All @@ -108,6 +110,7 @@ public void download(@NotNull String path, @NotNull String newName) throws IOExc
*
* @param folderPath Folder path. It could be relative path (like . or ..). Note that this parameter <b>isn't
* path of item that will be downloaded</b>. It must point parent directory of the item.
*
* @see FileItem#download(Path, String)
*/
public void download(@NotNull Path folderPath) throws IOException, ErrorResponseException {
Expand All @@ -124,6 +127,7 @@ public void download(@NotNull Path folderPath) throws IOException, ErrorResponse
* @param folderPath Folder path. It could be relative path (like . or ..). Note that this parameter <b>isn't
* path of item that will be downloaded</b>. It must point parent directory of the item.
* @param newName new file name.
*
* @throws SecurityException If a required system property value cannot be accessed, or if a security
* manager exists and its SecurityManager.checkRead method denies read access to
* the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ protected void _fetchChildren(String url) throws ErrorResponseException {
* {@// TODO: Implement '@name.conflictBehavior' }
*
* @param name New folder name.
*
* @return New folder's object.
*
* @throws RuntimeException If creating folder or converting response is fails.
* {@// TODO: add more @throws }
*/
Expand All @@ -231,6 +233,7 @@ public FolderItem createFolder(@NotNull String name) throws ErrorResponseExcepti
* fetch children data.
*
* @param newItem New object that contains new data to update.
*
* @throws IllegalArgumentException It's because of construction of {@link IdPointer} or {@link PathPointer}.
* @throws InternalException if parameter {@code parentReference} is null even if this isn't root directory.
*/
Expand Down
File renamed without changes.
Loading

0 comments on commit f6f6ffe

Please sign in to comment.