最近发现很多朋友编译saiku3.14颇为困难,这次结合我对外公布的nexus仓库,再一次编写了此文章,即saiku3.14的编译步骤(必须结合我对外公布的nexus仓库)
<pluginRepositories><pluginRepository><id>Analytical Labs Plugin Repo</id><name>Analytical Labs Repo-releases</name><url>http://repo.meteorite.bi/repository/alabs-release-local/</url></pluginRepository></pluginRepositories>
修改为
<pluginRepositories><pluginRepository><id>central</id><name>central</name><url>http://nexus.liuyingguang.cn/repository/maven-public/</url></pluginRepository></pluginRepositories>
<repositories><repository><id>Analytical Labs Repo</id><name>Analytical Labs Repo-releases</name><url>http://repo.meteorite.bi/repository/alabs-release-local/</url></repository><repository><id>Analytical Labs snapshots</id><name>Analytical Labs Repo-releases</name><url>htt
MyEclipse 10saiku2.5源码saiku-server-foodmart-2.5.zip
type=OLAPname=testdatasourcedriver=mondrian.olap4j.MondrianOlap4jDriverlocation=jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/testdatasource;Catalog=res:testdatasource/testdatasource.xml;username=rootpassword=111111
解释下上面一条的的参数
type=OLAP就不多说了,先按固定的来name=testdatasource 数据源名称driver=mondrian.olap4j.MondrianOlap4jDriver 可以理解为固定的,Mondrian的
修改内容为如下(重点是红色内容):
InputStream in = readVirtualFile(catalogUrl);
try {
return IOUtils.toString(in,"utf-8"); //-----------------此行为红色行
} finally {
IOUtils.closeQuietly(in);
}
或者按照网上说的另外一种方式,整体替换为如下内容,也可以,不过下面的编码必须写你的schema文件的编码:
try {
final byte[] bytes = Util. readFully(in, 1024);
final char[] chars = new char[bytes. length];
for ( int i = 0; i < chars. length; i++) {
chars[i] = ( char) bytes[i];
}
String str = new String(bytes,"utf-8").replace("\ufeff" , "" );//加replace("\ufeff", "")是为了过滤"UTF-8无BOM格式文件"的开头
return str;
} finally {
if (in != null) {
in.close();
}
}2、再找到文件 mondrian.rolap.RolapSchema.lo
1、根据文档中,比较费解,没有看太懂(并且部分文档的方法无法使用):http://mondrian.pentaho.com/documentation/cache_control.php
2、本来打算使用文档中的另一个方法
但是最终发现我完全从外部调用,哪里获取RolapConnection呢,于是,此方法宣告失败
public boolean clearCache() throws Exception {
if ( olapConnection.isWrapperFor( RolapConnection.class ) ) {
System.out.println( "Clearing cache" );
RolapConnection rcon = olapConnection.unwrap( RolapConnection.class );
rcon.getCacheControl( null ).flushSchemaCache();
}
return true;
}
3、经过努力,找到别人的方法,此方法可行,原文是
java.util.Iterator<mondrian.rolap.RolapSchema> schemaIterator = mondrian.rolap.RolapSchema.getRolapSchemas();
while(schemaIterator.hasNext()){
mondrian.rolap.RolapSchema schema = schemaIterator.next();
mondrian.olap.CacheControl cacheControl = schema.getInternalConnection().getCacheControl(null);
for (mondrian.olap.Cube cube : schema.getCubes()) {
cacheControl.flush(cacheControl.createMeasuresRegion(cube));
}
}但是对于我用的版本不对应,会报无法转换为Iterator,然后做了稍微修改,如下
List<mondrian.rola
解决办法,需要修改4个地方的编码:
修改 xml = new String( (byte[]) f.getEntity());为 xml = new String( (byte[]) f.getEntity(),"utf-8");
修改 InputSource source = new InputSource( ( new ByteArrayInputStream( xml.getBytes() ) ) );为 InputSource source = new InputSource( ( new ByteArrayInputStream( xml.getBytes("UTF-8") ) ) );
修改 InputStreamReader reader = new InputStreamReader(repoFile.getContent().getInputStream());为 InputStreamReader reader = new InputStreamReader(repoFile.getContent().getInputStream(),"UTF-8");
修改 OutputStreamWriter ow = new OutputStreamWriter(repoFile.getContent().getOutputStream());为 OutputStreamW