001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation;
013
014import java.util.List;
015import java.util.Map;
016
017import org.nuxeo.ecm.automation.core.impl.InvokableMethod;
018
019/**
020 * Describe an operation class. Each registered operation will be stored in the registry as an instance of this class.
021 *
022 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
023 */
024public interface OperationType {
025
026    String getId();
027
028    /**
029     * The operation ID Aliases array.
030     *
031     * @since 7.1
032     */
033    String[] getAliases();
034
035    Class<?> getType();
036
037    /**
038     * The input type of a chain/operation. If set, the following input types {"document", "documents", "blob", "blobs"}
039     * for all 'run method(s)' will handled. Other values will be adapted as java.lang.Object. If not set, Automation
040     * will set the input type(s) as the 'run methods(s)' parameter types (by introspection).
041     *
042     * @since 7.4
043     */
044    String getInputType();
045
046    Object newInstance(OperationContext ctx, Map<String, Object> args) throws OperationException;
047
048    /**
049     * Gets the service that registered that type.
050     */
051    AutomationService getService();
052
053    OperationDocumentation getDocumentation() throws OperationException;
054
055    /**
056     * Gets the name of the component that contributed the operation
057     *
058     * @return
059     */
060    String getContributingComponent();
061
062    InvokableMethod[] getMethodsMatchingInput(Class<?> in);
063
064    /**
065     * @since 5.7.2
066     */
067    public List<InvokableMethod> getMethods();
068}