summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfilters/provider/pom.xml1
-rw-r--r--filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersService.java4
-rw-r--r--filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersServiceImpl.java (renamed from filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/Activator.java)38
-rw-r--r--filters/provider/src/main/resources/org/opendaylight/blueprint/filters-blueprint.xml9
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java28
-rw-r--r--sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java12
6 files changed, 49 insertions, 43 deletions
diff --git a/filters/provider/pom.xml b/filters/provider/pom.xml
index 9f59d346..240966e8 100755
--- a/filters/provider/pom.xml
+++ b/filters/provider/pom.xml
@@ -73,7 +73,6 @@
<configuration>
<instructions>
<Bundle-SymbolicName>org.onap.ccsdk.sli.core.filters</Bundle-SymbolicName>
- <Bundle-Activator>org.onap.ccsdk.sli.core.filters.Activator</Bundle-Activator>
<Export-Package>org.onap.ccsdk.sli.core.filters</Export-Package>
<DynamicImport-Package>org.onap.ccsdk.sli.core.filters</DynamicImport-Package>
<Import-Package>javax.servlet.*,java.io.*,org.osgi.framework.*,org.slf4j.*,org.apache.commons.codec.binary.*</Import-Package>
diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersService.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersService.java
new file mode 100644
index 00000000..9587e8d9
--- /dev/null
+++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersService.java
@@ -0,0 +1,4 @@
+package org.onap.ccsdk.sli.core.filters;
+
+public interface FiltersService {
+}
diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/Activator.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersServiceImpl.java
index 6cac336a..12370ca9 100644
--- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/Activator.java
+++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/FiltersServiceImpl.java
@@ -21,43 +21,13 @@
package org.onap.ccsdk.sli.core.filters;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+public class FiltersServiceImpl implements FiltersService {
+ private static final Logger LOG = LoggerFactory.getLogger(FiltersServiceImpl.class);
-public class Activator implements BundleActivator {
-
- private ServiceRegistration registration = null;
-
- private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- @Override
- public void start(BundleContext ctx) throws Exception {
-
-
-
- Object impl = new String();
- String regName = impl.getClass().getName();
-
- if (registration == null)
- {
- LOG.debug("Registering Filters service "+regName);
- registration = ctx.registerService(regName, impl, null);
- }
-
- }
-
- @Override
- public void stop(BundleContext ctx) throws Exception {
-
- if (registration != null)
- {
- registration.unregister();
- registration = null;
- }
+ public FiltersServiceImpl() {
+ LOG.debug("Registering {}", FiltersServiceImpl.class.getName());
}
-
}
diff --git a/filters/provider/src/main/resources/org/opendaylight/blueprint/filters-blueprint.xml b/filters/provider/src/main/resources/org/opendaylight/blueprint/filters-blueprint.xml
new file mode 100644
index 00000000..3bf8423e
--- /dev/null
+++ b/filters/provider/src/main/resources/org/opendaylight/blueprint/filters-blueprint.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="filters" class="org.onap.ccsdk.sli.core.filters.FiltersServiceImpl" />
+ <service ref="filters" interface="org.onap.ccsdk.sli.core.filters.FiltersService" />
+
+</blueprint>
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
index de3682d8..9216519a 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java
@@ -8,9 +8,9 @@
* 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.
@@ -55,7 +55,7 @@ public class SvcLogicDblibStore implements SvcLogicStore {
.getLogger(SvcLogicDblibStore.class);
private static final String DBLIB_SERVICE =
- "org.onap.ccsdk.sli.core.dblib.DBResourceManager";
+ "org.onap.ccsdk.sli.core.dblib.DbLibService";
Properties props = null;
@@ -132,7 +132,7 @@ public class SvcLogicDblibStore implements SvcLogicStore {
String mode) throws SvcLogicException {
DbLibService dbSvc = getDbLibService();
-
+ PreparedStatement fetchGraphStmt = null;
Connection dbConn = null;
SvcLogicGraph retval = null;
ResultSet results = null;
@@ -146,7 +146,7 @@ public class SvcLogicDblibStore implements SvcLogicStore {
try {
dbConn = ((DBResourceManager) dbSvc).getConnection();
- PreparedStatement fetchGraphStmt;
+
ArrayList<String> args = new ArrayList<String>();
args.add(module);
@@ -193,6 +193,13 @@ public class SvcLogicDblibStore implements SvcLogicStore {
} catch (Exception e) {
throw new ConfigurationException("Graph processing failed", e);
} finally {
+ try {
+ if (fetchGraphStmt != null) {
+ fetchGraphStmt.close();
+ }
+ } catch (SQLException e) {
+ LOG.info(e.getMessage());
+ }
if (results != null) {
try {
results.close();
@@ -267,12 +274,12 @@ public class SvcLogicDblibStore implements SvcLogicStore {
}
Connection dbConn = null;
-
+ PreparedStatement storeGraphStmt = null;
try {
dbConn = ((DBResourceManager) dbSvc).getConnection();
boolean oldAutoCommit = dbConn.getAutoCommit();
dbConn.setAutoCommit(false);
- PreparedStatement storeGraphStmt = dbConn
+ storeGraphStmt = dbConn
.prepareStatement(storeGraphSql);
storeGraphStmt.setString(1, graph.getModule());
storeGraphStmt.setString(2, graph.getRpc());
@@ -289,6 +296,13 @@ public class SvcLogicDblibStore implements SvcLogicStore {
throw new SvcLogicException("Could not write object to database", e);
} finally {
try {
+ if (storeGraphStmt != null) {
+ storeGraphStmt.close();
+ }
+ } catch (SQLException e) {
+ LOG.info(e.getMessage());
+ }
+ try {
if (dbConn != null && !dbConn.isClosed()) {
dbConn.close();
}
diff --git a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java
index 1143ef74..4a60de95 100644
--- a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java
+++ b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/FileRecorder.java
@@ -24,6 +24,7 @@ package org.onap.ccsdk.sli.core.sli.recording;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -82,6 +83,7 @@ public class FileRecorder implements SvcLogicRecorder {
File recordFile = new File(fileName);
PrintWriter recPrinter = null;
+ FileWriter fileWriter = null;
Date now = new Date();
TimeZone tz = TimeZone.getTimeZone("UTC");
@@ -95,7 +97,7 @@ public class FileRecorder implements SvcLogicRecorder {
try
{
- recPrinter = new PrintWriter(new FileWriter(recordFile, true));
+ recPrinter = new PrintWriter(fileWriter = new FileWriter(recordFile, true));
recPrinter.println(record);
}
catch (Exception e)
@@ -108,6 +110,14 @@ public class FileRecorder implements SvcLogicRecorder {
{
recPrinter.close();
}
+ if (fileWriter != null)
+ {
+ try {
+ fileWriter.close();
+ } catch (IOException e) {
+
+ }
+ }
}