2.6. eXo Web Conferencing connector

eXo Web Conferencing add-on enables you to plug-in and manage any Web Conferencing solution in eXo Platform. You can use eXo Web Conferencing core to develop your own connector which will implement the call provider you need to embed in eXo Platform.

In this section, we will introduce the architecture of eXo Web Conferencing add-on and how to develop a custom connector allowing you to embed a call provider in eXo Platform.

Architecture

The following diagram shows the different parts involved to perform a Web Conferencing call.

eXo Web Conferencing core

The eXo Web Conferencing core component is responsible for:

The provider connector component is responsible for:

Develop your own call connector

eXo Web Conferencing add-on is a portal extension installed by default in eXo Platform. A call connector is also a portal extension which uses the eXo Web Conferencing core.

The connector should provide an implementation of its call button which is added by the Web Conferencing core in users profiles, spaces and chat rooms.

The connector implementation consists of a server code and a client application with user interface to run calls.

To implement your own connector follow this procedure:

  1. Create the connector project respecting the developement environment described here.

    We recommend you to clone our template project as it contains maven modules with eXo Web Conferencing dependencies and packaging. You should make your customizations on it: rename package, classes and variables and if needed include third-party libraries that your connector may use.

  2. Implement Java Service Provider Interface (SPI): It is the java class of your call provider which should extend the CallProvider class.

    Here is a java code snippet which represents the skeleton of the Java SPI class:

     package org.exoplatform.webconferencing.myconnector;
    
    
    /**
     * My Connector provider implementation.
     */
    public class MyConnectorProvider extends CallProvider {
      
      /**
       * Instantiates a new My Call provider.
       *
       * @param params the params (from configuration.xml)
       * @throws ConfigurationException the configuration exception
       */
      public MyConnectorProvider(InitParams params) throws ConfigurationException {
        super(params);
      }
      /**
       * {@inheritDoc}
       */
      @Override
      public String getType() {
        return TYPE;
      }
      /**
       * {@inheritDoc}
       */
      @Override
      public String[] getSupportedTypes() {
        return new String[] { getType() };
      }
      /**
       * {@inheritDoc}
       */
      @Override
      public String getTitle() {
        return TITLE;
      }
    }  
        
  3. Create a portlet which will be responsible of loading and intializing your call provider in the eXo Platform UI.

      public class MyConnectorPortlet extends GenericPortlet {
    
        /**
         * {@inheritDoc}
         */
        @Override
        public void init() throws PortletException {
          // Get eXo container and Web Conferencing service once per portlet initialization
          ExoContainer container = ExoContainerContext.getCurrentContainer();
          this.webConferencing = container.getComponentInstanceOfType(WebConferencingService.class);
          try {
            this.provider = (MyConnectorProvider) webConferencing.getProvider(MyConnectorProvider.TYPE);
          } catch (ClassCastException e) {
            LOG.error("Provider " + MyConnectorProvider.TYPE + " isn't an instance of " + MyConnectorProvider.class.getName(), e);
          }
        }
        /**
         * {@inheritDoc}
         */
        @Override
        protected void doView(final RenderRequest request, final RenderResponse response) throws PortletException, IOException {
          if (this.provider != null) {
            try {
              JavascriptManager js = ((WebuiRequestContext) WebuiRequestContext.getCurrentInstance()).getJavascriptManager();
              // first load Web Conferencing itself,
              js.require("SHARED/webConferencing", "webConferencing")
                // load our connector module to myProvider variable
                .require("SHARED/webConferencing_myconnector", "myProvider")
                // check if the variable contains an object to ensure the provider was loaded successfully
                .addScripts("if (myProvider) { "
                    // then add an instance of the provider to the Web Conferencing client
                    + "webConferencing.addProvider(myProvider); "
                    // and force Web Conferencing client update (to update call buttons and related stuff)
                    + "webConferencing.update(); " + "}");
            } catch (Exception e) {
              LOG.error("Error processing My Connector calls portlet for user " + request.getRemoteUser(), e);
            }
          }
        }
      }  
        
  4. Configure your connector extension, your provider plugin and your portlet in META-INF/exo-conf/configuration.xml file.

Extension connector configuration:


 <external-component-plugins>
    <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
    <component-plugin>
      <name>Change PortalContainer Definitions</name>
      <set-method>registerChangePlugin</set-method>
      <type>org.exoplatform.container.definition.PortalContainerDefinitionChangePlugin</type>
      <init-params>
        <value-param>
          <name>apply.default</name>
          <value>true</value>
        </value-param>
        <object-param>
          <name>change</name>
          <object type="org.exoplatform.container.definition.PortalContainerDefinitionChange$AddDependenciesAfter">
            <field name="dependencies">
              <collection type="java.util.ArrayList">
                <value>
                  <string>myconnector</string>
                </value>
              </collection>
            </field>
            <field name="target">
              <string>webconferencing</string>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>  
    

Provider configuration:


 <!-- Portal extension configuration for YOUR PROVIDER NAME -->
  <external-component-plugins>
    <target-component>org.exoplatform.webconferencing.WebConferencingService</target-component>
    <component-plugin>
      <name>add.callprovider</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.webconferencing.myconnector.MyConnectorProvider</type>
      <description>Call provider description here.</description>
      <init-params>
        <properties-param>
          <name>provider-configuration</name>
          <property name="my-apiKey" value="${webconferencing.myconnector.apiKey:myApiKey}" />
          <property name="my-clientId" value="${webconferencing.myconnector.clientId:myClientId}" />
          <property name="active" value="${webconferencing.myconnector.active:true}" />
        </properties-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>  
    

The above configuration is also configurable through exo.properties file as the following:

 ######### My Connector ###########
webconferencing.myconnector.apiKey=myApiKey
webconferencing.myconnector.clientId=myClientId
webconferencing.myconnector.serviceUrl=https://mycall.acme.com/myconnector

	

Provider portlet configuration:


 <!-- Add My Connector portlet to portal pages with a toolbar -->
  <external-component-plugins>
    <target-component>org.exoplatform.commons.addons.AddOnService</target-component>
    <component-plugin>
      <name>addPlugin</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.commons.addons.AddOnPluginImpl</type>
      <description>add application Config</description>
      <init-params>
        <value-param>
          <name>priority</name>
          <value>10</value>
        </value-param>
        <value-param>
          <name>containerName</name>
          <value>middle-topNavigation-container</value>
        </value-param>
        <object-param>
          <name>MyConnectorPortlet</name>
          <description>My Connector portlet</description>
          <object type="org.exoplatform.portal.config.serialize.PortletApplication">
            <field name="state">
              <object type="org.exoplatform.portal.config.model.TransientApplicationState">
                <field name="contentId">
                  <string>myconnector/MyConnectorPortlet</string>
                </field>
              </object>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>  
  
    
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus