use of org.wso2.carbon.apimgt.impl.dto.GatewayArtifactSynchronizerProperties in project carbon-apimgt by wso2.
the class GatewayArtifactsMgtDBUtil method initDatasource.
private static synchronized void initDatasource() throws APIManagerDatabaseException {
if (artifactSynchronizerDataSource == null) {
if (log.isDebugEnabled()) {
log.debug("Initializing data source");
}
GatewayArtifactSynchronizerProperties gatewayArtifactSynchronizerProperties = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration().getGatewayArtifactSynchronizerProperties();
String artifactSynchronizerDataSourceName = gatewayArtifactSynchronizerProperties.getArtifactSynchronizerDataSource();
if (artifactSynchronizerDataSourceName != null) {
try {
Context ctx = new InitialContext();
artifactSynchronizerDataSource = (DataSource) ctx.lookup(artifactSynchronizerDataSourceName);
} catch (NamingException e) {
throw new APIManagerDatabaseException("Error while looking up the data " + "source: " + artifactSynchronizerDataSourceName, e);
}
} else {
log.error(artifactSynchronizerDataSourceName + " not defined in api-manager.xml.");
}
}
}
Aggregations