JavaScript Development Tools
Release 3.2

org.eclipse.wst.jsdt.launching
Class StandardVMType

java.lang.Object
  extended by org.eclipse.wst.jsdt.launching.AbstractVMInstallType
      extended by org.eclipse.wst.jsdt.launching.StandardVMType
All Implemented Interfaces:
IVMInstallType

public class StandardVMType
extends AbstractVMInstallType

A VM install type for VMs the conform to the standard JDK installion layout. Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
static String ID_STANDARD_VM_TYPE
           
 
Constructor Summary
StandardVMType()
           
 
Method Summary
 File detectInstallLocation()
          Tries to detect an installed VM that matches this VM install type.
 void disposeVMInstall(String id)
          Remove the VM associated with the given id from the set of VMs managed by this VM type.
protected  IVMInstall doCreateVMInstall(String id)
          Subclasses should return a new instance of the appropriate IVMInstall subclass from this method.
static File findJavaExecutable(File vmInstallLocation)
          Starting in the specified VM install location, attempt to find the 'java' executable file.
protected  List gatherAllLibraries(String[] dirPaths)
          Returns a list of all zips and jars contained in the given directories.
protected  File getDefaultEndorsedDirectory(File installLocation)
          Returns the default location of the endorsed directory, based on the given install location.
protected  File getDefaultExtensionDirectory(File installLocation)
          Returns the default location of the extension directory, based on the given install location.
 URL getDefaultJavadocLocation(File installLocation)
          Returns a URL for the default jsdoc location of a VM installed at the given home location, or null if none.
 LibraryLocation[] getDefaultLibraryLocations(File installLocation)
          NOTE: We do not add libraries from the "endorsed" directory explicitly, as the bootpath contains these entries already (if they exist).
protected  IPath getDefaultPackageRootPath()
           
protected  String getDefaultRootPath()
           
protected  IPath getDefaultSystemLibrary(File javaHome)
          Return an IPath corresponding to the single library file containing the standard JavaScript classes for most VMs version 1.2 and above.
protected  IPath getDefaultSystemLibrarySource(File libLocation)
          Returns a path to the source attachment for the given libaray, or an empty path if none.
 String getName()
          Returns the display name of this VM type.
protected  String getVMVersion(File javaHome, File javaExecutable)
          Returns the version of the VM at the given location, with the given executable.
protected  String[] parsePaths(String paths)
           
protected  void setDefaultRootPath(String defaultRootPath)
           
 IStatus validateInstallLocation(File javaHome)
          Validates the given location of a VM installation.
 
Methods inherited from class org.eclipse.wst.jsdt.launching.AbstractVMInstallType
createVMInstall, findVMInstall, findVMInstallByName, getId, getVMInstalls, setInitializationData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_STANDARD_VM_TYPE

public static final String ID_STANDARD_VM_TYPE
See Also:
Constant Field Values
Constructor Detail

StandardVMType

public StandardVMType()
Method Detail

findJavaExecutable

public static File findJavaExecutable(File vmInstallLocation)
Starting in the specified VM install location, attempt to find the 'java' executable file. If found, return the corresponding File object, otherwise return null.


getName

public String getName()
Description copied from interface: IVMInstallType
Returns the display name of this VM type.

Returns:
the name of this IVMInstallType

doCreateVMInstall

protected IVMInstall doCreateVMInstall(String id)
Description copied from class: AbstractVMInstallType
Subclasses should return a new instance of the appropriate IVMInstall subclass from this method.

Specified by:
doCreateVMInstall in class AbstractVMInstallType
Parameters:
id - The vm's id. The IVMInstall instance that is created must return id from its getId() method. Must not be null.
Returns:
the newly created IVMInstall instance. Must not return null.

getVMVersion

protected String getVMVersion(File javaHome,
                              File javaExecutable)
Returns the version of the VM at the given location, with the given executable.

