1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 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;
15 
16 import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
17 import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
18 
19 /**
20  * Interface describing the {@link IApiBaselineManager}
21  *
22  * @noimplement This interface is not intended to be implemented by clients.
23  * @since 1.0.0
24  */
25 public interface IApiBaselineManager {
26 
27 	/**
28 	 * Allows a new profile to be added to the managers' cache of baselines. New
29 	 * baselines are added to the cache on a replace policy, meaning if there
30 	 * already exists an {@link IApiBaseline} entry it will be replaced with the
31 	 * new baseline provided. If <code>null</code> is passed in as a new
32 	 * baseline no work is done.
33 	 *
34 	 * @param newbaseline the new baseline to add to the manager
35 	 */
addApiBaseline(IApiBaseline newbaseline)36 	public void addApiBaseline(IApiBaseline newbaseline);
37 
38 	/**
39 	 * Returns the complete listing of {@link IApiBaseline}s contained in the
40 	 * manager or an empty array, never <code>null</code>.
41 	 *
42 	 * @return the complete listing of {@link IApiBaseline}s or an empty array
43 	 */
getApiBaselines()44 	public IApiBaseline[] getApiBaselines();
45 
46 	/**
47 	 * Returns the {@link IApiBaseline} object with the given id, or
48 	 * <code>null</code> if there is no profile with the given id.
49 	 *
50 	 * @param name the name of the profile to fetch
51 	 * @return the {@link IApiBaseline} with the given id or <code>null</code>
52 	 */
getApiBaseline(String name)53 	public IApiBaseline getApiBaseline(String name);
54 
55 	/**
56 	 * Removes the {@link IApiBaseline} with the given id from the manager,
57 	 * which propagates to the file-system to remove the underlying stored
58 	 * baseline (if it exists).
59 	 *
60 	 * @param name the unique name of the baseline to remove from the manager
61 	 * @return true if the removal was successful false otherwise. A successful
62 	 *         removal constitutes the associated baseline being removed from
63 	 *         the manager and/or the persisted state file being removed from
64 	 *         disk.
65 	 */
removeApiBaseline(String name)66 	public boolean removeApiBaseline(String name);
67 
68 	/**
69 	 * Allows the {@link IApiBaseline} with the specified id to be set as the
70 	 * default baseline. This method will accept <code>null</code>, which will
71 	 * remove a default {@link IApiBaseline} setting.
72 	 *
73 	 * @param name the name of the {@link IApiBaseline} to be the default
74 	 */
setDefaultApiBaseline(String name)75 	public void setDefaultApiBaseline(String name);
76 
77 	/**
78 	 * Returns the {@link IApiBaseline} that is the current default, or
79 	 * <code>null</code> if one has not been set, or the currently specified id
80 	 * for the default baseline no longer exists.
81 	 *
82 	 * @return the default {@link IApiBaseline} or <code>null</code>
83 	 */
getDefaultApiBaseline()84 	public IApiBaseline getDefaultApiBaseline();
85 
86 	/**
87 	 * Returns the workspace baseline. Creates a new one if one does not exist.
88 	 * If this method is called without the framework running it returns
89 	 * <code>null</code>
90 	 * <p>
91 	 * The workspace baseline should be re-retrieved each time it is required as
92 	 * some workspace modifications cause the underlying baseline object to
93 	 * change (for example, modification of MANIFEST.MF, build.properties, or
94 	 * project build paths).
95 	 * </p>
96 	 *
97 	 * @return the workspace baseline or <code>null</code>
98 	 */
getWorkspaceBaseline()99 	public IApiBaseline getWorkspaceBaseline();
100 
101 	/**
102 	 * Returns the API component the workspace baseline with the given symbolic
103 	 * name or <code>null</code> if none.
104 	 *
105 	 * @param symbolicName bundle symbolic name
106 	 * @return API component from the workspace baseline or <code>null</code>
107 	 */
getWorkspaceComponent(String symbolicName)108 	public IApiComponent getWorkspaceComponent(String symbolicName);
109 }
110