2 * Copyright 2017 ZTE Corporation.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onap.holmes.rulemgt;
19 import io.dropwizard.setup.Environment;
20 import java.io.IOException;
21 import lombok.extern.slf4j.Slf4j;
22 import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
23 import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
24 import org.onap.holmes.common.config.MicroServiceConfig;
25 import org.onap.holmes.common.utils.MSBRegisterUtil;
28 public class RuleActiveApp extends IOCApplication< RuleAppConfig > {
30 public static void main( String[] args ) throws Exception {
31 new RuleActiveApp().run( args );
35 public String getName() {
36 return "Holmes Rule Management ActiveApp APP ";
40 public void run(RuleAppConfig configuration, Environment environment) throws Exception {
41 super.run(configuration, environment);
44 new MSBRegisterUtil().register(initServiceEntity());
45 } catch (IOException e) {
46 log.warn("Micro service registry httpclient close failure",e);
51 private ServiceRegisterEntity initServiceEntity() {
52 ServiceRegisterEntity serviceRegisterEntity = new ServiceRegisterEntity();
53 serviceRegisterEntity.setServiceName("holmes-rule-mgmt");
54 serviceRegisterEntity.setProtocol("REST");
55 serviceRegisterEntity.setVersion("v1");
56 serviceRegisterEntity.setUrl("/onapapi/holmes-rule-mgmt/v1");
57 serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9101", 0);
58 serviceRegisterEntity.setVisualRange("1|0");
59 return serviceRegisterEntity;