Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.ComponentConstructor


    public void testComponentConstructorFailure()
    {
        Location l = fabricateLocation(13);

        ComponentConstructor cc = new ComponentConstructorImpl(BaseComponent.class
                .getConstructors()[0], new Object[]
        { "unexpected" }, l);

        try
        {
            cc.newInstance();
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(
View Full Code Here


       
        try {
           
            _lock.lockInterruptibly();
           
            ComponentConstructor result = (ComponentConstructor) _cachedConstructors.get(specification);
           
            if (result == null) {
               
                Class baseClass = _classResolver.findClass(className);
               
                EnhancementOperationImpl eo = new EnhancementOperationImpl(_classResolver,
                        specification, baseClass, _classFactory, _log);
               
                // Invoking on the chain is the same as invoking on every
                // object in the chain (because method performEnhancement() is type void).
               
                _chain.performEnhancement(eo, specification);
               
                result = eo.getConstructor();
               
                // TODO: This should be optional to work around that IBM JVM bug.
               
                _validator.validate(baseClass, result.getComponentClass(), specification);
               
                _cachedConstructors.put(specification, result);
            }
           
            return result;
View Full Code Here

                throw new ApplicationRuntimeException(PageloadMessages
                        .pageNotAllowed(id), container, spec.getLocation(),
                        null);
        }

        ComponentConstructor cc = _componentConstructorFactory
                .getComponentConstructor(spec, className);

        IComponent result = (IComponent) cc.newInstance();
       
        result.setNamespace(namespace);
        result.setPage(page);
        result.setContainer(container);
        result.setId(id);
View Full Code Here

            throw new ApplicationRuntimeException(PageloadMessages
                    .classNotPage(pageClass), location, null);

        String pageName = namespace.constructQualifiedName(name);

        ComponentConstructor cc = _componentConstructorFactory
                .getComponentConstructor(spec, className);

        IPage result = (IPage) cc.newInstance();

        result.setNamespace(namespace);
        result.setPageName(pageName);
        result.setPage(result);
        result.setLocale(_locale);
View Full Code Here

        String ref2 = eo.getClassReference(Map.class);

        eo.addMethod(Modifier.PUBLIC, new MethodSignature(Class.class, "getClassReference", null,
                null), "return " + ref + ";", l);

        ComponentConstructor cc = eo.getConstructor();

        GetClassReferenceFixture f = (GetClassReferenceFixture) cc.newInstance();

        assertSame(Map.class, f.getClassReference());

        verify();
View Full Code Here

    public void testComponentConstructorFailure()
    {
        Location l = newLocation();

        ComponentConstructor cc = new ComponentConstructorImpl(BaseComponent.class
                .getConstructors()[0], new Object[]
        { "unexpected" }, "<classfab>", l);

        try
        {
            cc.newInstance();
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(
View Full Code Here

        String ref2 = eo.getClassReference(Map.class);

        eo.addMethod(Modifier.PUBLIC, new MethodSignature(Class.class, "getClassReference", null,
                null), "return " + ref + ";", l);

        ComponentConstructor cc = eo.getConstructor();

        GetClassReferenceFixture f = (GetClassReferenceFixture) cc.newInstance();

        assertSame(Map.class, f.getClassReference());

        verify();
View Full Code Here

    public void testComponentConstructorFailure()
    {
        Location l = newLocation();

        ComponentConstructor cc = new ComponentConstructorImpl(BaseComponent.class
                .getConstructors()[0], new Object[]
        { "unexpected" }, "<classfab>", l);

        try
        {
            cc.newInstance();
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(
View Full Code Here

        try
        {
            _lock.lockInterruptibly();

            ComponentConstructor result = (ComponentConstructor) _cachedConstructors.get(specification);

            if (result == null)
            {
                Class baseClass = _classResolver.findClass(className);

                EnhancementOperationImpl eo = new EnhancementOperationImpl(_classResolver, specification, baseClass, _classFactory, _log);

                // Invoking on the chain is the same as invoking on every
                // object in the chain (because method performEnhancement() is type void).

                _chain.performEnhancement(eo, specification);

                result = eo.getConstructor();

                // TODO: This should be optional to work around that IBM JVM bug.

                _validator.validate(baseClass, result.getComponentClass(), specification);

                _cachedConstructors.put(specification, result);
            }

            return result;
View Full Code Here

            if (IPage.class.isAssignableFrom(componentClass))
                throw new ApplicationRuntimeException(PageloadMessages.pageNotAllowed(id),
                                                      container, spec.getLocation(), null);
        }

        ComponentConstructor cc = _componentConstructorFactory.getComponentConstructor(spec, className);

        IComponent result = (IComponent) cc.newInstance();

        result.setNamespace(namespace);
        result.setPage(page);
        result.setContainer(container);
        result.setId(id);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.ComponentConstructor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.