Skip to content

Commit

Permalink
keep only red5BBBInGW
Browse files Browse the repository at this point in the history
  • Loading branch information
antobinary committed May 21, 2015
1 parent bf60874 commit 40a45bb
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 30 deletions.
@@ -0,0 +1,81 @@
package org.bigbluebutton.conference.service.messaging;

import java.util.HashMap;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

public class SendSlideGenerated implements IMessage {
public static final String SEND_SLIDE_GENERATED = "send_slide_generated";
public static final String VERSION = "0.0.1";

public final String meetingId;
public final String messageKey;
public final String code;
public final String presId;
public final int numberOfPages;
public final int pagesCompleted;
public final String presName;

public SendSlideGenerated(String messageKey, String meetingId,
String code, String presId, int numberOfPages, int pagesCompleted,
String presName) {
this.meetingId = meetingId;
this.messageKey = messageKey;
this.code = code;
this.presId = presId;
this.numberOfPages = numberOfPages;
this.pagesCompleted = pagesCompleted;
this.presName = presName;
}

public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.MESSAGE_KEY, messageKey);
payload.put(Constants.CODE, code);
payload.put(Constants.PRESENTATION_ID, presId);
payload.put(Constants.NUM_PAGES, numberOfPages);
payload.put(Constants.PAGES_COMPLETED, pagesCompleted);
payload.put(Constants.PRESENTATION_NAME, presName);

java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_SLIDE_GENERATED, VERSION, null);
System.out.println("SendSlideGenerated toJson");
return MessageBuilder.buildJson(header, payload);
}

public static SendSlideGenerated fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);

if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");

if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (SEND_SLIDE_GENERATED.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE_KEY)
&& payload.has(Constants.CODE)
&& payload.has(Constants.PRESENTATION_ID)
&& payload.has(Constants.PAGES_COMPLETED)
&& payload.has(Constants.NUM_PAGES)
&& payload.has(Constants.PRESENTATION_NAME)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString();
String code = payload.get(Constants.CODE).getAsString();
String presId = payload.get(Constants.PRESENTATION_ID).getAsString();
int numberOfPages = payload.get(Constants.NUM_PAGES).getAsInt();
int pagesCompleted = payload.get(Constants.PAGES_COMPLETED).getAsInt();
String presName = payload.get(Constants.PRESENTATION_NAME).getAsString();

System.out.println("SendSlideGenerated fromJson");
return new SendSlideGenerated(messageKey, meetingId, code, presId, numberOfPages, pagesCompleted, presName);
}
}
}
}
return null;
}
}
Expand Up @@ -20,61 +20,49 @@


import org.slf4j.Logger; import org.slf4j.Logger;
import org.bigbluebutton.core.api.Red5BBBInGw; import org.bigbluebutton.core.api.Red5BBBInGw;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
import org.red5.logging.Red5LoggerFactory; import org.red5.logging.Red5LoggerFactory;


