]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCoreFactory.java
ea325057e34a76a07c0805cf3b0479ee7c3cf87c
[linphone] / java / common / org / linphone / core / LinphoneCoreFactory.java
1 /*
2 LinphoneCoreFactory.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
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.
9
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.
14
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.
18 */
19 package org.linphone.core;
20
21
22
23
24
25 abstract public class LinphoneCoreFactory {
26         
27         private static String factoryName = "org.linphone.core.LinphoneCoreFactoryImpl";
28         
29         
30         static LinphoneCoreFactory theLinphoneCoreFactory; 
31         /**
32          * Indicate the name of the class used by this factory
33          * @param pathName
34          */
35         public static void setFactoryClassName (String className) {
36                 factoryName = className;
37         }
38         
39         
40         public static final synchronized LinphoneCoreFactory instance() {
41                 try {
42                         if (theLinphoneCoreFactory == null) {
43                                 Class<?> lFactoryClass = Class.forName(factoryName);
44                                 theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance();
45                         }
46                 } catch (Exception e) {
47                         System.err.println("Cannot instanciate factory ["+factoryName+"]");
48                 }
49                 return theLinphoneCoreFactory;
50         }
51         abstract public LinphoneAuthInfo createAuthInfo(String username,String password, String realm);
52         /**
53          * create  {@link LinphoneAuthInfo}
54          * @param username
55          * @param userid user id as set in auth header
56          * @param passwd
57          * @param ha1
58          * @param realm
59          * */
60         abstract public LinphoneAuthInfo createAuthInfo(String username, String userid, String passwd, String ha1,String realm);
61         
62         abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig,String factoryConfig,Object  userdata) throws LinphoneCoreException;
63         abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException;
64
65
66         /**
67          * Constructs a LinphoneAddress object
68          * @param username 
69          * @param domain
70          * @param displayName
71          * @return 
72          */
73         abstract public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName);
74         /**
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
77          * @return
78          */
79         abstract public LinphoneAddress createLinphoneAddress(String address);
80         abstract public LpConfig createLpConfig(String file);
81         
82         abstract public  LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
83         /**
84          * Enable verbose traces
85          * @param enable 
86          * @param tag
87          */
88         abstract public  void setDebugMode(boolean enable, String tag);
89         
90         abstract public void setLogHandler(LinphoneLogHandler handler);
91         /**
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
95          */
96         abstract public LinphoneFriend createLinphoneFriend(String friendUri);
97         /**
98          * Create a new LinphoneFriend
99          * @return
100          */
101         abstract public LinphoneFriend createLinphoneFriend();
102         
103         
104 }