package com.huawei.esdk.ivs.professional.local;

import com.huawei.esdk.ivs.professional.local.impl.service.AlarmManagerServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.BusinessManagerServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.ClusterManagerServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.CommonServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.DeviceManagerServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.RecordManagerServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.UserManagerServiceExImpl;
import com.huawei.esdk.ivs.professional.local.impl.service.callback.IVSCallbackServiceExImpl;
import com.huawei.esdk.ivs.professional.local.service.alarmmanager.AlarmManagerServiceEx;
import com.huawei.esdk.ivs.professional.local.service.bussinessmanager.BusinessManagerServiceEx;
import com.huawei.esdk.ivs.professional.local.service.callback.IVSCallbackServiceEx;
import com.huawei.esdk.ivs.professional.local.service.clusterManager.ClusterManagerServiceEx;
import com.huawei.esdk.ivs.professional.local.service.common.CommonServiceEx;
import com.huawei.esdk.ivs.professional.local.service.devicemanager.DeviceManagerServiceEx;
import com.huawei.esdk.ivs.professional.local.service.recordmanager.RecordManagerServiceEx;
import com.huawei.esdk.ivs.professional.local.service.usermanager.UserManagerServiceEx;

public class ServiceFactoryEx
{
    static
    {
        System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
    }
    
    @SuppressWarnings("unchecked")
    public static <T> T getService(Class<? extends T> interfaceClass)
    {
        if (interfaceClass.getName().equals(UserManagerServiceEx.class.getName()))
        {
            return (T)UserManagerServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(CommonServiceEx.class.getName()))
        {
            return (T)CommonServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(AlarmManagerServiceEx.class.getName()))
        {
            return (T)AlarmManagerServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(ClusterManagerServiceEx.class.getName()))
        {
            return (T)ClusterManagerServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(DeviceManagerServiceEx.class.getName()))
        {
            return (T)DeviceManagerServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(RecordManagerServiceEx.class.getName()))
        {
            return (T)RecordManagerServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(IVSCallbackServiceEx.class.getName()))
        {
            return (T)IVSCallbackServiceExImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(BusinessManagerServiceEx.class.getName()))
        {
            return (T)BusinessManagerServiceExImpl.getInstance();
        }
        else
        {
            return null;
        }
        
    }
    
}
