Package org.auraframework.system.AuraContext

Examples of org.auraframework.system.AuraContext.Mode


    @Override
    public void serialize(Json json) throws IOException {
        json.writeMapBegin();
        json.writeMapEntry("message", getMessage());
        if (Aura.getContextService().isEstablished()) {
            Mode mode = Aura.getContextService().getCurrentContext().getMode();
            if (mode != Mode.PROD && mode != Mode.PRODDEBUG) {
                json.writeMapEntry("stack", AuraExceptionUtil.getStackTrace(this));
                json.writeMapEntry("location", getLocation());
            }
        }
View Full Code Here


        return new Dimension(320, 548);
    }

    protected final void runWithPerfApp(DefDescriptor<ComponentDef> descriptor) throws Exception {
        try {
            Mode mode = perfRunMode == PerfRunMode.AURASTATS ? Mode.STATS : Mode.PROD;
            setupContext(mode, AuraContext.Format.JSON, descriptor);

            String relativeUrl = "/perfTest/perf.app?";
            Map<String, Object> attributeValues = getComponentAttributeValues(descriptor);
            Map<String, Serializable> hash = ImmutableMap.of("componentDef", descriptor.getQualifiedName(),
View Full Code Here

            if (styleDefDesc != null) {
                attributes.put("auraInlineStyle", styleDefDesc.getDef().getCode());
            }

            String contextPath = context.getContextPath();
            Mode mode = context.getMode();

            if (mode.allowLocalRendering() && def.isLocallyRenderable()) {
                DefType defType = def.getDescriptor().getDefType();
                BaseComponent<?, ?> cmp = null;

                if (defType == DefType.APPLICATION) {
                    cmp = (BaseComponent<?, ?>) instanceService.getInstance((ApplicationDef) def, componentAttributes);
View Full Code Here

        attribs.put("defaultBodyClass", "auraError");
        attribs.put("forceError", "true");

        boolean writeStack = false;
        if (Aura.getContextService().isEstablished()) {
            Mode mode = Aura.getContextService().getCurrentContext().getMode();
            writeStack = mode != Mode.PROD && mode != Mode.PRODDEBUG;
        }           
        if (writeStack) {
            attribs.put("errorMessage", AuraExceptionUtil.getStackTrace(t));
        } else {
View Full Code Here

    }

    @Override
    public void write(Object value, Map<String, Object> attributes, Appendable out) throws IOException,
            QuickFixException {
        Mode m = Aura.getContextService().getCurrentContext().getMode();
        if (m != Mode.DEV) {
            Aura.getSerializationService().write(value, attributes, Throwable.class, out, getFormatName());
            return;
        }
View Full Code Here

            if (styleDefDesc != null) {
                attributes.put("auraInlineStyle", styleDefDesc.getDef().getCode());
            }

            String contextPath = context.getContextPath();
            Mode mode = context.getMode();

            if (mode.allowLocalRendering() && def.isLocallyRenderable()) {

                DefType defType = def.getDescriptor().getDefType();

                if (defType == DefType.APPLICATION) {
                    cmp = (BaseComponent<?, ?>) instanceService.getInstance((ApplicationDef) def, componentAttributes);
View Full Code Here

     */
    @Override
    public void serialize(Json json) throws IOException {
        try {
            AuraContext context = Aura.getContextService().getCurrentContext();
            Mode mode = context.getMode();
            boolean preloaded = context.isPreloaded(getDescriptor());
            boolean preloading = context.isPreloading();

            if (preloaded) {
                json.writeValue(descriptor);
            } else {
                json.writeMapBegin();
                json.writeMapEntry("descriptor", descriptor);
                context.pushCallingDescriptor(descriptor);
                try {
                    RendererDef rendererDef = getRendererDef();
                    if (rendererDef != null && !rendererDef.isLocal()) {
                        json.writeMapEntry("rendererDef", rendererDef);
                    }
                } finally {
                    context.popCallingDescriptor();
                }
                HelperDef helperDef = getHelperDef();
                if (helperDef != null && !helperDef.isLocal()) {
                    json.writeMapEntry("helperDef", helperDef);
                }

                json.writeMapEntry("styleDef", getStyleDef());
                json.writeMapEntry("controllerDef", getControllerDef());
                json.writeMapEntry("modelDef", getModelDef());
                json.writeMapEntry("superDef", getSuperDef());
                if (preloading) {
                    json.writeMapEntry("isCSSPreloaded", preloading);
                }

                Collection<AttributeDef> attrDefs = getAttributeDefs().values();
                if (!attrDefs.isEmpty()) {
                    json.writeMapEntry("attributeDefs", attrDefs);
                }

                Set<DefDescriptor<InterfaceDef>> allInterfaces = getAllInterfaces();
                if (allInterfaces != null && !allInterfaces.isEmpty()) {
                    json.writeMapEntry("interfaces", allInterfaces);
                }

                Collection<RegisterEventDef> regevents = getRegisterEventDefs().values();
                if (!regevents.isEmpty()) {
                    json.writeMapEntry("registerEventDefs", regevents);
                }

                Collection<EventHandlerDef> handlers = getHandlerDefs();
                if (!handlers.isEmpty()) {
                    json.writeMapEntry("handlerDefs", handlers);
                }
                Collection<ImportDef> imports = getImportDefs();
                if (!imports.isEmpty()) {
                    json.writeMapEntry("imports", imports);
                }

                if (!facets.isEmpty()) {
                    json.writeMapEntry("facets", facets);
                }

                boolean local = hasLocalDependencies();

                if (local) {
                    json.writeMapEntry("hasServerDeps", true);
                }

                if (isAbstract) {
                    json.writeMapEntry("isAbstract", isAbstract);
                }

                ProviderDef providerDef = getProviderDef();
                if (providerDef != null && !providerDef.isLocal()) {
                    json.writeMapEntry("providerDef", providerDef);
                }

                if (subDefs != null) {
                    json.writeMapEntry("subDefs", subDefs.values());
                }

                if (mode.equals(Mode.AUTOJSTEST)) {
                    json.writeMapEntry("testSuiteDef", getTestSuiteDef());
                }

                serializeFields(json);
                json.writeMapEnd();
View Full Code Here

    }

    @Override
    public void writeAppCss(Set<DefDescriptor<?>> dependencies, Writer out) throws IOException, QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        Mode mode = context.getMode();

        // build cache key
        final StringBuilder keyBuilder = new StringBuilder(64);
        keyBuilder.append("CSS:");

        // browser type
        keyBuilder.append(context.getClient().getType());

        keyBuilder.append("$");

        // minified or not
        final boolean minify = !(mode.isTestMode() || mode.isDevMode());
        keyBuilder.append(minify ? "MIN:" : "DEV:");

        // app uid
        DefDescriptor<?> appDesc = context.getLoadingApplicationDescriptor();
        final String uid = context.getUid(appDesc);
View Full Code Here

    @Override
    public void writeDefinitions(Set<DefDescriptor<?>> dependencies, Writer out)
            throws IOException, QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();

        Mode mode = context.getMode();
        final boolean minify = !mode.prettyPrint();
        final String mKey = minify ? "MIN:" : "DEV:";
        //
        // create a temp buffer in case anything bad happens while we're processing this.
        // don't want to end up with a half a JS init function
        //
View Full Code Here

    public void write(Object value, Map<String, Object> attributes, Appendable out) throws IOException {
        Throwable t = (Throwable) value;

        out.append("/** \nAN EXCEPTION OCCURRED WHILE PROCESSING CSS\n");
        // FIXME: this is pretty ugly.
        Mode mode = Aura.getContextService().getCurrentContext().getMode();
        if (mode != Mode.PROD && mode != Mode.PRODDEBUG && !Aura.getConfigAdapter().isProduction()) {
            out.append(AuraExceptionUtil.getStackTrace(t));
        }

        String message = "\\A\\A" + t.getMessage().replaceAll("\n", "\\\\A");
View Full Code Here

TOP

Related Classes of org.auraframework.system.AuraContext.Mode

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.