package com.vci.client.common.providers;
|
|
import com.vci.common.ServiceNames;
|
import com.vci.common.log.ServerWithLog4j;
|
import com.vci.common.util.IceProxyUtility;
|
//import com.vci.corba.auth2.Auth2ServicePrx;
|
import com.vci.corba.bofactory.BOFactoryServicePrx;
|
import com.vci.corba.framework.FrameworkServicePrx;
|
import com.vci.corba.log.LogServicePrx;
|
//import com.vci.corba.framework.method.VolumeManagerPrx;
|
import com.vci.corba.omd.OMDServicePrx;
|
import com.vci.corba.portal.PortalServicePrx;
|
import com.vci.corba.query.ObjectQueryServicePrx;
|
import com.vci.corba.volume.VolumeServicePrx;
|
import com.vci.corba.workflow.WorkflowServicePrx;
|
import com.zeroc.Ice.ObjectPrx;
|
import com.vci.client.mw.ClientProxyUtility;
|
|
public class ServiceProvider {
|
|
private static ServiceProvider _provider = null;
|
|
private IceProxyUtility _proxyUtil = null;
|
|
private static ServiceProvider getInstance(){
|
if(_provider == null){
|
_provider = new ServiceProvider();
|
}
|
|
return _provider;
|
}
|
|
/**
|
* 获取系统该框架服务代理
|
* @return
|
*/
|
public static FrameworkServicePrx getFrameService() {
|
FrameworkServicePrx service = getInstance().getFrameServiceImpl();
|
if (service == null) {
|
String error = "获取 Frame Service 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取系统该框架服务代理
|
* @return
|
*/
|
public static LogServicePrx getLogService() {
|
LogServicePrx service = getInstance().getLogServiceImpl();
|
if (service == null) {
|
String error = "获取 Log Service 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取系统授权认证框架服务代理
|
* @return
|
*/
|
// public static Auth2ServicePrx getAuth2Service() {
|
// Auth2ServicePrx service = getInstance().getAuth2ServiceImpl();
|
// if (service == null) {
|
// String error = "获取 Auth2Service 服务异常";
|
// System.out.println(error);
|
// }
|
//
|
// return service;
|
// }
|
|
/**
|
* 获取缓存服务代理
|
* @return
|
*/
|
// public static CacheServicePrx getCacheService() {
|
// CacheServicePrx service = getInstance().getCacheServiceImpl();
|
// if (service == null) {
|
// String error = "获取 CacheService 服务异常";
|
// System.out.println(error);
|
// }
|
//
|
// return service;
|
// }
|
|
/**
|
* 获取都西昂模型定义服务代理
|
* @return
|
*/
|
public static OMDServicePrx getOMDService() {
|
OMDServicePrx service = getInstance().getOMDServiceImpl();
|
if (service == null) {
|
String error = "获取 OMDService 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取业务对象工厂服务代理
|
* @return
|
*/
|
public static BOFactoryServicePrx getBOFService() {
|
BOFactoryServicePrx service = getInstance().getBOFServiceImpl();
|
if (service == null) {
|
String error = "获取 BOFactoryService 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取查询模板定义服务代理
|
* @return
|
*/
|
// public static QTDServicePrx getQTDService() {
|
// QTDServicePrx service = getInstance().getQTDServiceImpl();
|
// if (service == null) {
|
// String error = "获取 QTDService 服务异常";
|
// System.out.println(error);
|
// }
|
//
|
// return service;
|
// }
|
|
/**
|
* 获取对象查询服务代理
|
* @return
|
*/
|
public static ObjectQueryServicePrx getOQService() {
|
ObjectQueryServicePrx service = getInstance().getBOQueryServiceImpl();
|
if (service == null) {
|
String error = "获取 QTService 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取参考对象查询服务代理
|
* @return
|
*/
|
// public static RefQueryServicePrx getRQService() {
|
// RefQueryServicePrx service = getInstance().getRQServiceImpl();
|
// if (service == null) {
|
// String error = "获取 RefQueryService 服务异常";
|
// System.out.println(error);
|
// }
|
//
|
// return service;
|
// }
|
|
/**
|
* 获取UI服务服务代理
|
* @return
|
*/
|
public static PortalServicePrx getUIService() {
|
PortalServicePrx service = getInstance().getUIServiceImpl();
|
if (service == null) {
|
String error = "获取 PortalService 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取工作流服务代理
|
* @return
|
* @throws Exception
|
*/
|
public static WorkflowServicePrx getWFService() {
|
WorkflowServicePrx service = getInstance().getWFServiceImpl();
|
if (service == null) {
|
String error = "获取 WorkflowService 服务异常";
|
System.out.println(error);
|
//throw new Exception(error);
|
}
|
|
return service;
|
}
|
|
/**
|
* 获取卷服务服务代理
|
* @return
|
*/
|
// public static VolumeManagerPrx getVolumeManager() {
|
// VolumeManagerPrx service = getInstance().getVolumeFactoryImpl();
|
// if (service == null) {
|
// String error = "获取 VolumeFactory 服务异常";
|
// System.out.println(error);
|
// }
|
//
|
// return service;
|
// }
|
|
/**
|
* 获取系统该框架服务代理
|
* @return
|
*/
|
public static VolumeServicePrx getVolumeService(String vol) {
|
VolumeServicePrx service = getInstance().getVolumeServiceImpl(vol);
|
if (service == null) {
|
String error = "获取 VolumeService 服务异常";
|
System.out.println(error);
|
}
|
|
return service;
|
}
|
|
private ServiceProvider() {
|
InitIceUtil();
|
}
|
|
private void InitIceUtil() {
|
if (_proxyUtil != null)
|
return;
|
|
_proxyUtil = new ClientProxyUtility();
|
|
_proxyUtil.InitCommunicator(new String[0]);
|
|
}
|
|
|
// private Auth2ServicePrx _authService = null;
|
// private Auth2ServicePrx getAuth2ServiceImpl() {
|
// try {
|
// if(_authService != null){
|
// return _authService;
|
// }
|
//
|
// if (_proxyUtil == null) {
|
// InitIceUtil();
|
// }
|
//
|
// // added by xf 增加客户端时区的注入
|
// System.setProperty("user.timezone", "GMT+8");
|
// _authService = Auth2ServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.AUTH2SERVICE));
|
// } catch (Exception e) {
|
// //e.printStackTrace();
|
// ServerWithLog4j.logger.error(e);
|
// }
|
// return _authService;
|
// }
|
|
|
private FrameworkServicePrx _frameService = null;
|
private FrameworkServicePrx getFrameServiceImpl() {
|
try {
|
if(_frameService != null){
|
return _frameService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
ObjectPrx prx = _proxyUtil.getObjectByName(ServiceNames.FRAMESERVICE, ServiceNames.FRAMESERVICEREP);
|
|
_frameService = FrameworkServicePrx.checkedCast(prx);
|
} catch (Exception e) {
|
|
ServerWithLog4j.logger.error(e);
|
}
|
return _frameService;
|
}
|
|
private LogServicePrx _logService = null;
|
private LogServicePrx getLogServiceImpl() {
|
try {
|
if(_logService != null){
|
return _logService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
ObjectPrx prx = _proxyUtil.getObjectByName(ServiceNames.LOGSERVICE, ServiceNames.LOGSERVICEREP);
|
|
_logService = LogServicePrx.checkedCast(prx);
|
} catch (Exception e) {
|
|
ServerWithLog4j.logger.error(e);
|
}
|
return _logService;
|
}
|
|
|
// private CacheServicePrx _cacheService = null;
|
// private CacheServicePrx getCacheServiceImpl() {
|
// try {
|
// if(_cacheService != null){
|
// return _cacheService;
|
// }
|
//
|
// if (_proxyUtil == null) {
|
// InitIceUtil();
|
// }
|
//
|
// _cacheService = CacheServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.CACHESERVICE));
|
// } catch (Exception e) {
|
// //e.printStackTrace();
|
// ServerWithLog4j.logger.error(e);
|
// }
|
// return _cacheService;
|
// }
|
|
|
private BOFactoryServicePrx _bofService = null;
|
private BOFactoryServicePrx getBOFServiceImpl() {
|
try {
|
if(_bofService != null){
|
return _bofService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
_bofService = BOFactoryServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.BOFSERVICE, ServiceNames.BOFSERVICEREP));
|
} catch (Exception e) {
|
//e.printStackTrace();
|
ServerWithLog4j.logger.error(e);
|
}
|
return _bofService;
|
}
|
|
// private QTDServicePrx _qtdService = null;
|
// private QTDServicePrx getQTDServiceImpl(){
|
// try {
|
// if(_qtdService != null){
|
// return _qtdService;
|
// }
|
//
|
// if (_proxyUtil == null) {
|
// InitIceUtil();
|
// }
|
//
|
// _qtdService = QTDServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.QTDSERVICE));
|
// } catch (Exception e) {
|
// //e.printStackTrace();
|
// ServerWithLog4j.logger.error(e);
|
// }
|
// return _qtdService;
|
// }
|
|
private ObjectQueryServicePrx _oqService = null;
|
private ObjectQueryServicePrx getBOQueryServiceImpl(){
|
try {
|
if(_oqService != null){
|
return _oqService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
_oqService = ObjectQueryServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.OQSERVICE, ServiceNames.OQSERVICEREP));
|
} catch (Exception e) {
|
//e.printStackTrace();
|
ServerWithLog4j.logger.error(e);
|
}
|
return _oqService;
|
}
|
|
|
// private RefQueryServicePrx _rqService = null;
|
// private RefQueryServicePrx getRQServiceImpl() {
|
// try {
|
// if(_rqService != null){
|
// return _rqService;
|
// }
|
//
|
// if (_proxyUtil == null) {
|
// InitIceUtil();
|
// }
|
//
|
// _rqService = RefQueryServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.RQSERVICE));
|
// } catch (Exception e) {
|
// //e.printStackTrace();
|
// ServerWithLog4j.logger.error(e);
|
// }
|
// return _rqService;
|
// }
|
|
|
private PortalServicePrx _uiService = null;
|
private PortalServicePrx getUIServiceImpl(){
|
try {
|
if(_uiService != null){
|
return _uiService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
_uiService = PortalServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.UISERVICE, ServiceNames.UISERVICEREP));
|
} catch (Exception e) {
|
//e.printStackTrace();
|
ServerWithLog4j.logger.error(e);
|
}
|
return _uiService;
|
}
|
|
|
private OMDServicePrx _omdService = null;
|
private OMDServicePrx getOMDServiceImpl(){
|
try {
|
if(_omdService != null){
|
return _omdService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
_omdService = OMDServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.OMDSERVICE, ServiceNames.OMDSERVICEREP));
|
} catch (Exception e) {
|
//e.printStackTrace();
|
ServerWithLog4j.logger.error(e);
|
}
|
return _omdService;
|
}
|
|
private WorkflowServicePrx _wfService = null;
|
private WorkflowServicePrx getWFServiceImpl(){
|
try {
|
if(_wfService != null){
|
return _wfService;
|
}
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
_wfService = WorkflowServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.WFSERVICE, ServiceNames.WFSERVICEREP));
|
} catch (Exception e) {
|
//e.printStackTrace();
|
ServerWithLog4j.logger.error(e);
|
}
|
return _wfService;
|
}
|
|
// private VolumeManagerPrx getVolumeFactoryImpl(){
|
// try {
|
// if (_proxyUtil == null) {
|
// InitIceUtil();
|
// }
|
//
|
// return VolumeManagerPrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.VOLUMEMANAGER));
|
// } catch (Exception e) {
|
// //e.printStackTrace();
|
// ServerWithLog4j.logger.error(e);
|
// }
|
// return null;
|
// }
|
|
private VolumeServicePrx _defaultVolService = null;
|
private VolumeServicePrx getVolumeServiceImpl(String vol){
|
try {
|
if (_defaultVolService != null)
|
return _defaultVolService;
|
|
if (_proxyUtil == null) {
|
InitIceUtil();
|
}
|
|
_defaultVolService = VolumeServicePrx.checkedCast(_proxyUtil.getObjectByName(ServiceNames.VOLUMESERVICE, ServiceNames.VOLUMESERVICEREP));
|
} catch (Exception e) {
|
//e.printStackTrace();
|
ServerWithLog4j.logger.error(e);
|
}
|
return _defaultVolService;
|
}
|
}
|