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
Constructors Constructor Description AbstractVMInstall(IVMInstallType type, String id)Constructs a new VM install.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidabort(String message, Throwable exception, int code)Throws a core exception with an error status object built from the given message, lower level exception, and error code.booleanequals(Object object)Map<String,String>evaluateSystemProperties(String[] properties, IProgressMonitor monitor)Evaluates the specified system properties in this VM, returning the result as a map of property names to property values.StringgetAttribute(String key)Returns a VM specific attribute associated with the given key ornullif none.Map<String,String>getAttributes()Returns a map of VM specific attributes stored with this VM install.StringgetId()Returns the id for this VM.FilegetInstallLocation()Returns the root directory of the install location of this VM.URLgetJavadocLocation()Returns the Javadoc location associated with this VM install.StringgetJavaVersion()Returns a string representing thejava.versionsystem property of this VM install, ornullif unknown.LibraryLocation[]getLibraryLocations()Returns the library locations of this IVMInstall.StringgetName()Returns the display name of this VM.StringgetVMArgs()Returns VM arguments to be used with this vm install whenever this VM is launched as a raw string, ornullif none.String[]getVMArguments()Returns VM arguments to be used with this vm install whenever this VM is launched as they should be passed to the command line, ornullif none.IVMInstallTypegetVMInstallType()Returns the VM type of this VM.IVMRunnergetVMRunner(String mode)Returns a VM runner that runs this installed VM in the given mode.inthashCode()voidsetAttribute(String key, String value)Sets a VM specific attribute.voidsetInstallLocation(File installLocation)Sets the root directory of the install location of this VM.voidsetJavadocLocation(URL url)Sets the Javadoc location associated with this VM install.voidsetLibraryLocations(LibraryLocation[] locations)Sets the library locations of this IVMInstall.voidsetName(String name)Sets the display name of this VM.protected voidsetNotify(boolean notify)Whether this VM should fire property change notifications.voidsetVMArgs(String vmArgs)Sets VM arguments to be used with this vm install whenever this VM is launched as a raw string, possiblynull.voidsetVMArguments(String[] vmArgs)Sets VM arguments to be used with this vm install whenever this VM is launched, possiblynull.
-
-
-
Constructor Detail
-
AbstractVMInstall
public AbstractVMInstall(IVMInstallType type, String id)
Constructs a new VM install.- Parameters:
type- The type of this VM install. Must not benullid- The unique identifier of this VM instance Must not benull.- Throws:
IllegalArgumentException- if any of the required parameters arenull.
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:IVMInstallReturns 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:
getIdin interfaceIVMInstall- Returns:
- the VM identifier. Must not return
null.
-
getName
public String getName()
Description copied from interface:IVMInstallReturns the display name of this VM. The VM name is intended to be presented to users.- Specified by:
getNamein interfaceIVMInstall- Returns:
- the display name of this VM. May return
null.
-
setName
public void setName(String name)
Description copied from interface:IVMInstallSets the display name of this VM. The VM name is intended to be presented to users.- Specified by:
setNamein interfaceIVMInstall- Parameters:
name- the display name of this VM
-
getInstallLocation
public File getInstallLocation()
Description copied from interface:IVMInstallReturns the root directory of the install location of this VM.- Specified by:
getInstallLocationin interfaceIVMInstall- Returns:
- the root directory of this VM installation. May
return
null.
-
setInstallLocation
public void setInstallLocation(File installLocation)
Description copied from interface:IVMInstallSets the root directory of the install location of this VM.- Specified by:
setInstallLocationin interfaceIVMInstall- Parameters:
installLocation- the root directory of this VM installation
-
getVMInstallType
public IVMInstallType getVMInstallType()
Description copied from interface:IVMInstallReturns the VM type of this VM.- Specified by:
getVMInstallTypein interfaceIVMInstall- Returns:
- the VM type that created this IVMInstall instance
-
getVMRunner
public IVMRunner getVMRunner(String mode)
Description copied from interface:IVMInstallReturns a VM runner that runs this installed VM in the given mode.- Specified by:
getVMRunnerin 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
nullif the given mode is not supported by this VM. - See Also:
ILaunchManager
-
getLibraryLocations
public LibraryLocation[] getLibraryLocations()
Description copied from interface:IVMInstallReturns the library locations of this IVMInstall. Generally, clients should useJavaRuntime.getLibraryLocations(IVMInstall)to determine the libraries associated with this VM install.- Specified by:
getLibraryLocationsin interfaceIVMInstall- Returns:
- The library locations of this IVMInstall.
Returns
nullto indicate that this VM install uses the default library locations associated with this VM's install type. - See Also:
IVMInstall.setLibraryLocations(LibraryLocation[])
-
setLibraryLocations
public void setLibraryLocations(LibraryLocation[] locations)
Description copied from interface:IVMInstallSets the library locations of this IVMInstall.- Specified by:
setLibraryLocationsin interfaceIVMInstall- Parameters:
locations- TheLibraryLocations to associate with this IVMInstall. May benullto indicate that this VM install uses the default library locations associated with this VM's install type.
-
getJavadocLocation
public URL getJavadocLocation()
Description copied from interface:IVMInstallReturns the Javadoc location associated with this VM install.- Specified by:
getJavadocLocationin interfaceIVMInstall- Returns:
- a url pointing to the Javadoc location associated with
this VM install, or
nullif none
-
setJavadocLocation
public void setJavadocLocation(URL url)
Description copied from interface:IVMInstallSets the Javadoc location associated with this VM install.- Specified by:
setJavadocLocationin 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
-
getVMArguments
public String[] getVMArguments()
Description copied from interface:IVMInstallReturns VM arguments to be used with this vm install whenever this VM is launched as they should be passed to the command line, ornullif none.- Specified by:
getVMArgumentsin 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
nullif none
-
setVMArguments
public void setVMArguments(String[] vmArgs)
Description copied from interface:IVMInstallSets 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:
setVMArgumentsin interfaceIVMInstall- Parameters:
vmArgs- VM arguments to be used with this vm install whenever this VM is launched, possiblynull
-
getVMArgs
public String getVMArgs()
Description copied from interface:IVMInstall2Returns VM arguments to be used with this vm install whenever this VM is launched as a raw string, ornullif none.- Specified by:
getVMArgsin interfaceIVMInstall2- Returns:
- VM arguments to be used with this vm install whenever this
VM is launched as a raw string, or
nullif none
-
setVMArgs
public void setVMArgs(String vmArgs)
Description copied from interface:IVMInstall2Sets VM arguments to be used with this vm install whenever this VM is launched as a raw string, possiblynull.- Specified by:
setVMArgsin interfaceIVMInstall2- Parameters:
vmArgs- VM arguments to be used with this vm install whenever this VM is launched as a raw string, possiblynull
-
getJavaVersion
public String getJavaVersion()
Description copied from interface:IVMInstall2Returns a string representing thejava.versionsystem property of this VM install, ornullif unknown.- Specified by:
getJavaVersionin interfaceIVMInstall2- Returns:
- a string representing the
java.versionsystem property of this VM install, ornullif unknown.
-
evaluateSystemProperties
public Map<String,String> evaluateSystemProperties(String[] properties, IProgressMonitor monitor) throws CoreException
Description copied from interface:IVMInstall3Evaluates the specified system properties in this VM, returning the result as a map of property names to property values.- Specified by:
evaluateSystemPropertiesin 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:
CoreException- if an exception occurs evaluating the properties
-
abort
protected void abort(String message, Throwable exception, int code) throws 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, ornullif nonecode- error code- Throws:
CoreException- the "abort" core exception- Since:
- 3.2
-
setAttribute
public void setAttribute(String key, String value)
Sets a VM specific attribute. Attributes are persisted and restored with VM installs. Specifying a value ofnullas a value removes the attribute. Change notification is provided toIVMInstallChangedListenerfor VM attributes.- Parameters:
key- attribute key, cannot benullvalue- attribute value ornullto remove the attribute- Since:
- 3.4
-
getAttribute
public String getAttribute(String key)
Returns a VM specific attribute associated with the given key ornullif none.- Parameters:
key- attribute key, cannot benull- Returns:
- attribute value, or
nullif none - Since:
- 3.4
-
-