DescribedLocation.java has a @Override annotation ,so it can't be
compiled with JDK 1.3 .
On 8 Aug 2005 16:12:26 -0000, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> hlship 2005/08/08 09:12:26
>
> Modified: . status.xml
> framework/src/test/org/apache/tapestry/resolver
> TestComponentSpecificationResolver.java
> annotations/src/java/org/apache/tapestry/annotations
> AssetAnnotationWorker.java
> AnnotationEnhancementWorker.java
> framework/src/java/org/apache/tapestry/services
> ClassFinder.java
> framework/src/java/org/apache/tapestry/resolver
> ComponentSpecificationResolverImpl.java
> annotations/src/test/org/apache/tapestry/annotations
> TestAnnotationEnhancementWorker.java
> TestAssetAnnotationWorker.java
> framework/src/descriptor/META-INF tapestry.page.xml
> examples/Workbench/src/context/css workbench.css
> Added:
> examples/Workbench/src/java/org/apache/tapestry/workbench/components
> ShowError.java
> framework/src/test/org/apache/tapestry/util
> TestDescribedLocation.java
> framework/src/java/org/apache/tapestry/util
> DescribedLocation.java
> Removed: examples/Workbench/src/context/WEB-INF ShowError.jwc
> ShowError.html
> annotations/src/java/org/apache/tapestry/annotations
> AnnotationLocation.java
> annotations/src/test/org/apache/tapestry/annotations
> TestAnnotationLocation.java
> Log:
> TAPESTRY-354: Component w/o .jwc file not visible
>
> Revision Changes Path
> 1.190 +1 -0 jakarta-tapestry/status.xml
>
> Index: status.xml
> ===================================================================
> RCS file: /home/cvs/jakarta-tapestry/status.xml,v
> retrieving revision 1.189
> retrieving revision 1.190
> diff -u -r1.189 -r1.190
> --- status.xml 6 Aug 2005 16:21:46 -0000 1.189
> +++ status.xml 8 Aug 2005 16:12:25 -0000 1.190
> @@ -72,6 +72,7 @@
> <action type="update" dev="HLS">Enable Eclipse project-specific
> compile options, active additional checks as errors, and fix those errors in
> the code base</action>
> <action type="fix" dev="HLS" fixes-bug="TAPESTRY-534">WebRequest
> interface doesn't expose getRemoteUser(), isUserInRole() or
> getUserPrincipal()</action>
> <action type="fix" dev="HLS" fixes-bug="TAPESTRY-530"
> due-to="Raphael Jean">Namespace messages are retrieved using page's locale
> rather than engine's locale</action>
> + <action type="fix" dev="HLS" fixes-bug="TAPESTRY-354">Component w/o
> .jwc file not visible</action>
> </release>
> <release version="4.0-beta-3" date="Jul 22 2005">
> <action type="fix" dev="HLS" fixes-bug="TAPESTRY-398" due-to="Jonas
> Maurus">HiveMind configuration error breaks the useage of the state: binding
> prefix</action>
>
>
>
> 1.6 +105 -14
> 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.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- TestComponentSpecificationResolver.java 12 Jun 2005 15:27:16 -0000
> 1.5
> +++ TestComponentSpecificationResolver.java 8 Aug 2005 16:12:25 -0000
> 1.6
> @@ -18,9 +18,11 @@
> import org.apache.hivemind.ApplicationRuntimeException;
> import org.apache.hivemind.Location;
> import org.apache.hivemind.Resource;
> +import org.apache.tapestry.BaseComponent;
> import org.apache.tapestry.INamespace;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.engine.ISpecificationSource;
> +import org.apache.tapestry.services.ClassFinder;
> import org.apache.tapestry.spec.IComponentSpecification;
> import org.easymock.MockControl;
>
> @@ -62,13 +64,13 @@
> }
>
> private ISpecificationResolverDelegate newDelegate(IRequestCycle
> cycle, INamespace namespace,
> - IComponentSpecification spec)
> + String type, IComponentSpecification spec)
> {
> MockControl control =
> newControl(ISpecificationResolverDelegate.class);
> ISpecificationResolverDelegate delegate =
> (ISpecificationResolverDelegate) control
> .getMock();
>
> - delegate.findComponentSpecification(cycle, namespace,
> "DelegateComponent");
> + delegate.findComponentSpecification(cycle, namespace, type);
> control.setReturnValue(spec);
>
> return delegate;
> @@ -125,8 +127,9 @@
> 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.");
> +
> + 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();
>
> @@ -259,6 +262,9 @@
> namespace.isApplicationNamespace();
> namespacec.setReturnValue(false);
>
> + ClassFinder finder = newClassFinder("org.foo",
> "FrameworkComponent", null);
> + trainGetPackages(namespacec, namespace, "org.foo");
> +
> ISpecificationSource source = newSource(framework);
>
> framework.containsComponentType("FrameworkComponent");
> @@ -278,6 +284,7 @@
> ComponentSpecificationResolverImpl resolver = new
> ComponentSpecificationResolverImpl();
> resolver.setLog(log);
> resolver.setSpecificationSource(source);
> + resolver.setClassFinder(finder);
>
> resolver.resolve(cycle, namespace, "FrameworkComponent", l);
>
> @@ -304,7 +311,11 @@
> MockControl frameworkc = newControl(INamespace.class);
> INamespace framework = (INamespace) frameworkc.getMock();
>
> - ISpecificationResolverDelegate delegate = newDelegate(cycle,
> namespace, spec);
> + ISpecificationResolverDelegate delegate = newDelegate(
> + cycle,
> + namespace,
> + "DelegateComponent",
> + spec);
>
> Resource namespaceLocation = newResource("LibraryStandin.library");
>
> @@ -329,9 +340,12 @@
>
> log.isDebugEnabled();
> logc.setReturnValue(false);
> -
> +
> + ClassFinder finder = newClassFinder("org.foo",
> "DelegateComponent", null);
> + trainGetPackages(namespacec, namespace, "org.foo");
> +
> namespace.installComponentSpecification("DelegateComponent", spec);
> -
> +
> trainIsDeprecated(specc, spec, false);
>
> replayControls();
> @@ -340,6 +354,7 @@
> resolver.setLog(log);
> resolver.setSpecificationSource(source);
> resolver.setDelegate(delegate);
> + resolver.setClassFinder(finder);
>
> resolver.resolve(cycle, namespace, "DelegateComponent", l);
>
> @@ -349,6 +364,23 @@
> verifyControls();
> }
>
> + private void trainGetPackages(MockControl namespacec, INamespace
> namespace, String packages)
> + {
> +
> namespace.getPropertyValue("org.apache.tapestry.component-class-packages");
> + namespacec.setReturnValue(packages);
> + }
> +
> + private ClassFinder newClassFinder(String packages, String className,
> Class result)
> + {
> + MockControl control = newControl(ClassFinder.class);
> + ClassFinder finder = (ClassFinder) control.getMock();
> +
> + finder.findClass(packages, className);
> + control.setReturnValue(result);
> +
> + return finder;
> + }
> +
> public void testNotFound()
> {
> IRequestCycle cycle = newCycle();
> @@ -363,45 +395,53 @@
> MockControl frameworkc = newControl(INamespace.class);
> INamespace framework = (INamespace) frameworkc.getMock();
>
> - ISpecificationResolverDelegate delegate = newDelegate(cycle,
> namespace, null);
> + ISpecificationResolverDelegate delegate = newDelegate(
> + cycle,
> + namespace,
> + "NotFoundComponent",
> + null);
>
> Resource namespaceLocation = newResource("LibraryStandin.library");
>
> - namespace.containsComponentType("DelegateComponent");
> + namespace.containsComponentType("NotFoundComponent");
> namespacec.setReturnValue(false);
>
> - train(log, logc,
> ResolverMessages.resolvingComponent("DelegateComponent", namespace));
> + train(log, logc,
> ResolverMessages.resolvingComponent("NotFoundComponent", namespace));
>
> namespace.getSpecificationLocation();
> namespacec.setReturnValue(namespaceLocation);
>
> train(log, logc,
> ResolverMessages.checkingResource(namespaceLocation
> - .getRelativeResource("DelegateComponent.jwc")));
> + .getRelativeResource("NotFoundComponent.jwc")));
>
> namespace.isApplicationNamespace();
> namespacec.setReturnValue(false);
>
> ISpecificationSource source = newSource(framework);
>
> - framework.containsComponentType("DelegateComponent");
> + framework.containsComponentType("NotFoundComponent");
> frameworkc.setReturnValue(false);
>
> + ClassFinder finder = newClassFinder("org.foo",
> "NotFoundComponent", null);
> + trainGetPackages(namespacec, namespace, "org.foo");
> +
> replayControls();
>
> ComponentSpecificationResolverImpl resolver = new
> ComponentSpecificationResolverImpl();
> resolver.setLog(log);
> resolver.setSpecificationSource(source);
> resolver.setDelegate(delegate);
> + resolver.setClassFinder(finder);
>
> try
> {
> - resolver.resolve(cycle, namespace, "DelegateComponent", l);
> + resolver.resolve(cycle, namespace, "NotFoundComponent", l);
> unreachable();
> }
> catch (ApplicationRuntimeException ex)
> {
> assertEquals(
> - "Component 'DelegateComponent' not found in EasyMock
> for interface org.apache.tapestry.INamespace.",
> + "Component 'NotFoundComponent' not found in EasyMock
> for interface org.apache.tapestry.INamespace.",
> ex.getMessage());
> assertSame(l, ex.getLocation());
> }
> @@ -599,4 +639,55 @@
>
> verifyControls();
> }
> +
> + private Resource newResource()
> + {
> + return (Resource) newMock(Resource.class);
> + }
> +
> + public void testFoundComponentClass()
> + {
> + Resource componentResource = newResource();
> + Resource namespaceResource = newResource("folder/MyComponent.jwc",
> componentResource);
> +
> + MockControl namespacec = newControl(INamespace.class);
> + INamespace namespace = (INamespace) namespacec.getMock();
> +
> + trainGetPackages(namespacec, namespace, "org.foo");
> + ClassFinder finder = newClassFinder("org.foo",
> "folder.MyComponent", BaseComponent.class);
> +
> + trainGetResource(namespacec, namespace, namespaceResource);
> +
> + replayControls();
> +
> + ComponentSpecificationResolverImpl resolver = new
> ComponentSpecificationResolverImpl();
> + resolver.setClassFinder(finder);
> +
> + IComponentSpecification spec = resolver.searchForComponentClass(
> + namespace,
> + "folder/MyComponent");
> +
> + assertEquals(BaseComponent.class.getName(),
> spec.getComponentClassName());
> + assertSame(componentResource, spec.getSpecificationLocation());
> + assertSame(componentResource, spec.getLocation().getResource());
> +
> + verifyControls();
> + }
> +
> + private void trainGetResource(MockControl control, INamespace
> namespace, Resource resource)
> + {
> + namespace.getSpecificationLocation();
> + control.setReturnValue(resource);
> + }
> +
> + private Resource newResource(String relativePath, Resource
> relativeResource)
> + {
> + MockControl control = newControl(Resource.class);
> + Resource resource = (Resource) control.getMock();
> +
> + resource.getRelativeResource(relativePath);
> + control.setReturnValue(relativeResource);
> +
> + return resource;
> + }
> }
> \ No newline at end of file
>
>
>
> 1.6 +2 -1
> jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java
>
> Index: AssetAnnotationWorker.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- AssetAnnotationWorker.java 6 Aug 2005 06:58:25 -0000 1.5
> +++ AssetAnnotationWorker.java 8 Aug 2005 16:12:25 -0000 1.6
> @@ -22,6 +22,7 @@
> import org.apache.tapestry.spec.AssetSpecification;
> import org.apache.tapestry.spec.IAssetSpecification;
> import org.apache.tapestry.spec.IComponentSpecification;
> +import org.apache.tapestry.util.DescribedLocation;
>
> /**
> * Uses the [EMAIL PROTECTED] org.apache.tapestry.annotations.Asset}
> annotation to create a new
> @@ -48,7 +49,7 @@
> // of a location) to figure out what kind of asset they are.
>
> Resource specResource = spec.getSpecificationLocation();
> - Location assetLocation = new AnnotationLocation(specResource,
> location.toString());
> + Location assetLocation = new DescribedLocation(specResource,
> location.toString());
>
> as.setLocation(assetLocation);
>
>
>
>
> 1.5 +3 -2
> jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java
>
> Index: AnnotationEnhancementWorker.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- AnnotationEnhancementWorker.java 2 Jul 2005 22:51:23 -0000 1.4
> +++ AnnotationEnhancementWorker.java 8 Aug 2005 16:12:25 -0000 1.5
> @@ -26,6 +26,7 @@
> import org.apache.tapestry.enhance.EnhancementOperation;
> import org.apache.tapestry.enhance.EnhancementWorker;
> import org.apache.tapestry.spec.IComponentSpecification;
> +import org.apache.tapestry.util.DescribedLocation;
>
> /**
> * Implementation of [EMAIL PROTECTED]
> org.apache.tapestry.enhance.EnhancementWorker} that finds class and
> @@ -84,7 +85,7 @@
>
> try
> {
> - Location location = new AnnotationLocation(classResource,
> AnnotationMessages
> + Location location = new DescribedLocation(classResource,
> AnnotationMessages
> .classAnnotation(annotation, clazz));
>
> worker.performEnhancement(op, spec, clazz, location);
> @@ -119,7 +120,7 @@
>
> try
> {
> - Location location = new AnnotationLocation(classResource,
> AnnotationMessages
> + Location location = new DescribedLocation(classResource,
> AnnotationMessages
> .methodAnnotation(annotation, method));
> worker.performEnhancement(op, spec, method, location);
> }
>
>
>
> 1.3 +1 -1
> jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ClassFinder.java
>
> Index: ClassFinder.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ClassFinder.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- ClassFinder.java 16 Jul 2005 00:23:24 -0000 1.2
> +++ ClassFinder.java 8 Aug 2005 16:12:25 -0000 1.3
> @@ -26,7 +26,7 @@
> * Searches for a class within a list of packages, which always
> includes the default package.
> *
> * @param packageList
> - * a comma seperated list of package named (i.e.,
> "java.lang,java.util")
> + * a comma seperated list of package names (i.e.,
> "java.lang,java.util")
> * @param className
> * the name of the class to search for. This may be just a
> class name, or even a
> * partial class name (i.e., "impl.Foo").
>
>
>
> 1.1
> jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/components/ShowError.java
>
> Index: ShowError.java
> ===================================================================
> // 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.
>
> package org.apache.tapestry.workbench.components;
>
> import java.util.List;
>
> import org.apache.tapestry.AbstractComponent;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRender;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.annotations.ComponentClass;
> import org.apache.tapestry.annotations.Parameter;
> import org.apache.tapestry.valid.IValidationDelegate;
>
> /**
> * This would normally be done entirely <em>without</em> using code. Trying
> to demonstrate that
> * you can create components without a .jwc file by matching the component
> type against a class name
> * (in the proper package, as defined in the application specification).
> *
> * @author Howard Lewis Ship
> * @since 4.0
> */
> @ComponentClass(allowBody = false, allowInformalParameters = false)
> public abstract class ShowError extends AbstractComponent
> {
> @Parameter(required = true)
> public abstract IValidationDelegate getDelegate();
>
> @Override
> protected void renderComponent(IMarkupWriter writer, IRequestCycle
> cycle)
> {
> if (cycle.isRewinding())
> return;
>
> IValidationDelegate delegate = getDelegate();
>
> if (!delegate.getHasErrors())
> return;
>
> writer.begin("table");
> writer.attribute("class", "inputerror");
>
> writer.begin("tr");
> writer.attribute("valign", "top");
>
> writer.begin("td");
> writer.beginEmpty("img");
> writer.attribute("src", "images/Warning.gif");
> writer.attribute("width", 42);
> writer.attribute("height", 41);
> writer.end();
>
> writer.begin("td");
> writer.attribute("class", "message");
>
> List<IRender> errorRenders = delegate.getErrorRenderers();
>
> errorRenders.get(0).render(writer, cycle);
>
> writer.end("table");
> }
> }
>
>
>
> 1.10 +76 -39
> 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.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- ComponentSpecificationResolverImpl.java 6 Aug 2005 06:58:28 -0000
> 1.9
> +++ ComponentSpecificationResolverImpl.java 8 Aug 2005 16:12:25 -0000
> 1.10
> @@ -18,8 +18,11 @@
> import org.apache.hivemind.ApplicationRuntimeException;
> import org.apache.hivemind.Location;
> import org.apache.hivemind.Resource;
> +import org.apache.hivemind.impl.LocationImpl;
> import org.apache.tapestry.INamespace;
> import org.apache.tapestry.IRequestCycle;
> +import org.apache.tapestry.services.ClassFinder;
> +import org.apache.tapestry.spec.ComponentSpecification;
> import org.apache.tapestry.spec.IComponentSpecification;
>
> /**
> @@ -34,11 +37,13 @@
> * specification. The search, based on the <i>simple-name </i> of the
> page, goes as follows:
> * <ul>
> * <li>As declared in the application specification
> - * <li><i>type </i>.jwc in the same folder as the application specification
> - * <li><i>type </i> jwc in the WEB-INF/ <i>servlet-name </i> directory of
> the context root
> - * <li><i>type </i>.jwc in WEB-INF
> - * <li><i>type </i>.jwc in the application root (within the context root)
> + * <li><i>type</i>.jwc in the same folder as the application specification
> + * <li><i>type</i> jwc in the WEB-INF/ <i>servlet-name </i> directory of
> the context root
> + * <li><i>type</i>.jwc in WEB-INF
> + * <li><i>type</i>.jwc in the application root (within the context root)
> * <li>By searching the framework namespace
> + * <li>By searching for a named class file within the
> org.apache.tapestry.component-class-packages
> + * property (defined within the namespace)
> * </ul>
> * The search for components in library namespaces is more abbreviated:
> * <li>As declared in the library specification
> @@ -59,6 +64,8 @@
> /** Set by resolve() */
> private String _type;
>
> + private ClassFinder _classFinder;
> +
> protected void reset()
> {
> _type = null;
> @@ -133,27 +140,36 @@
> setNamespace(namespace);
>
> if (namespace.containsComponentType(type))
> + {
> setSpecification(namespace.getComponentSpecification(type));
> - else
> - searchForComponent(cycle);
> + return;
> + }
> +
> + IComponentSpecification spec = searchForComponent(cycle);
>
> // If not found after search, check to see if it's in
> // the framework instead.
>
> - if (getSpecification() == null)
> + if (spec == null)
> {
> -
> throw new
> ApplicationRuntimeException(ResolverMessages.noSuchComponentType(
> type,
> namespace), location, null);
>
> }
> +
> + setSpecification(spec);
> +
> + // Install it into the namespace, to short-circuit any future
> search.
> +
> + install();
> }
>
> // Hm. This could maybe go elsewhere, say onto ISpecificationSource
>
> - private void searchForComponent(IRequestCycle cycle)
> + private IComponentSpecification searchForComponent(IRequestCycle cycle)
> {
> + IComponentSpecification result = null;
> INamespace namespace = getNamespace();
>
> if (_log.isDebugEnabled())
> @@ -165,64 +181,80 @@
> // Look for appropriate file in same folder as the library (or
> application)
> // specificaiton.
>
> - if (found(namespaceLocation.getRelativeResource(expectedName)))
> - return;
> + result =
> check(namespaceLocation.getRelativeResource(expectedName));
> +
> + if (result != null)
> + return result;
>
> if (namespace.isApplicationNamespace())
> {
>
> // The application namespace gets some extra searching.
>
> - if
> (found(getWebInfAppLocation().getRelativeResource(expectedName)))
> - return;
> + result =
> check(getWebInfAppLocation().getRelativeResource(expectedName));
>
> - if
> (found(getWebInfLocation().getRelativeResource(expectedName)))
> - return;
> + if (result == null)
> + result =
> check(getWebInfLocation().getRelativeResource(expectedName));
>
> - if (found(getContextRoot().getRelativeResource(expectedName)))
> - return;
> + if (result == null)
> + result =
> check((getContextRoot().getRelativeResource(expectedName)));
> +
> + if (result != null)
> + return result;
> }
>
> + result = searchForComponentClass(namespace, _type);
> +
> + if (result != null)
> + return result;
> +
> // Not in the library or app spec; does it match a component
> // provided by the Framework?
>
> INamespace framework =
> getSpecificationSource().getFrameworkNamespace();
>
> if (framework.containsComponentType(_type))
> - {
> - setSpecification(framework.getComponentSpecification(_type));
> + return framework.getComponentSpecification(_type);
>
> - install();
> + return getDelegate().findComponentSpecification(cycle, namespace,
> _type);
> + }
>
> - return;
> - }
> + IComponentSpecification searchForComponentClass(INamespace namespace,
> String type)
> + {
> + String packages = namespace
> +
> .getPropertyValue("org.apache.tapestry.component-class-packages");
>
> - IComponentSpecification specification =
> getDelegate().findComponentSpecification(
> - cycle,
> - namespace,
> - _type);
> + String className = type.replace('/', '.');
>
> - if (specification != null)
> - {
> - setSpecification(specification);
> - install();
> - return;
> - }
> + Class componentClass = _classFinder.findClass(packages, className);
> +
> + if (componentClass == null)
> + return null;
> +
> + IComponentSpecification spec = new ComponentSpecification();
> +
> + Resource namespaceResource = namespace.getSpecificationLocation();
> +
> + Resource componentResource =
> namespaceResource.getRelativeResource(type + ".jwc");
> +
> + Location location = new LocationImpl(componentResource);
> +
> + spec.setLocation(location);
> + spec.setSpecificationLocation(componentResource);
> + spec.setComponentClassName(componentClass.getName());
> +
> + return spec;
> }
>
> - private boolean found(Resource resource)
> + private IComponentSpecification check(Resource resource)
> {
> if (_log.isDebugEnabled())
> _log.debug("Checking: " + resource);
>
> if (resource.getResourceURL() == null)
> - return false;
> + return null;
>
> -
> setSpecification(getSpecificationSource().getComponentSpecification(resource));
> -
> - install();
> -
> - return true;
> + return
> getSpecificationSource().getComponentSpecification(resource);
> }
>
> private void install()
> @@ -246,4 +278,9 @@
> _log = log;
> }
>
> + public void setClassFinder(ClassFinder classFinder)
> + {
> + _classFinder = classFinder;
> + }
> +
> }
> \ No newline at end of file
>
>
>
> 1.6 +10 -9
> jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestAnnotationEnhancementWorker.java
>
> Index: TestAnnotationEnhancementWorker.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestAnnotationEnhancementWorker.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- TestAnnotationEnhancementWorker.java 2 Jul 2005 22:51:24 -0000
> 1.5
> +++ TestAnnotationEnhancementWorker.java 8 Aug 2005 16:12:25 -0000
> 1.6
> @@ -25,6 +25,7 @@
> import org.apache.hivemind.impl.DefaultClassResolver;
> import org.apache.tapestry.enhance.EnhancementOperation;
> import org.apache.tapestry.spec.IComponentSpecification;
> +import org.apache.tapestry.util.DescribedLocation;
> import org.easymock.MockControl;
>
> /**
> @@ -81,7 +82,7 @@
>
> Method m = findMethod(AnnotatedPage.class, "getInjectedObject");
>
> - AnnotationLocation location = newMethodLocation(
> + DescribedLocation location = newMethodLocation(
> resolver,
> AnnotatedPage.class,
> m,
> @@ -100,22 +101,22 @@
> verifyControls();
> }
>
> - protected AnnotationLocation newMethodLocation(ClassResolver resolver,
> Class baseClass,
> + protected DescribedLocation newMethodLocation(ClassResolver resolver,
> Class baseClass,
> Method m, Class annotationClass)
> {
> Resource classResource = newResource(resolver, baseClass);
>
> - return new AnnotationLocation(classResource,
> AnnotationMessages.methodAnnotation(m
> + return new DescribedLocation(classResource,
> AnnotationMessages.methodAnnotation(m
> .getAnnotation(annotationClass), m));
> }
>
> - private AnnotationLocation newClassLocation(ClassResolver resolver,
> Class baseClass,
> + private DescribedLocation newClassLocation(ClassResolver resolver,
> Class baseClass,
> Class annotationClass)
> {
> Resource classResource = newResource(resolver, baseClass);
> Annotation annotation = baseClass.getAnnotation(annotationClass);
>
> - return new AnnotationLocation(classResource,
> AnnotationMessages.classAnnotation(
> + return new DescribedLocation(classResource,
> AnnotationMessages.classAnnotation(
> annotation,
> baseClass));
> }
> @@ -131,7 +132,7 @@
>
> Method m = findMethod(AnnotatedPageSubclass.class,
> "getInjectedObject");
>
> - AnnotationLocation location = newMethodLocation(
> + DescribedLocation location = newMethodLocation(
> resolver,
> AnnotatedPageSubclass.class,
> m,
> @@ -166,7 +167,7 @@
>
> Method m = findMethod(AnnotatedPage.class, "getInjectedObject");
>
> - AnnotationLocation location = newMethodLocation(
> + DescribedLocation location = newMethodLocation(
> resolver,
> AnnotatedPage.class,
> m,
> @@ -209,7 +210,7 @@
>
> ClassAnnotationEnhancementWorker classWorker =
> (ClassAnnotationEnhancementWorker)
> newMock(ClassAnnotationEnhancementWorker.class);
>
> - AnnotationLocation location = newClassLocation(
> + DescribedLocation location = newClassLocation(
> resolver,
> DeprecatedBean.class,
> Deprecated.class);
> @@ -241,7 +242,7 @@
>
> Throwable t = new RuntimeException("Simulated failure.");
>
> - AnnotationLocation location = newClassLocation(
> + DescribedLocation location = newClassLocation(
> resolver,
> DeprecatedBean.class,
> Deprecated.class);
>
>
>
> 1.6 +2 -1
> jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java
>
> Index: TestAssetAnnotationWorker.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- TestAssetAnnotationWorker.java 6 Aug 2005 06:58:25 -0000 1.5
> +++ TestAssetAnnotationWorker.java 8 Aug 2005 16:12:25 -0000 1.6
> @@ -22,6 +22,7 @@
> import org.apache.tapestry.spec.ComponentSpecification;
> import org.apache.tapestry.spec.IAssetSpecification;
> import org.apache.tapestry.spec.IComponentSpecification;
> +import org.apache.tapestry.util.DescribedLocation;
>
> /**
> * Tests for [EMAIL PROTECTED]
> org.apache.tapestry.annotations.AssetAnnotationWorker}.
> @@ -49,7 +50,7 @@
>
> IAssetSpecification as = spec.getAsset("globalStylesheet");
> assertEquals("/style/global.css", as.getPath());
> - assertEquals(new AnnotationLocation(r, l.toString()),
> as.getLocation());
> + assertEquals(new DescribedLocation(r, l.toString()),
> as.getLocation());
> assertEquals("globalStylesheet", as.getPropertyName());
> }
> }
>
>
>
> 1.21 +1 -0
> jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.page.xml
>
> Index: tapestry.page.xml
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.page.xml,v
> retrieving revision 1.20
> retrieving revision 1.21
> diff -u -r1.20 -r1.21
> --- tapestry.page.xml 8 Jul 2005 02:00:47 -0000 1.20
> +++ tapestry.page.xml 8 Aug 2005 16:12:25 -0000 1.21
> @@ -105,6 +105,7 @@
> <set-service property="delegate"
> service-id="SpecificationResolverDelegate"/>
> <set-object property="applicationId"
> value="infrastructure:applicationId"/>
> <set-object property="contextRoot"
> value="infrastructure:contextRoot"/>
> + <set-object property="classFinder"
> value="infrastructure:classFinder"/>
> </construct>
> </invoke-factory>
> </service-point>
>
>
>
> 1.5 +1 -1
> jakarta-tapestry/examples/Workbench/src/context/css/workbench.css
>
> Index: workbench.css
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tapestry/examples/Workbench/src/context/css/workbench.css,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- workbench.css 21 Jul 2005 13:17:58 -0000 1.4
> +++ workbench.css 8 Aug 2005 16:12:25 -0000 1.5
> @@ -10,7 +10,7 @@
> background-color: Red;
> }
>
> -TABLE.inputError TD.message
> +TABLE.inputerror TD.message
> {
> font-weight: bold;
> font-size: smaller;
>
>
>
> 1.1
> jakarta-tapestry/framework/src/test/org/apache/tapestry/util/TestDescribedLocation.java
>
> Index: TestDescribedLocation.java
> ===================================================================
> // 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.
>
> package org.apache.tapestry.util;
>
> import org.apache.hivemind.Resource;
> import org.apache.hivemind.test.HiveMindTestCase;
>
> /**
> * Tests for [EMAIL PROTECTED] org.apache.tapestry.util.DescribedLocation}.
> *
> * @author Howard Lewis Ship
> * @since 4.0
> */
> public class TestDescribedLocation extends HiveMindTestCase
> {
> public void testLineRowAreZero()
> {
> Resource r = (Resource) newMock(Resource.class);
>
> replayControls();
>
> DescribedLocation l = new DescribedLocation(r, "location
> description");
>
> assertEquals(0, l.getLineNumber());
> assertEquals(0, l.getColumnNumber());
>
> assertSame(r, l.getResource());
>
> assertEquals("location description", l.toString());
>
> verifyControls();
> }
>
> public void testEquals()
> {
> Resource r = (Resource) newMock(Resource.class);
> Resource r2 = (Resource) newMock(Resource.class);
>
> replayControls();
>
> DescribedLocation l = new DescribedLocation(r, "location
> description");
> DescribedLocation l2 = new DescribedLocation(r2, "location
> description");
> DescribedLocation l3 = new DescribedLocation(r, "wrong
> description");
> DescribedLocation l4 = new DescribedLocation(r, "location
> description");
>
> assertEquals(false, l.equals(null));
> assertEquals(false, l.equals("XYZ"));
> assertEquals(false, l.equals(l2));
> assertEquals(false, l.equals(l3));
> assertEquals(true, l.equals(l4));
>
> verifyControls();
> }
> }
>
>
>
> 1.1
> jakarta-tapestry/framework/src/java/org/apache/tapestry/util/DescribedLocation.java
>
> Index: DescribedLocation.java
> ===================================================================
> // 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.
>
> package org.apache.tapestry.util;
>
> import org.apache.hivemind.Location;
> import org.apache.hivemind.Resource;
> import org.apache.hivemind.util.Defense;
>
> /**
> * Implementation of [EMAIL PROTECTED] org.apache.hivemind.Location} that
> is used to describe a location within
> * a resource. This is used when the location within the resource can't be
> expressed as a line and
> * column. One example is for setting the location of an annotation. This
> is useful for line-precise
> * exception reporting of errors related to annotations.
> *
> * @author Howard Lewis Ship
> * @since 4.0
> */
> public class DescribedLocation implements Location
> {
> private final Resource _resource;
>
> private final String _description;
>
> public DescribedLocation(Resource resource, String description)
> {
> Defense.notNull(resource, "resource");
> Defense.notNull(description, "description");
>
> _resource = resource;
> _description = description;
> }
>
> /**
> * Returns the description provided in the constructor.
> */
>
> public String toString()
> {
> return _description;
> }
>
> /**
> * Returns the resource provided in the constructor.
> */
>
> public Resource getResource()
> {
> return _resource;
> }
>
> /**
> * Always returns 0.
> */
>
> public int getLineNumber()
> {
> return 0;
> }
>
> /**
> * Always returns 0.
> */
>
> public int getColumnNumber()
> {
> return 0;
> }
>
> /**
> * A DescribedLocation is equal to another only if their resources are
> equal, and their
> * descriptions are equal.
> */
> @Override
> public boolean equals(Object other)
> {
> if (other instanceof DescribedLocation)
> {
> DescribedLocation otherLocation = (DescribedLocation) other;
>
> return _resource.equals(otherLocation._resource)
> && _description.equals(otherLocation._description);
> }
>
> return false;
> }
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]