cleanup LinphonecoreFactory

This commit is contained in:
Jehan Monnier 2010-04-27 14:51:30 +02:00
parent 7f649c5675
commit 572b696529
2 changed files with 26 additions and 15 deletions

View file

@ -51,7 +51,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved)
//LinphoneFactory
extern "C" void Java_org_linphone_core_LinphoneCoreFactory_setDebugMode(JNIEnv* env
extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv* env
,jobject thiz
,jboolean isDebug) {
if (isDebug) {

View file

@ -21,33 +21,44 @@ package org.linphone.core;
import java.io.File;
import java.io.IOException;
public class LinphoneCoreFactory {
abstract public class LinphoneCoreFactory {
private static String defaulfFactory = "org.linphone.core.LinphoneCoreFactoryImpl";
static {
System.loadLibrary("linphone");
}
static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory();
static LinphoneCoreFactory theLinphoneCoreFactory;
/**
* Indicate the name of the class used by this factory
* @param pathName
*/
static void setFactoryClassName (String className) {
defaulfFactory = className;
}
public static LinphoneCoreFactory instance() {
try {
if (theLinphoneCoreFactory == null) {
Class lFactoryClass = Class.forName(defaulfFactory);
theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance();
}
} catch (Exception e) {
System.err.println("cannot instanciate factory ["+defaulfFactory+"]");
}
return theLinphoneCoreFactory;
}
public LinphoneAuthInfo createAuthInfo(String username,String password) {
return new LinphoneAuthInfoImpl(username,password) ;
}
abstract public LinphoneAuthInfo createAuthInfo(String username,String password);
public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
return new LinphoneCoreImpl(listener,userConfig,factoryConfig,userdata);
}
abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException;
public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName) {
return new LinphoneAddressImpl(username,domain,displayName);
}
abstract public LinphoneAddress createLinphoneAddress(String username,String domain,String displayName);
abstract public LinphoneProxyConfig createProxyConfig(String identity, String proxy,String route,boolean enableRegister) throws LinphoneCoreException;
/**
* Enable verbose traces
* @param enable
* @param enable
*/
public native void setDebugMode(boolean enable);
abstract public void setDebugMode(boolean enable);
}