diff options
57 files changed, 148 insertions, 151 deletions
diff --git a/dblib/features/pom.xml b/dblib/features/pom.xml index 2be6c8dbe..4053efaf9 100755 --- a/dblib/features/pom.xml +++ b/dblib/features/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>dblib</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>dblib-features</artifactId> <name>DBLIB Adaptor - Features</name> diff --git a/dblib/installer/pom.xml b/dblib/installer/pom.xml index 10845db17..a2d7362a9 100755 --- a/dblib/installer/pom.xml +++ b/dblib/installer/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>dblib</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>dblib-installer</artifactId> <name>DBLIB Adaptor - Karaf Installer</name> diff --git a/dblib/pom.xml b/dblib/pom.xml index 9e1516374..8e7afabb5 100755 --- a/dblib/pom.xml +++ b/dblib/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> @@ -16,7 +16,7 @@ <name>DBLIB Adaptor</name> <description>The DBLIB adaptor allows service logic to access persistent data in a local sql database</description> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> <build> diff --git a/dblib/provider/pom.xml b/dblib/provider/pom.xml index 11e0ff748..07fc61ab1 100755 --- a/dblib/provider/pom.xml +++ b/dblib/provider/pom.xml @@ -4,10 +4,10 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>dblib</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>dblib-provider</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> <packaging>bundle</packaging> <name>DBLIB Adaptor - Provider</name> <url>http://maven.apache.org</url> diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java index 9dc262d07..ee8ab2f33 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java @@ -20,6 +20,18 @@ package org.onap.ccsdk.sli.core.dblib; +import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; +import org.apache.tomcat.jdbc.pool.PoolExhaustedException; +import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; +import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor; +import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject; +import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.sql.DataSource; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.RowSetProvider; import java.io.Closeable; import java.io.IOException; import java.io.PrintWriter; @@ -36,20 +48,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Observer; -import javax.sql.DataSource; -import javax.sql.rowset.CachedRowSet; -import javax.sql.rowset.RowSetProvider; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.tomcat.jdbc.pool.PoolExhaustedException; -import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; -import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor; -import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver; -import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject; - -import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; - /** * @version $Revision: 1.13 $ @@ -94,12 +92,14 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito /* (non-Javadoc) * @see javax.sql.DataSource#getConnection() */ + @Override public Connection getConnection() throws SQLException { return ds.getConnection(); } - public CachedRowSet getData(String statement, ArrayList<Object> arguments) throws SQLException, Throwable + public CachedRowSet getData(String statement, ArrayList<Object> arguments) + throws SQLException, Throwable { TestObject testObject = null; testObject = monitor.registerRequest(); @@ -128,7 +128,8 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito } } - public boolean writeData(String statement, ArrayList<Object> arguments) throws SQLException, Throwable + public boolean writeData(String statement, ArrayList<Object> arguments) + throws SQLException, Throwable { TestObject testObject = null; testObject = monitor.registerRequest(); @@ -157,7 +158,8 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito } } - CachedRowSet executePreparedStatement(Connection conn, String statement, ArrayList<Object> arguments, boolean close) throws SQLException, Throwable + CachedRowSet executePreparedStatement(Connection conn, String statement, + ArrayList<Object> arguments, boolean close) throws SQLException, Throwable { long time = System.currentTimeMillis(); @@ -170,9 +172,10 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito } ResultSet rs = null; + PreparedStatement ps = null; try { data = RowSetProvider.newFactory().createCachedRowSet(); - PreparedStatement ps = conn.prepareStatement(statement); + ps = conn.prepareStatement(statement); if(arguments != null) { for(int i = 0, max = arguments.size(); i < max; i++){ @@ -223,6 +226,13 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito } catch(Exception exc){ } + try { + if (ps != null){ + ps.close(); + } + } catch (Exception exc){ + + } } return data; @@ -298,6 +308,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito /* (non-Javadoc) * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String) */ + @Override public Connection getConnection(String username, String password) throws SQLException { @@ -307,6 +318,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito /* (non-Javadoc) * @see javax.sql.DataSource#getLogWriter() */ + @Override public PrintWriter getLogWriter() throws SQLException { return ds.getLogWriter(); @@ -315,6 +327,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito /* (non-Javadoc) * @see javax.sql.DataSource#getLoginTimeout() */ + @Override public int getLoginTimeout() throws SQLException { return ds.getLoginTimeout(); @@ -323,6 +336,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito /* (non-Javadoc) * @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter) */ + @Override public void setLogWriter(PrintWriter out) throws SQLException { ds.setLogWriter(out); @@ -331,12 +345,14 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito /* (non-Javadoc) * @see javax.sql.DataSource#setLoginTimeout(int) */ + @Override public void setLoginTimeout(int seconds) throws SQLException { ds.setLoginTimeout(seconds); } + @Override public final String getDbConnectionName(){ return connectionName; } @@ -420,10 +436,12 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito return true; } + @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return false; } + @Override public <T> T unwrap(Class<T> iface) throws SQLException { return null; } @@ -447,34 +465,42 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito monitor.deleteObserver(observer); } + @Override public long getInterval() { return interval; } + @Override public long getInitialDelay() { return initialDelay; } + @Override public void setInterval(long value) { interval = value; } + @Override public void setInitialDelay(long value) { initialDelay = value; } + @Override public long getExpectedCompletionTime() { return expectedCompletionTime; } + @Override public void setExpectedCompletionTime(long value) { expectedCompletionTime = value; } + @Override public long getUnprocessedFailoverThreshold() { return unprocessedFailoverThreshold; } + @Override public void setUnprocessedFailoverThreshold(long value) { this.unprocessedFailoverThreshold = value; } @@ -487,6 +513,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito canTakeOffLine = false; final Thread offLineTimer = new Thread() { + @Override public void run(){ try { Thread.sleep(30000L); @@ -565,7 +592,9 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito retValue = false; } finally { try { - lock.close(); + if (lock != null) { + lock.close(); + } } catch(Exception exc) { } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java index 07e3dfab1..296fe70f1 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java @@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.core.dblib; import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration; import org.onap.ccsdk.sli.core.dblib.jdbc.JdbcDBCachedDataSource; -import org.onap.ccsdk.sli.core.dblib.jdbc.MySQLCachedDataSource; /** * @version $Revision: 1.1 $ diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java index 201cc4019..062cd8408 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java @@ -20,11 +20,8 @@ package org.onap.ccsdk.sli.core.dblib; -import com.google.common.annotations.VisibleForTesting; - import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.Optional; import java.util.Properties; @@ -35,10 +32,6 @@ import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibEnvVarFileResol import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibJREFileResolver; import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibKarafRootFileResolver; import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibPropertiesFileResolver; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -146,7 +139,6 @@ public class DBLIBResourceProvider { * <li>A <code>dblib.properties</code> file located in the karaf root directory</li> * </ol> */ - @VisibleForTesting File determinePropertiesFile(final DBLIBResourceProvider dblibResourceProvider) { for (final DblibPropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) { diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java index 8181b1300..40d1a2382 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java @@ -43,7 +43,6 @@ import java.util.concurrent.Executor; import javax.sql.rowset.CachedRowSet; import org.apache.tomcat.jdbc.pool.PooledConnection; -import org.apache.tomcat.jdbc.pool.ProxyConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,7 +64,8 @@ public class DBLibConnection implements Connection { public boolean lockTable(String tablename) { this.tableName = tablename; - return locked = dataSource.lockTable(connection, tableName); + locked = dataSource.lockTable(connection, tableName); + return locked; } public void resetInactivityTimer() { @@ -80,12 +80,13 @@ public class DBLibConnection implements Connection { public boolean unlock() { dataSource.unlockTable(connection); - return locked = false; + locked = false; + return locked; } public boolean writeData(String statement, ArrayList<String> arguments) throws SQLException, Throwable { - ArrayList<Object> newList=new ArrayList<Object>(); + ArrayList<Object> newList= new ArrayList<>(); if(arguments != null && !arguments.isEmpty()) { newList.addAll(arguments); } @@ -95,7 +96,7 @@ public class DBLibConnection implements Connection { public CachedRowSet getData(String statement, ArrayList<String> arguments) throws SQLException, Throwable { - ArrayList<Object> newList=new ArrayList<Object>(); + ArrayList<Object> newList= new ArrayList<>(); if(arguments != null && !arguments.isEmpty()) { newList.addAll(arguments); } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java index 7ed54306a..7a27a20ce 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java @@ -72,23 +72,22 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb protected final AtomicBoolean dsSelector = new AtomicBoolean(); // Queue<CachedDataSource> dsQueue = new ConcurrentLinkedQueue<CachedDataSource>(); - Queue<CachedDataSource> dsQueue = new PriorityQueue<CachedDataSource>(4, new Comparator<CachedDataSource>(){ - + Queue<CachedDataSource> dsQueue = new PriorityQueue<>(4, new Comparator<CachedDataSource>() { @Override public int compare(CachedDataSource left, CachedDataSource right) { try { - if(!left.isSlave()) + if (!left.isSlave()) { return -1; - if(!right.isSlave()) + } + if (!right.isSlave()) { return 1; - + } } catch (Throwable e) { LOGGER.warn("", e); } return 0; } - - }); + }); protected final Set<CachedDataSource> broken = Collections.synchronizedSet(new HashSet<CachedDataSource>()); protected final Object monitor = new Object(); protected final Properties configProps; @@ -236,6 +235,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb class RecoveryMgr extends Thread { + @Override public void run() { while(!terminating) { @@ -291,7 +291,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb */ @Override public CachedRowSet getData(String statement, ArrayList<String> arguments, String preferredDS) throws SQLException { - ArrayList<Object> newList=new ArrayList<Object>(); + ArrayList<Object> newList= new ArrayList<>(); if(arguments != null && !arguments.isEmpty()) { newList.addAll(arguments); } @@ -306,7 +306,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb CachedDataSource active = null; // test if there are any connection pools available - LinkedList<CachedDataSource> sources = new LinkedList<CachedDataSource>(this.dsQueue); + LinkedList<CachedDataSource> sources = new LinkedList<>(this.dsQueue); if(sources.isEmpty()){ LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available."); throw new DBLibException("No active DB connection pools are available in RequestDataWithRecovery call."); @@ -348,7 +348,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb handleGetConnectionException(active, exc); } finally { if(LOGGER.isDebugEnabled()){ - time = (System.currentTimeMillis() - time); + time = System.currentTimeMillis() - time; LOGGER.debug("getData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds."); } } @@ -402,7 +402,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb } } finally { if(LOGGER.isDebugEnabled()){ - time = (System.currentTimeMillis() - time); + time = System.currentTimeMillis() - time; LOGGER.debug(">> getData : "+ active.getDbConnectionName()+" "+time+" miliseconds."); } } @@ -415,7 +415,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb @Override public boolean writeData(String statement, ArrayList<String> arguments, String preferredDS) throws SQLException { - ArrayList<Object> newList=new ArrayList<Object>(); + ArrayList<Object> newList= new ArrayList<>(); if(arguments != null && !arguments.isEmpty()) { newList.addAll(arguments); } @@ -488,7 +488,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb } } finally { if(LOGGER.isDebugEnabled()){ - time = (System.currentTimeMillis() - time); + time = System.currentTimeMillis() - time; LOGGER.debug("writeData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds."); } } @@ -700,7 +700,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb public String getDBStatus(boolean htmlFormat) { StringBuilder buffer = new StringBuilder(); - ArrayList<CachedDataSource> list = new ArrayList<CachedDataSource>(); + ArrayList<CachedDataSource> list = new ArrayList<>(); list.addAll(dsQueue); list.addAll(broken); if (htmlFormat) @@ -785,7 +785,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb public String getPreferredDataSourceName(AtomicBoolean flipper) { - LinkedList<CachedDataSource> snapshot = new LinkedList<CachedDataSource>(dsQueue); + LinkedList<CachedDataSource> snapshot = new LinkedList<>(dsQueue); if(snapshot.size() > 1){ CachedDataSource first = snapshot.getFirst(); CachedDataSource last = snapshot.getLast(); diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java index de9846679..0dea664d5 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java @@ -7,9 +7,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. @@ -20,6 +20,7 @@ package org.onap.ccsdk.sli.core.dblib; +import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; @@ -43,4 +44,6 @@ public interface DbLibService { public abstract boolean isActive(); + public abstract Connection getConnection() throws SQLException; + } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java index 127e6d376..b4d1ef679 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java @@ -33,38 +33,47 @@ public class TerminatingCachedDataSource extends CachedDataSource implements SQL super(jdbcElem); } + @Override protected void configure(BaseDBConfiguration jdbcElem) throws DBConfigException { // no action } + @Override public long getInterval() { return 1000; } + @Override public long getInitialDelay() { return 1000; } + @Override public long getExpectedCompletionTime() { return 50; } + @Override public void setExpectedCompletionTime(long value) { } + @Override public void setInterval(long value) { } + @Override public void setInitialDelay(long value) { } + @Override public long getUnprocessedFailoverThreshold() { return 3; } + @Override public void setUnprocessedFailoverThreshold(long value) { } @@ -74,6 +83,7 @@ public class TerminatingCachedDataSource extends CachedDataSource implements SQL return 0; } + @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException { // TODO Auto-generated method stub return null; diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java index 6fc7e7a04..486d0ccc1 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java @@ -21,13 +21,8 @@ package org.onap.ccsdk.sli.core.dblib.factory; -import java.sql.SQLException; -import java.util.Set; -import java.util.concurrent.Callable; - import org.onap.ccsdk.sli.core.dblib.CachedDataSource; import org.onap.ccsdk.sli.core.dblib.CachedDataSourceFactory; -import org.onap.ccsdk.sli.core.dblib.DBConfigException; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; import org.onap.ccsdk.sli.core.dblib.config.DbConfigPool; @@ -35,6 +30,10 @@ import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.sql.SQLException; +import java.util.Set; +import java.util.concurrent.Callable; + /** * @version $Revision: 1.6 $ * Change Log @@ -85,7 +84,8 @@ public abstract class AbstractResourceManagerFactory { } }; if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Completed CachedDataSource.Call and notifyAll from " + ds.getDbConnectionName()); + LOGGER.debug("Completed CachedDataSource.Call and notifyAll from " + (ds != null ? ds + .getDbConnectionName() : null)); } Thread worker = new Thread(closure); worker.setDaemon(true); diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java index c024d0021..ffe834456 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java @@ -30,7 +30,6 @@ import org.apache.tomcat.jdbc.pool.PoolProperties; import org.onap.ccsdk.sli.core.dblib.CachedDataSource; import org.onap.ccsdk.sli.core.dblib.DBConfigException; import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; -import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java index 978de0eb3..803e6b3e7 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java @@ -22,9 +22,7 @@ package org.onap.ccsdk.sli.core.dblib.jdbc; import java.sql.SQLException; -import java.util.Arrays; import java.util.HashSet; -import java.util.List; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; @@ -35,7 +33,6 @@ import java.util.concurrent.FutureTask; import org.onap.ccsdk.sli.core.dblib.CachedDataSource; import org.onap.ccsdk.sli.core.dblib.CachedDataSourceFactory; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; -import org.onap.ccsdk.sli.core.dblib.DataSourceComparator; import org.onap.ccsdk.sli.core.dblib.config.DbConfigPool; import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration; import org.onap.ccsdk.sli.core.dblib.factory.AbstractResourceManagerFactory; diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java index 407209850..bea0d631f 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java @@ -26,7 +26,6 @@ import java.util.Properties; import org.onap.ccsdk.sli.core.dblib.CachedDataSource; import org.onap.ccsdk.sli.core.dblib.DBConfigException; import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; -import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java index 17c42ec83..0b69109f9 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; import com.google.common.base.Strings; + import java.io.File; import java.nio.file.Paths; import java.util.Optional; diff --git a/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java b/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java index 117492d0b..65ebfbae2 100644 --- a/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java +++ b/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java @@ -2,8 +2,6 @@ package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; import static org.junit.Assert.*; -import java.io.File; -import java.util.Optional; import org.junit.Test; public class DblibJREFileResolverTest { diff --git a/filters/features/pom.xml b/filters/features/pom.xml index 0d71e9167..95ccdfcd3 100755 --- a/filters/features/pom.xml +++ b/filters/features/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>filters</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>filters-features</artifactId> <name>Filters - Features</name> diff --git a/filters/installer/pom.xml b/filters/installer/pom.xml index 1e839d93e..e2eb43060 100755 --- a/filters/installer/pom.xml +++ b/filters/installer/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>filters</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>filters-installer</artifactId> <name>Filters - Karaf Installer</name> diff --git a/filters/pom.xml b/filters/pom.xml index 2e159c410..f79787ea4 100644 --- a/filters/pom.xml +++ b/filters/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> @@ -16,7 +16,7 @@ <name>Filters</name> <description>Servlet filter to implement ECOMP logging spec</description> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> diff --git a/filters/provider/pom.xml b/filters/provider/pom.xml index 240966e8b..a59071937 100755 --- a/filters/provider/pom.xml +++ b/filters/provider/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>filters</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>filters-provider</artifactId> <packaging>bundle</packaging> diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java index 4b14b21df..abbb7c66e 100644 --- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java +++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java @@ -144,7 +144,7 @@ public class LogFilter implements Filter { String authzHeader = request.getHeader("Authorization"); String usernameAndPassword = new String(Base64.decodeBase64(authzHeader.substring(6).getBytes())); - int userNameIndex = usernameAndPassword.indexOf(":"); + int userNameIndex = usernameAndPassword.indexOf(':'); String username = usernameAndPassword.substring(0, userNameIndex); userName = username; @@ -171,7 +171,7 @@ public class LogFilter implements Filter { MDC.put(END_TIMESTAMP,asIso8601(System.currentTimeMillis())); //MDC.put(REQUEST_ID,"already done above"); MDC.put(SERVICE_NAME,request.getRequestURL().toString()); - int idx = request.getPathInfo().toString().lastIndexOf(":"); + int idx = request.getPathInfo().lastIndexOf(':'); String instance = ""; if ( idx != -1 ) { instance = request.getPathInfo().substring(idx+1); @@ -186,13 +186,13 @@ public class LogFilter implements Filter { MDC.put(STATUS_CODE,"COMPLETE"); } - MDC.put(RESP_CODE,"" + response.getStatus()); + MDC.put(RESP_CODE, Integer.toString(response.getStatus())); MDC.put(RESP_DESC,""); MDC.put(INSTANCE_UUID,""); MDC.put(CATEGORY,""); MDC.put(SEVERITY,""); //MDC.put(SERVER_IP,""); //by chef - MDC.put(ELAPSED_TIME,"" + (System.currentTimeMillis() - startTime)); + MDC.put(ELAPSED_TIME,Long.toString(System.currentTimeMillis() - startTime)); //MDC.put(SERVER_HOST,""); //by chef MDC.put(CLIENT_IP,request.getRemoteHost()); MDC.put(CLASS,""); @@ -128,7 +128,7 @@ <organization> <name>ONAP</name> </organization> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </project> diff --git a/sli/common/pom.xml b/sli/common/pom.xml index 52bfd53f4..f71ca35f6 100755 --- a/sli/common/pom.xml +++ b/sli/common/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>sli</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sli-common</artifactId> <packaging>bundle</packaging> diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java index 699ace2e8..5e19a52c6 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java @@ -21,10 +21,6 @@ package org.onap.ccsdk.sli.core.sli; -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - public class SvcLogicAtom extends SvcLogicExpression { public enum AtomType { 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 9216519a8..712c64aba 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 @@ -145,7 +145,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { try { - dbConn = ((DBResourceManager) dbSvc).getConnection(); + dbConn = dbSvc.getConnection(); ArrayList<String> args = new ArrayList<String>(); @@ -276,7 +276,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { Connection dbConn = null; PreparedStatement storeGraphStmt = null; try { - dbConn = ((DBResourceManager) dbSvc).getConnection(); + dbConn = dbSvc.getConnection(); boolean oldAutoCommit = dbConn.getAutoCommit(); dbConn.setAutoCommit(false); storeGraphStmt = dbConn diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java index b8a47c45e..26783e70f 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpression.java @@ -22,7 +22,6 @@ package org.onap.ccsdk.sli.core.sli; import java.io.Serializable; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java index 451277576..23dff3e6e 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJavaPlugin.java @@ -21,14 +21,10 @@ package org.onap.ccsdk.sli.core.sli; -import java.util.Map; - +/** + * A marker interface, used to indicate that a class exposes methods that can be + * called from an <execute> node. Such methods must have the signature: + * void methodName(Map, SvcLogicContext) + */ public interface SvcLogicJavaPlugin { - - /** - * A marker interface, used to indicate that a class exposes methods that can be - * called from an <execute> node. Such methods must have the signature: - * void methodName(Map, SvcLogicContext) - */ - } diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java index 56ed53054..160107fea 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicNode.java @@ -36,8 +36,6 @@ import java.util.TreeMap; import org.apache.commons.lang3.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.xml.sax.Locator; - public class SvcLogicNode implements Serializable { diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java index 40295bd75..0e2c42574 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicResource.java @@ -21,7 +21,6 @@ package org.onap.ccsdk.sli.core.sli; -import java.sql.SQLException; import java.util.Map; public interface SvcLogicResource { diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java index ec18b8765..0e6000fb2 100644 --- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java @@ -28,12 +28,6 @@ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; -import java.util.LinkedList; - -import org.onap.ccsdk.sli.core.sli.SvcLogicParser; -import org.onap.ccsdk.sli.core.sli.SvcLogicParserException; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; import junit.framework.TestCase; diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java index 60d70460d..3b9fff75e 100644 --- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java @@ -21,17 +21,13 @@ package org.onap.ccsdk.sli.core.sli; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.io.InputStreamReader; import java.util.Enumeration; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java index 125ac5618..80df10cee 100644 --- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionParserTest.java @@ -25,9 +25,6 @@ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; -import org.onap.ccsdk.sli.core.sli.SvcLogicExprListener; -import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; -import org.onap.ccsdk.sli.core.sli.SvcLogicExpressionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sli/features/pom.xml b/sli/features/pom.xml index 975839fc0..dc7a95dc1 100755 --- a/sli/features/pom.xml +++ b/sli/features/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sli</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sli-features</artifactId> <name>SLI - Features</name> diff --git a/sli/installer/pom.xml b/sli/installer/pom.xml index 0319f5bcf..0eec3324a 100755 --- a/sli/installer/pom.xml +++ b/sli/installer/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sli</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sli-installer</artifactId> <name>SLI - Karaf Installer</name> diff --git a/sli/pom.xml b/sli/pom.xml index b8ce1e3a0..7257e9ee4 100755 --- a/sli/pom.xml +++ b/sli/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <packaging>pom</packaging> @@ -59,7 +59,7 @@ <organization> <name>ONAP</name> </organization> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </project> diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml index 5ef47ef19..f665c56a1 100755 --- a/sli/provider/pom.xml +++ b/sli/provider/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sli-provider</artifactId> <packaging>bundle</packaging> diff --git a/sli/recording/pom.xml b/sli/recording/pom.xml index 932e3ccab..97c99188c 100755 --- a/sli/recording/pom.xml +++ b/sli/recording/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sli-recording</artifactId> <packaging>bundle</packaging> diff --git a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java index 9228d15c2..fd857f56b 100644 --- a/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java +++ b/sli/recording/src/main/java/org/onap/ccsdk/sli/core/sli/recording/RecordingActivator.java @@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory; public class RecordingActivator implements BundleActivator { - private LinkedList<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); + private LinkedList<ServiceRegistration> registrations = new LinkedList<>(); private static final Logger LOG = LoggerFactory .getLogger(RecordingActivator.class); @@ -43,7 +43,7 @@ public class RecordingActivator implements BundleActivator { if (registrations == null) { - registrations = new LinkedList<ServiceRegistration>(); + registrations = new LinkedList<>(); } diff --git a/sliPluginUtils/features/pom.xml b/sliPluginUtils/features/pom.xml index ce87536df..41381b6f0 100755 --- a/sliPluginUtils/features/pom.xml +++ b/sliPluginUtils/features/pom.xml @@ -8,7 +8,7 @@ <parent> <artifactId>sliPluginUtils</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <name>SliPluginUtils Plugin - Features</name> diff --git a/sliPluginUtils/installer/pom.xml b/sliPluginUtils/installer/pom.xml index a92c9cd9a..dd904e40d 100755 --- a/sliPluginUtils/installer/pom.xml +++ b/sliPluginUtils/installer/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sliPluginUtils</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sliPluginUtils-installer</artifactId> <name>SLI Plugin Utilities - Karaf Installer</name> diff --git a/sliPluginUtils/pom.xml b/sliPluginUtils/pom.xml index 5e084af8d..3d80b7231 100755 --- a/sliPluginUtils/pom.xml +++ b/sliPluginUtils/pom.xml @@ -3,7 +3,7 @@ <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sliPluginUtils</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> <packaging>pom</packaging> <modelVersion>4.0.0</modelVersion> @@ -11,7 +11,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <name>Service Logic Interface Plugin Utilities</name> <description>A package of static utility functions to be used when developing SLI plugins</description> diff --git a/sliPluginUtils/provider/pom.xml b/sliPluginUtils/provider/pom.xml index 430221fcb..ad950c0c8 100755 --- a/sliPluginUtils/provider/pom.xml +++ b/sliPluginUtils/provider/pom.xml @@ -8,7 +8,7 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sliPluginUtils</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <name>SliPluginUtils Plugin - Provider</name> diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java index 326490d9d..6bdd87e24 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java @@ -124,7 +124,7 @@ public class DME2 implements SvcLogicJavaPlugin { sb.append("&dme2.partner=" + this.partner); } sb.append("&dme2.allowhttpcode=true"); - return (sb.toString()); + return sb.toString(); } public synchronized String acquireHostName() { diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java index 488dc395b..323758681 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java @@ -138,7 +138,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { // Obtain key-value pairs to check from parameters LOG.trace("reading keys parameter list"); - HashMap<String,String> keys_values = new HashMap<String,String>(); + HashMap<String,String> keys_values = new HashMap<>(); for( int i = 0; i < keys_length; i++ ) { keys_values.put(parameters.get("keys[" + i + "].key"), parameters.get("keys[" + i + "].value")); } @@ -174,7 +174,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { */ public void ctxSortList( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException { checkParameters(parameters, new String[]{"list","delimiter"}, LOG); - ArrayList<SortableCtxListElement> list = new ArrayList<SortableCtxListElement>(); + ArrayList<SortableCtxListElement> list = new ArrayList<>(); String[] sort_fields = null; if( parameters.containsKey("sort-fields") ) { @@ -205,7 +205,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { i++; } // Reset list length (removed by ctxBulkErase above) - ctx.setAttribute(ctx_list_str+"_length", ""+listSz); + ctx.setAttribute(ctx_list_str+"_length", Integer.toString(listSz)); } /** @@ -284,7 +284,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { log.debug("required parameters was empty, exiting early."); return; } - if (parametersMap == null || parametersMap.keySet().size() < 1){ + if (parametersMap == null || parametersMap.keySet().isEmpty()){ String errorMessage = "This method requires the parameters [" + StringUtils.join(requiredParams,",") + "], but no parameters were passed in."; log.error(errorMessage); throw new SvcLogicException(errorMessage); @@ -307,7 +307,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { * @since 1.0 */ public static final void ctxBulkErase( SvcLogicContext ctx, String pfx ) { - ArrayList<String> Keys = new ArrayList<String>( ctx.getAttributeKeySet() ); + ArrayList<String> Keys = new ArrayList<>(ctx.getAttributeKeySet()); for( String key : Keys ) { if( key.startsWith( pfx ) ) { ctx.setAttribute( pfx + key.substring(pfx.length()) , null); @@ -337,7 +337,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { // For each context key that begins with src_pfx, set the value of the // key dest_pfx + the suffix of the key to the key's value - ArrayList<String> Keys = new ArrayList<String>(ctx.getAttributeKeySet()); + ArrayList<String> Keys = new ArrayList<>(ctx.getAttributeKeySet()); for( String key : Keys ) { if( key.startsWith(src_pfx) ) { // Get suffix (no leading period) @@ -361,7 +361,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { * in ctx whose key begins with prefix. */ public static final Map<String, String> ctxGetBeginsWith( SvcLogicContext ctx, String prefix ) { - Map<String, String> prefixMap = new HashMap<String, String>(); + Map<String, String> prefixMap = new HashMap<>(); for( String key : ctx.getAttributeKeySet() ) { if( key.startsWith(prefix) ) { @@ -481,7 +481,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { * @since 1.0 */ public static final int getArrayLength( SvcLogicContext ctx, String key, Logger log, LogLevel logLevel, String log_message ) { - String ctxKey = ( key.endsWith("_length") ) ? key : key + "_length"; + String ctxKey = key.endsWith("_length") ? key : key + "_length"; try { return Integer.parseInt(ctx.getAttribute(ctxKey)); } @@ -525,7 +525,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { logLevelIsEnabled( log, logLevel ); // Print sorted context memory key-value pairs to the log - ArrayList<String> keys = new ArrayList<String>(ctx.getAttributeKeySet()); + ArrayList<String> keys = new ArrayList<>(ctx.getAttributeKeySet()); Collections.sort(keys); for( String key : keys ) { logMessageAtLevel( log, logLevel, key + " = " + ctx.getAttribute(key) ); @@ -616,7 +616,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { // ========== LOCAL CLASSES ========== private class SortableCtxListElement implements Comparable<SortableCtxListElement> { - HashMap<String,String> child_elements = new HashMap<String,String>(); + HashMap<String,String> child_elements = new HashMap<>(); String[] sort_fields; public SortableCtxListElement( SvcLogicContext ctx, String root, String[] sort_fields ) { @@ -729,7 +729,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { * @since 11.0.2 */ public static void requiredParameters(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException { - if (parameters == null || parameters.keySet().size() < 1) { + if (parameters == null || parameters.keySet().isEmpty()) { String errorMessage = "requiredParameters should not be called if the parameters hashmap is null or empty!"; LOG.error(errorMessage); throw new SvcLogicException(errorMessage); diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java index aa25fe374..32e1aebdc 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextList.java @@ -60,7 +60,7 @@ public class SvcLogicContextList { // Initialize list int capacity = getCtxListLength(ctx, prefix); - this.list = new ArrayList<HashMap<String, String>>(capacity); + this.list = new ArrayList<>(capacity); for( int i = 0; i < capacity; i++ ) { this.list.add(i, new HashMap<String,String>()); } @@ -158,7 +158,7 @@ public class SvcLogicContextList { for( int i = 0; i < this.list.size(); i++ ) { for( Map.Entry<String,String> entry : this.list.get(i).entrySet() ) { - if( entry.getKey().equals("") ) { + if("".equals(entry.getKey())) { ctx.setAttribute(prefix + '[' + i + ']', entry.getValue()); } else { ctx.setAttribute(prefix + '[' + i + "]." + entry.getKey(), entry.getValue()); diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java index 106b0cf46..166a60e90 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java @@ -27,7 +27,6 @@ import java.util.Map; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java index a46c85129..774aa1c84 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java @@ -32,7 +32,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java index ba7a7660d..f9d70f2fb 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java @@ -30,7 +30,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java index 9768108de..bf7cc1399 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortListTest.java @@ -30,7 +30,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java index 09683ac36..72b3264e9 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java @@ -35,7 +35,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils; /** * @author km991u diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java index 263ba1f1d..f916bbfca 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SvcLogicContextListTest.java @@ -29,7 +29,6 @@ import java.util.HashMap; import org.junit.Before; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.slipluginutils.SvcLogicContextList; public class SvcLogicContextListTest { //private static final Logger LOG = LoggerFactory.getLogger(SvcLogicContextTest.class); diff --git a/sliapi/features/pom.xml b/sliapi/features/pom.xml index 531315e8d..caa6a8b39 100755 --- a/sliapi/features/pom.xml +++ b/sliapi/features/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sliapi</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sliapi-features</artifactId> diff --git a/sliapi/installer/pom.xml b/sliapi/installer/pom.xml index 249520569..dff580b62 100755 --- a/sliapi/installer/pom.xml +++ b/sliapi/installer/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sliapi</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sliapi-installer</artifactId> <packaging>pom</packaging> diff --git a/sliapi/model/pom.xml b/sliapi/model/pom.xml index 8fed20036..fc9b76377 100755 --- a/sliapi/model/pom.xml +++ b/sliapi/model/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sliapi</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sliapi-model</artifactId> <packaging>bundle</packaging> diff --git a/sliapi/pom.xml b/sliapi/pom.xml index 64f84b9ac..a58596a93 100755 --- a/sliapi/pom.xml +++ b/sliapi/pom.xml @@ -6,13 +6,13 @@ <parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <packaging>pom</packaging> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sliapi</artifactId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> <properties> <feature-name>sliapi</feature-name> diff --git a/sliapi/provider/pom.xml b/sliapi/provider/pom.xml index e679f3687..7e0bd2642 100755 --- a/sliapi/provider/pom.xml +++ b/sliapi/provider/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>sliapi</artifactId> <groupId>org.onap.ccsdk.sli.core</groupId> - <version>0.1.1-SNAPSHOT</version> + <version>0.1.2-SNAPSHOT</version> </parent> <artifactId>sliapi-provider</artifactId> <packaging>bundle</packaging> |