Package org.auraframework.throwable.quickfix

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException


                    case XMLStreamConstants.START_DOCUMENT:
                    case XMLStreamConstants.COMMENT:
                    case XMLStreamConstants.SPACE:
                        break;
                    default:
                        throw new InvalidDefinitionException(
                                String.format("Found unexpected element of type %s", type), getLocation(xmlReader,
                                        source));
                    }
                }
                if (!xmlReader.hasNext()) {
                    throw new InvalidDefinitionException("Empty file", getLocation(xmlReader, source));
                }
            }
            ret = (D)handler.getElement();
            if (xmlReader != null) {
                LOOP: while (xmlReader.hasNext()) {
                    int type = xmlReader.next();
                    switch (type) {
                    case XMLStreamConstants.END_DOCUMENT:
                        break LOOP;
                    case XMLStreamConstants.COMMENT:
                    case XMLStreamConstants.SPACE:
                        break;
                    default:
                        throw new InvalidDefinitionException(String.format(
                                "Found unexpected element of type %s when expecting end of file.", type), getLocation(
                                xmlReader, source));
                    }
                }
            }
View Full Code Here


    @Override
    public void validateDefinition() throws QuickFixException {
        super.validateDefinition();

        if (eventType == null) {
            throw new InvalidDefinitionException("EventType cannot be null", getLocation());
        }

        for (AttributeDef att : this.attributeDefs.values()) {
            if(att.getVisibility() == Visibility.PRIVATE){
                throw new InvalidDefinitionException("Cannot declare an Event attribute as private",getLocation());
            }
            att.validateDefinition();
        }
    }
View Full Code Here

    @Override
    public void validateReferences() throws QuickFixException {
        if (extendsDescriptor != null) {
            EventDef extended = getExtendsDescriptor().getDef();
            if (extended == null) {
                throw new InvalidDefinitionException(String.format("Event %s cannot extend %s", getDescriptor(),
                        getExtendsDescriptor()), getLocation());
            }
           
            if (extended.getEventType() != getEventType()) {
                throw new InvalidDefinitionException(String.format("Event %s cannot extend %s", getDescriptor(),
                        getExtendsDescriptor()), getLocation());
            }
           
            MasterDefRegistry registry = Aura.getDefinitionService().getDefRegistry();
            registry.assertAccess(descriptor, extended);
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public IncludeDefRefImpl getElement() throws XMLStreamException, QuickFixException {
        DefDescriptor<LibraryDef> parentDescriptor = (DefDescriptor<LibraryDef>) parentHandler.getDefDescriptor();
        if (parentDescriptor.getDefType() != DefType.LIBRARY) {
            throw new InvalidDefinitionException("aura:include may only be set in a library.", getLocation());
        }

        validateAttributes();

        builder.setLocation(getLocation());

        String name = getAttributeValue(ATTRIBUTE_NAME);
        if (AuraTextUtil.isNullEmptyOrWhitespace(name)) {
            throw new InvalidDefinitionException(("aura:include must specify a valid library name."), getLocation());
        }
        builder.setDescriptor(SubDefDescriptorImpl.getInstance(name, parentDescriptor, IncludeDefRef.class));
        builder.setIncludeDescriptor(DefDescriptorImpl.getInstance(
                String.format("%s.%s", parentDescriptor.getNamespace(), name), IncludeDef.class, parentDescriptor));

        String importNames = getAttributeValue(ATTRIBUTE_IMPORTS);
        if (!AuraTextUtil.isNullEmptyOrWhitespace(importNames)) {
            List<DefDescriptor<IncludeDef>> imports = Lists.newLinkedList();
            for (String importName : Arrays.asList(importNames.trim().split("\\s*\\,\\s*"))) {
                String[] parts = importName.split(":");
                if (parts.length == 1) { // local import
                    imports.add(DefDescriptorImpl.getInstance(
                            String.format("%s.%s", parentDescriptor.getNamespace(), importName), IncludeDef.class,
                            parentDescriptor));
                } else if (parts.length == 3) { // external import
                    DefDescriptor<LibraryDef> externalLibrary = DefDescriptorImpl.getInstance(
                            String.format("%s:%s", parts[0], parts[1]), LibraryDef.class);
                    imports.add(DefDescriptorImpl.getInstance(String.format("%s.%s", parts[0], parts[2]),
                            IncludeDef.class, externalLibrary));
                } else { // invalid import name
                    throw new InvalidDefinitionException(String.format(
                            "Invalid name in aura:include imports property: %s", importName), getLocation());
                }
            }
            builder.setImports(imports);
        }
View Full Code Here

            // see comment in Aura.Component mock value above
            return ImmutableMap.<String, Object>of("componentDef", "ui:menuItem",
                    "attributes", ImmutableMap.<String, ImmutableMap<?, ?>>of("values", ImmutableMap.of("label", "Mock ui:menuItem label")));
        }

        throw new InvalidDefinitionException(String.format("Value for '%s' is not defined", attributeDef.getName()), attributeDef.getTypeDef().getLocation());
    }
View Full Code Here

    @Provider
    public static final class ProviderThrowsOnProvide implements ThemeDescriptorProvider {
        @Override
        public DefDescriptor<ThemeDef> provide() throws QuickFixException {
            throw new InvalidDefinitionException("provider error", null);
        }
View Full Code Here

public class TestRendererThrowsQFEDuringRender implements Renderer {

    @Override
    public void render(BaseComponent<?, ?> component, Appendable appendable) throws IOException, QuickFixException {
        throw new InvalidDefinitionException("From TestRendererThrowsQFEDuringRender", null);
    }
View Full Code Here

@Provider
public class TestProviderThrowsQFEDuringProvide implements ComponentDescriptorProvider {

    @Override
    public DefDescriptor<ComponentDef> provide() throws InvalidDefinitionException {
        throw new InvalidDefinitionException("From TestProviderThrowsQFEDuringProvide", null);
    }
View Full Code Here

TOP

Related Classes of org.auraframework.throwable.quickfix.InvalidDefinitionException

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.