001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.vfs2.operations;
018
019import java.util.Collection;
020
021import org.apache.commons.vfs2.FileObject;
022import org.apache.commons.vfs2.FileSystemException;
023
024/**
025 * FileOperationProvider is responsible for dealing with FileOperation's.
026 *
027 * @since 0.1
028 */
029public interface FileOperationProvider {
030
031    /**
032     * Empty array.
033     *
034     * @since 2.9.0
035     */
036    FileOperationProvider[] EMPTY_ARRAY = {};
037
038    /**
039     * Gather available operations for the specified FileObject and put them into specified operationsList.
040     *
041     * @param operationsList the list of available operations for the specified FileObject. The operationList contains
042     *            classes of available operations, e.g. Class objects.
043     * @param file the FileObject for which we want to get the list of available operations.
044     * @throws FileSystemException if list of operations cannot be retrieved.
045     */
046    void collectOperations(Collection<Class<? extends FileOperation>> operationsList, FileObject file) throws FileSystemException;
047
048    /**
049     * Gets implementation for a given FileObject and FileOperation interface.
050     *
051     * @param file the FileObject for which we need an operation.
052     * @param operationClass the Class which instance we are needed.
053     * @return the required operation instance.
054     * @throws FileSystemException if operation cannot be retrieved.
055     */
056    FileOperation getOperation(FileObject file, Class<? extends FileOperation> operationClass) throws FileSystemException;
057}