Package org.apache.tapestry5.ioc.internal.util

Examples of org.apache.tapestry5.ioc.internal.util.TapestryException


    private final PropertyAccess access = new PropertyAccessImpl();

    @Test
    public void find_cause_with_match()
    {
        TapestryException inner = new TapestryException("foo", null);

        RuntimeException outer = new RuntimeException(inner);

        assertSame(ExceptionUtils.findCause(outer, TapestryException.class), inner);
        assertSame(ExceptionUtils.findCause(outer, TapestryException.class, access), inner);
View Full Code Here


        {
            ComponentPageElement e = (ComponentPageElement) o;

            if (e.getComponentResources().getComponentModel().getComponentClassName().equals(componentClassName))
            {
                throw new TapestryException(
                        PageloadMessages.recursiveTemplate(componentClassName),
                        location,
                        null);
            }
        }
View Full Code Here

        boolean handled = element
                .triggerContextEvent(parameters.getEventType(), parameters.getEventContext(), callback);

        if (!handled)
            throw new TapestryException(ServicesMessages.eventNotHandled(element, parameters.getEventType()), element,
                    null);

        environment.pop(TrackableComponentEventCallback.class);
        environment.pop(ComponentEventResultProcessor.class);
View Full Code Here

            if (startx != expansionx)
                providers.add(new LiteralStringProvider(expression.substring(startx, expansionx)));

            int endx = expression.indexOf("}", expansionx);

            if (endx < 0) throw new TapestryException(ServicesMessages
                    .unclosedAttributeExpression(expression), location, null);

            String expansion = expression.substring(expansionx + 2, endx);

            final Binding binding = bindingSource.newBinding("attribute expansion", resources, resources,
                    BindingConstants.PROP, expansion, location);

            final StringProvider provider = new StringProvider()
            {
                public String provideString()
                {
                    try
                    {
                        Object raw = binding.get();

                        return typeCoercer.coerce(raw, String.class);
                    } catch (Exception ex)
                    {
                        throw new TapestryException(ex.getMessage(), location, ex);
                    }
                }
            };

            providers.add(provider);
View Full Code Here

                    popNewElement(pageAssembly);

                    pageAssembly.componentName.pop();
                } catch (RuntimeException ex)
                {
                    throw new TapestryException(PageloadMessages.exceptionAssemblingEmbeddedComponent(embeddedId,
                            componentClassName, container.getCompleteId(), InternalUtils.toMessage(ex)), location, ex);
                }
            }
        });
    }
View Full Code Here

        try
        {

            if (InternalUtils.isBlank(componentClassName))
            {
                throw new TapestryException(
                        PageloadMessages.missingComponentType(), location, null);
            }

            EmbeddedComponentAssemblerImpl embedded = new EmbeddedComponentAssemblerImpl(assemblerSource,
                    instantiatorSource, componentClassResolver, componentClassName, getSelector(), embeddedModel,
                    mixins, location);

            if (embeddedIdToAssembler == null)
                embeddedIdToAssembler = CollectionFactory.newMap();

            embeddedIdToAssembler.put(embeddedId, embedded);

            if (embeddedModel != null)
            {
                for (String publishedParameterName : embeddedModel.getPublishedParameters())
                {
                    if (publishedParameterToEmbeddedId == null)
                        publishedParameterToEmbeddedId = CollectionFactory.newCaseInsensitiveMap();

                    String existingEmbeddedId = publishedParameterToEmbeddedId.get(publishedParameterName);

                    if (existingEmbeddedId != null)
                    {
                        throw new TapestryException(
                                PageloadMessages.parameterAlreadyPublished(publishedParameterName, embeddedId, instantiator
                                        .getModel().getComponentClassName(), existingEmbeddedId), location, null);
                    }

                    publishedParameterToEmbeddedId.put(publishedParameterName, embeddedId);
                }

            }

            return embedded;
        } catch (Exception ex)
        {
            throw new TapestryException(PageloadMessages.failureCreatingEmbeddedComponent(embeddedId, instantiator
                    .getModel().getComponentClassName(), InternalUtils.toMessage(ex)), location, ex);
        }
    }
View Full Code Here

        if (innerBinder == null)
        {
            String message = PageloadMessages.publishedParameterNonexistant(parameterName, instantiator.getModel()
                    .getComponentClassName(), embeddedId);

            throw new TapestryException(message, embededdedComponentAssembler.getLocation(), null);
        }
        // The simple case, publishing a parameter of a subcomponent as if it were a parameter
        // of this component.

        return new ParameterBinder()
View Full Code Here

        try
        {
            page.persistFieldChange(this, fieldName, newValue);
        } catch (Exception ex)
        {
            throw new TapestryException(StructureMessages.fieldPersistFailure(getCompleteId(), fieldName, ex),
                    getLocation(), ex);
        }
    }
View Full Code Here

            try
            {
                resources.getEmbeddedComponent(componentId);
            } catch (UnknownValueException ex)
            {
                throw new TapestryException(String.format("Method %s references component id '%s' which does not exist.",
                        methodIdentifier, componentId), resources.getLocation(), ex);
            }
        }
View Full Code Here

        boolean handled = element.triggerContextEvent(parameters.getEventType(), parameters.getEventContext(), callback);

        if (!handled)
        {
            throw new TapestryException(String.format("Request event '%s' (on component %s) was not handled; you must provide a matching event handler method in the component or in one of its containers.", parameters.getEventType(), element.getCompleteId()), element,
                    null);
        }

        environment.pop(TrackableComponentEventCallback.class);
        environment.pop(ComponentEventResultProcessor.class);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.internal.util.TapestryException

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.