ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
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]);
        }
    }
 
}