fc52e0d655d53a22f1556e32939cdc4d8b445c25
[portal/sdk.git] /
1 /*-
2  * ================================================================================
3  * ECOMP Portal SDK
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ================================================================================
19  */
20 package org.openecomp.portalsdk.analytics.system.fusion;
21
22 import java.sql.*;
23 import java.util.*;
24
25 import javax.servlet.*;
26
27 import org.openecomp.portalsdk.analytics.config.*;
28 import org.openecomp.portalsdk.analytics.system.*;
29 import org.openecomp.portalsdk.analytics.system.fusion.adapter.FusionAdapter;
30 import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
31 import org.openecomp.portalsdk.analytics.system.fusion.adapter.SpringContext;
32 import org.openecomp.portalsdk.analytics.util.*;
33 import org.springframework.beans.factory.annotation.Autowired;
34
35
36
37 public class DbUtils implements IDbUtils {
38         
39         @Autowired
40         public RaptorAdapter raptorAdapter;
41         @Autowired
42         public FusionAdapter fusionAdapter;
43
44         public DbUtils() {}
45
46         public void initializeDbUtils(ServletContext servletContext) {
47                 raptorAdapter = (RaptorAdapter)SpringContext.getApplicationContext().getBean("raptorAdapter");
48         }   // initializeDbUtils
49
50         public Connection getConnection()  {
51                 return raptorAdapter.getConnection();
52         }   // getConnection
53
54         public void clearConnection(Connection con) {
55                 raptorAdapter.releaseConnection(con);
56         }   // clearConnection
57
58         public RaptorAdapter getRaptorAdapter() {
59                 return raptorAdapter;
60         }
61
62         public void setRaptorAdapter(RaptorAdapter raptorAdapter) {
63                 this.raptorAdapter = raptorAdapter;
64         }
65
66         public FusionAdapter getFusionAdapter() {
67                 return fusionAdapter;
68         }
69
70         public void setFusionAdapter(FusionAdapter fusionAdapter) {
71                 this.fusionAdapter = fusionAdapter;
72         }
73
74         
75         
76
77         
78 }   // DbUtils