Skip to content

Commit 853f835

Browse files
committed
Merge branch 'master' into add-license-header-plugin
Conflicts: build.gradle sample/HelloWorld/README.md sample/HelloWorld/build.gradle sample/HelloWorld/src/main/java/com/example/FreeMarkerTemplateView.java sample/HelloWorld/src/main/java/com/example/HelloWorldServer.java settings.gradle src/main/java/com/opentok/OpenTok.java src/main/java/com/opentok/Role.java src/main/java/com/opentok/constants/package-info.java src/main/java/com/opentok/exception/RequestException.java src/test/java/com/opentok/test/OpenTokTest.java
2 parents 3a13723 + 953df9f commit 853f835

File tree

83 files changed

+8928
-382
lines changed

Some content is hidden

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

83 files changed

+8928
-382
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.class
2+
*.DS_Store
23

34
# Package Files
45
*.jar

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
language: java
22
jdk:
3-
- openjdk7
4-
- openjdk6
5-
- oraclejdk7
3+
- openjdk7
4+
- openjdk6
5+
- oraclejdk7
6+
- oraclejdk8
7+
notifications:
8+
slack:
9+
secure: fGRoClN1IQiZvokEiqmKOrF7EeaNQDHDHqUMaT4n7d3qW2fMe3N8ZLxlIDlzgJ2pv09VWqK7rmPgdhJR8yVG7OE4QQ5kzR59xD8ePN0j0jf6W6eOBPq3a9UUarnny21LFsShvRMZ/BaXcvTox1zMVltpMGFw2K4ijH8+ZvdkNz8=

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing Guidelines
2+
3+
For anyone looking to get involved to this project, we are glad to hear from you. Here are a few types of contributions
4+
that we would be interested in hearing about.
5+
6+
* Bug fixes
7+
- If you find a bug, please first report it using Github Issues.
8+
- Issues that have already been identified as a bug will be labelled `bug`.
9+
- If you'd like to submit a fix for a bug, send a Pull Request from your own fork and mention the Issue number.
10+
+ Include a test that isolates the bug and verifies that it was fixed.
11+
* New Features
12+
- If you'd like to accomplish something in the library that it doesn't already do, describe the problem in a new
13+
Github Issue.
14+
- Issues that have been identified as a feature request will be labelled `enhancement`.
15+
- If you'd like to implement the new feature, please wait for feedback from the project maintainers before spending
16+
too much time writing the code. In some cases, `enhancement`s may not align well with the project objectives at
17+
the time.
18+
* Tests, Documentation, Miscellaneous
19+
- If you think the test coverage could be improved, the documentation could be clearer, you've got an alternative
20+
implementation of something that may have more advantages, or any other change we would still be glad hear about
21+
it.
22+
- If its a trivial change, go ahead and send a Pull Request with the changes you have in mind
23+
- If not, open a Github Issue to discuss the idea first.
24+
25+
## Requirements
26+
27+
For a contribution to be accepted:
28+
29+
* The test suite must be complete and pass
30+
* Code must follow existing styling conventions
31+
* Commit messages must be descriptive. Related issues should be mentioned by number.
32+
33+
If the contribution doesn't meet these criteria, a maintainer will discuss it with you on the Issue. You can still
34+
continue to add more commits to the branch you have sent the Pull Request from.
35+
36+
## How To
37+
38+
1. Fork this repository on GitHub.
39+
1. Clone/fetch your fork to your local development machine.
40+
1. Create a new branch (e.g. `issue-12`, `feat.add_foo`, etc) and check it out.
41+
1. Make your changes and commit them. (Did the tests pass?)
42+
1. Push your new branch to your fork. (e.g. `git push myname issue-12`)
43+
1. Open a Pull Request from your new branch to the original fork's `master` branch.
44+
45+
## Developer Guidelines
46+
47+
See DEVELOPING.md for guidelines for developing this project.

