Change the groupid from openo to onap
[holmes/engine-management.git] / engine-d / src / main / java / org / onap / holmes / engine / EngineDActiveApp.java
1 /**
2  * Copyright 2017 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.holmes.engine;
17
18 import io.dropwizard.setup.Environment;
19 import java.io.IOException;
20 import lombok.extern.slf4j.Slf4j;
21 import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
22 import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
23 import org.onap.holmes.common.config.MicroServiceConfig;
24 import org.onap.holmes.common.utils.MSBRegisterUtil;
25
26 @Slf4j
27 public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> {
28
29     public static void main(String[] args) throws Exception {
30         new EngineDActiveApp().run(args);
31     }
32
33     @Override
34     public void run(EngineDAppConfig configuration, Environment environment) throws Exception {
35         super.run(configuration, environment);
36
37         try {
38             new MSBRegisterUtil().register(initServiceEntity());
39         } catch (IOException e) {
40             log.warn("Micro service registry httpclient close failure", e);
41         }
42     }
43
44     private ServiceRegisterEntity initServiceEntity() {
45         ServiceRegisterEntity serviceRegisterEntity = new ServiceRegisterEntity();
46         serviceRegisterEntity.setServiceName("holmes-engine-mgmt");
47         serviceRegisterEntity.setProtocol("REST");
48         serviceRegisterEntity.setVersion("v1");
49         serviceRegisterEntity.setUrl("/onapapi/holmes-engine-mgmt/v1");
50         serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9102", 0);
51         serviceRegisterEntity.setVisualRange("1|0");
52         return serviceRegisterEntity;
53     }
54 }