001/*
002 * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     vpasquier <vpasquier@nuxeo.com>
016 *     slacoin <slacoin@nuxeo.com>
017 */
018
019package org.nuxeo.ecm.automation.core.trace;
020
021import java.util.Map;
022
023import org.nuxeo.ecm.automation.OperationContext;
024import org.nuxeo.ecm.automation.OperationType;
025import org.nuxeo.ecm.automation.core.impl.ChainTypeImpl;
026import org.nuxeo.ecm.automation.core.impl.InvokableMethod;
027
028/**
029 * Automation tracer recording all automation execution traces when mode activated.
030 *
031 * @since 5.7.3
032 */
033public class Tracer extends BasedTracer {
034
035    protected Tracer(TracerFactory factory, Boolean printable) {
036        super(factory, printable);
037    }
038
039    @Override
040    public void onOperation(OperationContext context, OperationType type, InvokableMethod method,
041            Map<String, Object> params) {
042        if (type instanceof ChainTypeImpl) {
043            pushContext(type);
044            return;
045        }
046        Call call = new Call(chain, context, type, method, params);
047        calls.add(call);
048    }
049
050}