Parameters:
javaHome -
javaExecutable -
Returns:
String

detectInstallLocation

public File detectInstallLocation()
Description copied from interface: IVMInstallType
Tries to detect an installed VM that matches this VM install type. Typically, this method will detect the VM installation the Eclipse platform runs on. Implementers should return null if they can't assure that a given vm install matches this IVMInstallType.

Returns:
The location of an VM installation that can be used with this VM install type, or null if unable to locate an installed VM.

getDefaultSystemLibrary

protected IPath getDefaultSystemLibrary(File javaHome)
Return an IPath corresponding to the single library file containing the standard JavaScript classes for most VMs version 1.2 and above.


getDefaultSystemLibrarySource

protected IPath getDefaultSystemLibrarySource(File libLocation)
Returns a path to the source attachment for the given libaray, or an empty path if none.

Parameters:
libLocation -
Returns:
a path to the source attachment for the given library, or an empty path if none

getDefaultPackageRootPath

protected IPath getDefaultPackageRootPath()

getDefaultLibraryLocations

public LibraryLocation[] getDefaultLibraryLocations(File installLocation)
NOTE: We do not add libraries from the "endorsed" directory explicitly, as the bootpath contains these entries already (if they exist).

Parameters:
installLocation - home location
Returns:
default library locations based on the given installLocation.
See Also:
org.eclipse.jdt.launching.IVMInstallType#getDefaultLibraryLocations(File)

gatherAllLibraries

protected List gatherAllLibraries(String[] dirPaths)
Returns a list of all zips and jars contained in the given directories.

Parameters:
dirPaths - a list of absolute paths of directories to search
Returns:
List of all zips and jars

getDefaultExtensionDirectory

protected File getDefaultExtensionDirectory(File installLocation)
Returns the default location of the extension directory, based on the given install location. The resulting file may not exist, or be null if an extension directory is not supported.

Parameters:
installLocation -
Returns:
default extension directory or null

getDefaultEndorsedDirectory

protected File getDefaultEndorsedDirectory(File installLocation)
Returns the default location of the endorsed directory, based on the given install location. The resulting file may not exist, or be null if an endorsed directory is not supported.

Parameters:
installLocation -
Returns:
default endorsed directory or null

getDefaultRootPath

protected String getDefaultRootPath()

setDefaultRootPath

protected void setDefaultRootPath(String defaultRootPath)

validateInstallLocation

public IStatus validateInstallLocation(File javaHome)
Description copied from interface: IVMInstallType
Validates the given location of a VM installation.

For example, an implementation might check whether the VM executable is present.

Parameters:
javaHome - the root directory of a potential installation for this type of VM
Returns:
a status object describing whether the install location is valid

parsePaths

protected String[] parsePaths(String paths)

disposeVMInstall

public void disposeVMInstall(String id)
Description copied from interface: IVMInstallType
Remove the VM associated with the given id from the set of VMs managed by this VM type. Has no effect if a VM with the given id is not currently managed by this type. A VM install that is disposed may not be used anymore.

Specified by:
disposeVMInstall in interface IVMInstallType
Overrides:
disposeVMInstall in class AbstractVMInstallType
Parameters:
id - the id of the VM to be disposed.

getDefaultJavadocLocation

public URL getDefaultJavadocLocation(File installLocation)
Description copied from class: AbstractVMInstallType
Returns a URL for the default jsdoc location of a VM installed at the given home location, or null if none. The default implementation returns null, subclasses must override as appropriate.

Note, this method would ideally be added to IVMInstallType, but it would have been a breaking API change between 2.0 and 2.1. Thus, it has been added to the abstract base class that VM install types should subclass.

Overrides:
getDefaultJavadocLocation in class AbstractVMInstallType
Parameters:
installLocation - home location
Returns:
default jsdoc location or null

JavaScript Development Tools
Release 3.2

Copyright (c) IBM Corp. and others 2000, 2010. All Rights Reserved.