001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     bstefanescu
018 */
019package org.nuxeo.ecm.automation;
020
021import java.util.List;
022import java.util.Map;
023
024import org.nuxeo.ecm.automation.core.impl.InvokableMethod;
025
026/**
027 * Describe an operation class. Each registered operation will be stored in the registry as an instance of this class.
028 *
029 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
030 */
031public interface OperationType {
032
033    String getId();
034
035    /**
036     * The operation ID Aliases array.
037     *
038     * @since 7.1
039     */
040    String[] getAliases();
041
042    Class<?> getType();
043
044    /**
045     * The input type of a chain/operation. If set, the following input types {"document", "documents", "blob", "blobs"}
046     * for all 'run method(s)' will handled. Other values will be adapted as java.lang.Object. If not set, Automation
047     * will set the input type(s) as the 'run methods(s)' parameter types (by introspection).
048     *
049     * @since 7.4
050     */
051    String getInputType();
052
053    Object newInstance(OperationContext ctx, Map<String, Object> args) throws OperationException;
054
055    /**
056     * Gets the service that registered that type.
057     */
058    AutomationService getService();
059
060    OperationDocumentation getDocumentation() throws OperationException;
061
062    /**
063     * Gets the name of the component that contributed the operation
064     *
065     * @return
066     */
067    String getContributingComponent();
068
069    InvokableMethod[] getMethodsMatchingInput(Class<?> in);
070
071    /**
072     * @since 5.7.2
073     */
074    public List<InvokableMethod> getMethods();
075}