public class PresentationApplication { public class PresentationApplication {
private static Logger log = Red5LoggerFactory.getLogger( PresentationApplication.class, "bigbluebutton" ); private static Logger log = Red5LoggerFactory.getLogger( PresentationApplication.class, "bigbluebutton" );


private IBigBlueButtonInGW bbbInGW;
private Red5BBBInGw red5BBBInGW; private Red5BBBInGw red5BBBInGW;


public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { public void setRed5BBBInGW(Red5BBBInGw inGW) {
bbbInGW = inGW; red5BBBInGW = inGW;
} }


public void setRed5BBBInGW(Red5BBBInGw inGW2) {
red5BBBInGW = inGW2;
}

public void clear(String meetingID) { public void clear(String meetingID) {
} }


public void sendConversionUpdate(String messageKey, String meetingId, public void sendConversionUpdate(String messageKey, String meetingId,
String code, String presentationId, String presName) { String code, String presentationId, String presName) {
System.out.println("-----sendConversionUpdate---"); System.out.println("-----sendConversionUpdate---");
// red5BBBInGW.sendConversionUpdate(messageKey, meetingId, code, red5BBBInGW.sendConversionUpdate(messageKey, meetingId, code,
// presentationId, presName);
bbbInGW.sendConversionUpdate(messageKey, meetingId, code,
presentationId, presName); presentationId, presName);
} }


public void sendPageCountError(String messageKey, String meetingId, public void sendPageCountError(String messageKey, String meetingId,
String code, String presentationId, int numberOfPages, String code, String presentationId, int numberOfPages,
int maxNumberPages, String presName) { int maxNumberPages, String presName) {
System.out.println("-----sendPageCountError---"); System.out.println("-----sendPageCountError---");
bbbInGW.sendPageCountError(messageKey, meetingId, code, red5BBBInGW.sendPageCountError(messageKey, meetingId, code,
presentationId, numberOfPages, maxNumberPages, presName); presentationId, numberOfPages, maxNumberPages, presName);
// Red5BBBInGw.sendPageCountError(messageKey, meetingId, code,
// presentationId, numberOfPages, maxNumberPages, presName);
} }


public void sendSlideGenerated(String messageKey, String meetingId, public void sendSlideGenerated(String messageKey, String meetingId,
String code, String presentationId, int numberOfPages, String code, String presentationId, int numberOfPages,
int pagesCompleted, String presName) { int pagesCompleted, String presName) {
System.out.println("-----sendSlideGenerated---"); System.out.println("-----sendSlideGenerated---");
bbbInGW.sendSlideGenerated(messageKey, meetingId, code, red5BBBInGW.sendSlideGenerated(messageKey, meetingId, code,
presentationId, numberOfPages, pagesCompleted, presName); presentationId, numberOfPages, pagesCompleted, presName);
} }


public void sendConversionCompleted(String messageKey, String meetingId, public void sendConversionCompleted(String messageKey, String meetingId,
String code, String presentation, int numberOfPages, String code, String presentation, int numberOfPages,
String presName, String presBaseUrl) { String presName, String presBaseUrl) {
System.out.println("-----sendConversionCompleted---"); System.out.println("-----sendConversionCompleted---");
bbbInGW.sendConversionCompleted(messageKey, meetingId, red5BBBInGW.sendConversionCompleted(messageKey, meetingId,
code, presentation, numberOfPages, presName, presBaseUrl); code, presentation, numberOfPages, presName, presBaseUrl);
// Red5BBBInGw.sendConversionCompleted(messageKey, meetingId,
// code, presentation, numberOfPages, presName, presBaseUrl);
} }


public void removePresentation(String meetingID, String presentationID){ public void removePresentation(String meetingID, String presentationID){
Expand Down
Expand Up @@ -13,6 +13,7 @@
import org.bigbluebutton.conference.service.messaging.SendConversionUpdate; import org.bigbluebutton.conference.service.messaging.SendConversionUpdate;
import org.bigbluebutton.conference.service.messaging.SendCursorUpdate; import org.bigbluebutton.conference.service.messaging.SendCursorUpdate;
import org.bigbluebutton.conference.service.messaging.SendPageCountError; import org.bigbluebutton.conference.service.messaging.SendPageCountError;
import org.bigbluebutton.conference.service.messaging.SendSlideGenerated;
import org.bigbluebutton.conference.service.messaging.SharePresentation; import org.bigbluebutton.conference.service.messaging.SharePresentation;
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;


Expand Down Expand Up @@ -84,7 +85,6 @@ private void sendConversionCompleted(String messageKey, String conference,
@Override @Override
public void handleMessage(String pattern, String channel, String message) { public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) { if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) {
System.out.println("__message:"+message);
JsonParser parser = new JsonParser(); JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message); JsonObject obj = (JsonObject) parser.parse(message);


Expand All @@ -97,8 +97,8 @@ public void handleMessage(String pattern, String channel, String message) {
SendConversionUpdate msg = SendConversionUpdate.fromJson(message); SendConversionUpdate msg = SendConversionUpdate.fromJson(message);
System.out.println("in messageHandler - sendConversionCompleted"); System.out.println("in messageHandler - sendConversionCompleted");


sendConversionUpdate(msg.messageKey, msg.meetingId, msg.code, // sendConversionUpdate(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.presName); // msg.presId, msg.presName);
bbbInGW.sendConversionUpdate(msg.messageKey, msg.meetingId, bbbInGW.sendConversionUpdate(msg.messageKey, msg.meetingId,
msg.code, msg.presId, msg.presName); msg.code, msg.presId, msg.presName);
} else if (ResizeAndMoveSlide.RESIZE_AND_MOVE_SLIDE.equals(messageName)) { } else if (ResizeAndMoveSlide.RESIZE_AND_MOVE_SLIDE.equals(messageName)) {
Expand All @@ -116,16 +116,16 @@ public void handleMessage(String pattern, String channel, String message) {
System.out.println("in messageHandler - sendConversionCompleted"); System.out.println("in messageHandler - sendConversionCompleted");
SendConversionCompleted msg = SendConversionCompleted.fromJson(message); SendConversionCompleted msg = SendConversionCompleted.fromJson(message);


sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code, // sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numPages, msg.presName, msg.presBaseUrl); // msg.presId, msg.numPages, msg.presName, msg.presBaseUrl);
bbbInGW.sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code, bbbInGW.sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numPages, msg.presName, msg.presBaseUrl); msg.presId, msg.numPages, msg.presName, msg.presBaseUrl);
} else if (SendPageCountError.SEND_PAGE_COUNT_ERROR.equals(messageName)) { } else if (SendPageCountError.SEND_PAGE_COUNT_ERROR.equals(messageName)) {
System.out.println("in messageHandler - sendPageCountError"); System.out.println("in messageHandler - sendPageCountError");
SendPageCountError msg = SendPageCountError.fromJson(message); SendPageCountError msg = SendPageCountError.fromJson(message);


sendPageCountError(msg.messageKey, msg.meetingId, msg.code, // sendPageCountError(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName); // msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName);
bbbInGW.sendPageCountError(msg.messageKey, msg.meetingId, msg.code, bbbInGW.sendPageCountError(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName); msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName);
} else if (GoToSlide.GO_TO_SLIDE.equals(messageName)) { } else if (GoToSlide.GO_TO_SLIDE.equals(messageName)) {
Expand Down Expand Up @@ -153,6 +153,12 @@ public void handleMessage(String pattern, String channel, String message) {
GetSlideInfo msg = GetSlideInfo.fromJson(message); GetSlideInfo msg = GetSlideInfo.fromJson(message);


bbbInGW.getSlideInfo(msg.meetingId, msg.requesterId, msg.replyTo); bbbInGW.getSlideInfo(msg.meetingId, msg.requesterId, msg.replyTo);
} else if (SendSlideGenerated.SEND_SLIDE_GENERATED.equals(messageName)) {
System.out.println("in messageHandler - SendSlideGenerated");
SendSlideGenerated msg = SendSlideGenerated.fromJson(message);

bbbInGW.sendSlideGenerated(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numberOfPages, msg.pagesCompleted, msg.presName);
} }
} }
} }
Expand Down
Expand Up @@ -6,6 +6,7 @@
import org.bigbluebutton.conference.service.messaging.GoToSlide; import org.bigbluebutton.conference.service.messaging.GoToSlide;
import org.bigbluebutton.conference.service.messaging.SendConversionCompleted; import org.bigbluebutton.conference.service.messaging.SendConversionCompleted;
import org.bigbluebutton.conference.service.messaging.SendPageCountError; import org.bigbluebutton.conference.service.messaging.SendPageCountError;
import org.bigbluebutton.conference.service.messaging.SendSlideGenerated;
import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage; import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage;
import org.bigbluebutton.conference.service.messaging.GetSlideInfo; import org.bigbluebutton.conference.service.messaging.GetSlideInfo;
import org.bigbluebutton.conference.service.messaging.ResizeAndMoveSlide; import org.bigbluebutton.conference.service.messaging.ResizeAndMoveSlide;
Expand Down Expand Up @@ -396,8 +397,10 @@ public void sendPageCountError(String messageKey, String meetingId,
public void sendSlideGenerated(String messageKey, String meetingId, public void sendSlideGenerated(String messageKey, String meetingId,
String code, String presId, int numberOfPages, int pagesCompleted, String code, String presId, int numberOfPages, int pagesCompleted,
String presName) { String presName) {
// TODO Auto-generated method stub System.out.println("~~sendSlideGenerated in Red5BBBInGw");

SendSlideGenerated msg = new SendSlideGenerated(messageKey, meetingId,
code, presId, numberOfPages, pagesCompleted, presName);
sender.send(MessagingConstants.TO_PRESENTATION_CHANNEL, msg.toJson());
} }


@Override @Override
Expand Down
Expand Up @@ -28,7 +28,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
"> ">


<bean id="presentationApplication" class="org.bigbluebutton.conference.service.presentation.PresentationApplication"> <bean id="presentationApplication" class="org.bigbluebutton.conference.service.presentation.PresentationApplication">
<property name="bigBlueButtonInGW"><ref bean="bbbInGW"/></property>
<property name="red5BBBInGW"><ref bean="red5BbbInGW"/></property> <property name="red5BBBInGW"><ref bean="red5BbbInGW"/></property>
</bean> </bean>


Expand Down

0 comments on commit 40a45bb

Please sign in to comment.