2 LinphoneCoreFactory.java
3 Copyright (C) 2010 Belledonne Communications, Grenoble, France
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package org.linphone.core;
25 abstract public class LinphoneCoreFactory {
27 private static String factoryName = "org.linphone.core.LinphoneCoreFactoryImpl";
30 static LinphoneCoreFactory theLinphoneCoreFactory;
32 * Indicate the name of the class used by this factory
35 public static void setFactoryClassName (String className) {
36 factoryName = className;
40 public static final synchronized LinphoneCoreFactory instance() {
42 if (theLinphoneCoreFactory == null) {
43 Class<?> lFactoryClass = Class.forName(factoryName);
44 theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance();
46 } catch (Exception e) {
47 System.err.println("Cannot instanciate factory ["+factoryName+"]");
49 return theLinphoneCoreFactory;
51 abstract public LinphoneAuthInfo createAuthInfo(String username,String password, String realm);
53 * create {@link LinphoneAuthInfo}
55 * @param userid user id as set in auth header
60 abstract public LinphoneAuthInfo createAuthInfo(String username, String userid, String passwd, String ha1,String realm);
62 abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig,String factoryConfig,Object userdata) throws LinphoneCoreException;
63 abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException;
67 * Constructs a LinphoneAddress object
73 abstract public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName);
75 * Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.
76 * @param address should be like sip:joe@sip.linphone.org
79 abstract public LinphoneAddress createLinphoneAddress(String address);
80 abstract public LpConfig createLpConfig(String file);
82 abstract public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
84 * Enable verbose traces
88 abstract public void setDebugMode(boolean enable, String tag);
90 abstract public void setLogHandler(LinphoneLogHandler handler);
92 * Create a LinphoneFriend, similar to {@link #createLinphoneFriend()} + {@link LinphoneFriend#setAddress(LinphoneAddress)}
93 * @param friendUri a buddy address, must be a sip uri like sip:joe@sip.linphone.org
94 * @return a new LinphoneFriend with address initialized
96 abstract public LinphoneFriend createLinphoneFriend(String friendUri);
98 * Create a new LinphoneFriend
101 abstract public LinphoneFriend createLinphoneFriend();