1 /******************************************************************************* 2 * Copyright (c) 2007, 2009 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.pde.api.tools.internal.provisional.model; 15 16 import org.eclipse.core.runtime.CoreException; 17 18 /** 19 * A container which can contain a set of source or class files. 20 * 21 * @since 1.0.0 22 */ 23 public interface IApiTypeContainer extends IApiElement { 24 25 /** 26 * Container type that is a JAR or ZIP archive 27 */ 28 public static final int ARCHIVE = 1; 29 /** 30 * Container type that is a folder rooted in the file system 31 */ 32 public static final int DIRECTORY = 2; 33 /** 34 * Container type that is a folder rooted in the workspace 35 */ 36 public static final int FOLDER = 3; 37 /** 38 * Container type that is an {@link IApiComponent} 39 */ 40 public static final int COMPONENT = 4; 41 42 /** 43 * Returns the names of all packages in this container in dot separated 44 * format. Does not include empty packages. 45 * 46 * @return names of all packages in this container 47 * @exception if unable to retrieve package names 48 */ getPackageNames()49 public String[] getPackageNames() throws CoreException; 50 51 /** 52 * Returns the {@link IApiTypeRoot} with the given fully qualified name or 53 * <code>null</code> if none. 54 * 55 * @param qualifiedName fully qualified type name. Package names are dot 56 * separated and type names are '$'-separated. 57 * @return {@link IApiTypeRoot} or <code>null</code> 58 * @exception if an exception occurs retrieving the class file 59 */ findTypeRoot(String qualifiedName)60 public IApiTypeRoot findTypeRoot(String qualifiedName) throws CoreException; 61 62 /** 63 * Returns the {@link IApiTypeRoot} with the given fully qualified name 64 * coming from the component with the given id or <code>null</code> if none. 65 * 66 * @param qualifiedName fully qualified type name. Package names are dot 67 * separated and type names are '$'-separated. 68 * @param id the API component id to consider 69 * @return {@link IApiTypeRoot} or <code>null</code> 70 * @exception if an exception occurs retrieving the class file 71 */ findTypeRoot(String qualifiedName, String id)72 public IApiTypeRoot findTypeRoot(String qualifiedName, String id) throws CoreException; 73 74 /** 75 * Visits all {@link IApiTypeRoot} in this container. 76 * 77 * @param visitor class file visitor. 78 * @exception CoreException if unable to visit this container 79 */ accept(ApiTypeContainerVisitor visitor)80 public void accept(ApiTypeContainerVisitor visitor) throws CoreException; 81 82 /** 83 * Closes this {@link IApiTypeContainer}. The container may still be used 84 * after closing, but clients should close the container when they are done 85 * with it to free system resources. 86 * 87 * @throws CoreException if closing fails 88 */ close()89 public void close() throws CoreException; 90 91 /** 92 * Returns the kind of container this is, one of: 93 * <ul> 94 * <li>{@link #ARCHIVE}</li> 95 * <li>{@link #DIRECTORY}</li> 96 * <li>{@link #FOLDER}</li> 97 * <li>{@link #STUB}</li> 98 * </ul> 99 * 100 * @return the type of container this is 101 */ getContainerType()102 public int getContainerType(); 103 } 104