开源BI报表及OLAP多维分析平台OPENI(二)—搭建Eclipse下的Openi开发环境
开源BI报表及OLAP多维分析平台OPENI(一)—DEMO演示
开源BI报表及OLAP多维分析平台OPENI(二)—搭建Eclipse下的Openi开发环境
接着上节的demo来看如何在Eclipse下搭建Openi的开发及调试环境.
一.下载openi- 1.3.0 -RELEASE-src
a. 官方网站: http://www.openi.org 或http://openi.sourceforge.net/index.html
b.下载源代码版本: http://sourceforge.net/project/showfiles.php?group_id=142873
二.新建web project
在MyEclipse下新建web project:openi
1.openi- 1.3.0 -RELEASE-src\openi\src下的文件copy到上面新建的openisrc下.
2.openi- 1.3.0 -RELEASE\openi\openi.war,在tomcat解压后的文件夹下,将除WEB-INF之外的所有文件copy至刚才新建的项目
3.在MyEclipse下发布openi
4.当然,别忘了把openi- 1.3.0 -RELEASE\openi\ openi-projects.war,openi-1.3.0-RELEASE\openi\ mondrian.war拷贝到<tomcat_home>\webapps
5.查看,并设置断点进行调试
启动tomcat, http://localhost:8080/openi,应该可以访问了.用户密码如果没有修改的话,应该就是tomcat/tomcat,如果不对,请去<tomcat_home>\conf\tomcat-users.xml自己去找.
三、修改端口
该项目默认的端口是8080.而大多数tomcat可能设置成别的端口如8088等。在这里通过查看源代码,及在MyEclipse下面调试源代码,就可以发现,org.openi.project.ProjectFactory类中方法:getProject
throws IOException {
// important to give proper feedback to caller
if (baseDirName == null) {
throw new IOException(
"Project directory name is null. This should be the location for all projects");
}
BeanStorage storage = new BeanStorage();
String projectFilePath = new File(baseDirName,
projectId + "/project.xml").getCanonicalPath();
logger.debug("Trying to restore project: " + projectFilePath);
Project retProject = null;
try{
retProject = (Project) storage.restoreBeanFromFile(projectFilePath);
}catch(Exception e){
logger.debug("trouble restoring project from " + projectFilePath, e);
logger.debug("possibly old format, trying xslt");
}
if(retProject == null){
String xsltPath = new File(baseDirName).getParent()
+ "/openi/WEB-INF/project/project.xsl";
logger.debug(
"transforming project.xml into new format using template "
+ xsltPath);
try {
String backup = backupOldFile(projectFilePath);
transformProjectToNewFormat(backup, projectFilePath, xsltPath);
//transformed, try to restore again, this time if it doesn't work, throw IOException:
retProject = (Project) storage.restoreBeanFromFile(projectFilePath);
} catch (Exception ex) {
//logger.error(ex.getStackTrace());
throw new IOException(
"An error occured while transforming project.xml into new format\nroot cause:"
+ ex.getMessage());
}
}
return retProject;
}
从中可以看出project的datasource的来源.它来自文件:<tomcat_home>\webapps\openi-projects\foodmart\project.xml
在此文件中
< entry >
< string > mondrian </ string >
< org .openi.analysis.Datasource >
< server > http://localhost:8080/mondrian/xmla </ server >
< xmlaDatasource > MondrianFoodMart </ xmlaDatasource >
< catalog > FoodMart </ catalog >
</ org.openi.analysis.Datasource >
</ entry >
只需要把这里面的8080改成自己的端口就OK了。(当然,别忘了修改tomcat\conf server.xml中的端口了哦,呵呵).
请对openi或BI感兴趣的朋友多多支持,让俺认真研究研究,以便发更多的文件.下节写写对整个openi的设计.