Cleaned code.

This commit is contained in:
Christian P. MOMON 2016-12-13 14:19:27 +01:00
parent 1ef88b0c7d
commit ffdba7956c

View file

@ -51,6 +51,7 @@ import fr.devinsy.util.StringList;
public class SQLSikevaDB implements SikevaDB
{
private static final Logger logger = LoggerFactory.getLogger(SQLSikevaDB.class);
private String driverClassname;
private String url;
private String login;
@ -77,7 +78,6 @@ public class SQLSikevaDB implements SikevaDB
*/
public SQLSikevaDB(final String driverClassName, final String url, final String login, final String password)
{
if (StringUtils.isBlank(driverClassName))
{
throw new NullPointerException("driverClassName is null.");
@ -1994,22 +1994,18 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void open() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, NamingException
{
//
close();
//
if (this.url != null)
{
//
Class.forName(this.driverClassname).newInstance();
this.singleConnection = DriverManager.getConnection(this.url, this.login, this.password);
logger.info("Single connection opened with [{}].", this.url);
}
else if (this.contextName != null)
{
//
Context initialContext = new InitialContext();
Context environmentContext = (Context) initialContext.lookup("java:comp/env");
this.dataSource = (DataSource) environmentContext.lookup(this.contextName);
@ -2027,15 +2023,12 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void put(final Element element) throws SQLException
{
//
if (element == null)
{
throw new IllegalArgumentException("element is null.");
}
else
{
//
if (exists(element))
{
//
@ -2135,14 +2128,12 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void put(final String key, final String value) throws SQLException
{
//
Element element = getElement(key);
//
if (element == null)
{
//
element = new Element();
element.setKey(key);
element.update(value);
@ -2150,7 +2141,6 @@ public class SQLSikevaDB implements SikevaDB
}
else
{
//
element.update(value);
}
@ -2209,7 +2199,6 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void put(final String key, final String subkey, final String value) throws SQLException
{
//
Element element = getElement(key, subkey);
@ -2431,7 +2420,6 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void renameKey(final String oldKey, final String newKey) throws SQLException
{
logger.info("renameKey starting... [{}][{}]", oldKey, newKey);
//
@ -2464,7 +2452,6 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void replaceInValue(final String key, final String... tokens) throws SQLException
{
logger.info("replaceInValue starting... [{}]", key);
//
@ -2489,7 +2476,6 @@ public class SQLSikevaDB implements SikevaDB
@Override
public void replaceInValues(final String key, final String... tokens) throws SQLException
{
logger.info("replaceInValues starting... [{}]", key);
//