Difference between revisions of "Custom SMS MMS Implementation"

(Prerequisites)
(Implementation)
Line 10: Line 10:
 
  context.registerService(MessagingNewService.class.getName(), new OwnImpl(), null);
 
  context.registerService(MessagingNewService.class.getName(), new OwnImpl(), null);
  
In this example the new class <code>OwnImpl</code> must be written.
+
In this example the new class <code>OwnImpl</code> must be written. Inside this class the interface enforces that an object of the type <code>MessagingUserConfigurationInterface</code> and an object of the type <code>MessagingAccountTransport</code> must be returned in the corresponding methods.
 +
 
 +
Please note that each of the returned objects is only valid for one session. So the returned <code>MessagingUserConfigurationInterface</code> can provide user specific settings based on the values in the session object.
 +
The settings which can be adjusted in the configuration should be explained by the JavaDoc Links below.
 +
 
 +
The more important part is the returned <code>MessagingAccountTransport</code> where the method com.openexchange.messaging.MessagingAccountTransport.transport(MessagingMessage, Collection<MessagingAddressHeader>) is responsible for sending the SMS / MMS. The corresponding <code>MessagingMessage</code> object therefore provides all the needed data for composing the messages. The same applies for the <code>Collection<MessagingAddressHeader></code> is irrelevant in this case

Revision as of 16:10, 24 January 2012

Prerequisites

The bundles open-xchange-messaging-sms and open-xchange-messaging-sms-gui should be installed

Implementation

The basic implementation must be done by a class implementing the interface com.openexchange.messaging.sms.service.MessagingNewService. This implementing class must be annouced to OSGi as a service implementation for this class. This can be done be the following:

context.registerService(MessagingNewService.class.getName(), new OwnImpl(), null);

In this example the new class OwnImpl must be written. Inside this class the interface enforces that an object of the type MessagingUserConfigurationInterface and an object of the type MessagingAccountTransport must be returned in the corresponding methods.

Please note that each of the returned objects is only valid for one session. So the returned MessagingUserConfigurationInterface can provide user specific settings based on the values in the session object. The settings which can be adjusted in the configuration should be explained by the JavaDoc Links below.

The more important part is the returned MessagingAccountTransport where the method com.openexchange.messaging.MessagingAccountTransport.transport(MessagingMessage, Collection<MessagingAddressHeader>) is responsible for sending the SMS / MMS. The corresponding MessagingMessage object therefore provides all the needed data for composing the messages. The same applies for the Collection<MessagingAddressHeader> is irrelevant in this case