Skip to content

Commit bece798

Browse files
switch to OkHttp #72
1 parent cd8f4b3 commit bece798

File tree

284 files changed

+23273
-27110
lines changed

Some content is hidden

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

284 files changed

+23273
-27110
lines changed

.gitattributes

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Handle line endings automatically for files detected as text
2+
# and leave all files detected as binary untouched.
3+
* text=auto
4+
5+
#
6+
# The above will handle all files NOT found below
7+
#
8+
# These files are text and should be normalized (Convert crlf => lf)
9+
*.css text
10+
*.df text
11+
*.htm text
12+
*.html text
13+
*.java text
14+
*.js text
15+
*.json text
16+
*.jsp text
17+
*.jspf text
18+
*.properties text
19+
*.sh text
20+
*.svg text
21+
*.tld text
22+
*.txt text
23+
*.xml text
24+
25+
# These files are binary and should be left untouched
26+
# (binary is a macro for -text -diff)
27+
*.class binary
28+
*.dll binary
29+
*.ear binary
30+
*.gif binary
31+
*.ico binary
32+
*.jar binary
33+
*.jpg binary
34+
*.jpeg binary
35+
*.png binary
36+
*.so binary
37+
*.war binary

CONTRIBUTING.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ please ask a question on [dW Answers][dw] or [Stack Overflow][stackoverflow].
88
If you encounter an issue with the Java SDK, you are welcome to submit a [bug report](https://github.com/watson-developer-cloud/java-sdk/issues).
99
Before that, please search for similar issues. It's possible somebody has encountered this issue already.
1010

11-
## Pull Requests
11+
# Pull Requests
1212

1313
If you want to contribute to the repository, here's a quick guide:
1414
1. Fork the repository
@@ -20,6 +20,33 @@ If you want to contribute to the repository, here's a quick guide:
2020
4. Commit your changes
2121
5. Push to your fork and submit a pull request to the **dev** branch
2222

23+
# Developer's Certificate of Origin 1.1
24+
25+
By making a contribution to this project, I certify that:
26+
27+
(a) The contribution was created in whole or in part by me and I
28+
have the right to submit it under the open source license
29+
indicated in the file; or
30+
31+
(b) The contribution is based upon previous work that, to the best
32+
of my knowledge, is covered under an appropriate open source
33+
license and I have the right under that license to submit that
34+
work with modifications, whether created in whole or in part
35+
by me, under the same open source license (unless I am
36+
permitted to submit under a different license), as indicated
37+
in the file; or
38+
39+
(c) The contribution was provided directly to me by some other
40+
person who certified (a), (b) or (c) and I have not modified
41+
it.
42+
43+
(d) I understand and agree that this project and the contribution
44+
are public and that a record of the contribution (including all
45+
personal information I submit with it, including my sign-off) is
46+
maintained indefinitely and may be redistributed consistent with
47+
this project or the open source license(s) involved.
48+
49+
2350
## Additional Resources
2451
+ [General GitHub documentation](https://help.github.com/)
2552
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)

README.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ APIs and SDKs that use cognitive computing to solve complex problems.
2626
* [Language Identification](#language-identification)
2727
* [Language Translation](#language-translation)
2828
* [Machine Translation](#machine-translation)
29-
* [Message Resonance](#message-resonance)
3029
* [Natural Language Classifier](#natural-language-classifier)
3130
* [Personality Insights](#personality-insights)
32-
* [Question and Answer](#question-and-answer)
3331
* [Relationship Extraction](#relationship-extraction)
3432
* [Speech to Text](#speech-to-text)
3533
* [Text to Speech](#text-to-speech)
@@ -222,19 +220,6 @@ TranslationResult translationResult = service.translate("hello", "en", "es");
222220
System.out.println(translationResult);
223221
```
224222

225-
### Message Resonance
226-
Send a word and Watson responds with the resonance scoring for the word, allowing you to enhance the effectiveness of your language for the intended audience.
227-
Example: Get resonance information for individual words in a sentence from the [Message Resonance][message_resonance] service.
228-
229-
```java
230-
MessageResonance service = new MessageResonance();
231-
service.setUsernameAndPassword("<username>", "<password>");
232-
233-
service.setDataset(MessageResonanceDataset.BIG_DATA);
234-
Message message = service.getResonance("IBM Watson Developer Cloud");
235-
System.out.println(message);
236-
```
237-
238223
### Natural Language Classifier
239224
Use [Natural Language Classifier](http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/nl-classifier/) service to create a classifier instance by providing a set of representative strings and a set of one or more correct classes for each as training. Then use the trained classifier to classify your new question for best matching answers or to retrieve next actions for your application.
240225

@@ -283,18 +268,6 @@ System.out.println(profile);
283268
authentication errors, remember that the Personality Insights service is not
284269
a free service.
285270

286-
### Question and Answer
287-
Ask a healthcare-related question of the [Question and Answer][question_and_answer] service.
288-
289-
```java
290-
QuestionAndAnswer service = new QuestionAndAnswer();
291-
service.setUsernameAndPassword("<username>", "<password>");
292-
293-
service.setDataset(QuestionAndAnswerDataset.HEALTHCARE);
294-
WatsonAnswer watsonAnswers = service.ask("What is HIV?");
295-
296-
System.out.println(watsonAnswers);
297-
```
298271

299272
### Relationship Extraction
300273
Analyze an English news article and get the relationships between sentence
@@ -444,7 +417,7 @@ System.out.println(recognizedImage);
444417
## Android
445418

446419
The library works well on Android. It depends on
447-
[Apache HttpClient][] (including the [HttpMime][] module) and [json-java][].
420+
[OkHttp][] and [gson][].
448421
Android SDK already comes with these two libraries so you don't need to include
449422
them when using the library there.
450423

@@ -506,9 +479,6 @@ available in [LICENSE](LICENSE).
506479
## Contributing
507480
See [CONTRIBUTING.md](CONTRIBUTING.md).
508481

509-
510-
[question_and_answer]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/qaapi/
511-
[message_resonance]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/mrapi/
512482
[personality_insights]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/personality-insights/
513483
[language_identification]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/lidapi/
514484
[machine_translation]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/mtapi/
@@ -531,11 +501,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
531501
[alchemy_data_news]: http://www.alchemyapi.com/products/alchemydata-news
532502

533503
[wdc]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/
534-
[vcap_environment]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/getting_started/index.html#EnvVars
535504
[bluemix]: https://console.ng.bluemix.net
536505
[Gradle]: http://www.gradle.org/
537-
[Apache HttpClient]: http://hc.apache.org/httpcomponents-client-ga/
538-
[HttpMime]: http://hc.apache.org/httpcomponents-client-ga/httpmime
539-
[json-java]: http://json.org/java/
506+
[OkHttp]: http://square.github.io/okhttp/
507+
[gson]: https://github.com/google/gson
540508
[apache_maven]: http://maven.apache.org/
541509
[releases]: https://github.com/watson-developer-cloud/java-sdk/releases

build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ sourceCompatibility = 1.6
66
targetCompatibility = 1.6
77
group = 'com.ibm.watson.developercloud'
88
archivesBaseName = 'watson-developer-cloud'
9-
version = '1.1.0'
9+
version = '2.0.0'
1010

1111
description = 'Client library to use the IBM Watson Services and AlchemyAPI'
1212

1313
repositories {
1414
mavenCentral()
1515
}
1616
dependencies {
17-
compile group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.0.3'
17+
compile group: 'com.squareup.okhttp', name: 'okhttp', version:'2.5.0'
1818
compile group: 'com.google.code.gson', name: 'gson', version:'2.3.1'
19-
compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.0.3'
2019
compile group: 'org.apache.commons', name: 'commons-csv', version:'1.2'
2120
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.3.2'
2221
testCompile group: 'org.mockito', name: 'mockito-core', version:'1.10.19'
Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
/**
22
* Copyright 2015 IBM Corp. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. 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 distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
1513
*/
1614
package com.ibm.watson.developer_cloud.alchemy_data_news.v1;
1715

@@ -24,13 +22,13 @@
2422

2523
public class AlchemyDataNewsExample {
2624

27-
public static void main(String[] args) throws URISyntaxException, FileNotFoundException {
28-
AlchemyDataNews service = new AlchemyDataNews();
29-
service.setApiKey("<api_key>");
25+
public static void main(String[] args) throws URISyntaxException, FileNotFoundException {
26+
final AlchemyDataNews service = new AlchemyDataNews();
27+
service.setApiKey("<api_key>");
3028

31-
VolumeResult result = service.getVolume("now-7d", "now", "12h");
29+
final VolumeResult result = service.getVolume("now-7d", "now", "12h");
3230

33-
System.out.println(result);
34-
}
31+
System.out.println(result);
32+
}
3533

3634
}
Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
/**
22
* Copyright 2015 IBM Corp. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. 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 distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
1513
*/
1614
package com.ibm.watson.developer_cloud.alchemy_language.v1;
1715

@@ -26,15 +24,16 @@
2624

2725
public class AlchemyLanguageExample {
2826

29-
public static void main(String[] args) throws URISyntaxException, FileNotFoundException {
30-
AlchemyLanguage service = new AlchemyLanguage();
31-
service.setApiKey("<api_key>");
27+
public static void main(String[] args) throws URISyntaxException, FileNotFoundException {
28+
final AlchemyLanguage service = new AlchemyLanguage();
29+
service.setApiKey("<api_key>");
3230

33-
Map<String,Object> params = new HashMap<String, Object>();
34-
params.put(AlchemyLanguage.TEXT, "IBM Watson won the Jeopardy television show hosted by Alex Trebek");
35-
DocumentSentiment sentiment = service.getSentiment(params);
31+
final Map<String, Object> params = new HashMap<String, Object>();
32+
params.put(AlchemyLanguage.TEXT,
33+
"IBM Watson won the Jeopardy television show hosted by Alex Trebek");
34+
final DocumentSentiment sentiment = service.getSentiment(params);
3635

37-
System.out.println(sentiment);
38-
}
36+
System.out.println(sentiment);
37+
}
3938

4039
}
Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
/**
22
* Copyright 2015 IBM Corp. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. 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 distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
1513
*/
1614
package com.ibm.watson.developer_cloud.alchemy_vision.v1;
1715

@@ -27,15 +25,15 @@
2725

2826
public class AlchemyVisionExample {
2927

30-
public static void main(String[] args) throws URISyntaxException, FileNotFoundException {
31-
AlchemyVision service = new AlchemyVision();
32-
service.setApiKey("<api_key>");
28+
public static void main(String[] args) throws URISyntaxException, FileNotFoundException {
29+
final AlchemyVision service = new AlchemyVision();
30+
service.setApiKey("<api_key>");
3331

34-
Map<String,Object> params = new HashMap<String, Object>();
35-
params.put(AlchemyVision.IMAGE, new File("src/test/resources/obama.jpg"));
36-
ImageKeywords keywords = service.getImageKeywords(params);
32+
final Map<String, Object> params = new HashMap<String, Object>();
33+
params.put(AlchemyVision.IMAGE, new File("src/test/resources/obama.jpg"));
34+
final ImageKeywords keywords = service.getImageKeywords(params);
3735

38-
System.out.println(keywords);
39-
}
36+
System.out.println(keywords);
37+
}
4038

4139
}

0 commit comments

Comments
 (0)