1313- 파일 다운로드 (sync and async)
1414- 폴더, 파일의 정보(이름, 설명) 변경, 삭제, 복사, 이동
1515- 폴더 생성
16- - 이미지, 비디오, 등등 OneDrive에서 지원하는 [ Facets ] ( https://dev.onedrive .com/facets/facets.htm )
16+ - 이미지, 비디오, 등등 OneDrive에서 지원하는 [ Resources ] ( https://docs.microsoft .com/en-us/onedrive/developer/rest-api/resources/ )
1717- 공유 폴더 조회
1818- 간단한 [ RemoteItem] ( https://dev.onedrive.com/misc/working-with-links.htm ) handling
19- - [ Drive] ( https://dev.onedrive .com/resources/drive.htm ) 조회
19+ - [ Drive] ( https://docs.microsoft .com/en-us/onedrive/developer/rest-api/ resources/drive ) 조회
2020- 파일 생성, 내용 업로드 (async)
21+ - Microsoft Graph 1.0 지원
22+ - OneDrive for Business 지원 (모두 테스트는 못함)
2123
2224##### ~~ _ 구현해 놓고 빠트린게 있을수도있..._ ~~
2325
4951
5052### Build
5153
54+ ` build/libs ` 에 ` jar ` 파일들 존재
55+
56+ ## __ Oracle JDK 10에서 Lombok과의 문제 때문에 컴파일 에러 발생. JDK 9권장__
57+
5258#### Windows
5359
5460``` cmd
@@ -73,25 +79,27 @@ gradle build
7379
7480## 간단한 예제
7581
82+ [ TestCode.java] ( https://github.com/isac322/OneDrive-SDK-java/blob/master/src/test/java/com/bhyoo/onedrive/TestCases.java ) 에서 사용예시 코드를 확인 가능
83+
7684
7785### 1. ` Client ` 객체 생성
7886
7987- 모든 작업은 ` Client ` 객체를 통해 이뤄진다.
8088- 복수개의 ` Client ` 객체를 생성할 수 있다.
8189- 자동 혹은 수동으로 ` Client ` 객체의 만료(expiration)을 갱신할 수 있다.
82- - 생성에 사용되는 변수들은 [ OneDrive app 인증 설명] ( https://dev.onedrive .com/app-registration.htm ) 을 따라하면 얻을 수 있다.
90+ - 생성에 사용되는 변수들은 [ OneDrive app 인증 설명] ( https://docs.microsoft .com/en-us/onedrive/developer/rest-api/getting-started/ app-registration ) 을 따라하면 얻을 수 있다.
8391
8492``` java
85- import com.bhyoo.Client ;
93+ import com.bhyoo.onedrive.client. Client ;
8694
8795String clientId = " xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ;
8896String [] scope = {" onedrive.readwrite" , " offline_access" , " onedrive.appfolder" };
8997String redirectURL = " http://localhost:8080/" ;
9098String clientSecret = " xxxxxxxxxxxxxxxxxxxxxxx" ;
9199
92- // auto login
100+ // with login
93101Client client = new Client (clientId, scope, redirectURL, clientSecret);
94- // self login
102+ // without login
95103Client client = new Client (clientId, scope, redirectURL, clientSecret, false );
96104client. login();
97105```
@@ -101,12 +109,12 @@ client.login();
101109
102110- ID와 경로를 통해서 가능.
103111- 폴더는 ` FolderItem ` , 파일은 ` FileItem ` 객체로 나눔.
104- - ` FolderItem ` 과 ` FileItem ` 은 모두 ` BaseItem ` 의 자식 클래스임.
112+ - ` FolderItem ` 과 ` FileItem ` 은 모두 ` DriveItem ` 의 자식 클래스임.
105113
106114``` java
107- import com.bhyoo.container.items.FolderItem ;
108- import com.bhyoo.container.items.BaseItem ;
109- import com.bhyoo.container.items.pointer.PathPointer ;
115+ import com.bhyoo.onedrive. container.items.DriveItem ;
116+ import com.bhyoo.onedrive. container.items.FileItem ;
117+ import com.bhyoo.onedrive. container.items.FolderItem ;
110118
111119// Client는 생성 되어있다고 가정
112120
@@ -128,29 +136,31 @@ FileItem file = client.getFile("XXXXXXXXXXXXXXXX!XXXX");
128136FileItem file1 = client. getFile(new PathPointer (" /{item-path}/{file-name}" ));
129137
130138// or if you don't know whether ID is file or folder
131- BaseItem item = client. getItem(" XXXXXXXXXXXXXXXX!XXXX" );
139+ DriveItem item = client. getItem(" XXXXXXXXXXXXXXXX!XXXX" );
132140
133141// or if you don't know whether path is file or folder
134- BaseItem item1 = client. getItem(new PathPointer (" /{item-path}" ));
142+ DriveItem item1 = client. getItem(new PathPointer (" /{item-path}" ));
135143```
136144
137145
138146### 3. 폴더의 자식 조회
139147
140- - ` FolderItem ` 는 ` Iterable ` 함. (자식 아아이템들을 ` BaseItem ` 으로 반환)
148+ - ` FolderItem ` 는 ` Iterable ` 함. (자식 아아이템들을 ` DriveItem ` 으로 반환)
141149- 기본적으로 ` FolderItem ` 객체가 ` Client ` 의 ` getFolder ` , ` getRootDir ` 등으로 생성될 경우 자식 목록도 자동적으로 불러옴. ** (폴더 자식 목록이 길다면 객체 생성이 오래걸릴 수도 있음)**
142150- ` FolderItem ` 의 ` getAllChildren ` , ` getFolderChildren ` , ` getFileChildren ` 를 호출하면 각각 모든 자식, 폴더인 자식, 파일인 자식 ` List ` 를 얻을 수 있음.
143151- 위의 메소드들은 호출시 자식정보를 load하고 caching한 후 반환하기 떄문에 ** 첫 호출은 오래걸릴 수도 있음.**
144152
145153``` java
146- import com.bhyoo.container.items.* ;
154+ import com.bhyoo.onedrive.container.items.DriveItem ;
155+ import com.bhyoo.onedrive.container.items.FileItem ;
156+ import com.bhyoo.onedrive.container.items.FolderItem ;
147157// Client는 생성 되어있다고 가정
148158
149159FolderItem root = client. getRootDir();
150160
151- List< BaseItem > children = root. getAllChildren ();
152- List< FolderItem > folderChildren = root. getFolderChildren ();
153- List< FileItem > fileChildren = root. getFileChildren ();
161+ DriveItem [] children = root. allChildren ();
162+ FolderItem [] folderChildren = root. folderChildren ();
163+ FileItem [] fileChildren = root. fileChildren ();
154164```
155165
156166
@@ -160,8 +170,8 @@ List<FileItem> fileChildren = root.getFileChildren();
160170- 생성된 폴더의 객체를 반환한다.
161171
162172``` java
163- import com.bhyoo.container.items.FolderItem ;
164- import com.bhyoo.container.items.pointer.PathPointer ;
173+ import com.bhyoo.onedrive. container.items.FolderItem ;
174+ import com.bhyoo.onedrive. container.items.pointer.PathPointer ;
165175
166176// Client는 생성 되어있다고 가정
167177
@@ -184,12 +194,12 @@ FolderItem newFolder2 = client.createFolder(new PathPointer("/"), "test2");
184194- 복사하고싶은 아이템의 객체, 혹은 ` Client ` 객체를 통해서 가능.
185195
186196``` java
187- import com.bhyoo.container.items.* ;
188- import com.bhyoo.container.items.pointer.* ;
197+ import com.bhyoo.onedrive. container.items.* ;
198+ import com.bhyoo.onedrive. container.items.pointer.* ;
189199
190200// Client는 생성 되어있다고 가정
191201
192- BaseItem item = client. getItem(" XXXXXXXXXXXXXXXX!XXXX" );
202+ FileItem item = ( FileItem ) client. getItem(" XXXXXXXXXXXXXXXX!XXXX" );
193203FolderItem destination = client. getFolder(" XXXXXXXXXXXXXXXX!XXXX" );
194204
195205// direct copy
@@ -221,7 +231,7 @@ client.copyItem(new PathPointer("/{item-path}"), new IdPointer("XXXXXXXXXXXXXXXX
221231### 6. 파일 다운로드 (synchronous)
222232
223233``` java
224- import com.bhyoo.container.items.FileItem ;
234+ import com.bhyoo.onedrive. container.items.FileItem ;
225235import java.nio.file.Paths ;
226236
227237// Client는 생성 되어있다고 가정
@@ -254,8 +264,8 @@ client.download(new PathPointer("/{item-path}"), Paths.get(path));
254264
255265``` java
256266import java.nio.file.Paths ;
257- import com.bhyoo.container.items.FileItem ;
258- import com.bhyoo.network.async.DownloadFuture ;
267+ import com.bhyoo.onedrive. container.items.FileItem ;
268+ import com.bhyoo.onedrive. network.async.DownloadFuture ;
259269
260270// assume that Client object is already constructed
261271
@@ -280,12 +290,13 @@ future.sync();
280290- 이동하고싶은 아이템의 객체, 혹은 ` Client ` 객체를 통해서 가능.
281291
282292``` java
283- import com.bhyoo.container.items.BaseItem ;
284- import com.bhyoo.container.items.pointer.* ;
293+ import com.bhyoo.onedrive.container.items.FileItem ;
294+ import com.bhyoo.onedrive.container.items.FolderItem ;
295+ import com.bhyoo.onedrive.container.items.pointer.* ;
285296
286297// Client는 생성 되어있다고 가정
287298
288- BaseItem item = client. getItem (" XXXXXXXXXXXXXXXX!XXXX" );
299+ FileItem item = client. getFile (" XXXXXXXXXXXXXXXX!XXXX" );
289300FolderItem destination = client. getFolder(" XXXXXXXXXXXXXXXX!XXXX" );
290301
291302// direct move
@@ -311,17 +322,17 @@ client.moveItem(new PathPointer("/{item-path}"), new IdPointer("XXXXXXXXXXXXXXXX
311322- 즉 ` refresh ` 함수가 호출될 경우, 현재 프로그램이 변경하지 않은 변수라도 업데이트 될 수 있음.
312323
313324``` java
314- import com.bhyoo.container.items.BaseItem ;
325+ import com.bhyoo.onedrive. container.items.DriveItem ;
315326
316327// Client는 생성 되어있다고 가정
317- BaseItem item = client. getItem(" XXXXXXXXXXXXXXXX!XXXX" );
328+ DriveItem item = client. getItem(" XXXXXXXXXXXXXXXX!XXXX" );
318329
319330// change item's name and flush to server.
320- item. setName (" new name" );
331+ item. rename (" new name" );
321332
322333
323334// change item's description and flush to server.
324- item. setDescription (" blah blah" );
335+ item. updateDescription (" blah blah" );
325336
326337
327338// refresh item's all variable to latest value
@@ -335,7 +346,7 @@ item.refresh();
335346
336347``` java
337348import java.nio.file.Path ;
338- import com.bhyoo.network.async.UploadFuture ;
349+ import com.bhyoo.onedrive. network.async.UploadFuture ;
339350
340351// Client는 생성 되어있다고 가정
341352
@@ -346,4 +357,8 @@ future = client.uploadFile("{remote-folder-id}", Paths.get("local-file-path"));
346357// wait until uploading is done
347358future. syncUninterruptibly();
348359
349- ```
360+ ```
361+
362+ ## ` *Item ` 구조도
363+
364+ ![ 구조도] ( https://raw.githubusercontent.com/isac322/OneDrive-SDK-java/master/item_diagram.png )
0 commit comments