package com.vci.web.util;
|
|
import com.vci.corba.logon.method.LogonFactory;
|
import com.vci.corba.logon.method.LogonFactoryHelper;
|
import com.vci.corba.volumn.method.VolumnFactory;
|
import com.vci.corba.volumn.method.VolumnFactoryHelper;
|
import com.vci.starter.corba.connector.JacorbClientConnector;
|
import com.vci.starter.web.exception.VciBaseException;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
import plm.bs.bom.common.BOFactoryService;
|
import plm.bs.bom.common.BOFactoryServiceHelper;
|
import plm.corba.attribpool.AttPoolServiceHelper;
|
import plm.corba.attribpool.AttPoolServiceOperations;
|
import plm.corba.btm.BTMServiceHelper;
|
import plm.corba.btm.BTMServiceOperations;
|
import plm.corba.enumManager.EnumServiceHelper;
|
import plm.corba.enumManager.EnumServiceOperations;
|
import plm.corba.lifecycle.LifeCyleServiceHelper;
|
import plm.corba.lifecycle.LifeCyleServiceOperations;
|
import plm.corba.linkTypeManager.LinkTypeServiceHelper;
|
import plm.corba.linkTypeManager.LinkTypeServiceOperations;
|
import plm.corba.portal.PortalServiceHelper;
|
import plm.corba.portal.PortalServiceOperations;
|
import plm.corba.qt.QTServiceHelper;
|
import plm.corba.qt.QTServiceOperations;
|
import plm.corba.statePoolManager.StatePoolServiceHelper;
|
import plm.corba.statePoolManager.StatePoolServiceOperations;
|
import plm.corba.versionRuleManager.VersionRuleServiceHelper;
|
import plm.corba.versionRuleManager.VersionRuleServiceOperations;
|
|
/**
|
* 平台的客户端调用工具类
|
* @author weidy
|
* @date 2021-2-14
|
*/
|
@Component
|
public class PlatformClientUtil {
|
|
/**
|
* 业务类型工厂的服务
|
*/
|
private static final String BO_FACTORY_SERVICE_NAME = "bofFactoryService";
|
|
/**
|
* 登录服务
|
*/
|
public static final String LOGON_FACTORY_SERVICE_NAME = "LogonFactoryService";
|
|
/**
|
* 状态池服务名字
|
*/
|
public static final String STATE_POOL_SERVICE_NAME = "statePoolService";
|
|
/**
|
* 生命周期服务
|
*/
|
public static final String LIFE_CYCLE_SERVICE_NAME = "lifeCycleService";
|
|
/**
|
* 枚举的服务
|
*/
|
public static final String ENUM_SERVICE_NAME = "enumService";
|
|
/**
|
* 版本规则的服务
|
*/
|
private static final String VERSION_SERVICE_NAME = "versionRuleService";
|
|
/**
|
* 属性的服务
|
*/
|
private static final String ATTRIBUTE_SERVICE_NAME = "apService";
|
|
/**
|
* 业务类型的服务
|
*/
|
private static final String BTM_SERVICE_NAME = "btmService";
|
|
/**
|
* 链接类型的服务
|
*/
|
public static final String LINK_SERVICE_NAME = "linkTypeService";
|
/**
|
* UI上下文服务
|
*/
|
private static final String PORTAL_SERVICE_NAME = "portalService";
|
/**
|
* 查询服务
|
*/
|
private static final String QUERY_SERVICE_NAME = "qtService";
|
|
/**
|
* corba的客户端调用
|
*/
|
@Autowired
|
private JacorbClientConnector jacorbClientConnector;
|
|
/**
|
* 获取业务类型工厂的服务
|
* @return 服务的对象
|
*/
|
public BOFactoryService getBOFactoryService(){
|
return BOFactoryServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(BO_FACTORY_SERVICE_NAME));
|
}
|
|
/**
|
* 获取登录主服务
|
* @return 服务的对象
|
*/
|
public LogonFactory getLogonFactoryService(){
|
return LogonFactoryHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LOGON_FACTORY_SERVICE_NAME));
|
}
|
|
/**
|
* 获取状态池的服务
|
* @return 服务的对象
|
*/
|
public StatePoolServiceOperations getStatePoolService(){
|
return StatePoolServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(STATE_POOL_SERVICE_NAME));
|
}
|
|
/**
|
* 获取生命周期的服务
|
* @return 生命周期的服务对象
|
*/
|
public LifeCyleServiceOperations getLifeCycleService(){
|
return LifeCyleServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LIFE_CYCLE_SERVICE_NAME));
|
}
|
|
/**
|
* 获取枚举的服务
|
* @return 枚举的服务对象
|
*/
|
public EnumServiceOperations getEnumService(){
|
return EnumServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ENUM_SERVICE_NAME));
|
}
|
|
/**
|
* 获取版本规则的服务
|
* @return 版本规则的服务
|
*/
|
public VersionRuleServiceOperations getVersionService(){
|
return VersionRuleServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(VERSION_SERVICE_NAME));
|
}
|
|
/**
|
* 属性服务
|
* @return 服务的对象
|
*/
|
public AttPoolServiceOperations getAttributeService(){
|
return AttPoolServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(ATTRIBUTE_SERVICE_NAME));
|
}
|
|
/**
|
* 获取业务类型
|
* @return 服务的对象
|
*/
|
public BTMServiceOperations getBtmService(){
|
return BTMServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(BTM_SERVICE_NAME));
|
}
|
|
/**
|
* 获取链接类型
|
* @return 服务的对象
|
*/
|
public LinkTypeServiceOperations getLinkTypeService(){
|
return LinkTypeServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(LINK_SERVICE_NAME));
|
}
|
|
/**
|
* 获取UI上下文服务
|
* @return 服务的对象
|
*/
|
public PortalServiceOperations getPortalService(){
|
return PortalServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(PORTAL_SERVICE_NAME));
|
}
|
|
/**
|
* 获取查询服务
|
* @return 服务的对象
|
*/
|
public QTServiceOperations getQueryService(){
|
return QTServiceHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByServiceName(QUERY_SERVICE_NAME));
|
}
|
|
/**
|
* 卷服务
|
* @param serverUrl 命名服务
|
* @param volumeName 卷的名称
|
* @return 卷服务的的对象
|
*/
|
public VolumnFactory getVolumeService(String serverUrl,String volumeName){
|
if(StringUtils.isNotBlank(serverUrl)){
|
if(StringUtils.countMatches(serverUrl,":") < 2){
|
throw new VciBaseException("卷服务的配置错误,需要主机名:端口:服务前缀这种形式");
|
}
|
String[] split = serverUrl.split(":");
|
serverUrl = "corbaloc::" + split[0] + ":" +split[1] + "/NameService:" +split[2];
|
}
|
return VolumnFactoryHelper.narrow(jacorbClientConnector.getCorbaServiceObjectByUrlAndServiceName(serverUrl,volumeName));
|
}
|
|
}
|