cocoon and xml

Cocoon项目利用XML/XSLT发布技术实现了一个高效平台,不仅提供转换能力,还解决了逻辑与表现分离及多渠道发布等问题。通过管道处理模型,Cocoon能够灵活地处理请求并生成响应。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The cocoon project has taken the concepts of publishing using xml/xslt and implemented them in an effective platform.This has been achieved by not only providing the transformation capabilities ,but also looking at some of the wider issues of the separation of logic and presenation along with multichannel delivery. Cocoon actually uses only part of the avalon infrastructure-namely,framework,excalibur,and logkit. All the cocoon core components are based on avalon components so that they can easily make use of the infrastructure provided. The fundamental roles that cocoon defines for its components are configured in a file called cocoon.roles,which can be found in the org/apache/cocoon folder of the source tree. This file is really used only to configure the roles and is not used to configure components,hyence it is compiled into the runtime cocoon.jar. Another,fra more relevant,file is cocoon.xconf.This file is used to proviode specific configuration data for components. You can find cocoon.xconf in the web-info folder.Here you will find parameters for configurinmg database connection pool sizes,the logicsheets that are avaible to the system,memory pool sizes,sitemap configuration and so on.

Although cocoon is typically thought of as a servlet, this is really an incorrect stance. The typical way cocoon is accessed is via a servlet. To provide a high level of flexibility and separation of concerns,cocoon uses a pipelin processing model.This basically means that a requesty goes through a sequential chain of events to generate a response. The chain of events that take places is configured via a configuraion file the sitemap. Inside the pipeline, a clearly defined sequence of basic steps has been identified that apply to the processing of request:@request matching and selection,@sax generation. The generation step generates a stream od sax events from a data source.@transformation,@serialization. The sitemap is the name of the file that contains the configuration information for the pipelines that an application requires. The main cocoon sitemap file is found in the root of the cocoon web application folder and is called sitemap.xmap.

What a view does is allow the stream to be captured and transferred to an alternative processing chain. A simple view would capture the generator stream and serializer that to xml;more complex views might capture the results of a transformation or aggregation. The principle of views can be extended and offer ways of debugging applications by capturing raw output at various stages of processing.

Whereas generators allow you to implement logic at the time data is collected,transformers allow you to implement logic on the data that is already collected by a generator. Aggregation is something that is extremely useful when dealing with disparate data sources that need to be combined into a single page. You can implement aggregation in cocoon in various ways:#CInclude#XInclude#pipeline aggregation. Sitemap parameters are an extremely powerful mechanism in cocoon. The concept actually has two meanings,referring both to parameters that are passed to sitemap component, and to parameters that are returned by certain components. As used in the first sense, stiemap parameters are actually avalon objects called paramters.A parameter object is basically equivalent to java.util.Properties, although there are some differences;parameters are read-only and are created by specifying <map:parameter>tag in the sitemap. When a request uri matches a pipeline, a new map object is created by the matcher(more precisely, the map object is returned to the piepline by the matcher). This map object contains a list of the substitution variables. Each time there is a new <map:match> or <map:act> tag, a new map object is created that exists in the pipeline until the corresponding close tag.

An action is a java component that can implement logic and interact with the sitemap via sitemap parameters. An action can get data from the sitemap via a paramters object. Like a matcher, it can also return data via a map object. Actions also have an effect on the pipeline merely based on whether they return a map object or null object. if a valid object is returned, all steps inside the <map;act> block will get executed,with execution terminating after the last step. If a null object is returned, all steps inside the <map;act> block will be ignored, but all actions following it will be executed.

A composable component is one that can make use of other components. The principles of separation of concerns and inversion of control as exercised in avalon mean that a component can not directly use the implementation of another component.Iy must be done through a ComponentManager.Implementaing the composable interface allows a component to gain access to the ComponentManger and thus access implementation via the role method.A component that implements the Composable interface will also implement the compose() method. This gets called as part of the component lifecycle and is where the component can gain access to the ComponentManger and from that to implementation of the other com[ponents. The Configurable interface is another common one to be implemented in Cocoon components. This is because many components need to be able to pick up configuration settings. ObjectModelHelper is a highly useful class because it gives your classes such as actions,access to the Context,Request,and Response objects. The SitemapModelComponent interface is implemented by generator,readers and transformers. It declares the setup() method that these components can override. The EJB container naturally, controls EJBs, providing services such as transaction management,security,remote client interaction,database connectivity and life-cycle management. Web components basically servlets and JSP pages are controlled in the web container.

Cocoon contains two primary components that can help with this process:JSPReader and JSPGenerator. These components are supported by another component,JSPEngine. This provides the link to a servlet engine. The servlet engine is called to compile and generate the JSP page;JSPR eader just passes the results through the output stream,and JSPGenerate takes the results of the JSP compilation process and passes the results down the pipeline as a stream of SAX events.
内容概要:本文详细介绍了900W或1Kw,20V-90V 10A双管正激可调电源充电机的研发过程和技术细节。首先阐述了项目背景,强调了充电机在电动汽车和可再生能源领域的重要地位。接着深入探讨了硬件设计方面,包括PCB设计、磁性器件的选择及其对高功率因数的影响。随后介绍了软件实现,特别是程序代码中关键的保护功能如过流保护的具体实现方法。此外,文中还提到了充电机所具备的各种保护机制,如短路保护、欠压保护、电池反接保护、过流保护和过温度保护,确保设备的安全性和可靠性。通讯功能方面,支持RS232隔离通讯,采用自定义协议实现远程监控和控制。最后讨论了散热设计的重要性,以及为满足量产需求所做的准备工作,包括提供详细的PCB图、程序代码、BOM清单、磁性器件和散热片规格书等源文件。 适合人群:从事电力电子产品研发的技术人员,尤其是关注电动汽车充电解决方案的专业人士。 使用场景及目标:适用于需要高效、可靠充电解决方案的企业和个人开发者,旨在帮助他们快速理解和应用双管正激充电机的设计理念和技术要点,从而加速产品开发进程。 其他说明:本文不仅涵盖了理论知识,还包括具体的工程实践案例,对于想要深入了解充电机内部构造和工作原理的人来说是非常有价值的参考资料。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值