1 /*******************************************************************************
2  * Copyright (c) 2005, 2012 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.jdt.launching.environments;
15 
16 import java.util.Map;
17 import java.util.Properties;
18 
19 import org.eclipse.jdt.core.IAccessRule;
20 import org.eclipse.jdt.core.IJavaProject;
21 import org.eclipse.jdt.launching.IVMInstall;
22 import org.eclipse.jdt.launching.LibraryLocation;
23 
24 /**
25  * An execution environment describes capabilities of
26  * a Java runtime environment (<code>IVMInstall</code>).
27  * <p>
28  * An execution environment is contributed in plug-in XML via the
29  * <code>org.eclipse.jdt.launching.executionEnvironments</code> extension
30  * point.
31  * </p>
32  * <p>
33  * Clients contributing execution environments may provide and implement execution environment
34  * analyzer delegates.
35  * </p>
36  * @since 3.2
37  * @see IExecutionEnvironmentAnalyzerDelegate
38  * @noimplement This interface is not intended to be implemented by clients.
39  * @noextend This interface is not intended to be extended by clients.
40  */
41 public interface IExecutionEnvironment {
42 
43 	/**
44 	 * Returns a unique identifier for this execution environment.
45 	 * Corresponds to the <code>id</code> attribute in plug-in XML.
46 	 *
47 	 * @return unique identifier of this execution environment
48 	 */
getId()49 	public String getId();
50 
51 	/**
52 	 * Returns a brief human-readable description of this environment.
53 	 *
54 	 * @return brief human-readable description of this environment.
55 	 */
getDescription()56 	public String getDescription();
57 
58 	/**
59 	 * Returns a collection of VM installs compatible with this environment,
60 	 * possibly empty.
61 	 *
62 	 * @return a collection of VM installs compatible with this environment,
63 	 *  possibly empty.
64 	 */
getCompatibleVMs()65 	public IVMInstall[] getCompatibleVMs();
66 
67 	/**
68 	 * Returns whether the specified VM install is strictly compatible with
69 	 * this environment. Returns <code>true</code> to indicate the VM install
70 	 * is strictly compatible with this environment and <code>false</code> to indicate
71 	 * the VM install represents a superset of this environment.
72 	 *
73 	 * @param vm VM install
74 	 * @return whether the VM install is strictly compatible with this environment
75 	 */
isStrictlyCompatible(IVMInstall vm)76 	public boolean isStrictlyCompatible(IVMInstall vm);
77 
78 	/**
79 	 * Returns the VM that is used by default for this execution environment,
80 	 * or <code>null</code> if none.
81 	 *
82 	 * @return default VM for this environment or <code>null</code> if none
83 	 */
getDefaultVM()84 	public IVMInstall getDefaultVM();
85 
86 	/**
87 	 * Sets the VM to use by default for this execution environment.
88 	 *
89 	 * @param vm VM to use by default for this execution environment,
90 	 *  or <code>null</code> to clear the default setting
91 	 * @exception IllegalArgumentException if the given VM is not compatible with
92 	 *  this environment
93 	 */
setDefaultVM(IVMInstall vm)94 	public void setDefaultVM(IVMInstall vm);
95 
96 	/**
97 	 * Returns a collection of access rules to be applied to the specified VM
98 	 * libraries for this execution environment in the context of the given project.
99 	 * An array of access rules is returned for each library specified by
100 	 * <code>libraries</code>, possibly empty.
101 	 * <p>
102 	 * Access rules for an execution environment are defined by access rule participants
103 	 * contributed in a <code>org.eclipse.jdt.launching.executionEnvironments</code>
104 	 * extension.
105 	 * </p>
106 	 * @param vm the VM that access rules are requested for
107 	 * @param libraries the libraries that access rules are requested for
108 	 * @param project the project the access rules are requested for or <code>null</code> if none
109 	 * @return a collection of arrays of access rules - one array per library
110 	 * @since 3.3
111 	 */
getAccessRules(IVMInstall vm, LibraryLocation[] libraries, IJavaProject project)112 	public IAccessRule[][] getAccessRules(IVMInstall vm, LibraryLocation[] libraries, IJavaProject project);
113 
114 	/**
115 	 * Returns the OSGi profile properties associated with this execution environment
116 	 * or <code>null</code> if none. Profile properties specify attributes such as
117 	 * {@link org.osgi.framework.Constants#FRAMEWORK_SYSTEMPACKAGES}. Profile properties
118 	 * can be optionally contributed with an execution environment extension.
119 	 *
120 	 * @return associated profile properties or <code>null</code> if none
121 	 * @since 3.5
122 	 */
getProfileProperties()123 	public Properties getProfileProperties();
124 
125 	/**
126 	 * Returns a collection of execution environments that are subsets of this environment.
127 	 *
128 	 * @return a collection of execution environments that are subsets of this environment
129 	 * @since 3.5
130 	 */
getSubEnvironments()131 	public IExecutionEnvironment[] getSubEnvironments();
132 
133 	/**
134 	 * Returns a map of Eclipse Java compiler options specified as default settings to
135 	 * use when building with this profile, or <code>null</code> if unspecified.
136 	 *
137 	 * @return a map of Eclipse Java compiler options associated with this profile or
138 	 * 	<code>null</code>
139 	 * @since 3.5
140 	 */
getComplianceOptions()141 	public Map<String, String> getComplianceOptions();
142 }
143