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 abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig,String factoryConfig,Object userdata) throws LinphoneCoreException;
54 abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException;
57 * Constructs a LinphoneAddress object
63 abstract public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName);
65 * Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.
66 * @param address should be like sip:joe@sip.linphone.org
69 abstract public LinphoneAddress createLinphoneAddress(String address);
70 abstract public LpConfig createLpConfig(String file);
72 abstract public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
74 * Enable verbose traces
78 abstract public void setDebugMode(boolean enable, String tag);
80 abstract public void setLogHandler(LinphoneLogHandler handler);
82 * Create a LinphoneFriend, similar to {@link #createLinphoneFriend()} + {@link LinphoneFriend#setAddress(LinphoneAddress)}
83 * @param friendUri a buddy address, must be a sip uri like sip:joe@sip.linphone.org
84 * @return a new LinphoneFriend with address initialized
86 abstract public LinphoneFriend createLinphoneFriend(String friendUri);
88 * Create a new LinphoneFriend
91 abstract public LinphoneFriend createLinphoneFriend();