1 package org.mxchange.jjobs.beans.smsprovider;
4 * Copyright (C) 2016 Roland Haeder
6 * This program is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
19 import java.util.Collections;
20 import java.util.List;
21 import javax.annotation.PostConstruct;
22 import javax.enterprise.context.ApplicationScoped;
23 import javax.faces.view.facelets.FaceletException;
24 import javax.inject.Named;
25 import javax.naming.Context;
26 import javax.naming.InitialContext;
27 import javax.naming.NamingException;
28 import org.mxchange.jphone.phonenumbers.smsprovider.AddressbookSmsProviderSingletonBeanRemote;
29 import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
34 * @author Roland Haeder<roland@mxchange.org>
38 public class SmsProviderWebApplicationBean implements SmsProviderWebApplicationController {
43 private static final long serialVersionUID = 176_985_298_681_742_960L;
48 private AddressbookSmsProviderSingletonBeanRemote cellphoneBean;
51 * List of all countries
53 private List<SmsProvider> cellphoneList;
58 public SmsProviderWebApplicationBean () {
61 // Get initial context
62 Context context = new InitialContext();
64 // Try to lookup the bean
65 this.cellphoneBean = (AddressbookSmsProviderSingletonBeanRemote) context.lookup("ejb/addressbook-singleton-smsprovider"); //NOI18N
66 } catch (final NamingException ex) {
68 throw new FaceletException(ex);
73 public List<SmsProvider> allSmsProvider () {
74 // Return "cached" version
75 return Collections.unmodifiableList(this.cellphoneList);
80 this.cellphoneList = this.cellphoneBean.allSmsProvider();