1 package com.trendmicro.grid.acl.ds; 2 3 import com.trendmicro.grid.acl.ds.datatypes.SharedFileDetails; 4 import com.trendmicro.grid.acl.ds.datatypes.SharedFileInformation; 5 import com.trendmicro.grid.acl.l0.datatypes.FileIdentiferListPage; 6 import com.trendmicro.grid.acl.l0.datatypes.FileIdentifier; 7 import com.trendmicro.grid.acl.l0.datatypes.Range; 8 9 import java.util.Collection; 10 11 /** 12 * Defines a readonly repository that provides information on files. 13 * 14 * @author juergen_kellerer, 2010-05-06 15 * @version 1.0 16 */ 17 public interface FileProvider extends Repository { 18 19 /** 20 * Returns true if the identified files exist inside the CoreDB and are not marked 'unknown'. 21 * 22 * @param files the files to check. 23 * @return a collection that contains the results of the requested files. 24 */ 25 Collection<Boolean> isFilesKnown(Collection<FileIdentifier> files); 26 27 /** 28 * Returns true if the given files are tagged with the specified tags. 29 * 30 * @param files The files to verify. 31 * @param tags The tags to check against. 32 * @return True if the tags apply to the files, false if not, 'null' if the file is unknown. 33 */ 34 Collection<Boolean> isFilesTaggedWith(Collection<FileIdentifier> files, String[] tags); 35 36 /** 37 * Returns all known files that are matched by the given tag expression. 38 * 39 * @param expression An expression following the tag query grammar used to identify files. 40 * @param range A range limiting the output or 'null' if no range is specified. 41 * @param pageNumber The number of the list page to return, starting from 0 for the first chunk. 42 * @return A chunk of file identifiers for the files, matching the given expression or 43 * 'null' if no chunk exists under the given number. 44 */ 45 FileIdentiferListPage getMatchingFiles(TagQueryExpression expression, Range range, int pageNumber); 46 47 /** 48 * Returns the canonical list of identifiers for the given file ids. 49 * <p/> 50 * Note: This is useful when using identifiers that are missing certain hashes. 51 * The method will ensure that SHA1 and MD5 are filled and valid. 52 * 53 * @param files The files to return the canonical list for. 54 * @return the canonical file identifier list for the given file ids. The list may contain 'null' 55 * entries if the corresponding file was unknown. 56 */ 57 Collection<FileIdentifier> getCanonicalIdentifiers(Collection<FileIdentifier> files); 58 59 /** 60 * Returns the file information list for the given files. 61 * 62 * @param files The files to return the information list for. 63 * @return the file information list for the given file. The list may contain 'null' 64 * entries if the corresponding file was unknown. 65 */ 66 Collection<SharedFileInformation> getFileInformationList(Collection<FileIdentifier> files); 67 68 /** 69 * Returns the file details list for the given files. 70 * 71 * @param files The files to return the details list for. 72 * @return the file details list for the given file. The list may contain 'null' 73 * entries if the corresponding file was unknown. 74 */ 75 Collection<SharedFileDetails> getFileDetailsList(Collection<FileIdentifier> files); 76 }