You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by df...@apache.org on 2004/06/01 16:48:42 UTC

cvs commit: jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/query ResourceQuery.java

dflorey     2004/06/01 07:48:42

  Modified:    proposals/projector/src/java/org/apache/slide/projector/processor
                        StringArrayRenderer.java
               proposals/projector/src/java/org/apache/slide/projector/engine
                        Process.java Step.java ProcessorManager.java
               proposals/projector/src/java/org/apache/slide/projector/descriptor
                        XMLValueDescriptor.java ArrayValueDescriptor.java
               proposals/projector/src/java/org/apache/slide/projector/connector/webdav
                        WebdavConnector.java
               proposals/projector/src/java/org/apache/slide/projector/processor/xml
                        XSLTransformer.java
               proposals/projector/src/java/org/apache/slide/projector/processor/table
                        TableArrayRenderer.java
               proposals/projector/src/java/org/apache/slide/projector/processor/query
                        ResourceQuery.java
  Log:
  Fixed some bugs regarding XSLT
  
  Revision  Changes    Path
  1.3       +4 -1      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/StringArrayRenderer.java
  
  Index: StringArrayRenderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/StringArrayRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringArrayRenderer.java	1 Jun 2004 07:49:55 -0000	1.2
  +++ StringArrayRenderer.java	1 Jun 2004 14:48:42 -0000	1.3
  @@ -8,6 +8,7 @@
   import org.apache.slide.projector.i18n.DefaultMessage;
   import org.apache.slide.projector.i18n.ParameterMessage;
   import org.apache.slide.projector.value.ArrayValue;
  +import org.apache.slide.projector.value.PrintableValue;
   import org.apache.slide.projector.value.StringValue;
   import org.apache.slide.projector.value.Value;
   
  @@ -16,7 +17,9 @@
           Value []array = ((ArrayValue)input).getArray();
           StringBuffer buffer = new StringBuffer(1024);
           for ( int i = 0; i < array.length; i++ ) {
  -            buffer.append(((StringValue)array[i]).toString());
  +        	if ( array[i] instanceof PrintableValue ) {
  +        		((PrintableValue)array[i]).print(buffer);
  +        	}
           }
           return new StringValue(buffer.toString());
       }
  
  
  
  1.8       +1 -0      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/engine/Process.java
  
  Index: Process.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/engine/Process.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Process.java	1 Jun 2004 07:49:54 -0000	1.7
  +++ Process.java	1 Jun 2004 14:48:42 -0000	1.8
  @@ -120,6 +120,7 @@
   			}
   		} catch (Exception exception) {
   			logger.log(Level.SEVERE, "Error while parsing process configuration", exception);
  +			throw new ConfigurationException(new ErrorMessage("process/configurationException"), exception);
   		}
   	}
   	
  
  
  
  1.4       +6 -3      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/engine/Step.java
  
  Index: Step.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/engine/Step.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Step.java	1 Jun 2004 07:49:54 -0000	1.3
  +++ Step.java	1 Jun 2004 14:48:42 -0000	1.4
  @@ -79,9 +79,12 @@
   			Element loadElement = (Element)i.next();
               String parameterName = loadElement.getAttributeValue("parameter");
               ParameterConfiguration parameterConfiguration = new ParameterConfiguration(parameterName);
  -            Element valueElement = (Element) loadElement.getChildren().iterator().next();
  -           	parameterConfiguration.configure(valueElement);
  -           	parameterConfigurations.put(parameterName, parameterConfiguration);
  +            Iterator childIterator = loadElement.getChildren().iterator();
  +            if ( childIterator.hasNext() ) {
  +            	Element valueElement = (Element)childIterator.next();
  +            	parameterConfiguration.configure(valueElement);
  +            	parameterConfigurations.put(parameterName, parameterConfiguration);
  +            }
   		}
   		List saveElements = element.getChildren("save");
   		for ( Iterator i = saveElements.iterator(); i.hasNext(); ) {
  
  
  
  1.13      +1 -1      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/engine/ProcessorManager.java
  
  Index: ProcessorManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/engine/ProcessorManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ProcessorManager.java	1 Jun 2004 07:49:54 -0000	1.12
  +++ ProcessorManager.java	1 Jun 2004 14:48:42 -0000	1.13
  @@ -135,7 +135,7 @@
       }
   
   	public void notify(URI uri, Map information) {
  -		update((URI)configurationToApplication.get(uri), uri);
  +		update((URI)configurationToApplication.get(uri), new URIValue(uri.toString().substring(Constants.REPOSITORY_DOMAIN.length()+1)));
   	}
   
   	public Processor getProcessor(URI uri) throws ProcessException {
  
  
  
  1.4       +1 -0      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/descriptor/XMLValueDescriptor.java
  
  Index: XMLValueDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/descriptor/XMLValueDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLValueDescriptor.java	1 Jun 2004 07:49:54 -0000	1.3
  +++ XMLValueDescriptor.java	1 Jun 2004 14:48:42 -0000	1.4
  @@ -4,6 +4,7 @@
   import org.apache.slide.projector.i18n.ErrorMessage;
   import org.apache.slide.projector.value.DocumentValue;
   import org.apache.slide.projector.value.StreamableValue;
  +import org.apache.slide.projector.value.StringValue;
   import org.apache.slide.projector.value.Value;
   import org.apache.slide.projector.value.XMLValue;
   import org.jdom.DocType;
  
  
  
  1.4       +1 -1      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/descriptor/ArrayValueDescriptor.java
  
  Index: ArrayValueDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/descriptor/ArrayValueDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArrayValueDescriptor.java	1 Jun 2004 07:49:54 -0000	1.3
  +++ ArrayValueDescriptor.java	1 Jun 2004 14:48:42 -0000	1.4
  @@ -32,7 +32,7 @@
                   // validate entries
                   Value[] array = ((ArrayValue)value).getArray();
                   for ( int i = 0; i < array.length; i++ ) {
  -                    if ( entryValueDescriptor.validate(array[i], context) == null ) return null;
  +                    array[i] = entryValueDescriptor.validate(array[i], context);
                   }
                   return (ArrayValue)value;
               } else if ( value instanceof List ) {
  
  
  
  1.6       +2 -2      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/connector/webdav/WebdavConnector.java
  
  Index: WebdavConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/connector/webdav/WebdavConnector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebdavConnector.java	1 Jun 2004 07:49:58 -0000	1.5
  +++ WebdavConnector.java	1 Jun 2004 14:48:42 -0000	1.6
  @@ -136,7 +136,7 @@
       }
   
       public Value[] search(String query, Credentials credentials) throws IOException {
  -        String url = Constants.REPOSITORY_DOMAIN;
  +        String url = Constants.REPOSITORY_DOMAIN+"/";
           SearchMethod searchMethod = new SearchMethod(url, query);
           searchMethod.setDoAuthentication(true);
           HttpState httpState = new HttpState();
  @@ -145,7 +145,7 @@
           List resources = new ArrayList();
           for ( Enumeration e = searchMethod.getAllResponseURLs(); e.hasMoreElements(); ) {
               String uri = (String)e.nextElement();
  -            uri = uri.substring(Constants.REPOSITORY_DOMAIN.length());
  +//            uri = uri.substring(Constants.REPOSITORY_DOMAIN.length());
               Value resource = getResource(new URIValue(uri), credentials);
               if ( resource != null ) {
                   resources.add(resource);
  
  
  
  1.3       +4 -67     jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/xml/XSLTransformer.java
  
  Index: XSLTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/xml/XSLTransformer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSLTransformer.java	1 Jun 2004 07:49:58 -0000	1.2
  +++ XSLTransformer.java	1 Jun 2004 14:48:42 -0000	1.3
  @@ -1,74 +1,11 @@
  -/*
  - * $Header$
  - * $Revision$
  - * $Date$
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Slide", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - *
  - * [Additional notices, if required by prior licensing conditions]
  - *
  - */
  -
   package org.apache.slide.projector.processor.xml;
   
   import org.apache.slide.projector.ConfigurableProcessor;
   import org.apache.slide.projector.ConfigurationException;
   import org.apache.slide.projector.Context;
   import org.apache.slide.projector.descriptor.ParameterDescriptor;
  -import org.apache.slide.projector.descriptor.ResourceValueDescriptor;
   import org.apache.slide.projector.descriptor.ResultEntryDescriptor;
  +import org.apache.slide.projector.descriptor.XMLValueDescriptor;
   import org.apache.slide.projector.i18n.DefaultMessage;
   import org.apache.slide.projector.i18n.ErrorMessage;
   import org.apache.slide.projector.i18n.ParameterMessage;
  @@ -95,14 +32,14 @@
       private Transformer transformer;
   
       public Value process(Value input, Context context) throws Exception {
  -        Document document = ((DocumentValue)input).getDocument();
  +    	Document document = ((DocumentValue)input).getDocument();
           JDOMResult result = new JDOMResult();
           transformer.transform(new JDOMSource(document), result);
           return new DocumentValue(result.getDocument());
       }
   
       public ParameterDescriptor getParameterDescriptor() {
  -        return new ParameterDescriptor(INPUT, new ParameterMessage("xslTransformer/parameter/input"), new ResourceValueDescriptor("text/xml"));
  +        return new ParameterDescriptor(INPUT, new ParameterMessage("xslTransformer/parameter/input"), new XMLValueDescriptor());
       }
   
       public ResultEntryDescriptor getResultEntryDescriptor() {
  
  
  
  1.3       +5 -1      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/table/TableArrayRenderer.java
  
  Index: TableArrayRenderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/table/TableArrayRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TableArrayRenderer.java	1 Jun 2004 07:49:58 -0000	1.2
  +++ TableArrayRenderer.java	1 Jun 2004 14:48:42 -0000	1.3
  @@ -79,7 +79,11 @@
           parameter.remove(LENGTH);
           int maxIndex = getMaxIndex(parameter);
           offset = Math.min(offset, maxIndex);
  -        length = Math.min(length, maxIndex-offset);
  +        if ( length > 0 ) {
  +            length = Math.min(length, maxIndex-offset);
  +        } else {
  +            length = maxIndex-offset;
  +        }
           if ( maxIndex == 0 ) {
               emptyTemplate.evaluate(buffer, parameter);
           } else {
  
  
  
  1.3       +6 -6      jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/query/ResourceQuery.java
  
  Index: ResourceQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/projector/src/java/org/apache/slide/projector/processor/query/ResourceQuery.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourceQuery.java	1 Jun 2004 07:49:58 -0000	1.2
  +++ ResourceQuery.java	1 Jun 2004 14:48:42 -0000	1.3
  @@ -60,9 +60,9 @@
   
       public Result process(Map parameter, Context context) throws Exception {
           String query = ((StringValue)parameter.get(DASL_QUERY)).toString();
  -        Value []resources = ConnectorFactory.getConnector().search(query, context.getCredentials());
  -        if ( resources.length == 0 ) return new Result(EMPTY);
  -        return new Result(StateDescriptor.OK, SimpleProcessor.OUTPUT, new ArrayValue(resources));
  +        Value []values = ConnectorFactory.getConnector().search(query, context.getCredentials());
  +        if ( values.length == 0 ) return new Result(EMPTY);
  +        return new Result(StateDescriptor.OK, SimpleProcessor.OUTPUT, new ArrayValue(values));
       }
   
       public ParameterDescriptor[] getParameterDescriptors() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org