package com.vci.server.omd; import com.vci.corba.omd.btm.BTMServicePrx; import com.vci.corba.omd.data.SystemModelData; import com.vci.corba.omd.etm.EnumServicePrx; import com.vci.corba.omd.lcm.LifeCycleServicePrx; import com.vci.corba.omd.ltm.LinkTypeServicePrx; import com.vci.corba.omd.qtm.QTDServicePrx; import com.vci.corba.omd.stm.StatePoolServicePrx; import com.vci.corba.omd.tim.TypeIndexServicePrx; import com.vci.corba.omd.OMDService; import com.vci.corba.omd.atm.AttPoolServicePrx; import java.util.Date; import com.vci.common.ServiceNames; import com.vci.corba.common.VCIError; import com.vci.corba.omd.vrm.VersionRuleServicePrx; import com.vci.server.BaseService; import com.vci.server.omd.attribpool.APServiceImpl; import com.vci.server.omd.biztype.BTMServiceImpl; import com.vci.server.omd.delegate.SystemConfDelegate; import com.vci.server.omd.enumtype.EnumServiceImpl; import com.vci.server.omd.lifecycle.LifeCycleServiceImpl; import com.vci.server.omd.linktype.LinkTypeServiceImpl; import com.vci.server.omd.qt.QTDefineServiceImpl; import com.vci.server.omd.statepool.StatePoolServiceImpl; import com.vci.server.omd.typeindex.TypeIndexServiceImpl; import com.vci.server.omd.versionrule.VersionRuleServiceImpl; import com.zeroc.Ice.Current; public class OMDServiceImpl extends BaseService implements OMDService { private EnumServicePrx _emService = null; private AttPoolServicePrx _apService = null; private StatePoolServicePrx _spService = null; private LifeCycleServicePrx _lcService = null; private VersionRuleServicePrx _vrService = null; private BTMServicePrx _btService = null; private LinkTypeServicePrx _ltService = null; private TypeIndexServicePrx _timService = null; //private DDLServicePrx _ddlService = null; private QTDServicePrx _qtdService = null; public OMDServiceImpl() { // EnumServerCacheUtil.initCache(); // APServerCacheUtil.initCache(); // StatePoolServerCacheUtil.initCache(); // LifeCycleCacheUtil.initCache(); // VRServerCacheUtil.initCache(); // BizTypeCacheUtil.initCache(); // LinkTypeCacheUtil.initCache(); } @Override public String getServiceName() { return ServiceNames.OMDSERVICE; } @Override public void test(com.zeroc.Ice.Current current) { String op = current.operation; String adapter = current.adapter.getName(); String id = current.id.name; String time = new Date().toString(); System.out.println(String.format("== %s [OMDService.test] (adapter=%s, id=%s, op=%s)", time, adapter, id, op)); } @Override public SystemModelData getSysModelData(String[] boTypes, Current current) throws VCIError { try { return SystemConfDelegate.getInstance().getAllConfigurationData(new String[0]); } catch (Throwable e) { throw new VCIError("OMD-100001", new String[0]); } } @Override public EnumServicePrx getEnumService(Current current) throws VCIError { try { if (_emService == null) { _emService = EnumServicePrx.checkedCast(current.adapter.addWithUUID(new EnumServiceImpl()), current.ctx); } return _emService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100002", new String[0]); } } @Override public AttPoolServicePrx getAttributeService(Current current) throws VCIError { try { if (_apService == null) { _apService = AttPoolServicePrx.checkedCast(current.adapter.addWithUUID(new APServiceImpl()), current.ctx); } return _apService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100003", new String[0]); } } @Override public StatePoolServicePrx getStateService(Current current) throws VCIError { try { if (_spService == null) { _spService = StatePoolServicePrx.checkedCast(current.adapter.addWithUUID(new StatePoolServiceImpl()), current.ctx); } return _spService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100004", new String[0]); } } @Override public LifeCycleServicePrx getLifeCycleService(Current current) throws VCIError { try { if (_lcService == null) { LifeCycleServiceImpl obj = new LifeCycleServiceImpl(); _lcService = LifeCycleServicePrx.checkedCast(current.adapter.addWithUUID(new LifeCycleServiceImpl()), current.ctx); } return _lcService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100005", new String[0]); } } @Override public VersionRuleServicePrx getVerRuleService(Current current) throws VCIError { try { if (_vrService == null) { _vrService = VersionRuleServicePrx.checkedCast(current.adapter.addWithUUID(new VersionRuleServiceImpl()), current.ctx); } return _vrService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100006", new String[0]); } } @Override public BTMServicePrx getBTMService(Current current) throws VCIError { try { if (_btService == null) { _btService = BTMServicePrx.checkedCast(current.adapter.addWithUUID(new BTMServiceImpl()), current.ctx); } return _btService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100007", new String[0]); } } @Override public LinkTypeServicePrx getLinkTypeService(Current current) throws VCIError { try { if (_ltService == null) { //LinkTypeServiceImpl obj = new LinkTypeServiceImpl(); _ltService = LinkTypeServicePrx.checkedCast(current.adapter.addWithUUID(new LinkTypeServiceImpl()), current.ctx); } return _ltService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100008", new String[0]); } } @Override public TypeIndexServicePrx getTypeIndexService(Current current) throws VCIError { try { if (_timService == null) { //LinkTypeServiceImpl obj = new LinkTypeServiceImpl(); _timService = TypeIndexServicePrx.checkedCast(current.adapter.addWithUUID(new TypeIndexServiceImpl()), current.ctx); } return _timService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100009", new String[0]); } } // @Override // public DDLServicePrx getDDLService(Current current) throws VCIError { // try { // if (_ddlService == null) { //// DDLServiceImpl obj = new DDLServiceImpl(); // _ddlService = DDLServicePrx.checkedCast(current.adapter.addWithUUID(new DDLServiceImpl()), current.ctx); // } // return _ddlService.ice_context(current.ctx); // } catch (Exception e) {e.printStackTrace(); // throw new VCIError("OMD-100009", new String[0]); // } // } @Override public QTDServicePrx getQTDService(Current current) throws VCIError { try { if (_qtdService == null) { // DDLServiceImpl obj = new DDLServiceImpl(); _qtdService = QTDServicePrx.checkedCast(current.adapter.addWithUUID(new QTDefineServiceImpl()), current.ctx); } return _qtdService.ice_context(current.ctx); } catch (Exception e) {e.printStackTrace(); throw new VCIError("OMD-100009", new String[0]); } } }