d1405a27d044bfa1fb059071e09880674022992f
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
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
17 package org.openo.nfvo.resmanagement.service.base.openstack.impl;
18
19 import java.util.ArrayList;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.openo.baseservice.remoteservice.exception.ServiceException;
24 import org.openo.nfvo.resmanagement.service.base.openstack.inf.Vim;
25 import org.openo.nfvo.resmanagement.service.business.inf.VimBusiness;
26 import org.openo.nfvo.resmanagement.service.entity.VimEntity;
27
28 import net.sf.json.JSONObject;
29
30 /**
31  * Vim info interface.<br/>
32  * <p>
33  * </p>
34  *
35  * @author
36  * @version NFVO 0.5 Aug 24, 2016
37  */
38 public class VimImpl implements Vim {
39
40     private VimBusiness vimBusiness;
41
42     @Override
43     public int add(String id) throws ServiceException {
44         return vimBusiness.addVim(id);
45     }
46
47     @Override
48     public int add(JSONObject jsonObject) throws ServiceException {
49         return add(jsonObject.getString("id"));
50     }
51
52     @Override
53     public int update(JSONObject jsonObject) throws ServiceException {
54         return 0;
55     }
56
57     @Override
58     public int delete(String id) throws ServiceException {
59         return vimBusiness.deleteVim(id);
60     }
61
62     @Override
63     public VimEntity getVim(String id) throws ServiceException {
64         return vimBusiness.getVim(id);
65     }
66
67     @Override
68     public List<VimEntity> getList() throws ServiceException {
69         return vimBusiness.getVims();
70     }
71
72     @Override
73     public List<JSONObject> getVimInfo(Map<String, Object> condition) throws ServiceException {
74         // get vim from vimadapter
75         return new ArrayList<JSONObject>();
76     }
77
78     public void setVimBusiness(VimBusiness vimBusiness) {
79         this.vimBusiness = vimBusiness;
80     }
81
82 }