Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
    public void fireOnConnect(ITransportHandler handler) {
        for (ITransportHandlerListener<T> l : transportHandlerListener) {
            l.onConnect(handler);
        }
    }
    public void fireOnDisconnect(ITransportHandler handler) {
        for (ITransportHandlerListener<T> l : transportHandlerListener) {
            l.onDisonnect(handler);
        }
    }

 

 

 

These methode are defined in the interface ITransportHandlerListener that is implemented by IProtocolHandler, the basic interface for ProtocolHandler.

Registering the handler

Odysseus is OSGi based and all the handler are implemented as declartive services.

For this, you have to create a xml file, typically placed under a folder called OSGI-INF, where you state the global unique name of the handler, the implemenation class and the interface that this handler provides. In the following is the example for the FacebookTransportHandler.

Code Block
languagexml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="de.uniol.inf.is.odysseus.wrapper.facebook.physicaloperator.access.FacebookTransportHandler">
   <implementation class="de.uniol.inf.is.odysseus.wrapper.facebook.physicaloperator.access.FacebookTransportHandler"/>
   <service>
      <provide interface="de.uniol.inf.is.odysseus.core.physicaloperator.access.transport.ITransportHandler"/>
   </service>
</scr:component>

The file MANIFEST.MF (typically provided in META-INF) must contain a hint to this new file

Code Block
Service-Component: OSGI-INF/FacebookTransportHandler.xml, OSGI-INF/FacebookProtocolHandler.xml

Remark: An eclipse wizzard can be used to create this file and the reference inside the MANIFEST.MF: File/New/Component DefinitionOSGi, Registering, Declarative service

Creating a new Protocol Handler

...