001/* 002 * Copyright 2014 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.sms.broker; 017 018import java.util.Set; 019 020/** 021 * The broker interface 022 */ 023public interface Broker 024{ 025 /** For avalon service manager */ 026 public static final String ROLE = Broker.class.getName(); 027 028 /** 029 * Send the message from the sender to all the phones in the list 030 * @param phoneNumbersList the list of phone numbers 031 * @param message the message to send 032 * @param listId the jcr id of the list to send mail to 033 * @throws Exception If the message was not sent correctly 034 */ 035 public void send(Set<String> phoneNumbersList, String message, String listId) throws Exception; 036 037 /** 038 * When a stop request is arriving from broker, the implementation extract the phone number associated 039 * @return the phone number from the 'stop' sender at format +{countryCode}{number} (ex: +33612345678), it can be null if the phone number cannot be extracted from the stop request 040 * @throws Exception if the phone number was not provided within the stop request 041 */ 042 public String getPhoneNumberFromStopRequest() throws Exception; 043}