tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/form Form.java
Date Fri, 03 Dec 2004 15:18:39 GMT
hlship      2004/12/03 07:18:39

  Modified:    framework/src/java/org/apache/tapestry/engine
                        HomeService.java ExternalService.java
                        ActionService.java DirectService.java
                        ResetService.java TagSupportService.java
                        PageService.java RestartService.java
                        IEngineService.java
               framework/src/java/org/apache/tapestry/link
                        ExternalLink.java DirectLink.java
                        AbstractLinkComponent.java ActionLink.java
                        PageLink.java
               framework/src/test/org/apache/tapestry/junit/engine
                        TestRequestCycleToString.java
               contrib/src/java/org/apache/tapestry/contrib/inspector
                        InspectorButton.java ShowTemplate.java
               src/documentation/content/xdocs/UsersGuide upgrade.xml
               framework/src/test/org/apache/tapestry/junit/mock/c21
                        NameMismatchService.java PrivateService.java
               src/documentation/content/xdocs links.ent
               framework/src/java/org/apache/tapestry/asset
                        AssetService.java PrivateAsset.java
               framework/src/java/org/apache/tapestry/html Frame.java
                        Shell.java
               examples/Workbench/src/java/org/apache/tapestry/workbench/chart
                        ChartService.java ChartAsset.java
               framework/src/java/org/apache/tapestry/form Form.java
  Added:       framework/src/java/org/apache/tapestry/engine
                        ActionServiceParameter.java EngineMessages.java
                        EngineStrings.properties
                        DirectServiceParameter.java
                        ExternalServiceParameter.java
  Removed:     framework/src/test/org/apache/tapestry/junit/engine
                        MockService.java
  Log:
  Change the IEngineService interface to pass a single untyped parameter object, allowing each service to define for itself what data is needed.
  
  Revision  Changes    Path
  1.4       +3 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/HomeService.java
  
  Index: HomeService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/HomeService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HomeService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ HomeService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -18,7 +18,6 @@
   
   import javax.servlet.ServletException;
   
  -import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IEngine;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  @@ -39,12 +38,10 @@
       /** @since 3.1 */
       private ResponseRenderer _responseRenderer;
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (Tapestry.size(parameters) != 0)
  -            throw new IllegalArgumentException(Tapestry.format(
  -                    "service-no-parameters",
  -                    Tapestry.HOME_SERVICE));
  +        if (parameter != null)
  +            throw new IllegalArgumentException(EngineMessages.serviceNoParameter(this));
   
           return constructLink(cycle, Tapestry.HOME_SERVICE, null, null, true);
       }
  
  
  
  1.5       +13 -10    jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ExternalService.java
  
  Index: ExternalService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ExternalService.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExternalService.java	12 Oct 2004 12:42:32 -0000	1.4
  +++ ExternalService.java	3 Dec 2004 15:18:37 -0000	1.5
  @@ -19,6 +19,7 @@
   import javax.servlet.ServletException;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IExternalPage;
   import org.apache.tapestry.IRequestCycle;
  @@ -114,21 +115,23 @@
   
       private ResponseRenderer _responseRenderer;
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (parameters == null || parameters.length == 0)
  -            throw new ApplicationRuntimeException(Tapestry.format(
  -                    "service-requires-parameters",
  -                    Tapestry.EXTERNAL_SERVICE));
  +        Defense.isAssignable(parameter, ExternalServiceParameter.class, "parameter");
  +
  +        ExternalServiceParameter esp = (ExternalServiceParameter) parameter;
  +
  +        String pageName = esp.getPageName();
   
  -        String pageName = (String) parameters[0];
           String[] context = new String[]
           { pageName };
   
  -        Object[] pageParameters = new Object[parameters.length - 1];
  -        System.arraycopy(parameters, 1, pageParameters, 0, parameters.length - 1);
  -
  -        return constructLink(cycle, Tapestry.EXTERNAL_SERVICE, context, pageParameters, true);
  +        return constructLink(
  +                cycle,
  +                Tapestry.EXTERNAL_SERVICE,
  +                context,
  +                esp.getServiceParameters(),
  +                true);
       }
   
       public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  
  
  
  1.4       +8 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ActionService.java
  
  Index: ActionService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ActionService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActionService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ ActionService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -20,6 +20,7 @@
   import javax.servlet.http.HttpSession;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IAction;
   import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IPage;
  @@ -59,12 +60,13 @@
   
       private static final String STATEFUL_OFF = "0";
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (parameters == null || parameters.length != 1)
  -            throw new IllegalArgumentException(Tapestry.format(
  -                    "service-single-parameter",
  -                    Tapestry.ACTION_SERVICE));
  +        Defense.isAssignable(parameter, ActionServiceParameter.class, "parameter");
  +
  +        ActionServiceParameter asp = (ActionServiceParameter) parameter;
  +
  +        IComponent component = asp.getComponent();
   
           String stateful = cycle.getEngine().isStateful() ? STATEFUL_ON : STATEFUL_OFF;
           IPage componentPage = component.getPage();
  @@ -78,7 +80,7 @@
   
           serviceContext[i++] = stateful;
           serviceContext[i++] = responsePage.getPageName();
  -        serviceContext[i++] = (String) parameters[0];
  +        serviceContext[i++] = asp.getActionId();
   
           // Because of Block/InsertBlock, the component may not be on
           // the same page as the response page and we need to make
  
  
  
  1.4       +9 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/DirectService.java
  
  Index: DirectService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/DirectService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DirectService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ DirectService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -20,6 +20,7 @@
   import javax.servlet.http.HttpSession;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IDirect;
   import org.apache.tapestry.IPage;
  @@ -59,8 +60,14 @@
   
       private static final String STATEFUL_OFF = "0";
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  +        Defense.isAssignable(parameter, DirectServiceParameter.class, "parameter");
  +
  +        DirectServiceParameter dsp = (DirectServiceParameter) parameter;
  +
  +        IComponent component = dsp.getDirect();
  +        Object[] serviceParameters = dsp.getServiceParameters();
   
           // New since 1.0.1, we use the component to determine
           // the page, not the cycle. Through the use of tricky
  @@ -90,7 +97,7 @@
           context[i++] = componentPage.getPageName();
           context[i++] = component.getIdPath();
   
  -        return constructLink(cycle, Tapestry.DIRECT_SERVICE, context, parameters, true);
  +        return constructLink(cycle, Tapestry.DIRECT_SERVICE, context, serviceParameters, true);
       }
   
       public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  
  
  
  1.4       +8 -10     jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ResetService.java
  
  Index: ResetService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ResetService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResetService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ ResetService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -47,19 +47,17 @@
       /** @since 3.1 */
   
       private ResetEventCoordinator _resetEventCoordinator;
  -    
  +
       /** @since 3.1 */
       private boolean _enabled;
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (Tapestry.size(parameters) != 0)
  -            throw new IllegalArgumentException(Tapestry.format(
  -                    "service-no-parameters",
  -                    Tapestry.RESET_SERVICE));
  +        if (parameter != null)
  +            throw new IllegalArgumentException(EngineMessages.serviceNoParameter(this));
   
  -        String[] context = new String[1];
  -        context[0] = component.getPage().getPageName();
  +        String[] context = new String[]
  +        { cycle.getPage().getPageName() };
   
           return constructLink(cycle, Tapestry.RESET_SERVICE, context, null, true);
       }
  @@ -105,9 +103,9 @@
       {
           _resetEventCoordinator = resetEventCoordinator;
       }
  -    
  +
       /** @since 3.1 */
  -    
  +
       public void setEnabled(boolean enabled)
       {
           _enabled = enabled;
  
  
  
  1.4       +4 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/TagSupportService.java
  
  Index: TagSupportService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/TagSupportService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TagSupportService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ TagSupportService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -25,7 +25,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  @@ -53,7 +52,7 @@
        *             always
        */
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
           throw new ApplicationRuntimeException(Tapestry.getMessage("TagSupportService.service-only"));
       }
  @@ -83,7 +82,9 @@
   
           IEngineService service = cycle.getEngine().getService(serviceName);
   
  -        ILink link = service.getLink(cycle, null, parameters);
  +        // TODO: This is all screwed up now!
  +        
  +        ILink link = service.getLink(cycle, parameters);
   
           String URI = link.getURL();
   
  
  
  
  1.4       +7 -8      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/PageService.java
  
  Index: PageService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/PageService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PageService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ PageService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -19,7 +19,7 @@
   import javax.servlet.ServletException;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.tapestry.IComponent;
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  @@ -39,15 +39,14 @@
       /** @since 3.1 */
       private ResponseRenderer _responseRenderer;
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (Tapestry.size(parameters) != 1)
  -            throw new IllegalArgumentException(Tapestry.format(
  -                    "service-single-parameter",
  -                    Tapestry.PAGE_SERVICE));
  +        Defense.isAssignable(parameter, String.class, "parameter");
   
  -        return constructLink(cycle, Tapestry.PAGE_SERVICE, new String[]
  -        { (String) parameters[0] }, null, true);
  +        String[] context = new String[]
  +        { (String) parameter };
  +
  +        return constructLink(cycle, Tapestry.PAGE_SERVICE, context, null, true);
   
       }
   
  
  
  
  1.4       +3 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/RestartService.java
  
  Index: RestartService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/RestartService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RestartService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ RestartService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -22,7 +22,6 @@
   import javax.servlet.http.HttpSession;
   
   import org.apache.commons.logging.Log;
  -import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.request.ResponseOutputStream;
  @@ -51,12 +50,10 @@
       /** @since 3.1 */
       private AbsoluteURLBuilder _builder;
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (Tapestry.size(parameters) != 0)
  -            throw new IllegalArgumentException(Tapestry.format(
  -                    "service-no-parameters",
  -                    Tapestry.RESTART_SERVICE));
  +        if (parameter != null)
  +            throw new IllegalArgumentException(EngineMessages.serviceNoParameter(this));
   
           return constructLink(cycle, Tapestry.RESTART_SERVICE, null, null, true);
       }
  
  
  
  1.4       +9 -7      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/IEngineService.java
  
  Index: IEngineService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/IEngineService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IEngineService.java	12 Oct 2004 12:42:32 -0000	1.3
  +++ IEngineService.java	3 Dec 2004 15:18:37 -0000	1.4
  @@ -18,7 +18,6 @@
   
   import javax.servlet.ServletException;
   
  -import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.request.ResponseOutputStream;
   
  @@ -37,19 +36,22 @@
       /**
        * Builds a URL for a service. This is performed during the rendering phase of one request cycle
        * and bulds URLs that will invoke activity in a subsequent request cycle.
  +     * <p>
  +     * <b>This method changed incompatibly between release 3.0 and release 3.1. </b>
  +     * </p>
        * 
        * @param cycle
        *            Defines the request cycle being processed.
  -     * @param component
  -     *            The component requesting the URL. Generally, the service context is established
  -     *            from the component.
  -     * @param parameters
  -     *            Additional parameters specific to the component requesting the EngineServiceLink.
  +     * @param parameter
  +     *            An object that provide any additional information needed by the service. Each
  +     *            service implementation will expect that an object of the proper type be passed in.
  +     *            In some cases, a simple String will do; in others, a specific object (possibly
  +     *            implementing an interface) will be required.
        * @return The URL for the service. The URL will have to be encoded via
        *         {@link javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)}.
        */
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters);
  +    public ILink getLink(IRequestCycle cycle, Object parameter);
   
       /**
        * Perform the service, interpreting the URL (from the
  
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ActionServiceParameter.java
  
  Index: ActionServiceParameter.java
  ===================================================================
  // Copyright 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.tapestry.engine;
  
  import org.apache.hivemind.Defense;
  import org.apache.tapestry.IComponent;
  
  /**
   * Parameter object used with {@link org.apache.tapestry.engine.ActionService}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class ActionServiceParameter
  {
  
      private IComponent _component;
  
      private String _actionId;
  
      public ActionServiceParameter(IComponent component, String actionId)
      {
          Defense.notNull(component, "component");
          Defense.notNull(actionId, "actionId");
  
          _component = component;
          _actionId = actionId;
      }
  
      public String getActionId()
      {
          return _actionId;
      }
  
      public IComponent getComponent()
      {
          return _component;
      }
  }
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/EngineMessages.java
  
  Index: EngineMessages.java
  ===================================================================
  // Copyright 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.tapestry.engine;
  
  import org.apache.hivemind.impl.MessageFormatter;
  
  /**
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  class EngineMessages
  {
      private static final MessageFormatter _formatter = new MessageFormatter(EngineMessages.class,
              "EngineStrings.properties");
  
      public static String serviceNoParameter(IEngineService service)
      {
          return _formatter.format("service-no-parameter", service.getName());
      }
  }
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/EngineStrings.properties
  
  Index: EngineStrings.properties
  ===================================================================
  service-no-parameter=The {0} service does not require a parameter object.
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/DirectServiceParameter.java
  
  Index: DirectServiceParameter.java
  ===================================================================
  // Copyright 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.tapestry.engine;
  
  import org.apache.hivemind.Defense;
  import org.apache.tapestry.IDirect;
  
  /**
   * Parameter object used by {@link org.apache.tapestry.engine.DirectService}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class DirectServiceParameter
  {
      private IDirect _direct;
  
      private Object[] _serviceParameters;
  
      public DirectServiceParameter(IDirect direct)
      {
          this(direct, null);
      }
  
      public DirectServiceParameter(IDirect direct, Object[] serviceParameters)
      {
          Defense.notNull(direct, "direct");
  
          _direct = direct;
          _serviceParameters = serviceParameters;
      }
  
      public IDirect getDirect()
      {
          return _direct;
      }
  
      public Object[] getServiceParameters()
      {
          return _serviceParameters;
      }
  }
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ExternalServiceParameter.java
  
  Index: ExternalServiceParameter.java
  ===================================================================
  // Copyright 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.tapestry.engine;
  
  import org.apache.hivemind.Defense;
  
  /**
   * Parameter for the {@link org.apache.tapestry.engine.ExternalService}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class ExternalServiceParameter
  {
      private String _pageName;
  
      private Object[] _serviceParameters;
  
      public ExternalServiceParameter(String pageName)
      {
          this(pageName, null);
      }
  
      public ExternalServiceParameter(String pageName, Object[] serviceParameters)
      {
          Defense.notNull(pageName, "pageName");
  
          _pageName = pageName;
          _serviceParameters = serviceParameters;
      }
  
      public String getPageName()
      {
          return _pageName;
      }
  
      public Object[] getServiceParameters()
      {
          return _serviceParameters;
      }
  }
  
  
  1.3       +11 -25    jakarta-tapestry/framework/src/java/org/apache/tapestry/link/ExternalLink.java
  
  Index: ExternalLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/link/ExternalLink.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExternalLink.java	16 Sep 2004 00:26:31 -0000	1.2
  +++ ExternalLink.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -16,46 +16,32 @@
   
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.engine.ExternalServiceParameter;
   import org.apache.tapestry.engine.ILink;
   
   /**
  - *  A component for creating a link to {@link org.apache.tapestry.IExternalPage} using the
  - * {@link org.apache.tapestry.engine.ExternalService}.
  - *
  - *  [<a href="../../../../../ComponentReference/ExternalLink.html">Component Reference</a>]
  - *
  + * A component for creating a link to {@link org.apache.tapestry.IExternalPage}using the
  + * {@link org.apache.tapestry.engine.ExternalService}. [ <a
  + * href="../../../../../ComponentReference/ExternalLink.html">Component Reference </a>]
  + * 
    * @see org.apache.tapestry.IExternalPage
    * @see org.apache.tapestry.engine.ExternalService
  - *
    * @author Malcolm Edgar
  - *
  - **/
  + */
   
   public abstract class ExternalLink extends AbstractLinkComponent
   {
       public ILink getLink(IRequestCycle cycle)
       {
  -        return getLink(cycle, Tapestry.EXTERNAL_SERVICE, getServiceParameters());
  -    }
  -
  -    private Object[] getServiceParameters()
  -    {
  -        Object[] pageParameters = DirectLink.constructServiceParameters(getParameters());
  -        String targetPage = getTargetPage();
  -
  -        if (pageParameters == null)
  -            return new Object[] { targetPage };
  -
  -        Object[] parameters = new Object[pageParameters.length + 1];
  -
  -        parameters[0] = targetPage;
  +        Object[] serviceParameters = DirectLink.constructServiceParameters(getParameters());
   
  -        System.arraycopy(pageParameters, 0, parameters, 1, pageParameters.length);
  +        ExternalServiceParameter esp = new ExternalServiceParameter(getTargetPage(),
  +                serviceParameters);
   
  -        return parameters;
  +        return getLink(cycle, Tapestry.EXTERNAL_SERVICE, esp);
       }
   
       public abstract Object getParameters();
   
       public abstract String getTargetPage();
  -}
  +}
  \ No newline at end of file
  
  
  
  1.5       +7 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/link/DirectLink.java
  
  Index: DirectLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/link/DirectLink.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DirectLink.java	17 Nov 2004 01:34:58 -0000	1.4
  +++ DirectLink.java	3 Dec 2004 15:18:38 -0000	1.5
  @@ -20,6 +20,7 @@
   import org.apache.tapestry.IDirect;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.engine.DirectServiceParameter;
   import org.apache.tapestry.engine.ILink;
   
   /**
  @@ -36,14 +37,18 @@
   
       /**
        * Returns true if the stateful parameter is bound to a true value. If stateful is not bound,
  -     * also returns the default, true. 
  +     * also returns the default, true.
        */
   
       public abstract boolean isStateful();
   
       public ILink getLink(IRequestCycle cycle)
       {
  -        return getLink(cycle, Tapestry.DIRECT_SERVICE, constructServiceParameters(getParameters()));
  +        Object[] serviceParameters = constructServiceParameters(getParameters());
  +
  +        DirectServiceParameter dsp = new DirectServiceParameter(this, serviceParameters);
  +
  +        return getLink(cycle, Tapestry.DIRECT_SERVICE, dsp);
       }
   
       /**
  
  
  
  1.3       +25 -39    jakarta-tapestry/framework/src/java/org/apache/tapestry/link/AbstractLinkComponent.java
  
  Index: AbstractLinkComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/link/AbstractLinkComponent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractLinkComponent.java	16 Sep 2004 00:26:31 -0000	1.2
  +++ AbstractLinkComponent.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -32,17 +32,14 @@
   import org.apache.tapestry.html.Body;
   
   /**
  - *  Base class for
  - *  implementations of {@link ILinkComponent}.  Includes a disabled attribute
  - *  (that should be bound to a disabled parameter), 
  - *  an anchor attribute, and a
  - *  renderer attribute (that should be bound to a renderer parameter).  A default,
  - *  shared instance of {@link org.apache.tapestry.link.DefaultLinkRenderer} is
  - *  used when no specific renderer is provided.
  - *
  - *  @author Howard Lewis Ship
  - *
  - **/
  + * Base class for implementations of {@link ILinkComponent}. Includes a disabled attribute (that
  + * should be bound to a disabled parameter), an anchor attribute, and a renderer attribute (that
  + * should be bound to a renderer parameter). A default, shared instance of
  + * {@link org.apache.tapestry.link.DefaultLinkRenderer}is used when no specific renderer is
  + * provided.
  + * 
  + * @author Howard Lewis Ship
  + */
   
   public abstract class AbstractLinkComponent extends AbstractComponent implements ILinkComponent
   {
  @@ -51,10 +48,9 @@
       public abstract boolean isDisabled();
   
       /**
  -     *  Adds an event handler (typically, from a wrapped component such
  -     *  as a {@link org.apache.tapestry.html.Rollover}).
  -     *
  -     **/
  +     * Adds an event handler (typically, from a wrapped component such as a
  +     * {@link org.apache.tapestry.html.Rollover}).
  +     */
   
       public void addEventHandler(LinkEventType eventType, String functionName)
       {
  @@ -92,10 +88,8 @@
       }
   
       /**
  -     *  Renders the link by delegating to an instance
  -     *  of {@link ILinkRenderer}.
  -     *
  -     **/
  +     * Renders the link by delegating to an instance of {@link ILinkRenderer}.
  +     */
   
       protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
       {
  @@ -119,11 +113,8 @@
           Body body = Body.get(cycle);
   
           if (body == null)
  -            throw new ApplicationRuntimeException(
  -                Tapestry.getMessage("AbstractLinkComponent.events-need-body"),
  -                this,
  -                null,
  -                null);
  +            throw new ApplicationRuntimeException(Tapestry
  +                    .getMessage("AbstractLinkComponent.events-need-body"), this, null, null);
   
           Iterator i = _eventHandlers.entrySet().iterator();
   
  @@ -137,12 +128,8 @@
   
       }
   
  -    protected String writeEventHandler(
  -        IMarkupWriter writer,
  -        Body body,
  -        String name,
  -        String attributeName,
  -        Object value)
  +    protected String writeEventHandler(IMarkupWriter writer, Body body, String name,
  +            String attributeName, Object value)
       {
           String wrapperFunctionName;
   
  @@ -181,7 +168,7 @@
           return name;
       }
   
  -    /** @since 3.0 **/
  +    /** @since 3.0 * */
   
       public abstract ILinkRenderer getRenderer();
   
  @@ -197,19 +184,18 @@
       }
   
       /**
  -     *  Utility method for subclasses; Gets the named service from the engine
  -     *  and invokes {@link IEngineService#getLink(IRequestCycle, org.apache.tapestry.IComponent, Object[])}
  -     *  on it.
  +     * Utility method for subclasses; Gets the named service from the engine and invokes
  +     * {@link IEngineService#getLink(IRequestCycle, org.apache.tapestry.IComponent, Object[])}on
  +     * it.
        * 
  -     *  @since 3.0
  -     * 
  -     **/
  +     * @since 3.0
  +     */
   
  -    protected ILink getLink(IRequestCycle cycle, String serviceName, Object[] serviceParameters)
  +    protected ILink getLink(IRequestCycle cycle, String serviceName, Object parameter)
       {
           IEngineService service = cycle.getEngine().getService(serviceName);
   
  -        return service.getLink(cycle, this, serviceParameters);
  +        return service.getLink(cycle, parameter);
       }
   
       public abstract String getAnchor();
  
  
  
  1.5       +3 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/link/ActionLink.java
  
  Index: ActionLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/link/ActionLink.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ActionLink.java	17 Nov 2004 01:34:58 -0000	1.4
  +++ ActionLink.java	3 Dec 2004 15:18:38 -0000	1.5
  @@ -20,6 +20,7 @@
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.RenderRewoundException;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.engine.ActionServiceParameter;
   import org.apache.tapestry.engine.ILink;
   
   /**
  @@ -32,7 +33,7 @@
   public abstract class ActionLink extends AbstractLinkComponent implements IAction
   {
       public abstract boolean isStateful();
  -    
  +
       /**
        * Returns true if the stateful parameter is bound to a true value. If stateful is not bound,
        * also returns the default, true.
  @@ -57,8 +58,7 @@
               throw new RenderRewoundException(this);
           }
   
  -        return getLink(cycle, Tapestry.ACTION_SERVICE, new Object[]
  -        { actionId });
  +        return getLink(cycle, Tapestry.ACTION_SERVICE, new ActionServiceParameter(this, actionId));
       }
   
       public abstract IActionListener getListener();
  
  
  
  1.3       +6 -9      jakarta-tapestry/framework/src/java/org/apache/tapestry/link/PageLink.java
  
  Index: PageLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/link/PageLink.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PageLink.java	16 Sep 2004 00:26:31 -0000	1.2
  +++ PageLink.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -20,14 +20,11 @@
   import org.apache.tapestry.engine.ILink;
   
   /**
  - *  A component for creating a navigation link to another page, 
  - *  using the page service.
  - *
  - *  [<a href="../../../../../ComponentReference/PageLink.html">Component Reference</a>]
  - *
  + * A component for creating a navigation link to another page, using the page service. [ <a
  + * href="../../../../../ComponentReference/PageLink.html">Component Reference </a>]
  + * 
    * @author Howard Ship
  - *
  - **/
  + */
   
   public abstract class PageLink extends AbstractLinkComponent
   {
  @@ -42,12 +39,12 @@
           else
               parameter = namespace.constructQualifiedName(targetPage);
   
  -        return getLink(cycle, Tapestry.PAGE_SERVICE, new String[] { parameter });
  +        return getLink(cycle, Tapestry.PAGE_SERVICE, parameter);
       }
   
       public abstract String getTargetPage();
   
  -    /** @since 2.2 **/
  +    /** @since 2.2 * */
   
       public abstract INamespace getTargetNamespace();
   }
  
  
  
  1.2       +11 -3     jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/engine/TestRequestCycleToString.java
  
  Index: TestRequestCycleToString.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/engine/TestRequestCycleToString.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestRequestCycleToString.java	29 Oct 2004 17:14:25 -0000	1.1
  +++ TestRequestCycleToString.java	3 Dec 2004 15:18:38 -0000	1.2
  @@ -18,12 +18,12 @@
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.RequestCycle;
   import org.apache.tapestry.junit.TapestryTestCase;
  +import org.easymock.MockControl;
   
   /**
    * Tests {@link org.apache.tapestry.engine.RequestCycle#toString()}.
    * 
    * @author Howard Lewis Ship
  - * @version $Id$
    */
   public class TestRequestCycleToString extends TapestryTestCase
   {
  @@ -62,13 +62,21 @@
   
       public void testWithService()
       {
  -        IEngineService service = new MockService("test");
  +        MockControl servicec = newControl(IEngineService.class);
  +        IEngineService service = (IEngineService) servicec.getMock();
  +
  +        service.getName();
  +        servicec.setReturnValue("mock-test");
  +
  +        replayControls();
   
           IRequestCycle cycle = new RequestCycle(null, null, service, null);
   
           assertEquals(
  -                "rewinding=false,service=test,serviceParameters=<null>,attributes=<null>,targetActionId=0,targetComponent=<null>",
  +                "rewinding=false,service=mock-test,serviceParameters=<null>,attributes=<null>,targetActionId=0,targetComponent=<null>",
                   toString(cycle));
  +
  +        verifyControls();
       }
   
       public void testWithAttributes()
  
  
  
  1.4       +26 -32    jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.java
  
  Index: InspectorButton.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InspectorButton.java	19 Nov 2004 16:43:58 -0000	1.3
  +++ InspectorButton.java	3 Dec 2004 15:18:38 -0000	1.4
  @@ -26,34 +26,33 @@
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.IScript;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.engine.DirectServiceParameter;
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.ILink;
   import org.apache.tapestry.engine.IScriptSource;
   import org.apache.tapestry.html.Body;
   
   /**
  - *  Component that can be placed into application pages that will launch
  - *  the inspector in a new window.
  + * Component that can be placed into application pages that will launch the inspector in a new
  + * window. [ <a href="../../../../../../ComponentReference/InspectorButton.html">Component Reference
  + * </a>]
  + * <p>
  + * Because the InspectorButton component is implemented using a
  + * {@link org.apache.tapestry.html.Rollover}, the containing page must use a {@link Body}component
  + * instead of a &lt;body&gt; tag.
    * 
  - *  [<a href="../../../../../../ComponentReference/InspectorButton.html">Component Reference</a>]
  - *
  - *  <p>Because the InspectorButton component is implemented using a {@link org.apache.tapestry.html.Rollover},
  - *  the containing page must use a {@link Body} component instead of
  - *  a &lt;body&gt; tag.
  - *
  - *  @author Howard Lewis Ship
  - *
  - **/
  + * @author Howard Lewis Ship
  + */
   
   public class InspectorButton extends BaseComponent implements IDirect
   {
       private boolean _disabled = false;
   
       /**
  -     *  Gets the listener for the link component.
  -     *
  -     *  @since 1.0.5
  -     **/
  +     * Gets the listener for the link component.
  +     * 
  +     * @since 1.0.5
  +     */
   
       public void trigger(IRequestCycle cycle)
       {
  @@ -65,10 +64,10 @@
       }
   
       /**
  -     *  Renders the script, then invokes the normal implementation.
  -     *
  -     *  @since 1.0.5
  -     **/
  +     * Renders the script, then invokes the normal implementation.
  +     * 
  +     * @since 1.0.5
  +     */
   
       protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
       {
  @@ -78,27 +77,23 @@
           IEngine engine = getPage().getEngine();
           IScriptSource source = engine.getScriptSource();
   
  -        Resource scriptLocation =
  -            getSpecification().getSpecificationLocation().getRelativeResource(
  -                "InspectorButton.script");
  +        Resource scriptLocation = getSpecification().getSpecificationLocation()
  +                .getRelativeResource("InspectorButton.script");
   
           IScript script = source.getScript(scriptLocation);
   
           Map symbols = new HashMap();
   
           IEngineService service = engine.getService(Tapestry.DIRECT_SERVICE);
  -        ILink link = service.getLink(cycle, this, null);
  +        ILink link = service.getLink(cycle, new DirectServiceParameter(this));
   
           symbols.put("URL", link.getURL());
   
           Body body = Body.get(cycle);
   
           if (body == null)
  -            throw new ApplicationRuntimeException(
  -                Tapestry.getMessage("InspectorButton.must-be-contained-by-body"),
  -                this,
  -                null,
  -                null);
  +            throw new ApplicationRuntimeException(Tapestry
  +                    .getMessage("InspectorButton.must-be-contained-by-body"), this, null, null);
   
           script.execute(cycle, body, symbols);
   
  @@ -118,11 +113,10 @@
       }
   
       /**
  -     *  Always returns false.
  -     * 
  -     *  @since 2.3
  +     * Always returns false.
        * 
  -     **/
  +     * @since 2.3
  +     */
   
       public boolean isStateful()
       {
  
  
  
  1.5       +7 -4      jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/inspector/ShowTemplate.java
  
  Index: ShowTemplate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/inspector/ShowTemplate.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ShowTemplate.java	16 Sep 2004 00:26:40 -0000	1.4
  +++ ShowTemplate.java	3 Dec 2004 15:18:38 -0000	1.5
  @@ -24,6 +24,7 @@
   import org.apache.tapestry.IRender;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.engine.DirectServiceParameter;
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.ILink;
   import org.apache.tapestry.link.DirectLink;
  @@ -122,7 +123,8 @@
   
               if (token.getType() == TokenType.OPEN)
               {
  -                boolean nextIsClose = (i + 1 < count) && (template.getToken(i + 1).getType() == TokenType.CLOSE);
  +                boolean nextIsClose = (i + 1 < count)
  +                        && (template.getToken(i + 1).getType() == TokenType.CLOSE);
   
                   write(writer, nextIsClose, (OpenToken) token);
   
  @@ -225,19 +227,20 @@
       {
           IComponent component = getInspectedComponent();
           IEngineService service = getPage().getEngine().getService(Tapestry.DIRECT_SERVICE);
  -        String[] context = new String[1];
   
           // Each id references a component embedded in the inspected component.
           // Get that component.
   
           String id = token.getId();
           IComponent embedded = component.getComponent(id);
  -        context[0] = embedded.getIdPath();
  +        Object[] serviceParameters = new Object[]
  +        { embedded.getIdPath() };
   
           // Build a URL to select that component, as if by the captive
           // component itself (it's a Direct).
   
  -        ILink link = service.getLink(getPage().getRequestCycle(), this, context);
  +        DirectServiceParameter dsp = new DirectServiceParameter(this, serviceParameters);
  +        ILink link = service.getLink(getPage().getRequestCycle(), dsp);
   
           writer.begin("span");
           writer.attribute("class", "jwc-tag");
  
  
  
  1.4       +5 -0      jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/upgrade.xml
  
  Index: upgrade.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/upgrade.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- upgrade.xml	20 Nov 2004 21:21:29 -0000	1.3
  +++ upgrade.xml	3 Dec 2004 15:18:38 -0000	1.4
  @@ -54,6 +54,11 @@
   The &lt;service&gt; element in a Tapestry 3.0 DTD is now ignored.
   </p>
   
  +<p>
  +The &IEngineService; interface has changed in non-backwards compatible ways. If your application created
  +custom engine services, you will have to make changes to your code.
  +</p>
  +
   </section>  <!-- upgrade.service -->
   
   <section id="upgrade.parameters">
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/NameMismatchService.java
  
  Index: NameMismatchService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/NameMismatchService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NameMismatchService.java	29 Oct 2004 17:14:18 -0000	1.1
  +++ NameMismatchService.java	3 Dec 2004 15:18:38 -0000	1.2
  @@ -27,7 +27,7 @@
   public class NameMismatchService implements IEngineService
   {
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
           return null;
       }
  
  
  
  1.2       +1 -2      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/PrivateService.java
  
  Index: PrivateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/PrivateService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PrivateService.java	29 Oct 2004 17:14:18 -0000	1.1
  +++ PrivateService.java	3 Dec 2004 15:18:38 -0000	1.2
  @@ -28,7 +28,6 @@
    * Test case for service which can't be instantiated.
    * 
    * @author Howard Lewis Ship
  - * @version $Id$
    * @since 3.0
    */
   public class PrivateService implements IEngineService
  @@ -38,7 +37,7 @@
       {
       }
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
           return null;
       }
  
  
  
  1.4       +1 -0      jakarta-tapestry/src/documentation/content/xdocs/links.ent
  
  Index: links.ent
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/links.ent,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- links.ent	5 Oct 2004 03:25:38 -0000	1.3
  +++ links.ent	3 Dec 2004 15:18:38 -0000	1.4
  @@ -57,6 +57,7 @@
   <!ENTITY IComponentSpecification 	'<link href="&apiroot;/spec/IComponentSpecification.html">IComponentSpecification</link>'>
   <!ENTITY IDirect 					'<link href="&apiroot;/IDirect.html">IDirect</link>'>
   <!ENTITY IEngine 					'<link href="&apiroot;/IEngine.html">IEngine</link>'>
  +<!ENTITY IEngineService				'<link href="&apiroot;/engine/IEngineService.html">IEngineService</link>'>
   <!ENTITY IForm 						'<link href="&apiroot;/IForm.html">IForm</link>'>
   <!ENTITY IFormComponent 			'<link href="&apiroot;/form/IFormComponent.html">IFormComponent</link>'>
   <!ENTITY IEngineService 			'<link href="&apiroot;/IEngineService.html">IEngineService</link>'>
  
  
  
  1.4       +5 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/AssetService.java
  
  Index: AssetService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/AssetService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AssetService.java	12 Oct 2004 12:42:34 -0000	1.3
  +++ AssetService.java	3 Dec 2004 15:18:38 -0000	1.4
  @@ -25,6 +25,7 @@
   import javax.servlet.ServletException;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  @@ -81,16 +82,14 @@
        * with a leading slash).
        */
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        if (Tapestry.size(parameters) != 1)
  -            throw new ApplicationRuntimeException(Tapestry.format(
  -                    "service-single-parameter",
  -                    Tapestry.ASSET_SERVICE));
  +        Defense.isAssignable(parameter, String.class, "parameter");
   
           // Service is stateless
   
  -        return constructLink(cycle, Tapestry.ASSET_SERVICE, null, parameters, false);
  +        return constructLink(cycle, Tapestry.ASSET_SERVICE, null, new Object[]
  +        { parameter }, false);
       }
   
       public String getName()
  
  
  
  1.3       +14 -23    jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/PrivateAsset.java
  
  Index: PrivateAsset.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/PrivateAsset.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PrivateAsset.java	16 Sep 2004 00:26:32 -0000	1.2
  +++ PrivateAsset.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -27,15 +27,13 @@
   import org.apache.tapestry.engine.ILink;
   
   /**
  - *  An implementation of {@link org.apache.tapestry.IAsset} for localizable assets within
  - *  the JVM's classpath.
  - *
  - *  <p>The localization code here is largely cut-and-paste from
  - *  {@link ContextAsset}.
  - *
  - *  @author Howard Ship
  + * An implementation of {@link org.apache.tapestry.IAsset}for localizable assets within the JVM's
  + * classpath.
  + * <p>
  + * The localization code here is largely cut-and-paste from {@link ContextAsset}.
    * 
  - **/
  + * @author Howard Ship
  + */
   
   public class PrivateAsset extends AbstractAsset
   {
  @@ -48,12 +46,10 @@
       }
   
       /**
  -     *  Gets the localized version of the resource.  Build
  -     *  the URL for the resource.  If possible, the application's
  -     *  {@link AssetExternalizer} is located, to copy the resource to
  -     *  a directory visible to the web server.
  -     *
  -     **/
  +     * Gets the localized version of the resource. Build the URL for the resource. If possible, the
  +     * application's {@link AssetExternalizer}is located, to copy the resource to a directory
  +     * visible to the web server.
  +     */
   
       public String buildURL(IRequestCycle cycle)
       {
  @@ -67,14 +63,9 @@
           if (externalURL != null)
               return externalURL;
   
  -        // Otherwise, the service is responsible for dynamically retrieving the
  -        // resource.
  -
  -        String[] parameters = new String[] { path };
  -
           IEngineService service = cycle.getEngine().getService(Tapestry.ASSET_SERVICE);
   
  -        ILink link = service.getLink(cycle, null, parameters);
  +        ILink link = service.getLink(cycle, path);
   
           return link.getURL();
       }
  @@ -91,9 +82,9 @@
           }
           catch (Exception ex)
           {
  -            throw new ApplicationRuntimeException(
  -                Tapestry.format("PrivateAsset.resource-missing", location),
  -                ex);
  +            throw new ApplicationRuntimeException(Tapestry.format(
  +                    "PrivateAsset.resource-missing",
  +                    location), ex);
           }
       }
   
  
  
  
  1.3       +6 -8      jakarta-tapestry/framework/src/java/org/apache/tapestry/html/Frame.java
  
  Index: Frame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/html/Frame.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Frame.java	16 Sep 2004 00:26:34 -0000	1.2
  +++ Frame.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -23,13 +23,11 @@
   import org.apache.tapestry.engine.ILink;
   
   /**
  - *  Implements a &lt;frame&gt; within a &lt;frameset&gt;.
  + * Implements a &lt;frame&gt; within a &lt;frameset&gt;. [ <a
  + * href="../../../../../ComponentReference/Frame.html">Component Reference </a>]
    * 
  - *  [<a href="../../../../../ComponentReference/Frame.html">Component Reference</a>]
  - * 
  - *  @author Howard Lewis Ship
  - *
  - **/
  + * @author Howard Lewis Ship
  + */
   
   public abstract class Frame extends AbstractComponent
   {
  @@ -40,7 +38,7 @@
   
           IEngine engine = cycle.getEngine();
           IEngineService pageService = engine.getService(Tapestry.PAGE_SERVICE);
  -        ILink link = pageService.getLink(cycle, this, new String[] { getTargetPage() });
  +        ILink link = pageService.getLink(cycle, getTargetPage());
   
           writer.beginEmpty("frame");
           writer.attribute("src", link.getURL());
  @@ -53,4 +51,4 @@
       public abstract String getTargetPage();
   
       public abstract void setTargetPage(String targetPage);
  -}
  +}
  \ No newline at end of file
  
  
  
  1.4       +1 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/html/Shell.java
  
  Index: Shell.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/html/Shell.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Shell.java	17 Nov 2004 01:34:58 -0000	1.3
  +++ Shell.java	3 Dec 2004 15:18:38 -0000	1.4
  @@ -174,8 +174,7 @@
           IEngineService pageService = cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
           String pageName = getPage().getPageName();
   
  -        ILink link = pageService.getLink(cycle, null, new String[]
  -        { pageName });
  +        ILink link = pageService.getLink(cycle, pageName);
   
           StringBuffer buffer = new StringBuffer();
           buffer.append(refresh);
  
  
  
  1.3       +14 -21    jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/chart/ChartService.java
  
  Index: ChartService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/chart/ChartService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChartService.java	19 Nov 2004 16:44:11 -0000	1.2
  +++ ChartService.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -18,6 +18,7 @@
   
   import javax.servlet.ServletException;
   
  +import org.apache.hivemind.Defense;
   import org.apache.tapestry.IComponent;
   import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
  @@ -25,6 +26,7 @@
   import org.apache.tapestry.engine.ILink;
   import org.apache.tapestry.request.ResponseOutputStream;
   import org.apache.tapestry.services.RequestExceptionReporter;
  +import org.apache.tapestry.util.ComponentAddress;
   import org.jCharts.Chart;
   import org.jCharts.encoders.JPEGEncoder13;
   
  @@ -44,35 +46,26 @@
       /** @since 3.1 */
       private RequestExceptionReporter _exceptionReporter;
   
  -    public ILink getLink(IRequestCycle cycle, IComponent component, Object[] parameters)
  +    public ILink getLink(IRequestCycle cycle, Object parameter)
       {
  -        String[] context;
  -        String pageName = component.getPage().getPageName();
  -        String idPath = component.getIdPath();
  -
  -        if (idPath != null)
  -        {
  -            context = new String[2];
  -            context[1] = idPath;
  -        }
  -        else
  -            context = new String[1];
  +        Defense.isAssignable(parameter, IComponent.class, "parameter");
   
  -        context[0] = pageName;
  +        IComponent component = (IComponent) parameter;
   
  -        return constructLink(cycle, SERVICE_NAME, context, null, true);
  +        Object[] serviceParameters = new Object[]
  +        { new ComponentAddress(component) };
  +
  +        return constructLink(cycle, SERVICE_NAME, null, serviceParameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output)
  -            throws ServletException, IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  +            IOException
       {
  -        String context[] = getServiceContext(cycle.getRequestContext());
  +        Object[] serviceParameters = getParameters(cycle);
   
  -        String pageName = context[0];
  -        String idPath = (context.length == 1) ? null : context[1];
  +        ComponentAddress address = (ComponentAddress) serviceParameters[0];
   
  -        IPage page = cycle.getPage(pageName);
  -        IComponent component = (idPath == null) ? page : page.getNestedComponent(idPath);
  +        IComponent component = address.findComponent(cycle);
   
           try
           {
  
  
  
  1.3       +1 -1      jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/chart/ChartAsset.java
  
  Index: ChartAsset.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/chart/ChartAsset.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChartAsset.java	19 Nov 2004 16:44:11 -0000	1.2
  +++ ChartAsset.java	3 Dec 2004 15:18:38 -0000	1.3
  @@ -49,7 +49,7 @@
   
       public String buildURL(IRequestCycle cycle)
       {
  -        ILink l = _chartService.getLink(cycle, _chartProvider, null);
  +        ILink l = _chartService.getLink(cycle, _chartProvider);
   
           return l.getURL();
       }
  
  
  
  1.5       +14 -5     jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.java
  
  Index: Form.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Form.java	17 Nov 2004 01:34:54 -0000	1.4
  +++ Form.java	3 Dec 2004 15:18:39 -0000	1.5
  @@ -32,6 +32,8 @@
   import org.apache.tapestry.RenderRewoundException;
   import org.apache.tapestry.StaleLinkException;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.engine.ActionServiceParameter;
  +import org.apache.tapestry.engine.DirectServiceParameter;
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.ILink;
   import org.apache.tapestry.html.Body;
  @@ -547,19 +549,26 @@
       private ILink getLink(IRequestCycle cycle, String actionId)
       {
           String serviceName = null;
  +        Object parameter = null;
   
           if (isDirect())
  +        {
               serviceName = Tapestry.DIRECT_SERVICE;
  +            parameter = new DirectServiceParameter(this, new Object[]
  +            { actionId });
  +        }
           else
  +        {
  +            // I'd love to pull out support for the action service entirely!
  +
               serviceName = Tapestry.ACTION_SERVICE;
  +            parameter = new ActionServiceParameter(this, actionId);
  +        }
   
           IEngine engine = cycle.getEngine();
           IEngineService service = engine.getService(serviceName);
  -
  -        // A single service parameter is used to store the actionId.
  -
  -        return service.getLink(cycle, this, new String[]
  -        { actionId });
  +        
  +        return service.getLink(cycle, parameter);
       }
   
       private void writeLinkParameters(IMarkupWriter writer, ILink link, boolean reserveOnly)
  
  
  

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


Mime
View raw message