Package org.auraframework.service

Examples of org.auraframework.service.DefinitionService


        super.setUp();
        Aura.getContextService().startContext(Mode.SELENIUM, Format.JSON, Authentication.AUTHENTICATED);

        // Build component where the new attribute is created
        BuilderService builderService = Aura.getBuilderService();
        DefinitionService definitionService = Aura.getDefinitionService();
        ComponentDef def = builderService.getComponentDefBuilder().setDescriptor(defDescriptor).build();
        definitionService.save(def);
    }
View Full Code Here


        }
    }

    private void checkInvalidModel(Class<?> clazz, String message) {
        DefDescriptor<ModelDef> desc = DefDescriptorImpl.getInstance("java://" + clazz.getName(), ModelDef.class);
        DefinitionService definitionService = Aura.getDefinitionService();
        try {
            definitionService.getDefinition(desc);
            fail("Expected exception");
        } catch (Exception e) {
            checkExceptionStart(e, InvalidDefinitionException.class, message, "java://" + clazz.getCanonicalName());
        }
    }
View Full Code Here

    }

    private void checkInvalidBeanConstructor(Class<?> clazz, String message) {
        DefDescriptor<ControllerDef> desc = DefDescriptorImpl.getInstance("java://" + clazz.getName(),
                ControllerDef.class);
        DefinitionService definitionService = Aura.getDefinitionService();
        try {
            definitionService.getDefinition(desc);
            fail("Expected exception");
        } catch (Exception e) {
            checkExceptionStart(e, InvalidDefinitionException.class, message, "java://" + clazz.getCanonicalName());
        }
    }
