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-2007 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 package org.netbeans.spi.java.queries; 20 21 import java.net.URL; 22 import org.netbeans.api.java.queries.BinaryForSourceQuery; 23 24 /** 25 * Information about where binaries (classfiles) corresponding to 26 * Java sources can be found, this is intended to be the inverse of 27 * the SourceForBinaryQueryImplementation. 28 * @see BinaryForSourceQuery 29 * @see SourceForBinaryQuery 30 * @see SourceForBinaryQueryImplementation 31 * @since org.netbeans.api.java/1 1.12 32 * @author Tomas Zezula 33 */ 34 public interface BinaryForSourceQueryImplementation { 35 36 /** 37 * Returns the binary root(s) for a given source root. 38 * <p> 39 * The returned BinaryForSourceQuery.Result must be a singleton. It means that for 40 * repeated calling of this method with the same recognized root the method has to 41 * return the same instance of BinaryForSourceQuery.Result.<br> 42 * The typical implemantation of the findBinaryRoots contains 3 steps: 43 * <ol> 44 * <li>Look into the cache if there is already a result for the root, if so return it</li> 45 * <li>Check if the sourceRoot is recognized, if not return null</li> 46 * <li>Create a new BinaryForSourceQuery.Result for the sourceRoot, put it into the cache 47 * and return it.</li> 48 * </ol> 49 * </p> 50 * <p> 51 * Any absolute URL may be used but typically it will use the <code>file</code> 52 * protocol for directory entries and <code>jar</code> protocol for JAR entries 53 * (e.g. <samp>jar:file:/tmp/foo.jar!/</samp>). 54 * </p> 55 * @param sourceRoot the source path root 56 * @return a result object encapsulating the answer or null if the sourceRoot is not recognized 57 */ 58 public BinaryForSourceQuery.Result findBinaryRoots(URL sourceRoot); 59 60 } 61