2 * Copyright 2016-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.
16 package org.onap.usecaseui.server.service.lcm.impl;
18 import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
19 import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
20 import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
21 import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest;
22 import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
23 import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
24 import org.onap.usecaseui.server.util.RestfulServices;
25 import org.springframework.context.annotation.EnableAspectJAutoProxy;
26 import org.springframework.stereotype.Service;
28 import java.io.IOException;
30 @Service("ServiceLcmService")
31 @org.springframework.context.annotation.Configuration
32 @EnableAspectJAutoProxy
33 public class DefaultServiceLcmService implements ServiceLcmService {
35 private SOService soService;
37 public DefaultServiceLcmService() {
38 this(RestfulServices.create(SOService.class));
41 public DefaultServiceLcmService(SOService soService) {
42 this.soService = soService;
46 public ServiceOperation instantiateService(ServiceInstantiationRequest request) {
48 return soService.instantiateService(request).execute().body();
49 } catch (IOException e) {
50 throw new SOException("SO Service is not available!", e);
55 public OperationProgressInformation queryOperationProgress(String serviceId, String operationId) {
57 return soService.queryOperationProgress(serviceId, operationId).execute().body();
58 } catch (IOException e) {
59 throw new SOException("SO Service is not available!", e);
64 public ServiceOperation terminateService(String serviceId) {
66 return soService.terminateService(serviceId).execute().body();
67 } catch (IOException e) {
68 throw new SOException("SO Service is not available!", e);