use of org.pentaho.platform.plugin.action.olap.IOlapServiceException in project pentaho-platform by pentaho.
the class OlapServiceImpl method makeOlap4jConnection.
private OlapConnection makeOlap4jConnection(String name) {
final Olap4jServerInfo olapServerInfo = getHelper().getOlap4jServerInfo(name);
assert olapServerInfo != null;
// Make sure the driver is present
try {
Class.forName(olapServerInfo.className);
} catch (ClassNotFoundException e) {
throw new IOlapServiceException(e);
}
// As per the JDBC specs, we can set the user/pass into
// connection properties called 'user' and 'password'.
final Properties newProps = new Properties(olapServerInfo.properties);
// First, apply the filters.
for (IOlapConnectionFilter filter : this.filters) {
filter.filterProperties(newProps);
}
// so as not to expose this.
if (olapServerInfo.user != null) {
newProps.put("user", olapServerInfo.user);
}
if (olapServerInfo.password != null) {
newProps.put("password", olapServerInfo.password);
}
try {
final Connection conn = DriverManager.getConnection(olapServerInfo.URL, newProps);
return conn.unwrap(OlapConnection.class);
} catch (SQLException e) {
throw new IOlapServiceException(e);
}
}
use of org.pentaho.platform.plugin.action.olap.IOlapServiceException in project pentaho-platform by pentaho.
the class OlapServiceImpl method flush.
/**
* Flushes a single schema from the cache.
*/
public void flush(IPentahoSession session, String name) {
final Lock writeLock = cacheLock.writeLock();
writeLock.lock();
try (OlapConnection connection = getConnection(name, session)) {
final RolapConnection rc = connection.unwrap(RolapConnection.class);
rc.getCacheControl(null).flushSchema(rc.getSchema());
} catch (Exception e) {
LOG.warn(Messages.getInstance().getErrorString("MondrianCatalogHelper.ERROR_0019_FAILED_TO_FLUSH", name), e);
throw new IOlapServiceException(Messages.getInstance().getErrorString("MondrianCatalogHelper.ERROR_0019_FAILED_TO_FLUSH", name));
} finally {
writeLock.unlock();
}
}
Aggregations