Alfresco 2.0 解读

Alfresco 2.0 解读
一、介绍
Alfresco is the Open Source Alternative for Enterprise Content Management (ECM), providing Document Management, Collaboration, Records Management, Knowledge Management, Web Content Management and Imaging.
采用的技术
Java
SpringAspect-Oriented Framework
ACEGI – Aspect-Oriented Security Framework
MyFacesJSF Implementation
HibernateORM Persistence
LuceneText 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

二、配置解读
1、从web.xml开始入手
其它的略过,在 web.xml 中可以看到加载了如下 Spring 配置文件
< context-param >
< param-name > contextConfigLocation </ param-name >
< param-value >
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
</ param-value >
< description > Spring config file locations </ description >
</ context-param >
web client 层
alfresco/web-client-application-context.xml
打开它可以看到它引入了所有的 alfresco/web-client*.xml & alfresco/extension/web-client*.xml & jar:*!/META-INF/web-client*.xml
web api 层
alfresco/web-api-application-context.xml
打开它可以看到它引入了 alfresco/web-api-config.xml & alfresco/extension/web-api-config-custom.xml
web service 层
web-services-application-context.xml
刚开始找这个文件时,居然没有找到,怪事!not exist???why?
于是后来才发现这个文件是在 remote-api.jar 包里,晕,不是很好的做法啊。
bean 配置定义关键的文件
alfresco/application-context.xml
< import resource =" classpath:alfresco/core-services-context.xml " />
< import resource =" classpath:alfresco/public-services-context.xml " />
< import resource =" classpath:alfresco/model-specific-services-context.xml " />
< import resource =" classpath:alfresco/action-services-context.xml " />
< import resource =" classpath:alfresco/rule-services-context.xml " />
< import resource =" classpath:alfresco/node-services-context.xml " />
< import resource =" classpath:alfresco/scheduled-jobs-context.xml " />
< import resource =" classpath:alfresco/network-protocol-context.xml " />
< import resource =" classpath:alfresco/content-services-context.xml " />
< import resource =" classpath:alfresco/hibernate-context.xml " />
< import resource =" classpath:alfresco/ownable-services-context.xml " />
< import resource =" classpath:alfresco/template-services-context.xml " />
< import resource =" classpath:alfresco/script-services-context.xml " />
< import resource =" classpath:alfresco/index-recovery-context.xml " />
< import resource =" classpath:alfresco/authority-services-context.xml " />
< import resource =" classpath:alfresco/authentication-services-context.xml " />
< import resource =" classpath:alfresco/policy-context.xml " />
< import resource =" classpath:alfresco/import-export-context.xml " />
< import resource =" classpath:alfresco/bootstrap-context.xml " />
< import resource =" classpath:alfresco/workflow-context.xml " />
< import resource =" classpath:alfresco/jcr-api-context.xml " />
< import resource =" classpath:alfresco/avm-services-context.xml " />
< import resource =" classpath:alfresco/audit-services-context.xml " />
< import resource =" classpath*:alfresco/patch/*-context.xml " />
< import resource =" classpath*:alfresco/domain/*-context.xml " />
<!--
Import all modules and related components.
Extensions are explicitly imported after this so that the default
mechanism can still be used to override module-specific beans.
-->
< import resource =" classpath*:alfresco/module-context.xml " />
<!--
Import of general extensions and bean overrides.
To give developers final control over the tuning
of their own local build, the dev-context.xml file
is processed last(note: dev-context.xml isn't
part of the source tree itself).
For details, see:
http://wiki.alfresco.com/wiki/Developer_Runtime_Configuration
-->
< import resource =" classpath*:alfresco/extension/*-context.xml "/>
< import resource =" classpath*:alfresco/extension/dev-context.xml " />
可以看到分层次地进行加载不同的 bean ,并且在后面提供可扩展的 bean 定义的引入,方便进行扩展,而不需要更变这个配置文件
继续一个个往下看,并把一些重要的 bean 配置拿出来:
core-services-context.xml 核心 bean 的配置
看到配置了 JMX 的服务
<!-- Custom MBeanServer -->
< bean id =" alfrescoMBeanServer " class =" org.springframework.jmx.support.MBeanServerFactoryBean "/>
< bean id =" registry " class =" org.springframework.remoting.rmi.RmiRegistryFactoryBean ">
< property name =" port " value =" ${avm.remote.port} "/>
</ bean >
<!-- MBeanServer Connector (registers itself with custom alfrescoMBeanServer) -->
< bean id =" serverConnector "
class =" org.springframework.jmx.support.ConnectorServerFactoryBean "
depends-on =" registry ">
< property name =" server " ref =" alfrescoMBeanServer "/>
< property name =" objectName " value =" connector:name=rmi "/>
< property name =" serviceUrl " value =" service:jmx:rmi://localhost/jndi/rmi://localhost:${avm.remote.port}/alfresco/jmxrmi " />
< property name =" environment ">
< map >
<!-- The following keys are only valid when sun jmx is used -->
< entry key =" jmx.remote.x.password.file " value =" ${alfresco.jmx.dir}/alfresco-jmxrmi.password "/>
< entry key =" jmx.remote.x.access.file " value =" ${alfresco.jmx.dir}/alfresco-jmxrmi.access "/>
</ map >
</ property >
</ bean >
<!-- MBeans registered with alfrescoMBeanServer -->
< bean id =" VirtServerRegistry "
class =" org.alfresco.mbeans.VirtServerRegistry "
init-method =" initialize " >
JMX 服务暴露
< bean id =" exporter " class =" org.springframework.jmx.export.MBeanExporter ">
< property name =" server " ref =" alfrescoMBeanServer "/>
< property name =" beans ">
< map >
<!-- MBeans to register with alfrescoMBeanServer -->
< entry key =" Alfresco:Name=VirtServerRegistry,Type=VirtServerRegistry " value-ref =" VirtServerRegistry "/>
< entry key =" Alfresco:Name=FileServerConfig,Type=FileServerConfig " value-ref =" FileServerConfig "/>
</ map >
</ property >
</ bean >
同时暴露了 RMI 的服务
RMI
<!-- The RMI export of the repo remote transport. -->
< bean id =" repoRemoteTransportRMI " class =" org.springframework.remoting.rmi.RmiServiceExporter ">
< property name =" service ">
< ref bean =" repoRemoteTransport "/>
</ property >
< property name =" serviceInterface ">
< value > org.alfresco.service.cmr.remote.RepoRemoteTransport </ value >
</ property >
< property name =" serviceName ">
< value > repo </ value >
</ property >
< property name =" registryPort ">
< value > ${avm.remote.port} </ value >
</ property >
</ bean >
验证 bean 配置,也是同时暴露了 RMI 的服务
authentication-services-context.xml
<!-- Here for now. Probably want remote-context.xml file. -->
<!-- The AuthenticationService exported as an RMI service. -->
< bean id =" rmiAuthenticationService " class =" org.springframework.remoting.rmi.RmiServiceExporter ">
< property name =" service ">
< ref bean =" AuthenticationService "/>
</ property >
< property name =" serviceInterface ">
< value > org.alfresco.service.cmr.security.AuthenticationService </ value >
</ property >
< property name =" serviceName ">
< value > authentication </ value >
</ property >
< property name =" registryPort ">
< value > ${avm.remote.port} </ value >
</ property >
</ bean >
avm 里也暴露了 RMI 的服务
avm-services-context.xml
<!-- The RMI wrapper around the AVM remote interface. -->
< bean id =" avmRemoteService " class =" org.springframework.remoting.rmi.RmiServiceExporter ">
< property name =" service ">
< ref bean =" avmRemoteTransport "/>
</ property >
< property name =" serviceInterface ">
< value > org.alfresco.service.cmr.remote.AVMRemoteTransport </ value >
</ property >
< property name =" serviceName ">
< value > avm </ value >
</ property >
< property name =" registryPort ">
< value > ${avm.remote.port} </ value >
</ property >
</ bean >
< bean id =" avmSyncServiceTransport " class =" org.alfresco.repo.avm.AVMSyncServiceTransportImpl ">
< property name =" authenticationService ">
< ref bean =" AuthenticationService "/>
</ property >
< property name =" avmSyncService ">
< ref bean =" AVMSyncService "/>
</ property >
</ bean >
< bean id =" avmSyncServiceTransportRMI " class =" org.springframework.remoting.rmi.RmiServiceExporter ">
< property name =" service ">
< ref bean =" avmSyncServiceTransport "/>
</ property >
< property name =" serviceInterface ">
< value > org.alfresco.service.cmr.remote.AVMSyncServiceTransport </ value >
</ property >
< property name =" serviceName ">
< value > avmsync </ value >
</ property >
< property name =" registryPort ">
< value > ${avm.remote.port} </ value >
</ property >
</ bean >
通过上面的 JMX 与 RMI 暴露在不同的配置文件里可以看到,如果我要去掉 JMX 或 RMI 服务的话,需要修改 N 个的配置文件,实在是麻烦。
建议要二次开发时根据需要进行整理,合并到一个文件里进行暴露即可,或者没有需要的话就直接 delete 掉这些:)
而且这个 JMX RMI 服务的暴露,导致你不能仅重启应用就可以,而非得重启整个应用服务器才行,要不然会报服务已启动,即默认的端口50500被占用了,而整个应用启动不了,麻烦。除非你在重启应用之前再去修改一下配置文件里的端口号,呵呵。
不过,最终的解决办法是象我在 Jmx4Log4J 里那样自己去再封装一个获取端口号的类,发现有人用了,就找下一个:)这样就OK了。
core-services-context.xml
<!-- Datasource bean -->
数据库连接池用的居然是 org.apache.commons.dbcp.BasicDataSource ,大家自己改吧 c3p0 等等
邮件
<!-- MAIL SERVICE -->
< bean id =" mailService " class =" org.springframework.mail.javamail.JavaMailSenderImpl ">
Lucene 索引和搜索 API
<!-- Indexing and Search API
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值