You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/06/07 00:28:19 UTC

cvs commit: jakarta-tapestry/framework/src/test/org/apache/tapestry/pageload TestPageLoader.java

hlship      2005/06/06 15:28:19

  Modified:    .        status.xml
               framework/src/java/org/apache/tapestry/pageload
                        PageloadStrings.properties PageLoader.java
                        PageloadMessages.java
               src/documentation/content/xdocs/UsersGuide spec.xml
               framework/src/java/org/apache/tapestry/resolver
                        ResolverStrings.properties
                        ComponentSpecificationResolverImpl.java
                        ResolverMessages.java
               framework/src/test/org/apache/tapestry/resolver
                        TestComponentSpecificationResolver.java
               framework/src/test/org/apache/tapestry/junit/parse
                        Parameter.jwc TestSpecificationParser.java
               framework/src/java/org/apache/tapestry/parse
                        SpecificationParser.java Tapestry_4_0.dtd
               framework/src/java/org/apache/tapestry/spec
                        IComponentSpecification.java
                        ParameterSpecification.java
                        ComponentSpecification.java
                        IParameterSpecification.java
               framework/src/test/org/apache/tapestry/pageload
                        TestPageLoader.java
  Added:       framework/src/test/org/apache/tapestry/junit/parse
                        DeprecatedComponent.jwc
  Log:
  Add deprecated attribute to <component-specification> and <parameter>.
  
  Revision  Changes    Path
  1.114     +1 -0      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- status.xml	2 Jun 2005 13:35:10 -0000	1.113
  +++ status.xml	6 Jun 2005 22:28:19 -0000	1.114
  @@ -65,6 +65,7 @@
          <action type="add" dev="HLS">Add getRequiredParameters() method to IComponentSpecification. </action>
          <action type="fix" dev="HLS">Make inherited bindings (a holdover from the 3.0 DTDs) override (quietly) default parameter bindings.</action>
          <action type="fix" dev="HLS">Properly identify when portal mode or window state has changed.</action>
  +       <action type="add" dev="HLS">Add deprecated attribute to &lt;component-specification&gt; and &lt;parameter&gt;.</action>
       </release>
       <release version="4.0-alpha-3" date="May 16 2005">
         <action type="add" dev="HLS">Add initial support for the validator: binding prefix.</action>
  
  
  
  1.5       +1 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageloadStrings.properties
  
  Index: PageloadStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageloadStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PageloadStrings.properties	31 May 2005 16:35:11 -0000	1.4
  +++ PageloadStrings.properties	6 Jun 2005 22:28:19 -0000	1.5
  @@ -28,3 +28,4 @@
   initializer-name=initializer for property {0}
   duplicate-parameter=A binding for parameter {0} conflicts with a previous binding (at {1}).
   used-parameter-alias=Parameter {2} (for component {1}, at {0}) was bound; this parameter has been deprecated, bind parameter {3} instead.
  +deprecated-parameter=Parameter {0} (at {1}) has been deprecated, and may be removed in a future release. Consult the documentation for component {2} to determine an appropriate replacement.
  
  
  
  1.26      +16 -6     jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageLoader.java
  
  Index: PageLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageLoader.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- PageLoader.java	31 May 2005 16:35:11 -0000	1.25
  +++ PageLoader.java	6 Jun 2005 22:28:19 -0000	1.26
  @@ -227,12 +227,22 @@
               if (!isFormal && spec.isReservedParameterName(name))
                   continue;
   
  -            if (isFormal && !name.equals(parameterName))
  -                _log.error(PageloadMessages.usedParameterAlias(
  -                        contained,
  -                        name,
  -                        parameterName,
  -                        bspec.getLocation()));
  +            if (isFormal)
  +            {
  +                if (!name.equals(parameterName))
  +                {
  +                    _log.error(PageloadMessages.usedParameterAlias(
  +                            contained,
  +                            name,
  +                            parameterName,
  +                            bspec.getLocation()));
  +                }
  +                else if (pspec.isDeprecated())
  +                    _log.error(PageloadMessages.deprecatedParameter(
  +                            name,
  +                            bspec.getLocation(),
  +                            contained.getType()));
  +            }
   
               // The type determines how to interpret the value:
               // As a simple static String
  
  
  
  1.10      +7 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageloadMessages.java
  
  Index: PageloadMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageloadMessages.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PageloadMessages.java	31 May 2005 16:35:11 -0000	1.9
  +++ PageloadMessages.java	6 Jun 2005 22:28:19 -0000	1.10
  @@ -126,4 +126,11 @@
           { HiveMind.getLocationString(bindingLocation), contained.getType(), name, parameterName });
       }
   
  +    public static String deprecatedParameter(String parameterName, Location location,
  +            String componentType)
  +    {
  +        return _formatter.format("deprecated-parameter", parameterName, HiveMind
  +                .getLocationString(location), componentType);
  +    }
  +
   }
  \ No newline at end of file
  
  
  
  1.29      +22 -0     jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/spec.xml
  
  Index: spec.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/spec.xml,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- spec.xml	31 May 2005 16:35:11 -0000	1.28
  +++ spec.xml	6 Jun 2005 22:28:19 -0000	1.29
  @@ -141,6 +141,7 @@
     <li>Removed the type attribute from the &spec.configure; element.</li>
     <li>Added many more options for <link href="#spec.boolean-types">boolean attributes</link>.</li>
     <li>Added the aliases, cache and default-binding attributes to the &spec.parameter; element.</li>
  +  <li>Added the deprecated attribute to &spec.component-specification; and &spec.parameter;.</li>
   </ul>
   
   <p>
  @@ -710,6 +711,18 @@
   	</td>
   </tr>
   
  +<tr>
  +  <td>deprecated</td>
  +  <td>boolean</td>
  +  <td>no</td>
  +  <td>false</td>
  +  <td>
  +    If true, then using the component will generate a warning. This is used
  +    to mark obsolete components.  The component's documentation should indicate
  +    what component replaces the deprecated component.
  +  </td>
  +</tr>
  +
   </table>
   
   <p>&component-specification; Elements</p>
  @@ -1368,6 +1381,15 @@
     </td>
   </tr>
   
  +<tr>
  +  <td>deprecated</td>
  +  <td>boolean</td>
  +  <td>no</td>
  +  <td>false</td>
  +  <td>If true, then binding the parameter will generate a runtime warning.  This is used when a parameter is being
  +    removed entirely in a later release.</td>
  +</tr>
  +
   </table>
   
   <p>
  
  
  
  1.5       +2 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ResolverStrings.properties
  
  Index: ResolverStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ResolverStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ResolverStrings.properties	28 Mar 2005 16:25:59 -0000	1.4
  +++ ResolverStrings.properties	6 Jun 2005 22:28:19 -0000	1.5
  @@ -20,4 +20,5 @@
   installing-component=Installing component type ''{0}'' into {1} as {2}.
   installing-page=Installing page ''{0}'' into {1} as {2}.
   found-framework-page=Found page ''{0}'' in framework namespace.
  -found-html-template=Found HTML template at {0}.
  \ No newline at end of file
  +found-html-template=Found HTML template at {0}.
  +component-is-deprecated=Component ''{0}'' (at {1}) is deprecated, and will likely be removed in a later release. Consult its documentation to find a replacement component.
  \ No newline at end of file
  
  
  
  1.6       +8 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ComponentSpecificationResolverImpl.java
  
  Index: ComponentSpecificationResolverImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ComponentSpecificationResolverImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComponentSpecificationResolverImpl.java	27 Mar 2005 17:42:23 -0000	1.5
  +++ ComponentSpecificationResolverImpl.java	6 Jun 2005 22:28:19 -0000	1.6
  @@ -96,6 +96,11 @@
           }
           else
               resolve(cycle, containerNamespace, null, type, location);
  +
  +        IComponentSpecification spec = getSpecification();
  +
  +        if (spec.isDeprecated())
  +            _log.error(ResolverMessages.componentIsDeprecated(type, location));
       }
   
       /**
  @@ -191,9 +196,9 @@
           if (framework.containsComponentType(_type))
           {
               setSpecification(framework.getComponentSpecification(_type));
  -            
  +
               install();
  -            
  +
               return;
           }
   
  @@ -201,7 +206,7 @@
                   cycle,
                   namespace,
                   _type);
  -        
  +
           setSpecification(specification);
       }
   
  
  
  
  1.8       +8 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ResolverMessages.java
  
  Index: ResolverMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ResolverMessages.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ResolverMessages.java	13 May 2005 13:21:06 -0000	1.7
  +++ ResolverMessages.java	6 Jun 2005 22:28:19 -0000	1.8
  @@ -14,6 +14,8 @@
   
   package org.apache.tapestry.resolver;
   
  +import org.apache.hivemind.HiveMind;
  +import org.apache.hivemind.Location;
   import org.apache.hivemind.Resource;
   import org.apache.hivemind.impl.MessageFormatter;
   import org.apache.tapestry.INamespace;
  @@ -76,4 +78,10 @@
       {
           return _formatter.format("found-html-template", resource);
       }
  +
  +    public static String componentIsDeprecated(String componentType, Location location)
  +    {
  +        return _formatter.format("component-is-deprecated", componentType, HiveMind
  +                .getLocationString(location));
  +    }
   }
  \ No newline at end of file
  
  
  
  1.4       +92 -17    jakarta-tapestry/framework/src/test/org/apache/tapestry/resolver/TestComponentSpecificationResolver.java
  
  Index: TestComponentSpecificationResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/resolver/TestComponentSpecificationResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestComponentSpecificationResolver.java	18 Apr 2005 17:07:54 -0000	1.3
  +++ TestComponentSpecificationResolver.java	6 Jun 2005 22:28:19 -0000	1.4
  @@ -32,6 +32,13 @@
    */
   public class TestComponentSpecificationResolver extends AbstractSpecificationResolverTestCase
   {
  +    private void trainIsDeprecated(MockControl control, IComponentSpecification spec,
  +            boolean isDeprecated)
  +    {
  +        spec.isDeprecated();
  +        control.setReturnValue(isDeprecated);
  +    }
  +
       protected ISpecificationSource newSource(Resource resource, IComponentSpecification spec)
       {
           MockControl control = newControl(ISpecificationSource.class);
  @@ -70,8 +77,10 @@
       public void testFoundInNamespace()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl control = newControl(INamespace.class);
           INamespace namespace = (INamespace) control.getMock();
  @@ -82,6 +91,8 @@
           namespace.getComponentSpecification("MyComponent");
           control.setReturnValue(spec);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -94,11 +105,49 @@
           verifyControls();
       }
   
  +    public void testDeprecated()
  +    {
  +        IRequestCycle cycle = newCycle();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
  +
  +        MockControl control = newControl(INamespace.class);
  +        INamespace namespace = (INamespace) control.getMock();
  +
  +        namespace.containsComponentType("MyComponent");
  +        control.setReturnValue(true);
  +
  +        namespace.getComponentSpecification("MyComponent");
  +        control.setReturnValue(spec);
  +
  +        trainIsDeprecated(specc, spec, true);
  +
  +        Log log = (Log) newMock(Log.class);
  +        
  +        log.error("Component 'MyComponent' (at classpath:/org/apache/tapestry/resolver/TestComponentSpecificationResolver, line 1) is deprecated, and will likely be removed in a later release. Consult its documentation to find a replacement component.");
  +
  +        replayControls();
  +
  +        ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  +        resolver.setLog(log);
  +
  +        resolver.resolve(cycle, namespace, "MyComponent", l);
  +
  +        assertSame(spec, resolver.getSpecification());
  +        assertSame(namespace, resolver.getNamespace());
  +
  +        verifyControls();
  +    }
  +
       public void testFoundInChildNamespace()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl namespacec = newControl(INamespace.class);
           INamespace namespace = (INamespace) namespacec.getMock();
  @@ -115,6 +164,8 @@
           library.getComponentSpecification("MyComponent");
           libraryc.setReturnValue(spec);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -130,8 +181,10 @@
       public void testSearchFoundRelative()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -157,6 +210,8 @@
   
           namespace.installComponentSpecification("MyComponent", spec);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -174,8 +229,10 @@
       public void testFoundInFrameworkNamespace()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -214,6 +271,8 @@
                   .installingComponent("FrameworkComponent", namespace, spec));
           namespace.installComponentSpecification("FrameworkComponent", spec);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -231,8 +290,10 @@
       public void testProvidedByDelegate()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -266,6 +327,8 @@
           framework.containsComponentType("DelegateComponent");
           frameworkc.setReturnValue(false);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -284,7 +347,7 @@
       public void testNotFound()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  +        Location l = newLocation();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -349,8 +412,10 @@
       public void testFoundInAppFolder()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -384,6 +449,8 @@
   
           namespace.installComponentSpecification("MyAppComponent", spec);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -404,8 +471,10 @@
       public void testFoundInWebInfFolder()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -441,6 +510,8 @@
   
           namespace.installComponentSpecification("MyWebInfComponent", spec);
   
  +        trainIsDeprecated(specc, spec, false);
  +
           replayControls();
   
           ComponentSpecificationResolverImpl resolver = new ComponentSpecificationResolverImpl();
  @@ -461,8 +532,10 @@
       public void testFoundInContextRoot()
       {
           IRequestCycle cycle = newCycle();
  -        Location l = fabricateLocation(13);
  -        IComponentSpecification spec = newSpecification();
  +        Location l = newLocation();
  +
  +        MockControl specc = newControl(IComponentSpecification.class);
  +        IComponentSpecification spec = (IComponentSpecification) specc.getMock();
   
           MockControl logc = newControl(Log.class);
           Log log = (Log) logc.getMock();
  @@ -501,6 +574,8 @@
                   namespace,
                   spec));
   
  +        trainIsDeprecated(specc, spec, false);
  +
           namespace.installComponentSpecification("ContextRootComponent", spec);
   
           replayControls();
  
  
  
  1.7       +1 -0      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/Parameter.jwc
  
  Index: Parameter.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/Parameter.jwc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Parameter.jwc	31 May 2005 16:35:11 -0000	1.6
  +++ Parameter.jwc	6 Jun 2005 22:28:19 -0000	1.7
  @@ -27,6 +27,7 @@
       <parameter name="defaultBindingType" default-binding="ognl"/>
       <parameter name="noCache" cache="false"/>
       <parameter name="withAliases" aliases="fred,barney"/>
  +    <parameter name="deprecated" deprecated="aye"/>
       
   </component-specification>
   
  
  
  
  1.18      +16 -0     jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java
  
  Index: TestSpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TestSpecificationParser.java	31 May 2005 16:35:11 -0000	1.17
  +++ TestSpecificationParser.java	6 Jun 2005 22:28:19 -0000	1.18
  @@ -357,6 +357,8 @@
   
           assertEquals(false, spec.isPageSpecification());
           assertNotNull(spec.getSpecificationLocation());
  +
  +        assertEquals(false, spec.isDeprecated());
       }
   
       /**
  @@ -970,6 +972,7 @@
           assertEquals("bar", ps.getType());
           assertNull(ps.getDefaultValue());
           assertNull(ps.getDefaultBindingType());
  +        assertEquals(false, ps.isDeprecated());
   
           ps = spec.getParameter("withDefault");
           assertEquals("withDefault", ps.getParameterName());
  @@ -1011,6 +1014,7 @@
           assertNull(ps.getDefaultBindingType());
           assertEquals(true, ps.getCache());
           assertTrue(ps.getAliasNames().isEmpty());
  +        assertEquals(false, ps.isDeprecated());
   
           ps = spec.getParameter("literalDefault");
   
  @@ -1033,6 +1037,9 @@
   
           assertSame(ps, spec.getParameter("fred"));
           assertSame(ps, spec.getParameter("barney"));
  +
  +        ps = spec.getParameter("deprecated");
  +        assertEquals(true, ps.isDeprecated());
       }
   
       /**
  @@ -1072,4 +1079,13 @@
           assertEquals("path/to/asset", as.getPath());
           assertEquals("myProperty", as.getPropertyName());
       }
  +
  +    /** @since 4.0 */
  +
  +    public void testDeprecatedComponent() throws Exception
  +    {
  +        IComponentSpecification cs = parseComponent("DeprecatedComponent.jwc");
  +
  +        assertEquals(true, cs.isDeprecated());
  +    }
   }
  \ No newline at end of file
  
  
  
  1.1                  jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/DeprecatedComponent.jwc
  
  Index: DeprecatedComponent.jwc
  ===================================================================
  <?xml version="1.0"?>
  <!-- 
     Copyright 2005 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.
  -->
  
  <!DOCTYPE component-specification PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
       	
  <component-specification deprecated="true"/>
  
  
  1.28      +2 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- SpecificationParser.java	31 May 2005 16:35:11 -0000	1.27
  +++ SpecificationParser.java	6 Jun 2005 22:28:19 -0000	1.28
  @@ -601,6 +601,7 @@
   
           cs.setAllowBody(getBooleanAttribute("allow-body", true));
           cs.setAllowInformalParameters(getBooleanAttribute("allow-informal-parameters", true));
  +        cs.setDeprecated(getBooleanAttribute("deprecated", false));
   
           String className = getAttribute("class");
   
  @@ -1338,6 +1339,7 @@
           String aliases = getAttribute("aliases");
   
           ps.setAliases(aliases);
  +        ps.setDeprecated(getBooleanAttribute("deprecated", false));
   
           IComponentSpecification cs = (IComponentSpecification) peekObject();
   
  
  
  
  1.5       +6 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/Tapestry_4_0.dtd
  
  Index: Tapestry_4_0.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/Tapestry_4_0.dtd,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Tapestry_4_0.dtd	31 May 2005 16:35:11 -0000	1.4
  +++ Tapestry_4_0.dtd	6 Jun 2005 22:28:19 -0000	1.5
  @@ -42,6 +42,7 @@
   - Removed the type attribute from the <configure> element
   - Added many alternatives to 'yes' and 'no' for boolean attributes.
   - Added aliases, default-binding and cache attributes to <parameter>
  +- Added deprecated to <component-specification>
   -->
   <!-- =======================================================
   Entity: attribute-flag
  @@ -221,12 +222,15 @@
     allow-body:  If yes (the default), the component may wrap other elements (have a body).
     allow-informal-parameters:  If yes (the default), informal parameters (parameters that are not
       explictily defined) are allowed.
  +  deprecated: If yes, then using the component will generate a warning, advising the user
  +    to find a different component. The default is no.
   -->
   <!ELEMENT component-specification (description?, (parameter | reserved-parameter | meta | bean | component | asset | property | inject )*)>
   <!ATTLIST component-specification
   	class CDATA #IMPLIED
   	allow-body %attribute-flag; "yes"
   	allow-informal-parameters %attribute-flag; "yes"
  +  deprecated %attribute-flag; "no"
   >
   <!-- =======================================================
   Element: description
  @@ -401,6 +405,7 @@
      for the binding on each access (though invariant bindings may still be cached).
     aliases: An optional, comma-seperated list of aliases for the parameter. Used to allow
       compatibility when parameter names are changed.
  +  deprecated: If true, then using the parameter will generate a runtime warning.
   -->
   <!ELEMENT parameter (description?)>
   <!ATTLIST parameter
  @@ -411,6 +416,7 @@
     default-binding CDATA #IMPLIED
     cache %attribute-flag; "yes"
     aliases CDATA #IMPLIED
  +  deprecated %attribute-flag; "no"
   >
   <!-- =======================================================
   Element: property
  
  
  
  1.11      +17 -2     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IComponentSpecification.java
  
  Index: IComponentSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IComponentSpecification.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- IComponentSpecification.java	2 Jun 2005 13:35:10 -0000	1.10
  +++ IComponentSpecification.java	6 Jun 2005 22:28:19 -0000	1.11
  @@ -141,9 +141,9 @@
        * 
        * @since 4.0
        */
  -    
  +
       public Collection getRequiredParameters();
  -    
  +
       /**
        * Returns a List of of String names of all parameters. This list is in alphabetical order.
        * 
  @@ -283,4 +283,19 @@
        */
   
       public List getInjectSpecifications();
  +
  +    /**
  +     * Returns true if the component is deprecated. Deprecated components generate a warning when
  +     * used.
  +     * 
  +     * @since 4.0
  +     */
  +
  +    public boolean isDeprecated();
  +
  +    /**
  +     * @since 4.0
  +     */
  +
  +    public void setDeprecated(boolean deprecated);
   }
  \ No newline at end of file
  
  
  
  1.11      +15 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ParameterSpecification.java
  
  Index: ParameterSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ParameterSpecification.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ParameterSpecification.java	31 May 2005 16:35:11 -0000	1.10
  +++ ParameterSpecification.java	6 Jun 2005 22:28:19 -0000	1.11
  @@ -59,6 +59,9 @@
       /** @since 4.0 */
       private String _parameterName;
   
  +    /** @since 4.0 */
  +    private boolean _deprecated = false;
  +
       /**
        * Returns the class name of the expected type of the parameter. The default value is
        * <code>java.lang.Object</code> which matches anything.
  @@ -205,4 +208,16 @@
           _parameterName = name;
       }
   
  +    /** @since 4.0 */
  +    public boolean isDeprecated()
  +    {
  +        return _deprecated;
  +    }
  +
  +    /** @since 4.0 */
  +    public void setDeprecated(boolean deprecated)
  +    {
  +        _deprecated = deprecated;
  +    }
  +
   }
  \ No newline at end of file
  
  
  
  1.11      +18 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java
  
  Index: ComponentSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ComponentSpecification.java	2 Jun 2005 13:35:10 -0000	1.10
  +++ ComponentSpecification.java	6 Jun 2005 22:28:19 -0000	1.11
  @@ -162,6 +162,12 @@
       private Map _claimedProperties;
   
       /**
  +     * @since 4.0
  +     */
  +
  +    private boolean _deprecated = false;
  +
  +    /**
        * @throws ApplicationRuntimeException
        *             if the name already exists.
        */
  @@ -671,4 +677,16 @@
   
           _claimedProperties.put(propertyName, subSpecification);
       }
  +
  +    /** @since 4.0 */
  +    public boolean isDeprecated()
  +    {
  +        return _deprecated;
  +    }
  +
  +    /** @since 4.0 */
  +    public void setDeprecated(boolean deprecated)
  +    {
  +        _deprecated = deprecated;
  +    }
   }
  \ No newline at end of file
  
  
  
  1.9       +16 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IParameterSpecification.java
  
  Index: IParameterSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IParameterSpecification.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- IParameterSpecification.java	31 May 2005 16:35:11 -0000	1.8
  +++ IParameterSpecification.java	6 Jun 2005 22:28:19 -0000	1.9
  @@ -144,4 +144,20 @@
        */
   
       public void setAliases(String nameList);
  +
  +    /**
  +     * Returns true if the parameter is deprecated. Deprecated parameter generate a warning when
  +     * bound.
  +     * 
  +     * @since 4.0
  +     */
  +
  +    public boolean isDeprecated();
  +
  +    /**
  +     * @since 4.0
  +     */
  +
  +    public void setDeprecated(boolean deprecated);
  +
   }
  \ No newline at end of file
  
  
  
  1.2       +60 -12    jakarta-tapestry/framework/src/test/org/apache/tapestry/pageload/TestPageLoader.java
  
  Index: TestPageLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/pageload/TestPageLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPageLoader.java	31 May 2005 16:35:11 -0000	1.1
  +++ TestPageLoader.java	6 Jun 2005 22:28:19 -0000	1.2
  @@ -38,17 +38,6 @@
    */
   public class TestPageLoader extends HiveMindTestCase
   {
  -    private IComponentSpecification newSpec(boolean allowInformalParameters)
  -    {
  -        MockControl control = newControl(IComponentSpecification.class);
  -        IComponentSpecification spec = (IComponentSpecification) control.getMock();
  -
  -        spec.getAllowInformalParameters();
  -        control.setReturnValue(allowInformalParameters);
  -
  -        return spec;
  -    }
  -
       public IComponent newComponent(IComponentSpecification spec)
       {
           MockControl control = newControl(IComponent.class);
  @@ -76,7 +65,7 @@
           return binding;
       }
   
  -    public void testaddDuplicateBindingFails()
  +    public void testAddDuplicateBindingFails()
       {
           MockControl componentc = newControl(IComponent.class);
           IComponent component = (IComponent) componentc.getMock();
  @@ -163,4 +152,63 @@
   
           verifyControls();
       }
  +
  +    public void testBindDeprecated()
  +    {
  +        MockControl containerc = newControl(IComponent.class);
  +        IComponent container = (IComponent) containerc.getMock();
  +
  +        MockControl componentc = newControl(IComponent.class);
  +        IComponent component = (IComponent) componentc.getMock();
  +
  +        ParameterSpecification pspec = new ParameterSpecification();
  +        pspec.setParameterName("fred");
  +        pspec.setDeprecated(true);
  +
  +        Location l = newLocation();
  +
  +        BindingSpecification bspec = new BindingSpecification();
  +        bspec.setType(BindingType.PREFIXED);
  +        bspec.setValue("an-expression");
  +        bspec.setLocation(l);
  +
  +        ContainedComponent contained = new ContainedComponent();
  +        contained.setBinding("fred", bspec);
  +        contained.setType("FredComponent");
  +
  +        IComponentSpecification spec = new ComponentSpecification();
  +        spec.addParameter(pspec);
  +
  +        component.getSpecification();
  +        componentc.setReturnValue(spec);
  +
  +        Log log = (Log) newMock(Log.class);
  +
  +        log
  +                .error("Parameter fred (at classpath:/org/apache/tapestry/pageload/TestPageLoader, line 1) has been deprecated, "
  +                        + "and may be removed in a future release. Consult the documentation for component FredComponent to "
  +                        + "determine an appropriate replacement.");
  +
  +        IBinding binding = newBinding();
  +        MockControl sourcec = newControl(BindingSource.class);
  +        BindingSource source = (BindingSource) sourcec.getMock();
  +
  +        source.createBinding(container, "parameter fred", "an-expression", "ognl", l);
  +        sourcec.setReturnValue(binding);
  +
  +        component.getBinding("fred");
  +        componentc.setReturnValue(null);
  +
  +        component.setBinding("fred", binding);
  +
  +        replayControls();
  +
  +        PageLoader loader = new PageLoader();
  +        loader.setLog(log);
  +        loader.setBindingSource(source);
  +
  +        loader.bind(container, component, contained);
  +
  +        verifyControls();
  +    }
   }
  
  
  

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