svn commit: r575531 - in /lenya/branches/revolution/1.3.x: ./ src/java/org/apache/cocoon/components/ src/java/org/apache/cocoon/components/source/ src/java/org/apache/lenya/cms/cocoon/components/modules/input/ src/java/org/apache/lenya/cms/cocoon/trans...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: solprovider
Date: Thu Sep 13 21:40:33 2007
New Revision: 575531

URL: http://svn.apache.org/viewvc?rev=575531&view=rev
Log:
Finished merging Java code from last year.  Fixed version number.

Added:
    lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/
    lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/source/
    lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/source/SourceResolverAdapter.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/VirtualModule.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/transformation/VirtualTransformer.java
Modified:
    lenya/branches/revolution/1.3.x/build.properties
    lenya/branches/revolution/1.3.x/src/resources/dev/eclipse/project.xml
    lenya/branches/revolution/1.3.x/src/targets/properties-build.xml
    lenya/branches/revolution/1.3.x/src/webapp/lenya/content/about.xml

Modified: lenya/branches/revolution/1.3.x/build.properties
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/build.properties?rev=575531&r1=575530&r2=575531&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/build.properties (original)
+++ lenya/branches/revolution/1.3.x/build.properties Thu Sep 13 21:40:33 2007
@@ -21,14 +21,13 @@
 # NOTE for Devs: Update this number if this file is being updated.
 #                Also update the version number within src/targets/properties-build.xml
 
-build.properties.version=157864
+build.properties.version=157866
 
 
 #------------------------------------------------------------------------------------
 # The root of the Cocoon source tree
 
