Package org.auraframework.service

Examples of org.auraframework.service.LoggingService


        Object[] args = getArgs();
        if (args == null) {
            return;
        }

        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("java");
        try {
            loggingService.incrementNum("JavaCallCount");
            this.returnValue = this.actionDef.getMethod().invoke(bean, args);
            this.state = State.SUCCESS;
        } catch (InvocationTargetException e) {
            // something bad happened in the body of the action itself
            // getCause() unwraps the InvocationTargetException, gives us the
            // real information.
            addException(e.getCause(), State.ERROR, true, true);
        } catch (Exception e) {
            //
            // Several cases handled here, including
            // * IllegalArgumentError: the conversion probably didn't work.
            // * IllegalAccessException: should not be possible.
            //
            addException(e, State.ERROR, true, false);
        } finally {
            loggingService.stopTimer("java");
            loggingService.startTimer(LoggingService.TIMER_AURA);
        }
    }
View Full Code Here


    private static final long serialVersionUID = -2779745160285710414L;

    @Override
    public void run(Message message, AuraContext context, Writer out, Map<?, ?> extras) throws IOException {
        LoggingService loggingService = Aura.getLoggingService();
        if (message == null) {
            return;
        }
        List<Action> actions = message.getActions();
        Json json = Json.createJsonStream(out, context.getJsonSerializationContext());
        try {
            json.writeMapBegin();
            if (extras != null && extras.size() > 0) {
                for (Map.Entry<?, ?> entry : extras.entrySet()) {
                    json.writeMapEntry(entry.getKey(), entry.getValue());
                }
            }
            json.writeMapKey("actions");
            json.writeArrayBegin();
            run(actions, json);
            json.writeArrayEnd();

            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION);
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION_AURA);
            try {
                json.writeMapEntry("context", context);
                List<Event> clientEvents = Aura.getContextService().getCurrentContext().getClientEvents();
                if (clientEvents != null && !clientEvents.isEmpty()) {
                    json.writeMapEntry("events", clientEvents);
                }
                json.writeMapEnd();
            } finally {
                loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION_AURA);
                loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION);
            }
        } finally {
            json.close();
        }
    }
View Full Code Here

            json.close();
        }
    }

    private void run(List<Action> actions, Json json) throws IOException {
        LoggingService loggingService = Aura.getLoggingService();
        AuraContext context = Aura.getContextService().getCurrentContext();
        for (Action action : actions) {
            StringBuffer actionAndParams = new StringBuffer(action.getDescriptor().getQualifiedName());
            KeyValueLogger logger = loggingService.getKeyValueLogger(actionAndParams);
            if (logger != null) {
                action.logParams(logger);
            }
            String aap = actionAndParams.toString();
            loggingService.startAction(aap);
            Action oldAction = context.setCurrentAction(action);
            try {
                //
                // We clear out action centric references here.
                //
                json.clearReferences();
                // DCHASMAN TODO Look into a common base for Action
                // implementations that we can move the call to
                // context.setCurrentAction() into!
                action.run();
            } catch (AuraExecutionException x) {
                Aura.getExceptionAdapter().handleException(x, action);
            } finally {
                context.setCurrentAction(oldAction);
                loggingService.stopAction(aap);
            }
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION);
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION_AURA);
            try {
                json.writeArrayEntry(action);
            } finally {
                loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION_AURA);
                loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION);
            }

            List<Action> additionalActions = action.getActions();

            // Recursively process any additional actions created by the
View Full Code Here

    protected SubDefDescriptorImpl(DefDescriptor<P> parentDescriptor, String subName, Class<T> defClass) {
        if (AuraTextUtil.isNullEmptyOrWhitespace(subName)) {
            throw new AuraRuntimeException("Sub definition name cannot be null");
        }
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_DEF_DESCRIPTOR_CREATION);
        try {
            this.parentDescriptor = parentDescriptor;
            this.name = subName;
            this.defType = DefType.getDefType(defClass);
            this.qualifiedName = String.format("%s/%s$%s", parentDescriptor.getQualifiedName(), defType.toString(),
                    name);
            this.descriptorName = String.format("%s/%s$%s", parentDescriptor.getDescriptorName(), defType.toString(),
                    name);
            this.hashCode = this.qualifiedName.toLowerCase().hashCode();
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_DEF_DESCRIPTOR_CREATION);
        }
        loggingService.incrementNum(LoggingService.DEF_DESCRIPTOR_COUNT);
    }
View Full Code Here

        return JavaModel.getValue(bean, key, this.modelDef);
    }

    @Override
    public void serialize(Json json) throws IOException {
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION_AURA);
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("javascript");

        try {
            json.writeMap(bean);
        } finally {
            loggingService.stopTimer("javascript");
            loggingService.startTimer(LoggingService.TIMER_AURA);
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION_AURA);
        }
    }
View Full Code Here

        return true;
    }

    @Override
    public void render(BaseComponent<?, ?> component, Appendable out) throws IOException, QuickFixException {
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("java");
        try {
            renderer.render(component, out);
            loggingService.incrementNum("JavaCallCount");
        } catch (Exception e) {
            throw AuraExceptionUtil.wrapExecutionException(e, this.location);
        } finally {
            loggingService.stopTimer("java");
            loggingService.startTimer(LoggingService.TIMER_AURA);
        }
    }
