Package org.auraframework.service

Examples of org.auraframework.service.LoggingService


     * method should be templated and defined in the interface, because the same
     * thing exists in its apex counterpart.
     */
    public Object getValueFrom(Object obj) {
        try {
            LoggingService loggingService = Aura.getLoggingService();
            loggingService.incrementNum("JavaCallCount");
            return getter.invoke(obj);
        } catch (IllegalArgumentException e) {
            throw new AuraRuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new AuraRuntimeException(e);
View Full Code Here


     * @param attributes
     * @throws QuickFixException
     */
    public BaseComponentImpl(DefDescriptor<D> descriptor, Map<String, Object> attributes) throws QuickFixException {
        this(descriptor, null, (Map<String, Object>) null, null, null);
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_COMPONENT_CREATION);
        try {
            this.attributeSet.set(attributes);
            finishInit();
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_COMPONENT_CREATION);
        }
        Aura.getContextService().getCurrentContext().getInstanceStack().popInstance(this);
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public <T extends D> BaseComponentImpl(T def, Map<String, Object> attributes) throws QuickFixException {
        this((DefDescriptor<D>) def.getDescriptor(), null, (Map<String, Object>) null, null, def);
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_COMPONENT_CREATION);
        try {
            this.attributeSet.set(attributes);
            finishInit();
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_COMPONENT_CREATION);
        }
        Aura.getContextService().getCurrentContext().getInstanceStack().popInstance(this);
    }
View Full Code Here

     * @throws QuickFixException
     */
    public BaseComponentImpl(DefDescriptor<D> descriptor, Collection<AttributeDefRef> attributeDefRefs,
            BaseComponent<?, ?> attributeValueProvider, String localId) throws QuickFixException {
        this(descriptor, attributeValueProvider, null, null, null);
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_COMPONENT_CREATION);
        try {
            this.attributeSet.set(attributeDefRefs);
            finishInit();
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_COMPONENT_CREATION);
        }
        Aura.getContextService().getCurrentContext().getInstanceStack().popInstance(this);
        this.localId = localId;
    }
View Full Code Here

     * @throws QuickFixException
     */
    protected BaseComponentImpl(DefDescriptor<D> descriptor, I extender, BaseComponent<?, ?> attributeValueProvider,
            I concreteComponent) throws QuickFixException {
        this(descriptor, attributeValueProvider, null, extender, null);
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_COMPONENT_CREATION);
        try {
            this.concreteComponent = concreteComponent;
            attributeSet.set(extender.getDescriptor().getDef().getFacets(), extender.getAttributes());
            finishInit();
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_COMPONENT_CREATION);
        }
        Aura.getContextService().getCurrentContext().getInstanceStack().popInstance(this);
    }
View Full Code Here

        if (parent != null) {
            // Insure that the parent is allowed to create an instance of this component
            defRegistry.assertAccess(parent.getDescriptor(), desc.getDef());
        }

        LoggingService loggingService = Aura.getLoggingService();
        loggingService.startTimer(LoggingService.TIMER_COMPONENT_CREATION);
        try {
            this.globalId = getNextGlobalId();

            this.attributeSet = new AttributeSetImpl(desc, attributeValueProvider, this);

            if (valueProviders != null) {
                this.valueProviders.putAll(valueProviders);
            }

            this.valueProviders.put(ValueProviderType.VIEW.getPrefix(), attributeSet);

            // def can be null if a definition not found exception was thrown for that definition. Odd.
            if (def != null) {
                ControllerDef cd = def.getDeclaredControllerDef();
                if (cd != null) {
                    // Insure that this def is allowed to create an instance of the controller
                    defRegistry.assertAccess(descriptor, cd);

                    this.valueProviders.put(ValueProviderType.CONTROLLER.getPrefix(), cd);
                }
            }

            loggingService.incrementNum(LoggingService.CMP_COUNT);
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_COMPONENT_CREATION);
        }
    }
