@@ -53,7 +53,6 @@ public class OpenTok {
53
53
private HttpClient client ;
54
54
static protected ObjectReader archiveReader = new ObjectMapper ().reader (Archive .class );
55
55
static protected ObjectReader archiveListReader = new ObjectMapper ().reader (ArchiveList .class );
56
-
57
56
58
57
/**
59
58
* Creates an OpenTok object.
@@ -68,20 +67,17 @@ public class OpenTok {
68
67
* page.)
69
68
*/
70
69
public OpenTok (int apiKey , String apiSecret ) {
71
-
72
70
this .apiKey = apiKey ;
73
71
this .apiSecret = apiSecret ;
74
72
this .client = new HttpClient .Builder (apiKey , apiSecret ).build ();
75
73
}
76
-
74
+
77
75
private OpenTok (int apiKey , String apiSecret , HttpClient httpClient ) {
78
-
79
76
this .apiKey = apiKey ;
80
77
this .apiSecret = apiSecret ;
81
- this .client =httpClient ;
82
-
83
- }
78
+ this .client = httpClient ;
84
79
80
+ }
85
81
86
82
/**
87
83
* Creates a token for connecting to an OpenTok session. In order to
@@ -114,7 +110,8 @@ private OpenTok(int apiKey, String apiSecret, HttpClient httpClient) {
114
110
* String role = Role.SUBSCRIBER;
115
111
*
116
112
* // Generate a token:
117
- * TokenOptions options = new TokenOptions.Buider().role(role).data(connectionMetadata).build();
113
+ * TokenOptions options = new TokenOptions.Buider().role(role).data(connectionMetadata)
114
+ * .build();
118
115
* String token = sdk.generateToken(sessionId, options);
119
116
* System.out.println(token);
120
117
* }
@@ -142,7 +139,8 @@ private OpenTok(int apiKey, String apiSecret, HttpClient httpClient) {
142
139
*
143
140
* @return The token string.
144
141
*/
145
- public String generateToken (String sessionId , TokenOptions tokenOptions ) throws OpenTokException {
142
+ public String generateToken (String sessionId , TokenOptions tokenOptions )
143
+ throws OpenTokException {
146
144
List <String > sessionIdParts = null ;
147
145
if (sessionId == null || sessionId == "" ) {
148
146
throw new InvalidArgumentException ("Session not valid" );
@@ -243,7 +241,8 @@ public String generateToken(String sessionId) throws OpenTokException {
243
241
* String API_SECRET = ""; // Replace with your OpenTok API secret.
244
242
* OpenTok sdk = new OpenTok(API_KEY, API_SECRET);
245
243
*
246
- * SessionProperties sp = new SessionProperties().Builder().mediaMode(MediaMode.RELAYED).build();
244
+ * SessionProperties sp = new SessionProperties().Builder().mediaMode(MediaMode.RELAYED)
245
+ * .build();
247
246
*
248
247
* Session session = sdk.createSession(sp);
249
248
* System.out.println(session.getSessionId());
@@ -294,7 +293,8 @@ public Session createSession(SessionProperties properties) throws OpenTokExcepti
294
293
return new Session (readXml (xpathQuery , xmlResponse ), apiKey , apiSecret );
295
294
}
296
295
} catch (XPathExpressionException e ) {
297
- throw new OpenTokException ("Cannot create session. Could not read the response: " + xmlResponse );
296
+ throw new OpenTokException (
297
+ "Cannot create session. Could not read the response: " + xmlResponse );
298
298
}
299
299
}
300
300
@@ -437,7 +437,8 @@ public ArchiveList listArchives(int offset, int count) throws OpenTokException {
437
437
* @return The Archive object. This object includes properties defining the
438
438
* archive, including the archive ID.
439
439
*/
440
- public Archive startArchive (String sessionId , ArchiveProperties properties ) throws OpenTokException {
440
+ public Archive startArchive (String sessionId , ArchiveProperties properties )
441
+ throws OpenTokException {
441
442
if (sessionId == null || sessionId == "" ) {
442
443
throw new InvalidArgumentException ("Session not valid" );
443
444
}
@@ -516,19 +517,17 @@ public Builder proxy(Proxy proxy) {
516
517
}
517
518
518
519
public OpenTok build () {
519
-
520
520
HttpClient .Builder clientBuilder = new HttpClient .Builder (apiKey , apiSecret );
521
-
521
+
522
522
if (this .apiUrl != null ) {
523
523
clientBuilder .apiUrl (this .apiUrl );
524
524
}
525
- if (this .proxy != null ) {
525
+ if (this .proxy != null ) {
526
526
clientBuilder .proxy (this .proxy );
527
527
}
528
528
529
529
return new OpenTok (this .apiKey , this .apiSecret , clientBuilder .build ());
530
530
531
-
532
531
}
533
532
534
533
}
0 commit comments