Examples of InvalidDefinitionException


Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

            if (parentDef == null) {
                throw new DefinitionNotFoundException(extendsDescriptor, getLocation());
            }

            if (parentDef.getDescriptor().equals(descriptor)) {
                throw new InvalidDefinitionException(String.format(
                        "%s cannot extend itself", getDescriptor()), getLocation());
            }

            if (!parentDef.isExtensible()) {
                throw new InvalidDefinitionException(String.format(
                        "%s cannot extend non-extensible component %s", getDescriptor(), extendsDescriptor),
                        getLocation());
            }

            registry.assertAccess(descriptor, parentDef);

            SupportLevel support = getSupport();
            DefDescriptor<T> extDesc = extendsDescriptor;
            while (extDesc != null) {
                T extDef = extDesc.getDef();
                if (support.ordinal() > extDef.getSupport().ordinal()) {
                    throw new InvalidDefinitionException(
                            String.format("%s cannot widen the support level to %s from %s's level of %s",
                                    getDescriptor(),
                                    support, extDesc, extDef.getSupport()), getLocation());
                }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

                if (e.getStem() != null) { // checks for private attributes used in expressions ..
                    String stem = e.getStem().toString();
                    AttributeDef attr = getAttributeDef(stem);
                    if ((attr != null) && (attr.getVisibility() == Visibility.PRIVATE)
                            && (!this.attributeDefs.values().contains(attr))) {
                        throw new InvalidDefinitionException(String.format(
                                "Expression %s refers to a private attribute '%s' ", e, attr), e.getLocation());
                    }
                }
            }
        }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

        // MasterDefRegistry reg =
        // Aura.getContextService().getCurrentContext().getDefRegistry();
        EventDef locationChangeDef = getLocationChangeEventDescriptor().getDef();
        if (!locationChangeDef.isInstanceOf(Aura.getDefinitionService().getDefDescriptor("aura:locationChange",
                EventDef.class))) {
            throw new InvalidDefinitionException(String.format("%s must extend aura:locationChange",
                    locationChangeDef.getDescriptor()), getLocation());
        }

        for (DefDescriptor<ThemeDef> themeDescriptor : themeDescriptors) {
            // the theme must not be a component theme. otherwise, it would allow users to circumvent var
            // cross-reference validation (regular themes enforce that cross references are defined in the same file,
            // but cmp themes allow cross references to the namespace-default file.)
            if (themeDescriptor.getDef().isCmpTheme()) {
                throw new InvalidDefinitionException(
                        String.format(
                                "%s must not specify a component-specific or app-specific theme as the main app theme",
                                getName()), getLocation());
            }
        }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

    @Override
    public void validateDefinition() throws QuickFixException {

        if (descriptor == null && name == null || descriptor != null && name != null) {
            throw new InvalidDefinitionException(
                    "aura:handler must specify one and only one of name=\"…\" or event=\"…\"", getLocation());
        }

        if (action == null) {
            throw new InvalidDefinitionException("aura:handler missing attribute: action=\"…\"", getLocation());
        }
    }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

                type = defService.getDefDescriptor("aura://Boolean", TypeDef.class);
            } else if (val instanceof Number) {
                // Number
                type = defService.getDefDescriptor("aura://Decimal", TypeDef.class);
            } else {
                throw new InvalidDefinitionException("Invalid value type in model definition.", getLocation());
            }

            JavascriptValueDef value = new JavascriptValueDef(key, type, val, location);
            memberMap.put(key, value);
        }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

    @SuppressWarnings("unchecked")
    @Override
    protected <T> T getValue(Object object, Class<T> retClass) throws QuickFixException {
        if (object != null && Model.class.equals(retClass)) {
            if (!(object instanceof Map)) {
                throw new InvalidDefinitionException(
                        "Mock Model expects a map of property names to Answers.", getLocation());
            }
            Map<String, Object> properties = Maps.newHashMap();
            Map<?, ?> propMap = (Map<?, ?>) object;
            for (Object key : propMap.keySet()) {
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

    @SuppressWarnings("unchecked")
    @Override
    protected <T> T getValue(Object object, Class<T> retClass) throws QuickFixException {
        if (object != null && ComponentConfig.class.equals(retClass)) {
            if (!(object instanceof Map)) {
                throw new InvalidDefinitionException("Mock Provider expects (descriptor and/or attributes) or (configProvider)", getLocation());
            }
            ComponentConfig config;
           
            String configProvider = (String)((Map<?, ?>) object).get("configProvider");
            //If a config provider is specified, defer provide until later
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

                            mockProvider = configProvider.substring("java://".length());
                        }
                        try{
                            Class<?> providerClass = Class.forName(mockProvider);
                            if(!ComponentConfigProvider.class.isAssignableFrom(providerClass)){
                                throw new InvalidDefinitionException("Class specified as configProvider should implement ComponentConfigProvider", getLocation());
                            }
                            ComponentConfigProvider provider = (ComponentConfigProvider)providerClass.newInstance();
                            config = provider.provide();
                        }catch(ClassNotFoundException e){
                            throw new InvalidDefinitionException("Could not locate class specified as configProvider:"+configProvider, getLocation());
                        }catch(IllegalAccessException e){
                            throw new InvalidDefinitionException("Constructor is inaccessible for "+ configProvider, getLocation());
                        }catch (InstantiationException ie) {
                            throw new InvalidDefinitionException("Cannot instantiate " + configProvider, getLocation());
                        }
                      return (T)config;
                    }
                };
            }else{
                return super.getAnswer(object, retClass);
            }
        }
        throw new InvalidDefinitionException("Mock answer must specify either 'value' or 'error'", getLocation());
    }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

     */
    @Override
    public void validateDefinition() throws QuickFixException {
        super.validateDefinition();
        if (renderer == null) {
            throw new InvalidDefinitionException("Renderer must implement the Renderer interface.", location);
        }
    }
View Full Code Here

Examples of org.auraframework.throwable.quickfix.InvalidDefinitionException

            List<Class<? extends Renderer>> interfaces = AuraUtil.findInterfaces(rendererClass, Renderer.class);
            if (!interfaces.isEmpty()) {
                try {
                    rendererInstance = (Renderer) rendererClass.newInstance();
                } catch (InstantiationException ie) {
                    setParseError(new InvalidDefinitionException("Cannot instantiate " + getLocation(), getLocation()));
                } catch (IllegalAccessException iae) {
                    setParseError(new InvalidDefinitionException("Constructor is inaccessible for " + getLocation(),
                            getLocation()));
                } catch (RuntimeException e) {
                    setParseError(new InvalidDefinitionException("Cannot instantiate " + getLocation(), getLocation(),
                            e));
                }
            } else {
                rendererInstance = null;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.