Created
March 18, 2013 22:54
-
-
Save vojkny/5191660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void connect() { | |
try { | |
Connection connIrs=new MyConnectDB().connect(irsConnection,irsUser,irsPassword); | |
Connection connImpact=new MyConnectDB().connect(impactConnection,impactUser,impactPassword); | |
Connection connIpreport=new MyConnectDB().connect(ipreportConnection,ipreportUser,ipreportPassword); | |
Mapping myMapping=Mapping.getInstance(connIrs,connImpact,connIpreport); | |
TreeMap<String, String> myParameters = myMapping.getParams(adminNum,sceneid,data,indata); | |
if(!myParameters.isEmpty()) { | |
for(String param : myParameters.keySet()) { | |
parameters.put(param, myParameters.get(param)); | |
logger.log(Logger.INFO, "Get param "+param+"="+myParameters.get(param)); | |
} | |
} else { | |
logger.log(Logger.WARNING, "Not supported technical solution for "+adminNum); | |
opStore.addError(operationID,"Route Agent","Not supported technical solution",kowgar.agent.common.Definitions.ERROR_LEVEL_CRITICAL); | |
} | |
} catch (Exception e) { | |
log.info(); | |
} finally { | |
close(connIrs); | |
close(connImpact); | |
close(connIpreport); | |
} | |
logger.log(Logger.INFO, "<obtainParametersFromBd() "); | |
return parameters; | |
} | |
private Connection getConnection(String a, b, c) { | |
Conenction conenction = new MyConnectDB().connect(irsConnection,irsUser,irsPassword); | |
if (conenction == null) { | |
throw new IllegalStateException("Impossible to connect"); | |
} | |
return connection; | |
} | |
public void close(Connection connection, String message) { | |
if(connection!=null) { | |
try { | |
connection.close(); | |
} catch (Exception ex) { | |
logger.log(Logger.WARNING, "Exception on "+message+" connection close "+ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment