1 /*******************************************************************************
2 * Copyright 2017 ZTE, Inc. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
13 ******************************************************************************/
14 package org.onap.msb.sdk.example.server;
16 import org.onap.msb.sdk.example.server.resources.AnimalResource;
17 import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
19 import io.dropwizard.Application;
20 import io.dropwizard.setup.Environment;
23 public class ExampleApp extends Application<Config> {
25 private static final String CONFIGURATION_FILE = "example.yml";
27 public static void main(String[] args) throws Exception {
29 String configFile = null;
30 if (args.length > 1) {
33 configFile = ExampleApp.class.getClassLoader().getResource(CONFIGURATION_FILE).getFile();
35 args = new String[] {"server", configFile};
36 new ExampleApp().run(args);
40 public void run(Config configuration, Environment environment) throws Exception {
41 // For real use case, MSB discovery IP and Port should come from configuration file instead
43 String msb_discovery_ip = "127.0.0.1";
44 int msb_discovery_port = 10081;
46 environment.jersey().register(new AnimalResource());
48 MSBServiceClient msbClient = new MSBServiceClient(msb_discovery_ip, msb_discovery_port);
50 MsbHelper helper = new MsbHelper(msbClient);