Merge branch 'sharedNotes' into sharedNotes-updated

Conflicts:
	bigbluebutton-client/build.xml
	bigbluebutton-client/resources/prod/BigBlueButton.html
This commit is contained in:
Felipe Cecagno 2011-09-19 15:56:04 -03:00
commit 7390c477f8
17 changed files with 530 additions and 17 deletions

0
bbb-video/vm-build.sh Normal file → Executable file
View File

0
bbb-voice/vm-build.sh Normal file → Executable file
View File

View File

@ -118,6 +118,10 @@ dependencies {
// Libraries needed for scala api
compile 'org.scala-lang:scala-library:2.7.7'
compile 'org/bigbluebutton/common:bbb-common-message:0.7@jar'
//redis
compile 'redis.clients:jedis:1.5.1'
compile 'commons-pool:commons-pool:1.5.5'
}
test {

View File

@ -0,0 +1,140 @@
/**
* ===License Header===
*
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
* ===License Header===
*/
package org.bigbluebutton.conference.service.rtmpadapter;
import org.red5.server.api.so.ISharedObject;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import redis.clients.jedis.Jedis;
import org.red5.server.api.IScope;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.IApplication;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.Red5;
import org.red5.server.api.so.ISharedObject;
import org.slf4j.Logger;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
import java.lang.Runnable;
import redis.clients.jedis.JedisException;
public class ChannelManager implements Runnable {
private static Logger log = Red5LoggerFactory.getLogger(RTMPAdapterApp.class, "bigbluebutton");
private HashMap<String,HashMap<String,ISharedObject>> sharedObjects;
private RTMPAdapterApp application;
private PubSubListener pubSubListener;
private Jedis jedisSub;
private Jedis jedisPub;
public ChannelManager(RTMPAdapterApp application){
this.application = application;
sharedObjects = new HashMap<String, HashMap<String,ISharedObject>>();
connectToRedis();
}
private void connectToRedis(){
jedisPub = new Jedis("localhost", 6379, 0);
jedisPub.set("fooPub", "barPub");
}
public void run(){
while(true){
jedisSub = new Jedis("localhost", 6379, 0);
jedisSub.set("fooSub", "barSub"); //If I remove this before pubsub, jedis will throw an exception.
log.info("Subscribing to Redis");
pubSubListener = new PubSubListener(this);
jedisSub.psubscribe(pubSubListener, "bigbluebutton:*");
}
}
public void subscribe(){
Thread t = new Thread(this);
t.start();
}
public boolean hasSharedObject(String sharedObjectScope, String appName){
boolean contains = false;
if (sharedObjects.containsKey(sharedObjectScope)){
HashMap<String, ISharedObject> map = sharedObjects.get(sharedObjectScope);
if (map.containsKey(appName)){
contains = true;
}
}
return contains;
}
public void registerRoom(String sharedObjectScope){
log.info("RTMPAdapter ChannelManager creating room for scope " + sharedObjectScope);
sharedObjects.put(sharedObjectScope, new HashMap<String,ISharedObject>());
}
public void removeRoom(String sharedObjectScope){
log.info("RTMPAdapter ChannelManager destroying room for scope " + sharedObjectScope);
sharedObjects.remove(sharedObjectScope);
}
public void registerSharedObject(String sharedObjectScope, String appName, ISharedObject sharedObject){
if (hasSharedObject(sharedObjectScope, appName)) return;
log.info("RTMPAdapter ChannelManager requesting room for scope: " + sharedObjectScope);
HashMap<String, ISharedObject> map = sharedObjects.get(sharedObjectScope);
map.put(appName, sharedObject);
}
public void sendData(String appName, String clientScope, String method, String data){
log.info("RTMPAdapter sending: bigbluebutton:" + appName + ":" + clientScope + ":" + method + ", data: " + data);
String channel = "bigbluebutton:" + appName + ":" + clientScope + ":" + method;
try{
jedisPub.publish(channel, data);
} catch(JedisException e){
connectToRedis();
jedisPub.publish(channel,data);
}
}
public void receivedMessage(String channel, String message){
log.info("RTMPAdapter received: " + channel + ", data: " + message);
String[] parts = channel.split(":");
String appName = parts[1];
String sharedObjectScope = parts[2];
String method = parts[3];
if (hasSharedObject(sharedObjectScope, appName)){
ISharedObject sharedObject = sharedObjects.get(sharedObjectScope).get(appName);
List<String> args = new ArrayList<String>();
args.add(message);
sharedObject.sendMessage(method, args);
}
}
public void addChannel(String appName, IScope scope){
}
}

View File

@ -0,0 +1,70 @@
/**
* ===License Header===
*
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
* ===License Header===
*/
package org.bigbluebutton.conference.service.rtmpadapter;
import org.red5.compatibility.flex.messaging.io.ArrayCollection;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.IApplication;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.Red5;
import org.red5.server.api.so.ISharedObject;
import org.slf4j.Logger;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
public class PubSubListener extends JedisPubSub {
private static Logger log = Red5LoggerFactory.getLogger(RTMPAdapterApp.class, "bigbluebutton");
private static final String APP = "RTMPAdapter";
private Jedis jedis;
private ChannelManager channelManager;
public PubSubListener(ChannelManager channelManager){
this.channelManager = channelManager;
}
public void onMessage(String channel, String message) {
channelManager.receivedMessage(channel, message);
}
public void onSubscribe(String channel, int subscribedChannels) {
log.info("PubSubListener subscribing to channel: " + channel + " num channels: " + subscribedChannels);
}
public void onUnsubscribe(String channel, int subscribedChannels) {
}
public void onPSubscribe(String pattern, int subscribedChannels) {
log.info("PubSubListener subscribing to: " + pattern + " num channels: " + subscribedChannels);
}
public void onPUnsubscribe(String pattern, int subscribedChannels) {
}
public void onPMessage(String pattern, String channel,
String message) {
channelManager.receivedMessage("pattern message " + channel, message);
}
}

View File

@ -0,0 +1,128 @@
/**
* ===License Header===
*
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
* ===License Header===
*/
package org.bigbluebutton.conference.service.rtmpadapter;
import java.util.ArrayList;
import java.util.List;
import org.red5.compatibility.flex.messaging.io.ArrayCollection;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.IApplication;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.Red5;
import org.red5.server.api.so.ISharedObject;
import org.slf4j.Logger;
import redis.clients.jedis.Jedis;
public class RTMPAdapterApp extends MultiThreadedApplicationAdapter implements IApplication {
private static Logger log = Red5LoggerFactory.getLogger(RTMPAdapterApp.class, "bigbluebutton");
private static final String APP = "RTMPAdapter";
private ChannelManager channelManager;
@Override
public boolean appStart(IScope app){
log.info("Starting RTMPAdapterApp");
this.scope = app;
channelManager = new ChannelManager(this);
channelManager.subscribe();
return true;
}
@Override
public void appStop(IScope scope){
}
public void sendData(String appName, String method, String data){
IScope clientScope = getLocalScope();
String clientScopeId = clientScope.getName();
ISharedObject sharedObject = getSharedObject(clientScope, appName);
if (!channelManager.hasSharedObject(clientScopeId, appName) && (sharedObject != null)) channelManager.registerSharedObject(clientScopeId, appName, sharedObject);
channelManager.sendData(appName, clientScopeId, method, data);
}
public void message(String channel, String message){
log.info("got message from redis on channel: " + channel + " - " + message);
}
@Override
public boolean appConnect(IConnection conn, Object[] params) {
return true;
}
@Override
public void appDisconnect(IConnection conn) {
}
@Override
public boolean appJoin(IClient client, IScope scope) {
return true;
}
@Override
public void appLeave(IClient client, IScope scope) {
}
@Override
public boolean roomConnect(IConnection connection, Object[] params) {
return true;
}
@Override
public void roomDisconnect(IConnection connection) {
}
@Override
public boolean roomJoin(IClient client, IScope scope) {
return true;
}
@Override
public void roomLeave(IClient client, IScope scope) {
}
@Override
public boolean roomStart(IScope scope) {
channelManager.registerRoom(scope.getName());
log.info("RTMPAdapter room started: " + scope.getName());
return true;
}
@Override
public void roomStop(IScope scope) {
channelManager.removeRoom(scope.getName());
log.info("RTMPAdapter room ended: " + scope.getName());
}
private IScope getLocalScope(){
return Red5.getConnectionLocal().getScope();
}
}

View File

@ -0,0 +1,45 @@
/**
* ===License Header===
*
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 2.1 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
* ===License Header===
*/
package org.bigbluebutton.conference.service.rtmpadapter;
import java.util.List;
import org.red5.compatibility.flex.messaging.io.ArrayCollection;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
public class RTMPAdapterService {
private static Logger log = Red5LoggerFactory.getLogger(RTMPAdapterService.class, "bigbluebutton");
private RTMPAdapterApp application;
public void setRTMPAdapter(RTMPAdapterApp a){
log.info("RTMPAdapterService: setting application instance");
this.application = a;
}
public void sendData(String appName, String method, String data){
application.sendData(appName, method, data);
}
}

View File

@ -136,6 +136,20 @@
<bean id="whiteboardRoomManager" class="org.bigbluebutton.conference.service.whiteboard.WhiteboardRoomManager"/>
<!-- END WHITEBOARD -->
<!-- BEGIN RTMPAdapter -->
<bean id="RTMPAdapter"
class="org.bigbluebutton.conference.service.rtmpadapter.RTMPAdapterApp">
<!--<property name="channelManager"> <ref local="channelManager"/></property>-->
</bean>
<bean id="rtmpadapter.service" class="org.bigbluebutton.conference.service.rtmpadapter.RTMPAdapterService">
<property name="RTMPAdapter"> <ref local="RTMPAdapter"/></property>
</bean>
<!--<bean id="channelManager" class="org.bigbluebutton.conference.service.rtmpadapter.ChannelManager"/>-->
<!-- END RTMPAdapter -->
<!-- Starting the Spring Integration configuration for JMS integration -->
<!-- INCOMING MESSAGES -->

View File

@ -35,6 +35,7 @@
<ref bean="presentationHandler" />
<ref bean="voiceHandler" />
<ref bean="whiteboardApplication" />
<ref bean="RTMPAdapter" />
</set>
</property>
<property name="recorderApplication"> <ref bean="recorderApplication"/></property>

View File

@ -27,6 +27,7 @@
<property name="DYN_INFO" value="DynamicInfoModule" />
<property name="BREAKOUT" value="BreakoutModule" />
<property name="CLASSROOM_AUDIO" value="ClassroomAudioModule" />
<property name="SHAREDNOTES" value="SharedNotesModule" />
<property name="AVAILABLE_LOCALES" value="az_AZ,bg_BG,cs_CZ,da_DK,de_DE,el_GR,en_US,es_ES,es_LA,fa_IR,fr_FR,fr_CA,hr_HR,hu_HU,id_ID,it_IT,ja_JP,ko_KR,lv_LV,lt_LT,nb_NO,nl_NL,pl_PL,pt_BR,pt_PT,ro_RO,ru_RU,sv_SE,sr_RS,sr_SR,th_TH,tr_TR,vi_VN,uk_UA,zh_CN,zh_TW"/>
@ -178,10 +179,23 @@
<target name="build-dyn" description="Compile Dynamic Info Module">
<build-module src="${SRC_DIR}" target="${DYN_INFO}" />
</target>
<target name="build-sharednotes" description="Compile SharedNotes Module">
<build-module src="${SRC_DIR}" target="${SHAREDNOTES}" />
<echo message="Copying assets for SharedNotesModule" />
<copy todir="${OUTPUT_DIR}/org/bigbluebutton/modules/sharednotes/images/" >
<fileset dir="${BASE_DIR}/src/org/bigbluebutton/modules/sharednotes/images/" />
</copy>
<copy todir="${OUTPUT_DIR}/sharednotes/" >
<fileset dir="${BASE_DIR}/html-template/sharednotes/" />
</copy>
</target>
<!-- just a grouping of modules to compile -->
<target name="build-main-chat-viewers-listeners-present"
depends="build-bbb-main, build-chat, build-viewers, build-listeners, build-present, build-breakout"
depends="build-bbb-main, build-chat, build-viewers, build-listeners, build-present, build-breakout, build-sharednotes"
description="Compile main, chat, viewers, listeners, present, breakout modules">
</target>

View File

@ -33,8 +33,8 @@ Learn more about Flex at http://flex.org
<script src="bbb_deskshare.js" language="javascript"></script>
<!-- Shared Noted javascript files. Uncomment for shared notes module -->
<!--<script src="sharednotes/diff_match_patch_uncompressed.js" language="javascript"></script>-->
<!--<script src="sharednotes/shared_notes.js" language="javascript"></script>-->
<script src="sharednotes/diff_match_patch_uncompressed.js" language="javascript"></script>
<script src="sharednotes/shared_notes.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }

View File

@ -87,8 +87,8 @@
-->
<!--<module name="ExampleChatModule" url="ExampleChatModule.swf?v=56"
uri="rtmp://HOST/bigbluebutton"
host="http://HOST"
uri="rtmp://HOST/bigbluebutton"
host="http://HOST"
/>-->
<!--<module name="BreakoutModule" url="BreakoutModule.swf?v=VERSION"
@ -98,10 +98,10 @@
salt="1708e5ecf25b7142b06f2338b4ea3cf1"
/>-->
<!--<module name="SharedNotesModule" url="SharedNotesModule.swf?v=VERSION"
uri="http://192.168.0.225/bigbluebutton"
<module name="SharedNotesModule" url="SharedNotesModule.swf?v=VERSION"
uri="http://HOST/bigbluebutton"
dependsOn="ViewersModule"
/>-->
/>
</modules>
</config>

View File

@ -33,8 +33,8 @@ Learn more about Flex at http://flex.org
<script src="bbb_deskshare.js" language="javascript"></script>
<!-- Shared Noted javascript files. Uncomment for shared notes module -->
<!--<script src="sharednotes/diff_match_patch_uncompressed.js" language="javascript"></script>-->
<!--<script src="sharednotes/shared_notes.js" language="javascript"></script>-->
<script src="sharednotes/diff_match_patch_uncompressed.js" language="javascript"></script>
<script src="sharednotes/shared_notes.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }

View File

@ -91,7 +91,7 @@
SharedNotesWindow.document = _attributes.room;
// The following line has been removed, as the uri should be in
// the URI property in the config.xml file of the client
HTTPServerConnection.syncURL = (_attributes.uri as String).replace("RTMP", "http") + "/notes/notes.jsp";
HTTPServerConnection.syncURL = (_attributes.uri as String).replace("RTMP", "http") + "/demo/notes.jsp";
addToolbarButton();
}

