## org.eclipse.wst.server.core
Interface IRuntimeWorkingCopy

All Superinterfaces:
  IRuntime

    public interface IRuntimeWorkingCopy

extends IRuntime

A working copy runtime object used for formulating changes to a runtime instance (`IRuntime`). Changes made on a working copy do not occur (and are not persisted) until a save() is performed.

If the client of this working copy calls loadAdapter(), a new instance of the delegate (RuntimeDelegate) will be created to help this working copy. This delegate instance will be used as long as this working copy exists.

This interface is not intended to be implemented by clients.

Since:
  1.0
See Also:
  `IRuntime`

Field Summary
`static java.lang.String` `PROPERTY_LOCATION` Property change name (value "location") used when the location of the runtime changes.
`static java.lang.String` `PROPERTY_NAME` Property change name (value "name") used when the name of the runtime changes.
`static int` `SAVE_CONFLICT` Status code (value 1) returned from the save() method when the save failed with force set to `false` because the runtime has been modified and saved since this working copy was created.

Method Summary
`void` `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Adds a property change listener to this runtime.
`IRuntime` `getOriginal()` Returns the runtime instance that this working copy is associated with.
`boolean` `isDirty()` Returns whether this working copy has unsaved changes.
`void` `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Removes a property change listener from this runtime.
`IRuntime` `save(boolean force, IProgressMonitor monitor)` Commits the changes made in this working copy.
`void` `setLocation(IPath path)` Sets the absolute path in the local file system to the root of the runtime, typically the installation directory.
`void` `setName(java.lang.String name)` Sets the displayable name for this runtime.
`void` `setReadOnly(boolean readOnly)` Sets or unsets whether this runtime is marked as read only.
`void` `setStub(boolean stub)` Returns whether this runtime is a stub (used for compilation only) or a full runtime.

Methods inherited from interface org.eclipse.wst.server.core.IRuntime
`createWorkingCopy, delete, getAdapter, getId, getLocation, getName, getRuntimeType, isReadOnly, isStub, isWorkingCopy, loadAdapter, validate`

Field Detail

### SAVE_CONFLICT

    static final int SAVE_CONFLICT

  Status code (value 1) returned from the save() method when the save failed with force set to `false` because the runtime has been modified and saved since this working copy was created.

  See Also:
    `save(boolean, IProgressMonitor)`, Constant Field Values

### PROPERTY_NAME

    static final java.lang.String PROPERTY_NAME

  Property change name (value "name") used when the name of the runtime changes.

  See Also:
    `addPropertyChangeListener(PropertyChangeListener)`, `removePropertyChangeListener(PropertyChangeListener)`, Constant Field Values

### PROPERTY_LOCATION

    static final java.lang.String PROPERTY_LOCATION

  Property change name (value "location") used when the location of the runtime changes.

  See Also:
    `addPropertyChangeListener(PropertyChangeListener)`, `removePropertyChangeListener(PropertyChangeListener)`, Constant Field Values

Method Detail

### setName

    void setName(java.lang.String name)

  Sets the displayable name for this runtime.

  The name should be appropriate for the current locale.

  Parameters:
    `name` - a displayable name
  See Also:
    `IRuntime.getName()`

### setReadOnly

    void setReadOnly(boolean readOnly)

  Sets or unsets whether this runtime is marked as read only. When a runtime is read only, working copies can be created but they cannot be saved.

  Parameters:
    `readOnly` - `true` to set this runtime to be marked read only, and `false` to unset

### isDirty

    boolean isDirty()

  Returns whether this working copy has unsaved changes.

  Returns:
    `true` if this working copy has unsaved changes, and `false` otherwise

### addPropertyChangeListener

    void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Adds a property change listener to this runtime.

  Once registered, a listener starts receiving notification of property changes to this runtime. The listener continues to receive notifications until it is removed. Has no effect if an identical listener is already registered.

  Parameters:
    `listener` - a property change listener
  See Also:
    `removePropertyChangeListener(PropertyChangeListener)`

### removePropertyChangeListener

    void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Removes a property change listener from this runtime. Has no effect if the listener is not registered.

  Parameters:
    `listener` - a property change listener
  See Also:
    `addPropertyChangeListener(PropertyChangeListener)`

### getOriginal

    IRuntime getOriginal()

  Returns the runtime instance that this working copy is associated with.

  For a runtime working copy created by a call to `IRuntime.createWorkingCopy()`, `this.getOriginal()` returns the original runtime object. For a runtime working copy just created by a call to `IRuntimeType.createRuntime(String, IProgressMonitor)`, `this.getOriginal()` returns `null`.

  Returns:
    the associated runtime instance, or `null` if none

### setLocation

    void setLocation(IPath path)

  Sets the absolute path in the local file system to the root of the runtime, typically the installation directory.

  Parameters:
    `path` - the location of this runtime, or `null` if none
  See Also:
    `IRuntime.getLocation()`

### setStub

    void setStub(boolean stub)

  Returns whether this runtime is a stub (used for compilation only) or a full runtime.

  Parameters:
    `stub` - `true` if this runtime is a stub, and `false` otherwise

### save

    IRuntime save(boolean force,
                  IProgressMonitor monitor)
                  throws CoreException

  Commits the changes made in this working copy. If there is no extant runtime instance with a matching id and runtime type, this will create a runtime instance with attributes taken from this working copy, and return that object.

  If there an existing runtime instance with a matching id and runtime type, this will change the runtime instance accordingly. The returned runtime will be the same runtime this is returned from getOriginal(), after the changes have been applied. Otherwise, this method will return a newly created runtime.

  Runtimes can be saved even when they have invalid properties. It is the clients responsibility to call validate() or check the properties before saving.

  Parameters:
    `force` - `true` to force the save, or `false` otherwise
    `monitor` - a progress monitor, or `null` if progress reporting and cancellation are not desired
  Returns:
    a new runtime instance
  Throws:
    `CoreException` - if the save could not be completed
  See Also:
    `SAVE_CONFLICT`