View Full Code Here

        String format = MARKUP_PREFIX.equals(prefix) ? "%s:%s" : "%s.%s";
        return String.format(format, namespace, name);
    }

    protected DefDescriptorImpl(DefDescriptor<?> associate, Class<T> defClass, String newPrefix) {
        LoggingService loggingService = Aura.getLoggingService();

        loggingService.startTimer(LoggingService.TIMER_DEF_DESCRIPTOR_CREATION);
        try {
            this.bundle = null;
            this.defType = DefType.getDefType(defClass);
            this.prefix = newPrefix;
            this.name = associate.getName();
            this.namespace = associate.getNamespace();
            this.qualifiedName = buildQualifiedName(prefix, namespace, name);
            this.descriptorName = buildDescriptorName(prefix, namespace, name);
            int pos = name.indexOf('<');
            this.nameParameters = pos >= 0 ? name.substring(pos).replaceAll("\\s", "") : null;
            this.hashCode = createHashCode();
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_DEF_DESCRIPTOR_CREATION);
        }
        loggingService.incrementNum(LoggingService.DEF_DESCRIPTOR_COUNT);
    }
View Full Code Here

        loggingService.incrementNum(LoggingService.DEF_DESCRIPTOR_COUNT);
    }

    private DefDescriptorImpl(String qualifiedName, Class<T> defClass, DefDescriptor<?> bundle) {
        this.bundle = bundle;
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_DEF_DESCRIPTOR_CREATION);
        try {
            this.defType = DefType.getDefType(defClass);
            if (AuraTextUtil.isNullEmptyOrWhitespace(qualifiedName)) {
                throw new AuraRuntimeException("QualifiedName is required for descriptors");
            }

            String prefix = null;
            String namespace = null;
            String name = null;
            String nameParameters = null;

            switch (defType) {
            case CONTROLLER:
            case TESTSUITE:
            case MODEL:
            case RENDERER:
            case HELPER:
            case STYLE:
            case RESOURCE:
            case TYPE:
            case PROVIDER:
            case THEME_PROVIDER:
            case THEME_MAP_PROVIDER:
            case INCLUDE:
                Matcher matcher = CLASS_PATTERN.matcher(qualifiedName);
                if (matcher.matches()) {
                    prefix = matcher.group(1);
                    namespace = matcher.group(2);
                    if (namespace.isEmpty()) {
                        namespace = null;
                    }
                    name = matcher.group(3);
                    if (matcher.group(4) != null) {
                        // combine name with <generic params> if available
                        name += matcher.group(4);
                        if (defType == org.auraframework.def.DefDescriptor.DefType.TYPE) {
                            nameParameters = matcher.group(4);
                        }
                    }
                } else {
                    throw new AuraRuntimeException(String.format("Invalid Descriptor Format: %s[%s]", qualifiedName, defType.toString()));
                }

                break;
            // subtypes
            case ACTION:
            case DESCRIPTION:
                throw new AuraRuntimeException(
                        String.format("%s descriptor must be a subdef: %s", defType.name(), qualifiedName));
            case ATTRIBUTE:
            case LAYOUT:
            case LAYOUT_ITEM:
            case TESTCASE:
            case VAR:
            case THEME_DEF_REF:
            case ATTRIBUTE_DESIGN:
            case DESIGN_TEMPLATE:
            case DESIGN_TEMPLATE_REGION:
            case INCLUDE_REF:
                name = qualifiedName;
                break;
            case APPLICATION:
            case COMPONENT:
            case INTERFACE:
            case EVENT:
            case LIBRARY:
            case DOCUMENTATION:
            case EXAMPLE:
            case LAYOUTS:
            case NAMESPACE:
            case THEME:
            case DESIGN:
                Matcher tagMatcher = TAG_PATTERN.matcher(qualifiedName);
                if (tagMatcher.matches()) {
                    prefix = tagMatcher.group(1);
                    if (prefix == null) {
                        prefix = MARKUP_PREFIX;
                    }
                    namespace = tagMatcher.group(2);
                    name = tagMatcher.group(3);
                    if (AuraTextUtil.isNullEmptyOrWhitespace(name)) {
                        name = namespace;
                        namespace = null;
                    }
                    qualifiedName = buildQualifiedName(prefix, namespace, name);
                } else {
                    throw new AuraRuntimeException(String.format("Invalid Descriptor Format: %s[%s]", qualifiedName, defType.toString()));
                }

                break;
            }

            if (AuraTextUtil.isNullEmptyOrWhitespace(prefix)) {
                prefix = Aura.getContextService().getCurrentContext().getDefaultPrefix(defType);
                if (prefix != null) {
                    qualifiedName = buildQualifiedName(prefix, namespace, name);
                }
            }
            this.qualifiedName = qualifiedName;
            this.descriptorName = buildDescriptorName(prefix, namespace, name);
            this.prefix = prefix;
            if (defType == DefType.NAMESPACE) {
                this.namespace = name;
                this.name = name;
            } else {
                this.namespace = namespace;
                this.name = name;
            }
            this.hashCode = createHashCode();
            this.nameParameters = nameParameters;
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_DEF_DESCRIPTOR_CREATION);
        }
        loggingService.incrementNum(LoggingService.DEF_DESCRIPTOR_COUNT);
    }
View Full Code Here

        }
    }

    @Override
    public void tearDown() throws Exception {
        LoggingService loggingService = Aura.getLoggingService();
        if (loggingService != null) {
            loggingService.release();
        }
        try {
            resetMocks();
        } catch (Throwable t) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, t.getMessage(), t);
View Full Code Here

        // make sure we actually received a csp-report
        if (report.containsKey(JSON_NAME)) {
            report.put(HttpHeaders.USER_AGENT, req.getHeader(HttpHeaders.USER_AGENT));
           
            LoggingService ls = Aura.getLoggingService();
            ls.establish();
            try {
                ls.logCSPReport(report);
            } finally {
                ls.release();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.auraframework.service.LoggingService

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.