Permalink
Browse files

Initial impport of Butterfly

git-svn-id: https://svn.apache.org/repos/asf/cocoon/branches/bin@30863 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
0 parents commit 464f5611cb7fa0c4b1975c61f82180329eb3234a Ugo Cei committed Jul 28, 2004
Showing with 139 additions and 0 deletions.
  1. +77 −0 beans.xml
  2. +15 −0 log4j.properties
  3. BIN org/apache/butterfly/components/pipeline/InvalidPipelineException.class
  4. BIN org/apache/butterfly/components/pipeline/PipelineException.class
  5. BIN org/apache/butterfly/components/pipeline/PipelineProcessingException.class
  6. BIN org/apache/butterfly/components/pipeline/ProcessingPipeline.class
  7. BIN org/apache/butterfly/components/pipeline/impl/GroovySitemapTestCase.class
  8. +13 −0 org/apache/butterfly/components/pipeline/impl/MyPipeline.groovy
  9. BIN org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipeline.class
  10. BIN org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase$1.class
  11. BIN org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase$2.class
  12. BIN org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase$3.class
  13. BIN org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase$4.class
  14. BIN org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase.class
  15. +34 −0 org/apache/butterfly/components/pipeline/impl/Pipeline.groovy
  16. BIN org/apache/butterfly/environment/Environment.class
  17. BIN org/apache/butterfly/generation/FileGenerator.class
  18. BIN org/apache/butterfly/generation/FileGeneratorTestCase.class
  19. BIN org/apache/butterfly/generation/Generator.class
  20. BIN org/apache/butterfly/reading/Reader.class
  21. BIN org/apache/butterfly/serialization/Serializer.class
  22. BIN org/apache/butterfly/serialization/XMLSerializer.class
  23. BIN org/apache/butterfly/serialization/XMLSerializerTestCase.class
  24. BIN org/apache/butterfly/sitemap/SitemapOutputComponent.class
  25. BIN org/apache/butterfly/source/Source.class
  26. BIN org/apache/butterfly/source/SourceException.class
  27. BIN org/apache/butterfly/source/SourceFactory.class
  28. BIN org/apache/butterfly/source/SourceNotFoundException.class
  29. BIN org/apache/butterfly/source/SourceResolver.class
  30. BIN org/apache/butterfly/source/SourceResolverTestCase.class
  31. BIN org/apache/butterfly/source/SourceUtil.class
  32. BIN org/apache/butterfly/source/SourceValidity.class
  33. BIN org/apache/butterfly/source/URIAbsolutizer.class
  34. BIN org/apache/butterfly/source/impl/FileSource.class
  35. BIN org/apache/butterfly/source/impl/FileSourceFactory.class
  36. BIN org/apache/butterfly/source/impl/URLSource.class
  37. BIN org/apache/butterfly/source/impl/URLSourceFactory.class
  38. BIN org/apache/butterfly/source/impl/validity/FileTimeStampValidity.class
  39. BIN org/apache/butterfly/test/SitemapComponentTestCase.class
  40. BIN org/apache/butterfly/transformation/Transformer.class
  41. BIN org/apache/butterfly/transformation/TraxTransformer.class
  42. BIN org/apache/butterfly/transformation/TraxTransformerTestCase.class
  43. BIN org/apache/butterfly/xml/AbstractXMLPipe.class
  44. BIN org/apache/butterfly/xml/AbstractXMLProducer.class
  45. BIN org/apache/butterfly/xml/EmbeddedXMLPipe.class
  46. BIN org/apache/butterfly/xml/Parser.class
  47. BIN org/apache/butterfly/xml/WhitespaceFilter.class
  48. BIN org/apache/butterfly/xml/XMLConsumer.class
  49. BIN org/apache/butterfly/xml/XMLException.class
  50. BIN org/apache/butterfly/xml/XMLPipe.class
  51. BIN org/apache/butterfly/xml/XMLProducer.class
  52. BIN org/apache/butterfly/xml/dom/DOMBuilder$Listener.class
  53. BIN org/apache/butterfly/xml/dom/DOMBuilder.class
  54. BIN org/apache/butterfly/xml/dom/DOMStreamer$DefaultDOMStreamer.class
  55. BIN org/apache/butterfly/xml/dom/DOMStreamer$NamespaceNormalizingDOMStreamer$ElementInfo.class
  56. BIN org/apache/butterfly/xml/dom/DOMStreamer$NamespaceNormalizingDOMStreamer.class
  57. BIN org/apache/butterfly/xml/dom/DOMStreamer.class
  58. BIN org/apache/butterfly/xml/xslt/TraxException.class
  59. BIN org/apache/butterfly/xml/xslt/TraxTransformerFactory.class
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright 2004, Ugo Cei
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--+
+ | Spring's bean factory configuration file.
+ |
+ | $Id: beans.xml,v 1.1 2004/07/23 08:47:20 ugo Exp $
+ +-->
+
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+
+ <bean id="fileSourceFactory" class="org.apache.butterfly.source.impl.FileSourceFactory"/>
+ <bean id="urlSourceFactory" class="org.apache.butterfly.source.impl.URLSourceFactory"/>
+
+ <bean id="sourceResolver" class="org.apache.butterfly.source.SourceResolver">
+ <property name="factories">
+ <map>
+ <entry key="file">
+ <ref bean="fileSourceFactory"/>
+ </entry>
+ <entry key="*">
+ <ref bean="urlSourceFactory"/>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!-- The XML Parser. Should probably be pooled. -->
+ <bean id="xmlParser" class="org.apache.butterfly.xml.Parser"
+ singleton="false" init-method="initialize">
+ <property name="saxDriver">
+ <value>org.apache.xerces.parsers.SAXParser</value>
+ </property>
+ </bean>
+
+ <bean id="fileGenerator" class="org.apache.butterfly.generation.FileGenerator" singleton="false">
+ <property name="sourceResolver">
+ <ref bean="sourceResolver"/>
+ </property>
+ <property name="parser">
+ <ref bean="xmlParser"/>
+ </property>
+ </bean>
+
+ <bean id="traxTransformerFactory" class="org.apache.butterfly.xml.xslt.TraxTransformerFactory">
+ <property name="sourceResolver">
+ <ref bean="sourceResolver"/>
+ </property>
+ </bean>
+
+ <bean id="xmlSerializer" class="org.apache.butterfly.serialization.XMLSerializer" singleton="false">
+ <property name="traxTransformerFactory">
+ <ref bean="traxTransformerFactory"/>
+ </property>
+ <property name="encoding">
+ <value>UTF-8</value>
+ </property>
+ </bean>
+
+</beans>
@@ -0,0 +1,15 @@
+# Configure logging for testing
+
+log4j.rootCategory=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p %c - %m%n
+
+#log4j.category.org.springframework.aop.framework.ProxyFactoryBean=DEBUG
+
+log4j.category.org.springframework.enterpriseservices=DEBUG
+
+log4j.category.org.springframework.transaction.interceptor=INFO
+
+log4j.category.org.springframework.beans.factory=INFO
Binary file not shown.
@@ -0,0 +1,13 @@
+class MyPipeline extends Pipeline {
+
+ void define(String requestPath) {
+ if (requestPath =~ ".*\.html") {
+ generate "testdata/traxtest-input.xml"
+ transform "trax", "testdata/traxtest-style.xsl"
+ serialize "xml"
+ }
+ else {
+ println("No matches for " + requestPath);
+ }
+ }
+}
@@ -0,0 +1,34 @@
+import org.apache.butterfly.xml.dom.DOMBuilder
+import org.apache.butterfly.components.pipeline.impl.NonCachingProcessingPipeline
+
+class Pipeline {
+ public beanFactory;
+ private pipeline;
+
+ protected Pipeline() {
+ this.pipeline = new NonCachingProcessingPipeline()
+ }
+
+ protected void generate(src) {
+ generator = beanFactory.getBean("fileGenerator")
+ generator.inputSource = src
+ this.pipeline.generator = generator
+ }
+
+ protected void transform(type, src) {
+ factory = beanFactory.getBean(type + "TransformerFactory")
+ transformer = factory.getTransformer(src)
+ this.pipeline.addTransformer(transformer)
+ }
+
+ protected void serialize(type) {
+ serializer = beanFactory.getBean(type + "Serializer")
+ this.pipeline.serializer = serializer
+ }
+
+ public void process() {
+ builder = new DOMBuilder()
+ this.pipeline.process(null, builder)
+ println(builder.document.documentElement)
+ }
+}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 464f561

Please sign in to comment.