diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2017-09-25 01:31:18 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2017-09-25 01:31:29 +0800 |
commit | 8082387d62a3d242608f5f95c2d3a081cc9a57d0 (patch) | |
tree | 440ef7abf64bfc4b851ed56e914a53656e231d57 /src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java | |
parent | da86aa52d6cc136a040f342709b425be82ce187d (diff) |
instantiate and terminate servce
Change-Id: Id41c300d6750170e62ce211dab434d1e862c9c05
Issue-Id: USECASEUI-36
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
Diffstat (limited to 'src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java')
-rw-r--r-- | src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java new file mode 100644 index 00000000..7bb3777a --- /dev/null +++ b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java @@ -0,0 +1,71 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.service.lcm.impl; + +import org.onap.usecaseui.server.service.lcm.ServiceLcmService; +import org.onap.usecaseui.server.service.lcm.domain.so.SOService; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceInstantiationRequest; +import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; +import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException; +import org.onap.usecaseui.server.util.RestfulServices; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; + +import java.io.IOException; + +@Service("ServiceLcmService") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class DefaultServiceLcmService implements ServiceLcmService { + + private SOService soService; + + public DefaultServiceLcmService() { + this(RestfulServices.create(SOService.class)); + } + + public DefaultServiceLcmService(SOService soService) { + this.soService = soService; + } + + @Override + public ServiceOperation instantiateService(ServiceInstantiationRequest request) { + try { + return soService.instantiateService(request).execute().body(); + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } + + @Override + public OperationProgressInformation queryOperationProgress(String serviceId, String operationId) { + try { + return soService.queryOperationProgress(serviceId, operationId).execute().body(); + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } + + @Override + public ServiceOperation terminateService(String serviceId) { + try { + return soService.terminateService(serviceId).execute().body(); + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } +} |