View File

@ -20,9 +20,10 @@ package org.bigbluebutton.modules.example
{
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.net.Responder;
import flash.net.SharedObject;
import mx.controls.Alert;
import mx.controls.Alert;
public class ExampleChatProxy
{
@ -42,7 +43,7 @@ package org.bigbluebutton.modules.example
extractAttributes(attributes);
simpleChatSO = SharedObject.getRemote("simpleChatSO", url, false);
simpleChatSO = SharedObject.getRemote("simpleChat", url, false);
simpleChatSO.addEventListener(NetStatusEvent.NET_STATUS, netStatusEventHandler);
simpleChatSO.client = this;
simpleChatSO.connect(connection);
@ -61,11 +62,19 @@ package org.bigbluebutton.modules.example
}
public function sendMessage(message:String):void{
simpleChatSO.send("serverCallback", message);
connection.call("rtmpadapter.sendData", new Responder(
function(result:Object):void{
//window.displayNewMessage(result as String);
},
function(status:Object):void{
window.displayNewMessage("Call failed");
}),
"simpleChat", "testMethod", message)
}
public function serverCallback(message:String):void{
window.displayNewMessage(message);
public function testMethod(data:String):void{
window.displayNewMessage(data);
}
}
}

View File

@ -53,7 +53,7 @@ Notes.mxml is the main view of the SharedNotes application
}
public function getPrefferedPosition():String{
return MainCanvas.POPUP;
return MainCanvas.RIGHT;
}
]]>