View Full Code Here

    }

    @Override
    public void serialize(Json json) throws IOException {
        json.writeMapBegin();
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION_AURA);
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("java");
        try {
            for (JavaValueDef member : this.modelDef.getAllMembers()) {
                Object value = member.getValueFrom(bean);
                String typeName = null;
                if (value == null) {
                    try {
                        typeName = member.getType().toString();
                    } catch (QuickFixException qfe) {
                        // Uh, swallow this and just treat it as not-a-list, not-a-map.
                        // It probably should never happen, but we don't want to choke for it.
                    }
                }
                json.writeMapEntry(member.getName(), value, typeName);
            }
        } finally {
            loggingService.stopTimer("java");
            loggingService.startTimer(LoggingService.TIMER_AURA);
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION_AURA);
        }
        json.writeMapEnd();
    }
View Full Code Here

     * @param root The object from which we want to extract the property
     * @param key the key for the property.
     * @param def the model definition.
     */
    public static Object getValue(Object root, PropertyReference key, ModelDef def) throws QuickFixException {
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("java");
        Object ret = null;
        try {
            String part = key.getRoot();
            PropertyReference stem = key.getStem();
            if (root == null) {
                return null;
            } else if (root instanceof Map) {
                ret = ((Map<?, ?>) root).get(part);
            } else if (root instanceof List) {
                List<?> l = ((List<?>) root);
                // special case for length property
                if ("length".equals(part)) {
                    ret = l.size();
                } else {
                    int i;

                    try {
                        i = Integer.parseInt(part); // NumberFormatException will be caught below
                    } catch (NumberFormatException nfe) {
                        throw makeException(nfe.getMessage(), nfe, def);
                    }
                    ret = ((List<?>) root).get(i);
                }
            } else {
                Method meth = null;
                try {
                    meth = root.getClass().getMethod("get" + AuraTextUtil.initCap(part));
                } catch (NoSuchMethodException e) {
                    try {
                        meth = root.getClass().getMethod("is" + AuraTextUtil.initCap(part));
                    } catch (NoSuchMethodException nme) {
                        throw makeException("no such property: " + part, e, def);
                    }
                }
                try {
                    ret = meth.invoke(root);
                } catch (IllegalAccessException iae) {
                    throw makeException("no such property: " + part, iae, def);
                } catch (InvocationTargetException ite) {
                    throw makeException(ite.getCause().getMessage(), ite.getCause(), def);
                }
                loggingService.incrementNum("JavaCallCount");
            }
            ValueProvider vp;
            if (def != null) {
                TypeDef typeDef = def.getType(part);
                vp = (ret instanceof ValueProvider) ? (ValueProvider) ret : (ValueProvider) typeDef.wrap(ret);
            } else {
                vp = (ret instanceof ValueProvider) ? (ValueProvider) ret : new JavaValueProvider(ret);
            }
            if (stem != null) {
                ret = vp.getValue(stem);
            }
        } catch (AuraRuntimeException lre) {
            throw lre;
        } catch (Exception e) {
            throw makeException(e.getMessage(), e, def);
        } finally {
            loggingService.stopTimer("java");
            loggingService.startTimer(LoggingService.TIMER_AURA);
        }

        return ret;
    }
View Full Code Here

    }

    @Override
    public ComponentConfig provide(DefDescriptor<? extends RootDefinition> intfDescriptor) throws QuickFixException {
        ComponentConfig config = null;
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("java");
        try {
            if (configProvider != null) {
                config = configProvider.provide();
                loggingService.incrementNum("JavaCallCount");
            } else if (descriptorProvider != null) {
                config = new ComponentConfig();
                config.setDescriptor(descriptorProvider.provide());
                loggingService.incrementNum("JavaCallCount");
            }
        } catch (Exception e) {
            throw AuraExceptionUtil.wrapExecutionException(e, this.location);
        } finally {
            loggingService.stopTimer("java");
            loggingService.startTimer(LoggingService.TIMER_AURA);
        }

        return config;
    }
View Full Code Here

    }

    @Override
    public ComponentConfig provide(ComponentDefRefBuilder ref) throws QuickFixException {
        ComponentConfig config = null;
        LoggingService loggingService = Aura.getLoggingService();
        loggingService.stopTimer(LoggingService.TIMER_AURA);
        loggingService.startTimer("java");

        try {
            config = staticConfigProvider.provide(ref);
            loggingService.incrementNum("JavaCallCount");
        } catch (Exception e) {
            throw AuraExceptionUtil.wrapExecutionException(e, this.location);
        } finally {
            loggingService.stopTimer("java");
            loggingService.startTimer(LoggingService.TIMER_AURA);
        }

        return config;
    }
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.