-#cocoon.src.dir=../cocoon-2.1.7
-cocoon.src.dir=../cocoon-2.1.8
+cocoon.src.dir=../cocoon-2.1.10
 #cocoon.src.dir=../cocoon/branches/BRANCH_2_1_X
 
 #------------------------------------------------------------------------------------

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/source/SourceResolverAdapter.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/source/SourceResolverAdapter.java?rev=575531&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/source/SourceResolverAdapter.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/cocoon/components/source/SourceResolverAdapter.java Thu Sep 13 21:40:33 2007
@@ -0,0 +1,90 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+
+package org.apache.cocoon.components.source;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.Source;
+import org.apache.cocoon.environment.SourceResolver;
+import org.xml.sax.SAXException;
+
+/**
+ * An adapter for the Excalibur SourceResolver.
+ *
+ * @version CVS $Id: SourceResolverAdapter.java 55454 2004-10-24 18:02:39Z cziegeler $
+ */
+public class SourceResolverAdapter implements SourceResolver
+{
+    private org.apache.excalibur.source.SourceResolver resolver;
+
+    public SourceResolverAdapter(org.apache.excalibur.source.SourceResolver resolver) {
+        this.resolver = resolver;
+    }
+
+    /**
+     * Get a <code>Source</code> object.
+     * This is a shortcut for <code>resolve(location, null, null)</code>
+     * @throws org.apache.excalibur.source.SourceException if the source cannot be resolved
+     */
+    public org.apache.excalibur.source.Source resolveURI( String location )
+        throws MalformedURLException, IOException, org.apache.excalibur.source.SourceException {
+  
+        return this.resolver.resolveURI(location);
+    }
+
+    /**
+     * Get a <code>Source</code> object.
+     * @param location - the URI to resolve. If this is relative it is either
+     *                   resolved relative to the base parameter (if not null)
+     *                   or relative to a base setting of the source resolver
+     *                   itself.
+     * @param base - a base URI for resolving relative locations. This
+     *               is optional and can be <code>null</code>.
+     * @param parameters - Additional parameters for the URI. The parameters
+     *                     are specific to the used protocol.
+     * @throws org.apache.excalibur.source.SourceException if the source cannot be resolved
+     */
+    public org.apache.excalibur.source.Source resolveURI( String location,
+                                                          String base,
+                                                          Map parameters )
+        throws MalformedURLException, IOException, org.apache.excalibur.source.SourceException {
+
+        return this.resolver.resolveURI(location, base, parameters);
+    }
+
+    /**
+     * Releases a resolved resource
+     */
+    public void release( org.apache.excalibur.source.Source source ) {
+        this.resolver.release(source);
+    }
+
+    /**
+     * Resolve the source.
+     * @param systemID This is either a system identifier
+     * (<code>java.net.URL</code> or a local file.
+     * @deprecated Use the resolveURI methods instead
+     */
+    public Source resolve(String systemID)
+        throws ProcessingException, SAXException, IOException {
+
+        throw new RuntimeException("Method SourceResolver.resolve(String) is deprecated");
+    }
+}

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/VirtualModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/VirtualModule.java?rev=575531&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/VirtualModule.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/VirtualModule.java Thu Sep 13 21:40:33 2007
@@ -0,0 +1,76 @@
+package org.apache.lenya.cms.cocoon.components.modules.input;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.ContextHelper;
+
+import org.apache.cocoon.components.modules.input.AbstractInputModule;
+import org.apache.lenya.cms.cocoon.components.source.impl.VirtualSourceFactory;
+
+
+/**
+ * {virtual:new} Reserves and returns a new Key for a VirtualSource.
+ * {virtual:Key} Releases Key for a VirtualSource.
+ */
+public class VirtualModule extends AbstractInputModule implements Serviceable, Contextualizable, ThreadSafe {
+    private ServiceManager manager;
+    private org.apache.avalon.framework.context.Context context;
+    /**
+     * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
+     *      org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+     */
+    public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
+        if(name.equalsIgnoreCase("new")) return VirtualSourceFactory.reserve();
+        VirtualSourceFactory.releaseSource(name);
+        return name;
+    }
+
+    /**
+     * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
+     *      java.util.Map)
+     */
+    public Iterator getAttributeNames(Configuration modeConf, Map objectModel) throws ConfigurationException {
+        return Collections.EMPTY_SET.iterator();
+    }
+
+    /**
+     * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
+     *      org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+     */
+    public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
+            throws ConfigurationException {
+        Object[] objects = { getAttribute(name, modeConf, objectModel) };
+        return objects;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
+    /**
+     * Contextualizable, get the object model
+     */
+    public void contextualize( Context context ) throws ContextException {
+        this.context = context;
+    }
+    /**
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure(Configuration conf) throws ConfigurationException {
+        super.configure(conf);
+    }
+}
\ No newline at end of file

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/transformation/VirtualTransformer.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/transformation/VirtualTransformer.java?rev=575531&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/transformation/VirtualTransformer.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/transformation/VirtualTransformer.java Thu Sep 13 21:40:33 2007
@@ -0,0 +1,48 @@
+package org.apache.lenya.cms.cocoon.transformation;
+
+import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.cocoon.components.CocoonComponentManager;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.transformation.AbstractDOMTransformer;
+import org.apache.excalibur.source.Source;
+import org.apache.lenya.cms.cocoon.components.source.impl.StringSource;
+import org.apache.lenya.cms.cocoon.components.source.impl.VirtualSourceFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * This transformer creates a new VirtualDocument with the specified key.
+ * 
+ * @author <a href="mailto:[email protected]">Paul Ercolino</a>
+ */
+public class VirtualTransformer extends AbstractDOMTransformer{
+   private static final String SERIALIZER_NAME = "xml";
+   public static final String CONTENT_PREFIX = "content";
+
+   protected org.w3c.dom.Document transform(org.w3c.dom.Document doc){
+      Request request = ObjectModelHelper.getRequest(super.objectModel);
+      createVirtual(request, this.source, doc);
+      return doc;
+   }
+   static public org.w3c.dom.Document transformDocument(Request request, String key, org.w3c.dom.Document doc){
+      createVirtual(request, key, doc);
+      return doc;
+   }
+   /**
+    *
+    * @param request The request
+    * @param doc The data to be inserted.
+    */
+   static private void createVirtual(Request request, String key, org.w3c.dom.Document doc){
+      if (doc == null){
+System.out.println("Virtual: Document is required.");
+//         throw new ProcessingException("CreateRevision: document is required.");
+      }
+      ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
+//      Element root = doc.getDocumentElement();
+//      Source source = (Source) new StringSource(manager, root);
+      Source source = (Source) new StringSource(manager, doc);
+      VirtualSourceFactory.addSource(key, source);
+   }
+}

Modified: lenya/branches/revolution/1.3.x/src/resources/dev/eclipse/project.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/resources/dev/eclipse/project.xml?rev=575531&r1=575530&r2=575531&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/resources/dev/eclipse/project.xml (original)
+++ lenya/branches/revolution/1.3.x/src/resources/dev/eclipse/project.xml Thu Sep 13 21:40:33 2007
@@ -1,18 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>Lenya 1.2</name>
-	<comment></comment>
-	<projects>
-		<project>cocoon-2.1.7</project>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Lenya 1.3.0</name>
+	<comment></comment>
+	<projects>
+		<project>cocoon-2.1.10</project>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Modified: lenya/branches/revolution/1.3.x/src/targets/properties-build.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/targets/properties-build.xml?rev=575531&r1=575530&r2=575531&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/targets/properties-build.xml (original)
+++ lenya/branches/revolution/1.3.x/src/targets/properties-build.xml Thu Sep 13 21:40:33 2007
@@ -35,14 +35,14 @@
   <property file="build.properties"/>
 
   <condition property="local.properties.in.sync">
-    <equals arg1="${build.properties.version}" arg2="157864"/>
+    <equals arg1="${build.properties.version}" arg2="157866"/>
   </condition>
 
   <fail unless="local.properties.in.sync" message="It seems that your local.build.properties is NOT in sync with build.properties! The file build.properties has probably been modified by some Apache Lenya developer. Re-copy build.properties to local.build.properties and re-set your local properties to get the two files back in sync. Please apologoize the inconvenience."/>
 
 
   <!-- Project version and name -->
-  <property name="version" value="1.2.5-dev"/>
+  <property name="version" value="1.3.0-dev"/>
   <property name="fullname" value="${ant.project.name}-${version}"/>
   <property name="distname" value="apache-${ant.project.name}-${version}"/>
 

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/content/about.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/content/about.xml?rev=575531&r1=575530&r2=575531&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/content/about.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/content/about.xml Thu Sep 13 21:40:33 2007
@@ -31,7 +31,7 @@
 Apache Lenya includes software developed by the <a href="http://www.apache.org/">Apache Software Foundation</a>, 
 <a href="http://w3c.org">W3C</a>, <br /><a href="http://dom4j.org">DOM4J</a>, and <a href="http://sf.net/projects/websphinx">WebSHPINX</a>.
 <br /><br /> 
-Copyright (C) 1999-2005 The Apache Software Foundation. All rights reserved.
+Copyright (C) 1999-2007 The Apache Software Foundation. All rights reserved.
 </p>
 <form>
 <input type="button" value="Back" onClick="history.go(-1)"/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.