]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCoreFactory.java
javadoc enhancements
[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         /**
52          * create  {@link LinphoneAuthInfo}
53          * @param username
54          * @param userid user id as set in auth header
55          * @param passwd
56          * */
57         abstract public LinphoneAuthInfo createAuthInfo(String username,String password, String realm);
58         /**
59          * create  {@link LinphoneAuthInfo}
60          * @param username
61          * @param userid user id as set in auth header
62          * @param passwd
63          * @param ha1
64          * @param realm
65          * */
66         abstract public LinphoneAuthInfo createAuthInfo(String username, String userid, String passwd, String ha1,String realm);
67         
68         abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig,String factoryConfig,Object  userdata) throws LinphoneCoreException;
69         abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException;
70
71
72         /**
73          * Constructs a LinphoneAddress object
74          * @param username 
75          * @param domain
76          * @param displayName
77          * @return 
78          */
79         abstract public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName);
80         /**
81          * Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.
82          * @param address should be like sip:joe@sip.linphone.org
83          * @return
84          */
85         abstract public LinphoneAddress createLinphoneAddress(String address);
86         abstract public LpConfig createLpConfig(String file);
87         
88         abstract public  LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
89         /**
90          * Enable verbose traces
91          * @param enable 
92          * @param tag
93          */
94         abstract public  void setDebugMode(boolean enable, String tag);
95         
96         abstract public void setLogHandler(LinphoneLogHandler handler);
97         /**
98          * Create a LinphoneFriend, similar to {@link #createLinphoneFriend()} + {@link LinphoneFriend#setAddress(LinphoneAddress)} 
99          * @param friendUri a buddy address, must be a sip uri like sip:joe@sip.linphone.org
100          * @return a new LinphoneFriend with address initialized
101          */
102         abstract public LinphoneFriend createLinphoneFriend(String friendUri);
103         /**
104          * Create a new LinphoneFriend
105          * @return
106          */
107         abstract public LinphoneFriend createLinphoneFriend();
108         
109         
110 }