Skip to content

Commit f457b63

Browse files
committed
Merge remote-tracking branch 'ms/dev' into dev
# Conflicts: # src/main/java/com/microsoft/graph/models/generated/BaseActivityHistoryItem.java
2 parents a195065 + 8dcf5a8 commit f457b63

File tree

12,707 files changed

+375437
-472178
lines changed

Some content is hidden

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

12,707 files changed

+375437
-472178
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Microsoft Graph SDK for Java
1+
# Microsoft Graph SDK for Java
22

33
[ ![Download](https://api.bintray.com/packages/microsoftgraph/Maven/microsoft-graph/images/download.svg) ](https://bintray.com/microsoftgraph/Maven/microsoft-graph/_latestVersion)
44

@@ -18,7 +18,7 @@ repository {
1818
1919
dependency {
2020
// Include the sdk as a dependency
21-
compile('com.microsoft.graph:microsoft-graph:1.0.+')
21+
compile('com.microsoft.graph:microsoft-graph:1.5.+')
2222
}
2323
```
2424

@@ -28,7 +28,7 @@ Add the dependency in `dependencies` in pom.xml
2828
<dependency>
2929
<groupId>com.microsoft.graph</groupId>
3030
<artifactId>microsoft-graph</artifactId>
31-
<version>1.0.1</version>
31+
<version>1.5.0</version>
3232
</dependency>
3333
```
3434

@@ -109,7 +109,7 @@ Thanks to everyone who has already devoted time to improving the library:
109109
<!-- prettier-ignore -->
110110
| [<img src="https://avatars.githubusercontent.com/u/2273297?v=4" width="100px;"/><br /><sub><b>Caitlin Bales</b></sub>](https://developer.microsoft.com/graph)<br />[💬](#question-cbales "Answering Questions") [💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=cbales "Code") [📖](https://github.com/microsoftgraph/msgraph-sdk-java/wiki "Documentation") [👀](#review-cbales "Reviewed Pull Requests") [⚠️](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=cbales "Tests")| [<img src="https://avatars.githubusercontent.com/u/318187?v=4" width="100px;"/><br /><sub><b>David Moten</b></sub>](https://github.com/davidmoten)<br /> [🐛](https://github.com/microsoftgraph/msgraph-sdk-java/issues?q=is%3Aissue+author%3Adavidmoten "Bug reports") [💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=davidmoten "Code") [📖](https://github.com/microsoftgraph/msgraph-sdk-java/commit/87389b5a4240072e3f2226a2f04f089916ffed0b#diff-04c6e90faac2675aa89e2176d2eec7d8 "Documentation") [🤔](#ideas-davidmoten "Ideas & Planning") [👀](#review-davidmoten "Reviewed Pull Requests") [⚠️](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=davidmoten "Tests") | [<img src="https://avatars.githubusercontent.com/u/8527305?v=4" width="100px;"/><br /><sub><b>Michael Mainer</b></sub>](https://developer.microsoft.com/graph)<br /> [💬](#question-cbales "Answering Questions") [🤔](#ideas-MIchaelMainer "Ideas & Planning") [👀](#review-MIchaelMainer "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/27295799?v=4" width="100px;"/><br /><sub><b>Linda Caputo</b></sub>](https://developer.microsoft.com/graph)<br />[📖](https://github.com/microsoftgraph/msgraph-sdk-java/wiki "Documentation") | [<img src="https://avatars.githubusercontent.com/u/8884923?v=4" width="100px;"/><br /><sub><b>John Austin</b></sub>](https://developer.microsoft.com/graph)<br />[🐛](https://github.com/microsoftgraph/msgraph-sdk-java/issues "Bug reports") | [<img src="https://avatars.githubusercontent.com/u/3460953?v=4" width="100px;"/><br /><sub><b>Dmitry Pimenov</b></sub>](https://developer.microsoft.com/graph)<br />[🤔](#ideas-dpim "Ideas & Planning") | [<img src="https://avatars.githubusercontent.com/u/1427840?v=4" width="100px;"/><br /><sub><b>Jonathan Giles</b></sub>](https://github.com/JonathanGiles)<br />[🤔](#ideas-JonathanGiles "Ideas & Planning") |
111111
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
112-
| [<img src="https://avatars.githubusercontent.com/u/881767?v=4" width="100px;"/><br /><sub><b>Martin Sawicki</b></sub>](https://github.com/martinsawicki)<br />[🤔](#ideas-martinsawicki "Ideas & Planning") | [<img src="https://avatars.githubusercontent.com/u/29152134?v=4" width="100px;"/><br /><sub><b>Louis Maresca</b></sub>](https://github.com/LouMM)<br />[🤔](#ideas-LouMM "Ideas & Planning") [👀](#review-LouMM "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/604089?v=4" width="100px;"/><br /><sub><b>Josef H.B. Schneider</b></sub>](https://j0s.at/)<br />[🐛](https://github.com/microsoftgraph/msgraph-sdk-java/issues?q=is%3Aissue+author%3AJ0s3f "Bug reports") [💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=J0s3f "Code") | [<img src="https://avatars2.githubusercontent.com/u/3197588?v=4" width="100px;"/><br /><sub><b>Deepak Agrawal</b></sub>](https://github.com/deepak2016)<br />[💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=deepak2016 "Code") | [<img src="https://avatars3.githubusercontent.com/u/16473684?v=4" width="100px;"/><br /><sub><b>Nakul Sabharwal</b></sub>](https://github.com/NakulSabharwal)<br />[💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=NakulSabharwal "Code") [👀](#review-NakulSabharwal "Reviewed Pull Requests")
112+
| [<img src="https://avatars.githubusercontent.com/u/881767?v=4" width="100px;"/><br /><sub><b>Martin Sawicki</b></sub>](https://github.com/martinsawicki)<br />[🤔](#ideas-martinsawicki "Ideas & Planning") | [<img src="https://avatars.githubusercontent.com/u/29152134?v=4" width="100px;"/><br /><sub><b>Louis Maresca</b></sub>](https://github.com/LouMM)<br />[🤔](#ideas-LouMM "Ideas & Planning") [👀](#review-LouMM "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/604089?v=4" width="100px;"/><br /><sub><b>Josef H.B. Schneider</b></sub>](https://j0s.at/)<br />[🐛](https://github.com/microsoftgraph/msgraph-sdk-java/issues?q=is%3Aissue+author%3AJ0s3f "Bug reports") [💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=J0s3f "Code") | [<img src="https://avatars2.githubusercontent.com/u/3197588?v=4" width="100px;"/><br /><sub><b>Deepak Agrawal</b></sub>](https://github.com/deepak2016)<br />[💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=deepak2016 "Code") | <img src="https://avatars.githubusercontent.com/u/22523479?v=4" width="100px;"/><br /><sub><b>Ben Tipper</b></sub><br /> | [<img src="https://avatars3.githubusercontent.com/u/16473684?v=4" width="100px;"/><br /><sub><b>Nakul Sabharwal</b></sub>](https://github.com/NakulSabharwal)<br />[💻](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=NakulSabharwal "Code") [👀](#review-NakulSabharwal "Reviewed Pull Requests")
113113
<!-- ALL-CONTRIBUTORS-LIST:END -->
114114

115115
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ dependencies {
3535
compile 'com.google.code.gson:gson:2.8.2'
3636

3737
compile 'com.sun.jersey:jersey-server:1.19.4'
38+
39+
// Core Http library
40+
compile('com.microsoft.graph:microsoft-graph-core:1.0.0')
3841
}
3942

4043
def pomConfig = {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ mavenBintraySnapshotUrl = http://oss.jfrog.org/artifactory/oss-snapshot-local
2626
mavenGroupId = com.microsoft.graph
2727
mavenArtifactId = microsoft-graph
2828
mavenMajorVersion = 1
29-
mavenMinorVersion = 0
30-
mavenPatchVersion = 1
29+
mavenMinorVersion = 6
30+
mavenPatchVersion = 0
3131
mavenArtifactSuffix =
3232
nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven
3333

src/main/java/com/microsoft/graph/concurrency/ChunkedUploadProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class ChunkedUploadProvider<UploadType> {
8282
/**
8383
* The stream size
8484
*/
85-
private final int streamSize;
85+
private final long streamSize;
8686

8787
/**
8888
* The upload response handler
@@ -92,7 +92,7 @@ public class ChunkedUploadProvider<UploadType> {
9292
/**
9393
* The counter for how many bytes have been read from input stream
9494
*/
95-
private int readSoFar;
95+
private long readSoFar;
9696

9797
/**
9898
* Creates the ChunkedUploadProvider
@@ -106,7 +106,7 @@ public class ChunkedUploadProvider<UploadType> {
106106
public ChunkedUploadProvider(final UploadSession uploadSession,
107107
final IGraphServiceClient client,
108108
final InputStream inputStream,
109-
final int streamSize,
109+
final long streamSize,
110110
final Class<UploadType> uploadTypeClass) {
111111
if (uploadSession == null) {
112112
throw new InvalidParameterException("Upload session is null.");

src/main/java/com/microsoft/graph/concurrency/ChunkedUploadResponseHandler.java

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@
2222

2323
package com.microsoft.graph.concurrency;
2424

25-
import com.microsoft.graph.requests.extensions.ChunkedUploadResult;
26-
import com.microsoft.graph.models.extensions.UploadSession;
25+
import java.io.BufferedInputStream;
26+
import java.io.IOException;
27+
import java.io.InputStream;
28+
2729
import com.microsoft.graph.http.DefaultHttpProvider;
2830
import com.microsoft.graph.http.GraphServiceException;
2931
import com.microsoft.graph.http.HttpResponseCode;
3032
import com.microsoft.graph.http.IConnection;
3133
import com.microsoft.graph.http.IHttpRequest;
3234
import com.microsoft.graph.http.IStatefulResponseHandler;
3335
import com.microsoft.graph.logger.ILogger;
36+
import com.microsoft.graph.models.extensions.UploadSession;
37+
import com.microsoft.graph.requests.extensions.ChunkedUploadResult;
3438
import com.microsoft.graph.serializer.ISerializer;
3539

36-
import java.io.BufferedInputStream;
37-
import java.io.InputStream;
40+
import okhttp3.Response;
3841

3942
/**
4043
* Handles the stateful response from the OneDrive upload session
@@ -66,6 +69,16 @@ public ChunkedUploadResponseHandler(final Class<UploadType> uploadType) {
6669
public void configConnection(final IConnection connection) {
6770
return;
6871
}
72+
73+
/**
74+
* Do nothing before getting the response
75+
*
76+
* @param response The response
77+
*/
78+
@Override
79+
public void configConnection(final Response response) {
80+
return;
81+
}
6982

7083
/**
7184
* Generate the chunked upload response result
@@ -112,10 +125,68 @@ public ChunkedUploadResult<UploadType> generateResult(
112125
}
113126
} finally {
114127
if (in != null) {
115-
in.close();
128+
try{
129+
in.close();
130+
} catch(IOException e) {
131+
logger.logError(e.getMessage(), e);
132+
}
116133
}
117134
}
118135

119136
return null;
120137
}
138+
139+
/**
140+
* Generate the chunked upload response result
141+
*
142+
* @param request the HTTP request
143+
* @param response the HTTP response
144+
* @param serializer the serializer
145+
* @param logger the system logger
146+
* @return the chunked upload result, which could be either an uploaded item or error
147+
* @throws Exception an exception occurs if the request was unable to complete for any reason
148+
*/
149+
@Override
150+
public ChunkedUploadResult<UploadType> generateResult(
151+
final IHttpRequest request,
152+
final Response response,
153+
final ISerializer serializer,
154+
final ILogger logger) throws Exception {
155+
InputStream in = null;
156+
try {
157+
if (response.code() == HttpResponseCode.HTTP_ACCEPTED) {
158+
logger.logDebug("Chunk bytes has been accepted by the server.");
159+
in = new BufferedInputStream(response.body().byteStream());
160+
final UploadSession session = serializer.deserializeObject(
161+
DefaultHttpProvider.streamToString(in), UploadSession.class);
162+
163+
return new ChunkedUploadResult<UploadType>(session);
164+
165+
} else if (response.code() == HttpResponseCode.HTTP_CREATED
166+
|| response.code() == HttpResponseCode.HTTP_OK) {
167+
logger.logDebug("Upload session is completed, uploaded item returned.");
168+
in = new BufferedInputStream(response.body().byteStream());
169+
String rawJson = DefaultHttpProvider.streamToString(in);
170+
UploadType uploadedItem = serializer.deserializeObject(rawJson,
171+
this.deserializeTypeClass);
172+
173+
return new ChunkedUploadResult<UploadType>(uploadedItem);
174+
} else if (response.code() >= HttpResponseCode.HTTP_CLIENT_ERROR) {
175+
logger.logDebug("Receiving error during upload, see detail on result error");
176+
177+
return new ChunkedUploadResult<UploadType>(
178+
GraphServiceException.createFromConnection(request, null, serializer,
179+
response, logger));
180+
}
181+
} finally {
182+
if (in != null) {
183+
try{
184+
in.close();
185+
} catch(IOException e) {
186+
logger.logError(e.getMessage(), e);
187+
}
188+
}
189+
}
190+
return null;
191+
}
121192
}

src/main/java/com/microsoft/graph/core/Constants.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,28 @@ private Constants() {
55
}
66

77
public static final String APPROOT = "approot";
8+
/**
9+
* The content type header
10+
*/
11+
public static final String CONTENT_TYPE_HEADER_NAME = "Content-Type";
12+
/**
13+
* The encoding type for getBytes
14+
*/
15+
public static final String JSON_ENCODING = "UTF-8";
16+
/**
17+
* The content type for JSON responses
18+
*/
19+
public static final String JSON_CONTENT_TYPE = "application/json";
20+
/**
21+
* The binary content type header's value
22+
*/
23+
public static final String BINARY_CONTENT_TYPE = "application/octet-stream";
824

925
// Constants for functional tests
1026
// TO-DO: document how to register an application for functional
1127
// testing purposes
1228
public static final String APPID = "app-id";
1329
public static final String USERNAME = "[email protected]";
1430
public static final String PASSWORD = "password";
15-
public static final String VERSION_NAME = "1.0.1";
31+
public static final String VERSION_NAME = "1.6.0";
1632
}

src/main/java/com/microsoft/graph/core/DefaultClientConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import com.microsoft.graph.authentication.IAuthenticationProvider;
2626
import com.microsoft.graph.concurrency.DefaultExecutors;
2727
import com.microsoft.graph.concurrency.IExecutors;
28-
import com.microsoft.graph.http.DefaultHttpProvider;
28+
import com.microsoft.graph.http.CoreHttpProvider;
2929
import com.microsoft.graph.http.IHttpProvider;
3030
import com.microsoft.graph.logger.DefaultLogger;
3131
import com.microsoft.graph.logger.ILogger;
@@ -45,7 +45,7 @@ public abstract class DefaultClientConfig implements IClientConfig {
4545
/**
4646
* The HTTP provider instance
4747
*/
48-
private DefaultHttpProvider httpProvider;
48+
private IHttpProvider httpProvider;
4949

5050
/**
5151
* The logger
@@ -98,11 +98,11 @@ public IAuthenticationProvider getAuthenticationProvider() {
9898
@Override
9999
public IHttpProvider getHttpProvider() {
100100
if (httpProvider == null) {
101-
httpProvider = new DefaultHttpProvider(getSerializer(),
101+
httpProvider = new CoreHttpProvider(getSerializer(),
102102
getAuthenticationProvider(),
103103
getExecutors(),
104104
getLogger());
105-
getLogger().logDebug("Created DefaultHttpProvider");
105+
getLogger().logDebug("Created CoreHttpProvider");
106106
}
107107
return httpProvider;
108108
}

0 commit comments

Comments
 (0)