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 * Gather available operations for the specified FileObject and put them into specified operationsList. 033 * 034 * @param operationsList the list of available operations for the specified FileObject. The operationList contains 035 * classes of available operations, e.g. Class objects. 036 * @param file the FileObject for which we want to get the list of available operations. 037 * 038 * @throws FileSystemException if list of operations cannot be retrieved. 039 */ 040 void collectOperations(final Collection<Class<? extends FileOperation>> operationsList, final FileObject file) 041 throws FileSystemException; 042 043 /** 044 * Get implementation for a given FileObject and FileOperation interface. 045 * 046 * @param file the FileObject for which we need a operation. 047 * @param operationClass the Class which instance we are needed. 048 * @return the required operation instance. 049 * 050 * @throws FileSystemException if operation cannot be retrieved. 051 */ 052 FileOperation getOperation(final FileObject file, final Class<? extends FileOperation> operationClass) 053 throws FileSystemException; 054}