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