Package org.eclipse.jdt.launching
Class AbstractVMInstall
java.lang.Object
org.eclipse.jdt.launching.AbstractVMInstall
- All Implemented Interfaces:
IVMInstall
,IVMInstall2
,IVMInstall3
- Direct Known Subclasses:
VMStandin
public abstract class AbstractVMInstall
extends Object
implements IVMInstall, IVMInstall2, IVMInstall3
Abstract implementation of a VM install.
Clients implementing VM installs must subclass this class.
-
Constructor Summary
ConstructorDescriptionAbstractVMInstall
(IVMInstallType type, String id) Constructs a new VM install. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Throws a core exception with an error status object built from the given message, lower level exception, and error code.boolean
evaluateSystemProperties
(String[] properties, org.eclipse.core.runtime.IProgressMonitor monitor) Evaluates the specified system properties in this VM, returning the result as a map of property names to property values.getAttribute
(String key) Returns a VM specific attribute associated with the given key ornull
if none.Returns a map of VM specific attributes stored with this VM install.getId()
Returns the id for this VM.Returns the root directory of the install location of this VM.Returns the Javadoc location associated with this VM install.Returns a string representing thejava.version
system property of this VM install, ornull
if unknown.Returns the library locations of this IVMInstall.getName()
Returns the display name of this VM.Returns VM arguments to be used with this vm install whenever this VM is launched as a raw string, ornull
if none.String[]
Returns VM arguments to be used with this vm install whenever this VM is launched as they should be passed to the command line, ornull
if none.Returns the VM type of this VM.getVMRunner
(String mode) Returns a VM runner that runs this installed VM in the given mode.int
hashCode()
void
setAttribute
(String key, String value) Sets a VM specific attribute.void
setInstallLocation
(File installLocation) Sets the root directory of the install location of this VM.void
setJavadocLocation
(URL url) Sets the Javadoc location associated with this VM install.void
setLibraryLocations
(LibraryLocation[] locations) Sets the library locations of this IVMInstall.void
Sets the display name of this VM.protected void
setNotify
(boolean notify) Whether this VM should fire property change notifications.void
Sets VM arguments to be used with this vm install whenever this VM is launched as a raw string, possiblynull
.void
setVMArguments
(String[] vmArgs) Sets VM arguments to be used with this vm install whenever this VM is launched, possiblynull
.
-
Constructor Details
-
AbstractVMInstall
Constructs a new VM install.- Parameters:
type
- The type of this VM install. Must not benull
id
- The unique identifier of this VM instance Must not benull
.- Throws:
IllegalArgumentException
- if any of the required parameters arenull
.
-
-
Method Details
-
getId
Description copied from interface:IVMInstall
Returns the id for this VM. VM IDs are unique within the VMs of a given VM type. The VM id is not intended to be presented to users.- Specified by:
getId
in interfaceIVMInstall
- Returns:
- the VM identifier. Must not return
null
.
-
getName
Description copied from interface:IVMInstall
Returns the display name of this VM. The VM name is intended to be presented to users.- Specified by:
getName
in interfaceIVMInstall
- Returns:
- the display name of this VM. May return
null
.
-
setName
Description copied from interface:IVMInstall
Sets the display name of this VM. The VM name is intended to be presented to users.- Specified by:
setName
in interfaceIVMInstall
- Parameters:
name
- the display name of this VM
-
getInstallLocation
Description copied from interface:IVMInstall
Returns the root directory of the install location of this VM.- Specified by:
getInstallLocation
in interfaceIVMInstall
- Returns:
- the root directory of this VM installation. May
return
null
.
-
setInstallLocation
Description copied from interface:IVMInstall
Sets the root directory of the install location of this VM.- Specified by:
setInstallLocation
in interfaceIVMInstall
- Parameters:
installLocation
- the root directory of this VM installation
-
getVMInstallType
Description copied from interface:IVMInstall
Returns the VM type of this VM.- Specified by:
getVMInstallType
in interfaceIVMInstall
- Returns:
- the VM type that created this IVMInstall instance
-
getVMRunner
Description copied from interface:IVMInstall
Returns a VM runner that runs this installed VM in the given mode.- Specified by:
getVMRunner
in interfaceIVMInstall
- Parameters:
mode
- the mode the VM should be launched in; one of the constants declared inorg.eclipse.debug.core.ILaunchManager
- Returns:
- a VMRunner for a given mode May return
null
if the given mode is not supported by this VM. - See Also:
-
ILaunchManager
-
getLibraryLocations
Description copied from interface:IVMInstall
Returns the library locations of this IVMInstall. Generally, clients should useJavaRuntime.getLibraryLocations(IVMInstall)
to determine the libraries associated with this VM install.- Specified by:
getLibraryLocations
in interfaceIVMInstall
- Returns:
- The library locations of this IVMInstall.
Returns
null
to indicate that this VM install uses the default library locations associated with this VM's install type. - See Also:
-
setLibraryLocations
Description copied from interface:IVMInstall
Sets the library locations of this IVMInstall.- Specified by:
setLibraryLocations
in interfaceIVMInstall
- Parameters:
locations
- TheLibraryLocation
s to associate with this IVMInstall. May benull
to indicate that this VM install uses the default library locations associated with this VM's install type.
-
getJavadocLocation
Description copied from interface:IVMInstall
Returns the Javadoc location associated with this VM install.- Specified by:
getJavadocLocation
in interfaceIVMInstall
- Returns:
- a url pointing to the Javadoc location associated with
this VM install, or
null
if none
-
setJavadocLocation
Description copied from interface:IVMInstall
Sets the Javadoc location associated with this VM install.- Specified by:
setJavadocLocation
in interfaceIVMInstall
- Parameters:
url
- a url pointing to the Javadoc location associated with this VM install
-
setNotify
protected void setNotify(boolean notify) Whether this VM should fire property change notifications.- Parameters:
notify
- if this VM should fire property change notifications.- Since:
- 2.1
-
equals
-
hashCode
public int hashCode() -
getVMArguments
Description copied from interface:IVMInstall
Returns VM arguments to be used with this vm install whenever this VM is launched as they should be passed to the command line, ornull
if none.- Specified by:
getVMArguments
in interfaceIVMInstall
- Returns:
- VM arguments to be used with this vm install whenever this
VM is launched as they should be passed to the command line, or
null
if none
-
setVMArguments
Description copied from interface:IVMInstall
Sets VM arguments to be used with this vm install whenever this VM is launched, possiblynull
. This is equivalent tosetVMArgs(String)
with whitespace character delimited arguments.- Specified by:
setVMArguments
in interfaceIVMInstall
- Parameters:
vmArgs
- VM arguments to be used with this vm install whenever this VM is launched, possiblynull
-
getVMArgs
Description copied from interface:IVMInstall2
Returns VM arguments to be used with this vm install whenever this VM is launched as a raw string, ornull
if none.- Specified by:
getVMArgs
in interfaceIVMInstall2
- Returns:
- VM arguments to be used with this vm install whenever this
VM is launched as a raw string, or
null
if none
-
setVMArgs
Description copied from interface:IVMInstall2
Sets VM arguments to be used with this vm install whenever this VM is launched as a raw string, possiblynull
.- Specified by:
setVMArgs
in interfaceIVMInstall2
- Parameters:
vmArgs
- VM arguments to be used with this vm install whenever this VM is launched as a raw string, possiblynull
-
getJavaVersion
Description copied from interface:IVMInstall2
Returns a string representing thejava.version
system property of this VM install, ornull
if unknown.- Specified by:
getJavaVersion
in interfaceIVMInstall2
- Returns:
- a string representing the
java.version
system property of this VM install, ornull
if unknown.
-
evaluateSystemProperties
public Map<String,String> evaluateSystemProperties(String[] properties, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Description copied from interface:IVMInstall3
Evaluates the specified system properties in this VM, returning the result as a map of property names to property values.- Specified by:
evaluateSystemProperties
in interfaceIVMInstall3
- Parameters:
properties
- the property names to evaluate, for example{"user.home"}
monitor
- progress monitor ornull
- Returns:
- map of system property names to associated property values
- Throws:
org.eclipse.core.runtime.CoreException
- if an exception occurs evaluating the properties
-
abort
protected void abort(String message, Throwable exception, int code) throws org.eclipse.core.runtime.CoreException Throws a core exception with an error status object built from the given message, lower level exception, and error code.- Parameters:
message
- the status messageexception
- lower level exception associated with the error, ornull
if nonecode
- error code- Throws:
org.eclipse.core.runtime.CoreException
- the "abort" core exception- Since:
- 3.2
-
setAttribute
Sets a VM specific attribute. Attributes are persisted and restored with VM installs. Specifying a value ofnull
as a value removes the attribute. Change notification is provided toIVMInstallChangedListener
for VM attributes.- Parameters:
key
- attribute key, cannot benull
value
- attribute value ornull
to remove the attribute- Since:
- 3.4
-
getAttribute
Returns a VM specific attribute associated with the given key ornull
if none.- Parameters:
key
- attribute key, cannot benull
- Returns:
- attribute value, or
null
if none - Since:
- 3.4
-
getAttributes
Returns a map of VM specific attributes stored with this VM install. Keys and values are strings. Modifying the map does not modify the attributes associated with this VM install.- Returns:
- map of VM attributes
- Since:
- 3.4
-