View Full Code Here

     */
    public void testUpdateLoadedUnloadsCircularComp() throws Exception {
        AuraContext context = Aura.getContextService().startContext(Mode.PROD, Format.JSON,
                Authentication.AUTHENTICATED,
                laxSecurityApp);
        DefinitionService ds = Aura.getDefinitionService();
        DefDescriptor<?> compDesc = ds.getDefDescriptor("markup://aura:component", ComponentDef.class);
        DefDescriptor<?> tempDesc = ds.getDefDescriptor("markup://aura:template", ComponentDef.class);
        String compUid = context.getDefRegistry().getUid(null, compDesc);
        String tempUid = context.getDefRegistry().getUid(null, tempDesc);

        //
        // Now make sure we have truly circular references.
View Full Code Here

     */
    public void testUpdateLoadedUnloadsCircularTemp() throws Exception {
        AuraContext context = Aura.getContextService().startContext(Mode.PROD, Format.JSON,
                Authentication.AUTHENTICATED,
                laxSecurityApp);
        DefinitionService ds = Aura.getDefinitionService();
        DefDescriptor<?> compDesc = ds.getDefDescriptor("markup://aura:component", ComponentDef.class);
        DefDescriptor<?> tempDesc = ds.getDefDescriptor("markup://aura:template", ComponentDef.class);
        String compUid = context.getDefRegistry().getUid(null, compDesc);
        String tempUid = context.getDefRegistry().getUid(null, tempDesc);

        //
        // Now make sure we have truly circular references.
View Full Code Here

    public void testComponentDefSerializedFormat() throws Exception {
        DefDescriptor<ApplicationDef> appDesc = Aura.getDefinitionService().getDefDescriptor(
                "preloadTest:dependenciesApp", ApplicationDef.class);
        AuraContext context = Aura.getContextService().startContext(Mode.UTEST, Format.HTML,
                Authentication.AUTHENTICATED, appDesc);
        DefinitionService ds = Aura.getDefinitionService();
        ApplicationDef appDef = ds.getDefinition("preloadTest:dependenciesApp", ApplicationDef.class);
        Map<DefDescriptor<?>, String> clientLoaded = Maps.newHashMap();
        clientLoaded.put(appDesc, context.getDefRegistry().getUid(null, appDesc));
        context.setClientLoaded(clientLoaded);
        ds.updateLoaded(null);

        assertEquals("\"markup://preloadTest:dependenciesApp\"", Json.serialize(appDef));
    }
View Full Code Here

            @SuppressWarnings("unchecked")
            List<String> themes = (List<String>) configMap.get("themes");
            if (themes != null) {
                try {
                    DefinitionService ds = Aura.getDefinitionService();
                    for (String theme : themes) {
                        context.appendThemeDescriptor(ds.getDefDescriptor(theme, ThemeDef.class));
                    }
                } catch (QuickFixException e) {
                    throw new AuraRuntimeException(e);
                }
            }
View Full Code Here

            //
            return;
        }
        @SuppressWarnings("unchecked")
        Map<String, String> loaded = (Map<String, String>) loadedEntry;
        DefinitionService definitionService = Aura.getDefinitionService();
        Map<DefDescriptor<?>, String> clientLoaded = Maps.newHashMap();

        for (Map.Entry<String, String> entry : loaded.entrySet()) {
            String uid = entry.getValue();
            if (uid != null && !uid.equals("null")) {
                String key = entry.getKey();
                int posn = key.indexOf("@");
                if (posn > 0) {
                    String typeStr = key.substring(0, posn);
                    String defStr = key.substring(posn + 1);
                    DefType type = null;
                    try {
                        type = DefType.valueOf(typeStr);
                    } catch (Throwable t) {
                        // ignore unknown types...
                        // We really should log these at a level where we can
                        // see them, but, well, we don't have that now.
                    }
                    if (type != null) {
                        DefDescriptor<?> ld = null;

                        ld = definitionService.getDefDescriptor(defStr, type.getPrimaryInterface());
                        clientLoaded.put(ld, uid);
                    }
                }
            }
        }
View Full Code Here

     * @throws ServletException if there was a problem handling the out of sync
     */
    private Set<DefDescriptor<?>> handleTopLevel(HttpServletRequest request, HttpServletResponse response,
            AuraContext context) throws IOException, ServletException {
        DefDescriptor<? extends BaseComponentDef> appDesc = context.getApplicationDescriptor();
        DefinitionService definitionService = Aura.getDefinitionService();
        MasterDefRegistry mdr = context.getDefRegistry();

        context.setPreloading(true);
        if (appDesc == null) {
            //
            // This means we have nothing to say to the client, so the response is
            // left completely empty.
            //
            return null;
        }
        long ifModifiedSince = request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE);
        String uid = context.getUid(appDesc);
        try {
            try {
                definitionService.updateLoaded(appDesc);
                if (uid != null && ifModifiedSince != -1) {
                    //
                    // In this case, we have an unmodified descriptor, so just tell
                    // the client that.
                    //
                    response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
                    return null;
                }
            } catch (ClientOutOfSyncException coose) {
                //
                // We can't actually handle an out of sync here, since we are doing a
                // preload. We have to ignore it, and continue as if nothing happened.
                // But in the process, we make sure to set 'no-cache' so that the result
                // is thrown away. This may actually not give the right result in bizarre
                // corner cases... beware cache inconsistencied on revert after a QFE.
                //
                // We actually probably should do something different, like send a minimalist
                // set of stuff to make the client re-try.
                //
                setNoCache(response);
                String oosUid = mdr.getUid(null, appDesc);
                return mdr.getDependencies(oosUid);
            }
        } catch (QuickFixException qfe) {
            DefDescriptor<ComponentDef> qfeDescriptor;

            //
            // A quickfix exception means that we couldn't compile something.
            // In this case, we still want to preload things, but we want to preload
            // quick fix values, note that we force NoCache here.
            //
            setNoCache(response);

            qfeDescriptor = definitionService.getDefDescriptor("markup://auradev:quickFixException",
                    ComponentDef.class);
            context.setLoadingApplicationDescriptor(qfeDescriptor);
            String qfeUid;
            try {
                qfeUid = mdr.getUid(null, qfeDescriptor);
View Full Code Here

                }
            }

            attribs.put(RESOURCE_URLS, sw.toString());

            DefinitionService definitionService = Aura.getDefinitionService();
            InstanceService instanceService = Aura.getInstanceService();
            DefDescriptor<ComponentDef> tmplDesc = definitionService
                    .getDefDescriptor("ui:manifest", ComponentDef.class);
            Component tmpl = instanceService.getInstance(tmplDesc, attribs);
            Aura.getRenderingService().render(tmpl, response.getWriter());
        } catch (Exception e) {
            Aura.getExceptionAdapter().handleException(e);
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.