DEVELOPING.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Development Guidelines
2+
3+
This document describes tools, tasks and workflow that one needs to be familiar with in order to effectively maintain
4+
this project. If you use this package within your own software as is but don't plan on modifying it, this guide is
5+
**not** for you.
6+
7+
## Tools
8+
9+
* [Gradle](http://www.gradle.org/): used to run predefined tasks. It also manages dependencies for the project. If you
10+
do not have it already installed, you won't need to install it. The gradle wrapper is included in the project and you
11+
can invoke it using `./gradlew` substituted for `gradle`.
12+
13+
## Tasks
14+
15+
### Building
16+
17+
Gradle's [Java Plugin](http://www.gradle.org/docs/current/userguide/java_plugin.html) provides various tasks to build
18+
this software. The most common tasks are:
19+
20+
* `gradle build` - build jars and test
21+
* `gradle clean` - remove previously built artifacts.
22+
23+
### Testing
24+
25+
This project's tests are written as JUnit test cases. Common tasks:
26+
27+
* `gradle check` - run the test suite.
28+
29+
### Generating Documentation
30+
31+
This project's reference documentation is generated by Javadoc and resides in the `docs` directory of the project.
32+
Common tasks:
33+
34+
* `gradle javadoc` - generate the reference documentation locally.
35+
36+
### Releasing
37+
38+
In order to create a release, the following should be completed in order.
39+
40+
1. Ensure all the tests are passing (`gradle check`) and that there is enough test coverage.
41+
1. Make sure you are on the `master` branch of the repository, with all changes merged/commited already.
42+
1. Update the version number in the source code and the README. See [Versioning](#versioning) for information
43+
about selecting an appropriate version number. Files to change:
44+
- src/main/java/com/opentok/constants/Version.java
45+
- build.gradle
46+
- README.md
47+
1. Commit the version number change with the message "Update to version x.x.x", substituting the new version number.
48+
1. Create a git tag: `git tag -a vx.x.x -m "Release vx.x.x"`
49+
1. Ensure that you have permission to update the OSSRH repository. The following system properties must be set:
50+
- `ossrhUsername`
51+
- `ossrhPassword`
52+
- `signing.keyId`
53+
- `signing.password`
54+
- `signing.secretKeyRingFile`
55+
1. Run `gradle uploadArchives` to create a staging release.
56+
1. Login to [OSSRH](https://oss.sonatype.org/) and promote the staging release to a public release.
57+
1. Change the version number for future development by incrementing the patch number and
58+
adding "-alpha.1" in each file except the README. Building may have generated the docs files once again, so to clear
59+
them run `git checkout -- docs/`. Then stage the remaining files and commit with the message
60+
"Begin development on next version".
61+
1. Push the changes to the source repository: `git push origin master; git push --tags origin`
62+
1. Find the latest .jar in the build directory and upload this as an attached to the latest GitHub Release. Add release
63+
notes with a description of changes and fixes.
64+
65+
### IDE Integration
66+
67+
Gradle's [IDEA Plugin](http://www.gradle.org/docs/current/userguide/idea_plugin.html) and
68+
[Eclipse Plugin](http://www.gradle.org/docs/current/userguide/eclipse_plugin.html) provide tasks to generate project
69+
files for these IDEs. In general, neither of these are necessary to work on the project. If you prefer to use one of
70+
these IDEs, you may find those tasks helpful.
71+
72+
## Workflow
73+
74+
### Versioning
75+
76+
The project uses [semantic versioning](http://semver.org/) as a policy for incrementing version numbers. For planned
77+
work that will go into a future version, there should be a Milestone created in the Github Issues named with the version
78+
number (e.g. "v2.2.1").
79+
80+
During development the version number should end in "-alpha.x" or "-beta.x", where x is an increasing number starting from 1.
81+
82+
### Branches
83+
84+
* `master` - the main development branch.
85+
* `feat.foo` - feature branches. these are used for longer running tasks that cannot be accomplished in one commit.
86+
once merged into master, these branches should be deleted.
87+
* `vx.x.x` - if development for a future version/milestone has begun while master is working towards a sooner
88+
release, this is the naming scheme for that branch. once merged into master, these branches should be deleted.
89+
90+
### Tags
91+
92+
* `vx.x.x` - commits are tagged with a final version number during release.
93+
94+
### Issues
95+
96+
Issues are labelled to help track their progress within the pipeline.
97+
98+
* no label - these issues have not been triaged.
99+
* `bug` - confirmed bug. aim to have a test case that reproduces the defect.
100+
* `enhancement` - contains details/discussion of a new feature. it may not yet be approved or placed into a
101+
release/milestone.
102+
* `wontfix` - closed issues that were never addressed.
103+
* `duplicate` - closed issue that is the same to another referenced issue.
104+
* `question` - purely for discussion
105+
106+
### Management
107+
108+
When in doubt, find the maintainers and ask.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 TokBox, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 72 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# OpenTok Java SDK
22

3-
**TODO**: change this to opentok fork instead of aoberoi
4-
5-
[![Build Status](https://travis-ci.org/aoberoi/Opentok-Java-SDK.svg?branch=modernization)](https://travis-ci.org/aoberoi/Opentok-Java-SDK)
3+
[![Build Status](https://travis-ci.org/opentok/Opentok-Java-SDK.svg)](https://travis-ci.org/opentok/Opentok-Java-SDK)
64

75
The OpenTok Java SDK lets you generate
86
[sessions](http://tokbox.com/opentok/tutorials/create-session/) and
97
[tokens](http://tokbox.com/opentok/tutorials/create-token/) for [OpenTok](http://www.tokbox.com/)
10-
applications that run on the JVM. This version of the SDK also includes support for working with OpenTok
11-
2.0 archives.
8+
applications that run on the JVM. This version of the SDK also includes support for working
9+
with [OpenTok 2.0 archives](http://tokbox.com/#archiving).
10+
11+
If you are updating from a previous version of this SDK, see
12+
[Important changes since v2.2.0](#important-changes-since-v220).
13+
1214

1315
# Installation
1416

@@ -23,9 +25,9 @@ When you use Maven as your build tool, you can manage dependencies in the `pom.x
2325

2426
```xml
2527
<dependency>
26-
<groupId>com.opentok</groupId>
28+
<groupId>com.tokbox</groupId>
2729
<artifactId>opentok-server-sdk</artifactId>
28-
<version>2.2.0</version>
30+
<version>2.2.2</version>
2931
</dependency>
3032
```
3133

@@ -35,13 +37,17 @@ When you use Gradle as your build tool, you can manage dependencies in the `buil
3537

3638
```groovy
3739
dependencies {
38-
compile group: 'com.opentok', name: 'opentok-server-sdk', version: '2.2.0'
40+
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '2.2.2'
3941
}
4042
```
4143

4244
## Manually:
4345

44-
**TODO**: download from releases page?
46+
Download the jar file for the latest release from the
47+
[Releases](https://github.com/opentok/opentok-java-sdk/releases) page. Include it in the classpath
48+
for your own project by
49+
[using the JDK directly](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html)
50+
or in your IDE of choice.
4551

4652
# Usage
4753

@@ -62,28 +68,35 @@ OpenTok opentok = new OpenTok(apiKey, apiSecret)
6268
## Creating Sessions
6369

6470
To create an OpenTok Session, use the `OpenTok` instance's `createSession(SessionProperties properties)`
65-
method. The `properties` parameter is optional and it is used to specify whether you are creating a
66-
p2p Session and specifying a location hint. An instance can be initialized using the
67-
`com.opentok.SessionProperties.Builder` class. The `sessionId` property of the returned `com.opentok.Session`
68-
instance, which you can read using the `getSessionId()` method, is useful to get a sessionId that can
69-
be saved to a persistent store (e.g. database).
71+
method. The `properties` parameter is optional and it is used to specify two things:
72+
73+
* Whether the session uses the OpenTok Media Router
74+
* A location hint for the OpenTok server.
75+
76+
An instance can be initialized using the `com.opentok.SessionProperties.Builder` class.
77+
The `sessionId` property of the returned `com.opentok.Session` instance, which you can read using
78+
the `getSessionId()` method, is useful to get an identifier that can be saved to a persistent store
79+
(such as a database).
7080

7181
```java
82+
import com.opentok.MediaMode;
7283
import com.opentok.Session;
7384
import com.opentok.SessionProperties;
7485

75-
// Just a plain Session
86+
// A session that attempts to stream media directly between clients:
7687
Session session = opentok.createSession();
77-
// A p2p Session
88+
89+
// A session that uses the OpenTok Media Router:
7890
Session session = opentok.createSession(new SessionProperties.Builder()
79-
.p2p(true)
91+
.mediaMode(MediaMode.ROUTED)
8092
.build());
81-
// A Session with a location hint
93+
94+
// A Session with a location hint:
8295
Session session = opentok.createSession(new SessionProperties.Builder()
8396
.location("12.34.56.78")
8497
.build());
8598

86-
// Store this sessionId in the database for later use
99+
// Store this sessionId in the database for later use:
87100
String sessionId = session.getSessionId();
88101
```
89102

@@ -98,7 +111,7 @@ instance can be initialized using the `TokenOptions.Builder` class.
98111

99112
```java
100113
import com.opentok.TokenOptions;
101-
import com.opentok.Roles;
114+
import com.opentok.Role;
102115

103116
// Generate a token from just a sessionId (fetched from a database)
104117
String token = opentok.generateToken(sessionId);
@@ -107,7 +120,7 @@ String token = session.generateToken();
107120

108121
// Set some options in a token
109122
String token = session.generateToken(new TokenOptions.Builder()
110-
.role(Roles.MODERATOR)
123+
.role(Role.MODERATOR)
111124
.expireTime((System.currentTimeMillis() / 1000L) + (7 * 24 * 60 * 60)) // in one week
112125
.data("name=Johnny")
113126
.build());
@@ -169,9 +182,18 @@ List<Archive> archives = opentok.listArchives(0, 50);
169182
List<Archive> archives = opentok.listArchives(50, 50);
170183
```
171184

185+
# Samples
186+
187+
There are two sample applications included with the SDK. To get going as fast as possible, clone the whole
188+
repository and follow the Walkthroughs:
189+
190+
* [HelloWorld](sample/HelloWorld/README.md)
191+
* [Archiving](sample/Archiving/README.md)
192+
172193
# Documentation
173194

174-
**TODO**: Reference documentation is available at <http://opentok.github.io/opentok-java-sdk/>
195+
Reference documentation is available at <http://www.tokbox.com/opentok/libraries/server/java/reference/index.html> and in the
196+
docs directory of the SDK.
175197

176198
# Requirements
177199

@@ -180,26 +202,47 @@ You need an OpenTok API key and API secret, which you can obtain at <https://das
180202
The OpenTok Java SDK requires JDK 6 or greater to compile. Runtime requires Java SE 6 or greater.
181203
This project is tested on both OpenJDK and Oracle implementations.
182204

205+
183206
# Release Notes
184207

185-
**TODO**: See the [Releases](https://github.com/opentok/opentok-java-sdk/releases) page for details
208+
See the [Releases](https://github.com/opentok/opentok-java-sdk/releases) page for details
186209
about each release.
187210

188-
## Important changes in v2.0
211+
# Important changes since v2.2.0
212+
213+
**Changes in v2.2.1:**
214+
215+
The default setting for the `createSession()` method is to create a session with the media mode set
216+
to relayed. In previous versions of the SDK, the default setting was to use the OpenTok Media Router
217+
(with the media mode set to routed in v2.2.0, or with p2p.preference="disabled" in previous
218+
versions). In a relayed session, clients will attempt to send streams directly between each other
219+
(peer to peer); and if clients cannot connect due to firewall restrictions, the session uses the
220+
OpenTok TURN server to relay audio-video streams.
221+
222+
**Changes in v2.2.0:**
189223

190224
This version of the SDK includes support for working with OpenTok 2.0 archives. (This API does not
191225
work with OpenTok 1.0 archives.)
192226

227+
This version of the SDK includes a number of improvements in the API design. These include a number
228+
of API changes. See the OpenTok 2.2 SDK Reference for details on the new API.
229+
230+
The API_Config class has been removed. Store your OpenTok API key and API secret in code outside of the SDK files.
231+
232+
The `create_session()` method has been renamed `createSession()`. Also, the method has changed to
233+
take one parameter: a SessionProperties object. You now generate a SessionProperties object using a Builder pattern.
234+
235+
The `generate_token()` method has been renamed `generateToken()`. Also, the method has changed to
236+
take two parameters: the session ID and a TokenOptions object.
237+
193238
# Development and Contributing
194239

195-
Interested in contributing? We <3 pull requests! File a new
196-
[Issue](https://github.com/opentok/opentok-java-sdk/issues) or take a look at the existing ones. If
197-
you are going to send us a pull request, please try to run the test suite first and also include
198-
tests for your changes.
240+
Interested in contributing? We :heart: pull requests! See the [Development](DEVELOPING.md) and
241+
[Contribution](CONTRIBUTING.md) guidelines.
199242

200243
# Support
201244

202-
See <http://tokbox.com/opentok/support/> for all our support options.
245+
See <https://support.tokbox.com> for all our support options.
203246

204247
Find a bug? File it on the [Issues](https://github.com/opentok/opentok-java-sdk/issues) page. Hint:
205248
test cases are really helpful!

0 commit comments

Comments
 (0)