View File

@ -0,0 +1,88 @@
<%@ page contentType="text/plain" %><%--
--%><%@ page import="java.net.Socket" %><%--
--%><%@ page import="java.io.OutputStream" %><%--
--%><%@ page import="java.io.InputStream" %><%--
--%><%@ page import="java.io.BufferedInputStream" %><%--
--%><%
/*
This file is part of BBB-Notes.
Copyright (c) Islam El-Ashi. All rights reserved.
BBB-Notes is free software: you can redistribute it and/or modify
it under the terms of the Lesser GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
BBB-Notes is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with BBB-Notes. If not, see <http://www.gnu.org/licenses/>.
Author: Islam El-Ashi <ielashi@gmail.com>, <http://www.ielashi.com>
*/
/* This file is based on a source file on Google MobWrite JSP gateway (license below) */
/*
# MobWrite - Real-time Synchronization and Collaboration Service
#
# Copyright 2006 Google Inc.
# http://code.google.com/p/google-mobwrite/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This server-side script connects the Ajax client to the Python daemon.
# This is a minimal man-in-the-middle script. No input checking from either side.
# JSP MobWrite gateway by Erich Bratton http://bratton.com
*/
Socket socket = null;
try {
// Connect to bbb-notes daemon
socket = new Socket("127.0.0.1", 8095);
// Timeout if daemon dosen't respond in 10 seconds.
socket.setSoTimeout(10 * 1000);
String data = request.getParameter("message") + "\0";
// Write data to daemon
OutputStream outputStream = socket.getOutputStream();
outputStream.write(data.getBytes());
// Read the response from daemon and copy it to JSP out
InputStream inputStream = new BufferedInputStream(socket.getInputStream());
int read;
data = "";
while ((read = inputStream.read()) > -1) {
data += (char)read;
}
out.write(data);
} catch (Exception e) {
%><%= e.getMessage() %><%
} finally {
try {
if (socket != null) {
socket.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
%>