001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.launching;
011:
012: import java.io.File;
013:
014: import org.eclipse.core.runtime.IStatus;
015:
016: /**
017: * Represents a particular type of VM for which there may be
018: * any number of VM installations. An example of a VM type
019: * is the standard JRE which might have instances corresponding
020: * to different installed versions such as JRE 1.2.2 and
021: * JRE 1.3.
022: * <p>
023: * This interface is intended to be implemented by clients that contribute
024: * to the <code>"org.eclipse.jdt.launching.vmInstallTypes"</code> extension point.
025: * </p>
026: *
027: * @see IVMInstall
028: */
029: public interface IVMInstallType {
030: /**
031: * Creates a new instance of this VM Install type.
032: * The newly created IVMInstall is managed by this IVMInstallType.
033: *
034: * @param id An id String that must be unique within this IVMInstallType.
035: *
036: * @return the newly created VM instance
037: *
038: * @throws IllegalArgumentException If the id exists already.
039: */
040: IVMInstall createVMInstall(String id);
041:
042: /**
043: * Finds the VM with the given id.
044: *
045: * @param id the VM id
046: * @return a VM instance, or <code>null</code> if not found
047: */
048: IVMInstall findVMInstall(String id);
049:
050: /**
051: * Finds the VM with the given name.
052: *
053: * @param name the VM name
054: * @return a VM instance, or <code>null</code> if not found
055: * @since 2.0
056: */
057: IVMInstall findVMInstallByName(String name);
058:
059: /**
060: * Remove the VM associated with the given id from the set of VMs managed by
061: * this VM type. Has no effect if a VM with the given id is not currently managed
062: * by this type.
063: * A VM install that is disposed may not be used anymore.
064: *
065: * @param id the id of the VM to be disposed.
066: */
067: void disposeVMInstall(String id);
068:
069: /**
070: * Returns all VM instances managed by this VM type.
071: *
072: * @return the list of VM instances managed by this VM type
073: */
074: IVMInstall[] getVMInstalls();
075:
076: /**
077: * Returns the display name of this VM type.
078: *
079: * @return the name of this IVMInstallType
080: */
081: String getName();
082:
083: /**
084: * Returns the globally unique id of this VM type.
085: * Clients are responsible for providing a unique id.
086: *
087: * @return the id of this IVMInstallType
088: */
089: String getId();
090:
091: /**
092: * Validates the given location of a VM installation.
093: * <p>
094: * Since 3.4, the given installLocation may be a file (rather than a home
095: * directory). For example, the standard VM install type accepts execution
096: * environment description files, as described by
097: * <code>http://wiki.eclipse.org/index.php/Execution_Environment_Descriptions</code>.
098: * </p>
099: * <p>
100: * For example, an implementation might check whether the VM executable
101: * is present.
102: * </p>
103: * @param installLocationOrDefinitionFile the root directory of a potential installation for
104: * this type of VM or since 3.4, a file describing an installation
105: * @return a status object describing whether the install location is valid
106: */
107: IStatus validateInstallLocation(File installLocationOrDefinitionFile);
108:
109: /**
110: * Tries to detect an installed VM that matches this VM install type.
111: * Typically, this method will detect the VM installation the
112: * Eclipse platform runs on. Implementers should return <code>null</code> if they
113: * can't assure that a given vm install matches this IVMInstallType.
114: * @return The location of an VM installation that can be used
115: * with this VM install type, or <code>null</code> if unable
116: * to locate an installed VM.
117: */
118: File detectInstallLocation();
119:
120: /**
121: * Returns a collection of <code>LibraryLocation</code>s that represent the
122: * default system libraries of this VM install type, if a VM was installed
123: * at the given <code>installLocation</code>.
124: * The returned <code>LibraryLocation</code>s may not exist if the
125: * <code>installLocation</code> is not a valid install location.
126: * <p>
127: * Since 3.4, the given installLocation may be a file (rather than a home
128: * directory). For example, the standard VM install type accepts execution
129: * environment description files, as described by
130: * <code>http://wiki.eclipse.org/index.php/Execution_Environment_Descriptions</code>.
131: * </p>
132: * @param installLocationOrDefinitionFile home directory or since 3.4, a file
133: * describing an installation
134: * @see LibraryLocation
135: * @see IVMInstallType#validateInstallLocation(File)
136: *
137: * @return default library locations based on the given <code>installLocation</code>.
138: * @since 2.0
139: */
140: LibraryLocation[] getDefaultLibraryLocations(
141: File installLocationOrDefinitionFile);
142: }
|