1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.spi.queries; 21 22 import java.io.File; 23 24 /** 25 * Determine whether files should be shared (for example in a VCS) or are intended 26 * to be unshared. 27 * <div class="nonnormative"> 28 * <p> 29 * Could be implemented e.g. by project types which know that certain files or folders in 30 * a project (e.g. <samp>src/</samp>) are intended for VCS sharing while others 31 * (e.g. <samp>build/</samp>) are not. 32 * </p> 33 * <p> 34 * Note that the Project API module registers a default implementation of this query 35 * which delegates to the project which owns the queried file, if there is one. 36 * This is more efficient than searching instances in global lookup, so use that 37 * facility wherever possible. 38 * </p> 39 * </div> 40 * <p> 41 * Threading note: implementors should avoid acquiring locks that might be held 42 * by other threads. Generally treat this interface similarly to SPIs in 43 * {@link org.openide.filesystems} with respect to threading semantics. 44 * </p> 45 * @see org.netbeans.api.queries.SharabilityQuery 46 * @see <a HREF="@ANT/PROJECT@/org/netbeans/spi/project/support/ant/AntProjectHelper.html#createSharabilityQuery(java.lang.String[],%20java.lang.String[])"><code>AntProjectHelper.createSharabilityQuery(...)</code></a> 47 * @author Jesse Glick 48 */ 49 public interface SharabilityQueryImplementation { 50 51 /** 52 * Check whether a file or directory should be shared. 53 * If it is, it ought to be committed to a VCS if the user is using one. 54 * If it is not, it is either a disposable build product, or a per-user 55 * private file which is important but should not be shared. 56 * @param file a file to check for sharability (may or may not yet exist) 57 * @return one of {@link org.netbeans.api.queries.SharabilityQuery}'s constants 58 */ 59 int getSharability(File file); 60 61 } 62