黄石新航线旅行社:Alfresco 2.0 解读 - 超越黎明 - CSDNBlog

来源:百度文库 编辑:九乡新闻网 时间:2024/05/06 11:53:10
Alfresco 2.0 解读 一、介绍http://www.alfresco.com Alfrescois the Open Source Alternative for Enterprise Content Management (ECM),providing Document Management, Collaboration, Records Management,Knowledge Management, Web Content Management and Imaging. 采用的技术Java Spring Aspect-Oriented Framework ACEGI – Aspect-Oriented Security Framework MyFaces JSF Implementation Hibernate ORM Persistence Lucene Text Search Engine JLAN POI File Format Conversion PDFBox – PDF Conversion OpenOffice jBPM Rhino JavaScript engine 支持的接口CIFS/SMB Microsoft File Share Protocol JSR-168 Portlet Specification JSR-127 Java Server Faces FTP WebDAV Web Services REST 更多的技术规范详见: http://www.alfresco.com/products/ecm/specifications/  
二、配置解读1、从web.xml开始入手其它的略过,在 web.xml 中可以看到加载了如下 Spring 配置文件            contextConfigLocation                 classpath:alfresco/web-client-application-context.xml     classpath:web-services-application-context.xml     classpath:alfresco/web-api-application-context.xml     classpath:alfresco/application-context.xml             Spring config file locationsweb client 层alfresco/web-client-application-context.xml打开它可以看到它引入了所有的 alfresco/web-client*.xml & alfresco/extension/web-client*.xml & jar:*!/META-INF/web-client*.xmlweb api 层alfresco/web-api-application-context.xml打开它可以看到它引入了 alfresco/web-api-config.xml & alfresco/extension/web-api-config-custom.xmlweb service 层web-services-application-context.xml刚开始找这个文件时,居然没有找到,怪事!not exist???why?于是后来才发现这个文件是在 remote-api.jar 包里,晕,不是很好的做法啊。bean 配置定义关键的文件alfresco/application-context.xml                                                                                                                           可以看到分层次地进行加载不同的 bean ,并且在后面提供可扩展的 bean 定义的引入,方便进行扩展,而不需要更变这个配置文件 继续一个个往下看,并把一些重要的 bean 配置拿出来:core-services-context.xml 核心 bean 的配置看到配置了 JMX 的服务                                                                                JMX 服务暴露                                        同时暴露了 RMI 的服务RMI                                                                                    org.alfresco.service.cmr.remote.RepoRemoteTransport                                                repo                                                ${avm.remote.port}             验证 bean 配置,也是同时暴露了 RMI 的服务authentication-services-context.xml                                                                                    org.alfresco.service.cmr.security.AuthenticationService                                                authentication                                                ${avm.remote.port}             avm 里也暴露了 RMI 的服务avm-services-context.xml                                                                                     org.alfresco.service.cmr.remote.AVMRemoteTransport                                                avm                                                ${avm.remote.port}                                                                                                                        org.alfresco.service.cmr.remote.AVMSyncServiceTransport                avmsync                ${avm.remote.port}     通过上面的 JMX 与 RMI 暴露在不同的配置文件里可以看到,如果我要去掉 JMX 或 RMI 服务的话,需要修改 N 个的配置文件,实在是麻烦。建议要二次开发时根据需要进行整理,合并到一个文件里进行暴露即可,或者没有需要的话就直接 delete 掉这些:) 而且这个 JMX RMI 服务的暴露,导致你不能仅重启应用就可以,而非得重启整个应用服务器才行,要不然会报服务已启动,即默认的端口50500被占用了,而整个应用启动不了,麻烦。除非你在重启应用之前再去修改一下配置文件里的端口号,呵呵。 不过,最终的解决办法是象我在 Jmx4Log4J 里那样自己去再封装一个获取端口号的类,发现有人用了,就找下一个:)这样就OK了。 core-services-context.xml数据库连接池用的居然是 org.apache.commons.dbcp.BasicDataSource ,大家自己改吧 c3p0 等等 邮件 Lucene 索引和搜索 API                                锁         版本控制         数据库                                                            alfresco/model/dictionaryModel.xml                alfresco/model/systemModel.xml                org/alfresco/repo/security/authentication/userModel.xml                                 alfresco/model/contentModel.xml                alfresco/model/bpmModel.xml                alfresco/model/wcmModel.xml                alfresco/model/forumModel.xml                                 alfresco/model/applicationModel.xml                alfresco/model/wcmAppModel.xml                                                org/alfresco/repo/action/actionModel.xml                org/alfresco/repo/rule/ruleModel.xml                org/alfresco/repo/version/version_model.xml                                                alfresco/model/deprecated/deprecated_contentModel.xml                                                        alfresco/model/dataTypeAnalyzers                alfresco/messages/system-model                alfresco/messages/dictionary-model                alfresco/messages/content-model                alfresco/messages/bpm-messages                alfresco/messages/application-model                alfresco/messages/forum-model                         拷贝             检出 / 检入         全文搜索         Lucene 索引文件备份                                          public-services-context.xml 当中引入了    public-services-security-context.xml 安全认证相关使用的是 Acegi 组件,当中引入了     cache-context.xml Cache 相关的,使用的是 EHCache                  classpath:alfresco/ehcache-transactional.xml         public-services-context.xml         基本上服务都从这里注入并从中获取,树结构,当中有Spring Bean Factory model-specific-services-context.xml                 action-services-context.xml Action 相关的用 Thread local containing the current action chain        rule-services-context.xml 规则、触发规则服务node-services-context.xml 节点相关服务scheduled-jobs-context.xml 定时任务            true                classpath:alfresco/domain/quartz.properties                DefaultScheduler     # Quartz thread settings 默认的线程优先级为 3org.quartz.threadPool.threadPriority=3network-protocol-context.xml 网络相关的服务需要相关的文件配置信息在 file-servers.xmlcontent-services-context.xml 内容相关的服务MIME OpenOffice PDF Mail MP3 ...hibernate-context.xml Hibernate 的映射配置文件                            classpath:alfresco/domain/hibernate-cfg.properties                            true                            classpath:alfresco/domain/cache-strategies.properties                                      不同的Cache策略        ownable-services-context.xmlOwnership service support. Use in permissions framework as dynamic authority. template-services-context.xml 模板引擎 freemarkerscript-services-context.xml 脚本引擎 Rhino JavaScript engine.index-recovery-context.xml 索引校验与恢复       ${index.recovery.mode}  authority-services-context.xml 授权服务                                                                                                 admin                                    administrator                                authentication-services-context.xml 验证 Acegipolicy-context.xml 策略服务import-export-context.xml 导入导出服务bootstrap-context.xml 系统启动的初始化工作如:数据库、AVM、文件服务器、FTP、NFS、CIFS等等。。。Repository Bootstrap Sequence.        workflow-context.xml 工作流相关的服务,JBPM jcr-api-context.xml 实现JCR 170相关的API,即1.0版本的APIAlfresco implementation of a JCR Repositoryavm-services-context.xml AVM相关服务,以及一堆的DAO avm-console-context.xml avm-console.properties 默认配置为本地MySQL的数据库# Database specifics.db.driver=org.gjt.mm.mysql.Driverdb.url=jdbc:mysql://127.0.0.1/avmdb.username=rootdb.password=db.pool.initial=4db.pool.max=32# Hibernate propertieshibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialecthibernate.current_session_context_class=threadhibernate.connection.isolation=2hibernate.default_batch_fetch_size=16hibernate.jdbc.batch_versioned_data=truehibernate.cache.use_second_level_cache=truehibernate.hbm2ddl.auto=update# AVM specific properties.     audit-services-context.xml                  其后在 application-context.xml 还加载了一堆Patch,呵呵patch-services-context.xml其它的。。。 module-context.xml 加载其它的模块Bean最后加载一些扩展与二次开发的Bean 同时覆盖掉想覆盖的Bean,后面覆盖前面的,Map嘛。比如: custom-repository-context.xml 里的属性配置、资源配置、事务配置等
三、配置安装时的注意事项1、要将 Alfresco 默认安装使用的数据库HSQL转换为MqSQL的话,只需要删掉三个 HSQL 使用的文件:这三个文件分别是 tomcat/shared/classes/alfresco/extension 目录下的            custom-db-and-data-context.xml            custom-db-connection.properties            custom-hibernate-dialect.properties为了产生一个MySQL数据库,执行 \extra\database\mysql ,运行 db_setup.bat 文件,或者打开文件,手工输入命令也一样。就会产生一个与一个使用者一起命名 alfresco 的 MySQL 数据库帐户和一个 alfresco 的密码。 2、国际化alfresco的文件路径为: WEB-INF\classes\alfresco\messages 下面包含了一堆文件,一个个去国际化吧,当然用插件、Native2ASCII或配合ANT都可以。Eclipse 的 PropertiesEditor 插件不错。 3、无论从一种数据库切换到另一种数据库,都要记得把 repository.properties 配置文件里 dir.root 所在的目录下的文件删除干净,要不然会出问题。比如:Caused by: org.alfresco.repo.search.SearcherException: More than one root node in index: 2#dir.root=./alf_data 4、将 Win32NetBIOS.dll 拷贝到 %JAVA_HOME%\jre\bin\ 目录下 或者 %TOMCAT_HOME%\bin 目录下 5、不要 ScriptService 的话,可以在 public-services-context.xml 中注释掉 ScriptService 和 ScriptService_transaction 6、查看 Hibernate 的 SQL             修改 log4j.properties             在 log4j.logger.org.hibernate 下增加一行,即可            log4j.logger.org.hibernate.SQL=debug 7、发现启动报 "Ensure that the ‘dir.root‘ property is pointing to the correctdata location." ... 之类的错误时可以在 repository.properties 配置文件里将 strict 设置为false# Change the failure behaviour of the configuration checkersystem.bootstrap.config_check.strict=false不过,设置后很有可能可以启动,但是仍是登录不了之类的,要小心。如果用的是HSQL的话,最好把 alf_data\hsql_data 下面的 alfresco.propertiesalfresco.script 恢复成原来的,并删除其它的文件,再重启就可以了。 8、第 7 条,仍报错 ERROR [repo.admin.ConfigurationChecker] CONTENT INTEGRITYERROR: Indexes not found for 5 stores. 的话,设置为全部索引,并按第 3条所说的删除文件,或者直接就换个文件夹,不要用默认的文件夹名称,并删除数据库的内容(所有的表以及HIBERNATE_SEQUENCE),并重启即可。在 repository.properties 中设置index.recovery.mode=FULL 9、如果是强行关闭掉Tomcat之类后,马上启动Tomcat的话,有可能会报错IOExceptionwhile loading persisted sessions: java.io.WriteAbortedException:writing aborted; java.io.NotSerializableException:org.alfresco.web.ui.common.component.UIListItem过一会儿再启动就没有问题了。 10、Alfresco 2.0 需要 JDK 1.5_07 以上的版本,这个也要注意。 11、用户名大小字问题,可以在 repository.properties 进行设置# Are user names case sensitive?user.name.caseSensitive=true设置为 true ,大小写敏感,默认为 false 12、关闭FTP服务,在 bootstrap-context.xml 配置中注释掉它就可以了。file-servers.xml里保存相关的配置信息或者也可以在 file-servers.xml 文件中设置  13、关闭CIFS服务在 file-servers.xml 文件中设置 即可。四、数据库模型可以看附件,有包含JBPM的与不包含JBMP的两个数据库五、相关资料Java Content Repository API 简介 学习 JSR-170 如何使构建 CMA 变得轻而易举http://www.ibm.com/developerworks/cn/java/j-jcr/  国外厂商纷纷投入开源界 自述其中原因,此文重点介绍 Alfresco 的相关信息。http://dotnet.csdn.net/n/20060206/86350.html 六、开发与代码分析1、换 Web Services 的实现方式由 AXIS 换到 XFireCodehaus XFire is a next-generation java SOAP framework. CodehausXFire makes service oriented development approachable through its easyto use API and support for standards. It is also highly performantsince it is built on a low memory StAX based model. ==============================================================代码分析有时间再继续整理上来 Category由id,title,description组成            public Category(org.alfresco.webservice.types.Reference id,java.lang.String title,java.lang.String description) Classification           public Classification(java.lang.Stringclassification,org.alfresco.webservice.types.CategoryrootCategory,java.lang.String title,java.lang.String description) Reference            public Reference(org.alfresco.webservice.types.Store store,java.lang.String uuid,java.lang.String path) AppliedCategory?            public AppliedCategory(java.lang.String classification,org.alfresco.webservice.types.Reference[] categories) ClassDefinition           public ClassDefinition(java.lang.String name,java.lang.Stringtitle,java.lang.String description,java.lang.String superClass,booleanisAspect,org.alfresco.webservice.types.PropertyDefinition[]properties,org.alfresco.webservice.types.AssociationDefinition[]associations)  

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1609437