Package org.auraframework.service

Examples of org.auraframework.service.DefinitionService


            if (e.getRoot().equals(LABEL.getPrefix())) {
                labelProvider.getValue(e.getStem());
            }
        }

        DefinitionService definitionService = Aura.getDefinitionService();
        retrieveListLabels(definitionService, controllerDescriptors);
        retrieveListLabels(definitionService, rendererDescriptors);
        retrieveListLabels(definitionService, helperDescriptors);
        retrieveListLabels(definitionService, providerDescriptors);
    }
View Full Code Here


    /**
     * @return all descriptors known by the Aura runtime
     */
    public static Set<DefDescriptor<?>> getAllKnownDescriptors() throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();
        Set<DefDescriptor<?>> descriptors = definitionService.find(new DescriptorFilter("*://*:*"));
        Set<DefDescriptor<?>> includedDescriptors = new HashSet<DefDescriptor<?>>();

        // add bundle ones from RootDefinition elements
        Set<DefDescriptor<?>> bundlesDescriptors = new HashSet<DefDescriptor<?>>();
        for (DefDescriptor<?> descriptor : descriptors) {
View Full Code Here

    }

    @AuraEnabled
    public static Component getComponent(@Key(value = "name", loggable = true) String name, @Key("attributes") Map<String, Object> attributes)
            throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();
        DefDescriptor<ComponentDef> desc = definitionService.getDefDescriptor(name, ComponentDef.class);
        definitionService.updateLoaded(desc);
        return Aura.getInstanceService().getInstance(desc, attributes);
    }
View Full Code Here

    }

    @AuraEnabled
    public static Application getApplication(@Key(value = "name", loggable = true) String name, @Key("attributes") Map<String, Object> attributes)
            throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();
        DefDescriptor<ApplicationDef> desc = definitionService.getDefDescriptor(name, ApplicationDef.class);
        definitionService.updateLoaded(desc);
        return Aura.getInstanceService().getInstance(desc, attributes);
    }
View Full Code Here

        if (defs == null || defs.isEmpty()) {
            return;
        }

        // Get the Descriptors for the provided Definitions
        final DefinitionService definitionService = Aura.getDefinitionService();
        final Set<DefDescriptor<?>> cached = Sets.newHashSet();
        for (T def : defs) {
            if (def != null) {
                cached.add(def.getDescriptor());
            }
        }

        // Wait for the change notifications to get processed. We expect listeners to get processed in the order in
        // which they subscribe.
        final CountDownLatch latch = new CountDownLatch(cached.size());
        SourceListener listener = new SourceListener() {
            private Set<DefDescriptor<?>> descriptors = Sets.newHashSet(cached);

            @Override
            public void onSourceChanged(DefDescriptor<?> source, SourceMonitorEvent event, String filePath) {
                if (descriptors.remove(source)) {
                    latch.countDown();
                }
                if (descriptors.isEmpty()) {
                    definitionService.unsubscribeToChangeNotification(this);
                }
            }
        };
        definitionService.subscribeToChangeNotification(listener);
        for (DefDescriptor<?> desc : cached) {
            definitionService.onSourceChanged(desc, SourceMonitorEvent.CHANGED, null);
        }
        if (!latch.await(CACHE_CLEARING_TIMEOUT_SECS, TimeUnit.SECONDS)) {
            throw new AuraRuntimeException(String.format(
                    "Timed out after %s seconds waiting for cached Aura definitions to clear: %s",
                    CACHE_CLEARING_TIMEOUT_SECS, defs));
View Full Code Here

        private Map<String, JavascriptValueDef> memberMap = Maps.newHashMap();

        public void addProperty(String key, Object val, Location location) throws QuickFixException {
            DefDescriptor<TypeDef> type = null;
            DefinitionService defService = Aura.getDefinitionService();
            if (val == null || val instanceof Map) {
                // Object
                type = defService.getDefDescriptor("aura://Object", TypeDef.class);
            } else if (val instanceof List) {
                // Array
                type = defService.getDefDescriptor("aura://List", TypeDef.class);
            } else if (val instanceof String) {
                // String
                type = defService.getDefDescriptor("aura://String", TypeDef.class);
            } else if (val instanceof Boolean) {
                // Boolean
                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);
View Full Code Here

        Writer out = source.getWriter();
        try {
            Map<String, Object> attributes = Maps.newHashMap();
            attributes.put("def", def);
            InstanceService instanceService = Aura.getInstanceService();
            DefinitionService definitionService = Aura.getDefinitionService();
            DefDescriptor<ComponentDef> tmplDesc = definitionService.getDefDescriptor("auradev:saveStyle",
                    ComponentDef.class);
            Component tmpl = instanceService.getInstance(tmplDesc, attributes);
            Aura.getRenderingService().render(tmpl, out);
        } catch (QuickFixException x) {
            throw new AuraError(x);
View Full Code Here

        this.styleTokens = AuraUtil.immutableMap(builder.styleTokens);
    }
   
    @Override
    public void appendDependencies(Set<DefDescriptor<?>> dependencies) {
        DefinitionService ds = Aura.getDefinitionService();
       
        super.appendDependencies(dependencies);
        dependencies.add(ds.getDefDescriptor("String", TypeDef.class));
        dependencies.add(ds.getDefDescriptor("Map", TypeDef.class));
    }
View Full Code Here

            fail("The following ui:output* components should have a required 'value' attributef: " + failures);
        }
    }

    private Set<ComponentDef> getUiOutputComponents() throws Exception {
        DefinitionService definitionService = Aura.getDefinitionService();
        DefDescriptor<ComponentDef> matcher = definitionService.getDefDescriptor("markup://ui:output*",
                ComponentDef.class);
        Set<ComponentDef> ret = Sets.newHashSet();
        for (DefDescriptor<ComponentDef> def : definitionService.find(matcher)) {
            if (def.getName().startsWith("output")) {
                ret.add(def.getDef());
            }
        }
        return ret;
View Full Code Here

        }
        return ret;
    }

    private ComponentDef getUiOutputComponent() throws Exception {
        DefinitionService definitionService = Aura.getDefinitionService();
        ComponentDef def = definitionService.getDefinition("markup://ui:output", ComponentDef.class);
        return def;
    }
View Full Code Here

TOP

Related Classes of org.auraframework.service.DefinitionService

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.