cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/generation PortalGenerator.java
Date Tue, 17 Jun 2003 19:59:33 GMT
cziegeler    2003/06/17 12:59:33

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/impl
                        PortalServiceImpl.java DefaultLinkService.java
               src/blocks/portal/java/org/apache/cocoon/portal/coplet
                        CopletFactory.java
               src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl
                        AspectUtil.java
               src/blocks/portal/java/org/apache/cocoon/portal/generation
                        PortalGenerator.java
  Log:
  Fixing some todos
  
  Revision  Changes    Path
  1.4       +1 -3      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
  
  Index: PortalServiceImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PortalServiceImpl.java	8 May 2003 14:01:03 -0000	1.3
  +++ PortalServiceImpl.java	17 Jun 2003 19:59:31 -0000	1.4
  @@ -73,7 +73,6 @@
   import org.xml.sax.SAXException;
   
   /**
  - * TODO: Check attribute names and make them unique
    * 
    * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
    * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  @@ -165,7 +164,6 @@
           if (null != map) {
               return map.keySet().iterator();
           }
  -        // TODO
           return Collections.EMPTY_MAP.keySet().iterator();
       }
   
  
  
  
  1.6       +42 -45    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java
  
  Index: DefaultLinkService.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultLinkService.java	1 Jun 2003 19:30:36 -0000	1.5
  +++ DefaultLinkService.java	17 Jun 2003 19:59:31 -0000	1.6
  @@ -95,10 +95,7 @@
       protected ComponentManager manager;
       protected Context context;
       
  -    // FIXME - comparable events are not completly implemented yet
  -    
       protected Info getInfo() {
  -        // TODO - add portal name to allow several portals at the same time
           final Request request = ContextHelper.getRequest( this.context );
           Info info = (Info)request.getAttribute(DefaultLinkService.class.getName());
           if ( info == null ) {
  @@ -123,71 +120,71 @@
           final Info info = this.getInfo();
           final StringBuffer buffer = new StringBuffer(info.linkBase.toString());
           boolean hasParams = info.hasParameters;
  +
  +        // add comparable events
           Iterator iter = info.comparableEvents.iterator();
           while (iter.hasNext()) {
  -            ComparableEvent ce = (ComparableEvent)iter.next();
  -            if (event instanceof ComparableEvent) {
  -                if ( !ce.equalsEvent((ComparableEvent)event)) {
  -                    if ( hasParams ) {
  -                        buffer.append('&');
  -                    } else {
  -                        buffer.append('?');
  -                    }
  -                    hasParams = true;
  -                    String parameterName = DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
  -                    if (ce instanceof RequestEvent ) {
  -                        final String eventParName = ((RequestEvent)ce).getRequestParameterName();
  -                        if ( eventParName != null ) {
  -                            parameterName = eventParName;
  -                        }
  -                    }
  -                    final String value = this.converter.encode( ce );
  -                    buffer.append(parameterName).append('=').append(SourceUtil.encode(value));
  -                }
  +            ComparableEvent current = (ComparableEvent)iter.next();
  +            if (!(event instanceof ComparableEvent)
  +                 || ( !current.equalsEvent((ComparableEvent)event))) {
  +
  +                hasParams = this.addEvent(buffer, current, hasParams);
               }
           }
           
  -        final String value = this.converter.encode( event );
  +        // now add event
  +        hasParams = this.addEvent(buffer, event, hasParams);
  +
  +        return buffer.toString();
  +    }
  +
  +    protected boolean addEvent(StringBuffer buffer, Event event, boolean hasParams) {
           if ( hasParams ) {
               buffer.append('&');
           } else {
               buffer.append('?');
           }
           String parameterName = DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
  -        if (event instanceof RequestEvent) {
  +        if (event instanceof RequestEvent ) {
               final String eventParName = ((RequestEvent)event).getRequestParameterName();
               if ( eventParName != null ) {
                   parameterName = eventParName;
               }
           }
  +        final String value = this.converter.encode( event );
           buffer.append(parameterName).append('=').append(SourceUtil.encode(value));
  -
  -        return buffer.toString();
  +        return true;
       }
  -
  +    
       public String getLinkURI(List events) {
           final Info info = this.getInfo();
  +        boolean hasParams = info.hasParameters;
           final StringBuffer buffer = new StringBuffer(info.toString());
           
  -        Iterator iter = events.iterator();
  -        boolean hasPars = info.hasParameters;
  -        while ( iter.hasNext()) {
  -            final Event current = (Event)iter.next();
  -            final String value = this.converter.encode( current );
  -            if ( hasPars ) {
  -                buffer.append('&');
  -            } else {
  -                buffer.append('?');
  -            }
  -            hasPars = true;
  -            String parameterName = DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
  -            if (current instanceof RequestEvent) {
  -                final String eventParName = ((RequestEvent)current).getRequestParameterName();
  -                if ( eventParName != null ) {
  -                    parameterName = eventParName;
  +        // add comparable events
  +        Iterator iter = info.comparableEvents.iterator();
  +        while (iter.hasNext()) {
  +            ComparableEvent current = (ComparableEvent)iter.next();
  +            
  +            Iterator eventIterator = events.iterator();
  +            boolean found = false;
  +            while (!found && eventIterator.hasNext()) {
  +                Event inEvent = (Event)eventIterator.next();
  +                if ( inEvent instanceof ComparableEvent
  +                     && current.equalsEvent((ComparableEvent)inEvent)) {
  +                     found = true;
                   }
               }
  -            buffer.append(parameterName).append('=').append(SourceUtil.encode(value));
  +            if (!found) {
  +                hasParams = this.addEvent(buffer, current, hasParams);
  +            }
  +        }
  +
  +        // now add events
  +        iter = events.iterator();
  +        while ( iter.hasNext()) {
  +            final Event current = (Event)iter.next();
  +            hasParams = this.addEvent(buffer, current, hasParams);
           }
           return buffer.toString();
       }
  
  
  
  1.4       +1 -2      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletFactory.java
  
  Index: CopletFactory.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CopletFactory.java	26 May 2003 14:03:49 -0000	1.3
  +++ CopletFactory.java	17 Jun 2003 19:59:32 -0000	1.4
  @@ -63,7 +63,6 @@
       
       String ROLE = CopletFactory.class.getName();
       
  -	// TODO - define the interface
       void prepare(CopletData copletData)
       throws ProcessingException;
       
  
  
  
  1.3       +1 -2      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AspectUtil.java
  
  Index: AspectUtil.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AspectUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AspectUtil.java	22 May 2003 12:32:47 -0000	1.2
  +++ AspectUtil.java	17 Jun 2003 19:59:32 -0000	1.3
  @@ -70,7 +70,6 @@
        * Create a new instance
        */
       public static Object createNewInstance(AspectDescription desc) {
  -        // TODO - cache class
           try {
               Class clazz = ClassUtils.loadClass(desc.getClassName());
               if ( clazz.getName().startsWith("java.lang.")) {
  
  
  
  1.2       +3 -24     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java
  
  Index: PortalGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/generation/PortalGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortalGenerator.java	7 May 2003 06:22:29 -0000	1.1
  +++ PortalGenerator.java	17 Jun 2003 19:59:33 -0000	1.2
  @@ -51,20 +51,16 @@
   package org.apache.cocoon.portal.generation;
   
   import java.io.IOException;
  -import java.io.Serializable;
   import java.util.Map;
   
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.caching.CacheableProcessingComponent;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.generation.ComposerGenerator;
   import org.apache.cocoon.portal.PortalManager;
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.excalibur.source.SourceValidity;
  -import org.apache.excalibur.source.impl.validity.NOPValidity;
   import org.xml.sax.SAXException;
   
   /**
  @@ -74,8 +70,8 @@
    * 
    * @version CVS $Id$
    */
  -public class PortalGenerator extends ComposerGenerator
  -implements CacheableProcessingComponent {
  +public class PortalGenerator 
  +extends ComposerGenerator {
   
   	/**
   	 * @see org.apache.cocoon.generation.Generator#generate()
  @@ -93,23 +89,6 @@
           } finally {
               this.manager.release(pm);
           }
  -	}
  -
  -	/* (non-Javadoc)
  -	 * @see org.apache.cocoon.caching.CacheableProcessingComponent#generateKey()
  -	 */
  -	public Serializable getKey() {
  -		// FIXME quick hack
  -        return null; //ObjectModelHelper.getRequest(this.objectModel).getQueryString();
  -
  -	}
  -
  -	/* (non-Javadoc)
  -	 * @see org.apache.cocoon.caching.CacheableProcessingComponent#generateValidity()
  -	 */
  -	public SourceValidity getValidity() {
  -		return new NOPValidity();
  -
   	}
   
       /* (non-Javadoc)
  
  
  

Mime
View raw message