Package org.eclipse.emf.cdo.view

## Interface CDOView.Options

- All Superinterfaces:
    `CDOCommonView.Options`, `org.eclipse.net4j.util.event.INotifier`, `org.eclipse.net4j.util.options.IOptions`
  All Known Subinterfaces:
    `CDOTransaction.Options`
  Enclosing interface:
    CDOView

      public static interface CDOView.Options
      extends CDOCommonView.Options

  Encapsulates a set of notifying `view` configuration options.
  Author:
    Simon McDuff
  No Implement
    This interface is not intended to be implemented by clients.
  No Extend
    This interface is not intended to be extended by clients.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `CDOView.Options.CacheReferenceTypeEvent` | An `options event` fired from view `options` when the `cache reference type` option has changed.
    `static interface` | `CDOView.Options.ChangeSubscriptionPoliciesEvent` | An `options event` fired from view `options` when the `change subscription policies` option has changed.
    `static interface` | `CDOView.Options.ClearAdapterPolicyEvent` | An `options event` fired from view `options` when the `clear adapter policy` option has changed.
    `static interface` | `CDOView.Options.DetachmentNotificationEvent` | An `options event` fired from view `options` when the `detachment notification enabled` option has changed.
    `static interface` | `CDOView.Options.FeatureAnalyzerEvent` | An `options event` fired from view `options` when the `feature analyzer` option has changed.
    `static interface` | `CDOView.Options.InvalidationNotificationEvent` | An `options event` fired from view `options` when the `invalidation notification enabled` option has changed.
    `static interface` | `CDOView.Options.InvalidationPolicyEvent` | An `options event` fired from view `options` when the `invalidation policy` option has changed.
    `static interface` | `CDOView.Options.LoadNotificationEvent` | An `options event` fired from view `options` when the `load notification enabled` option has changed.
    `static interface` | `CDOView.Options.ReferencePolicyEvent` | Deprecated. Use `CDOView.Options.StrongReferencePolicyEvent` instead.
    `static interface` | `CDOView.Options.RevisionPrefetchingPolicyEvent` | An `options event` fired from view `options` when the `revision prefetching policy` option has changed.
    `static interface` | `CDOView.Options.StaleReferencePolicyEvent` | An `options event` fired from view `options` when the `stale reference type` option has changed.
    `static interface` | `CDOView.Options.StrongReferencePolicyEvent` | An `options event` fired from view `options` when the `strong reference policy` option has changed.

    - ### Nested classes/interfaces inherited from interface org.eclipse.emf.cdo.common.CDOCommonView.Options

      `CDOCommonView.Options.LockNotificationEvent`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

      `org.eclipse.net4j.util.event.INotifier.INotifier2`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_REVISION_PREFETCHING` |
    `static int` | `NO_REVISION_PREFETCHING` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addChangeSubscriptionPolicy​(CDOAdapterPolicy policy)` | Adds a change subscription policy to this view.
    `org.eclipse.net4j.util.ref.ReferenceType` | `getCacheReferenceType()` | Returns the reference type to be used in the internal object cache.
    `CDOAdapterPolicy[]` | `getChangeSubscriptionPolicies()` | Returns the current set of `change subscription policies`.
    `CDOAdapterPolicy` | `getClearAdapterPolicy()` |
    `CDOView` | `getContainer()` | Returns the `view` of this options object.
    `CDOFeatureAnalyzer` | `getFeatureAnalyzer()` |
    `CDOInvalidationPolicy` | `getInvalidationPolicy()` |
    `CDORevisionPrefetchingPolicy` | `getRevisionPrefetchingPolicy()` | Returns the CDORevisionPrefetchingPolicy in use.
    `CDOStaleReferencePolicy` | `getStaleReferenceBehaviour()` | Deprecated. Use `getStaleReferencePolicy()`
    `CDOStaleReferencePolicy` | `getStaleReferencePolicy()` | Returns the CDOStaleReferencePolicy in use.
    `CDOAdapterPolicy` | `getStrongReferencePolicy()` | Returns the strong reference policy in use.
    `boolean` | `isDetachmentNotificationEnabled()` | Returns `true` if the `objects` in this view will notify their `adapters` about the fact that they are detached (due to remote changes), `false` otherwise.
    `boolean` | `isInvalidationNotificationEnabled()` | Returns `true` if the `objects` in this view will notify their `adapters` about the fact that they are invalidated (due to remote changes), `false` otherwise.
    `boolean` | `isLoadNotificationEnabled()` | Returns `true` if the `objects` in this view will notify their `adapters` about the fact that they are loaded, `false` otherwise.
    `void` | `removeChangeSubscriptionPolicy​(CDOAdapterPolicy policy)` | Removes a change subscription policy from this view.
    `boolean` | `setCacheReferenceType​(org.eclipse.net4j.util.ref.ReferenceType referenceType)` | Sets the reference type to be used in the internal object cache to either `STRONG`, `SOFT` or `WEAK`.
    `void` | `setClearAdapterPolicy​(CDOAdapterPolicy policy)` |
    `void` | `setDetachmentNotificationEnabled​(boolean enabled)` | Specifies whether the `objects` in this view will notify their `adapters` about the fact that they are detached (due to remote changes) or not.
    `void` | `setFeatureAnalyzer​(CDOFeatureAnalyzer featureAnalyzer)` |
    `void` | `setInvalidationNotificationEnabled​(boolean enabled)` | Specifies whether the `objects` in this view will notify their `adapters` about the fact that they are invalidated (due to remote changes) or not.
    `void` | `setInvalidationPolicy​(CDOInvalidationPolicy policy)` |
    `void` | `setLoadNotificationEnabled​(boolean enabled)` | Specifies whether the `objects` in this view will notify their `adapters` about the fact that they are loaded or not.
    `void` | `setRevisionPrefetchingPolicy​(CDORevisionPrefetchingPolicy prefetchingPolicy)` | The CDORevisionPrefetchingPolicy feature of the CDOView allows CDO users to fetch many objects at a time.
    `void` | `setStaleReferenceBehaviour​(CDOStaleReferencePolicy policy)` | Deprecated. Use `setStaleReferencePolicy(CDOStaleReferencePolicy)`
    `void` | `setStaleReferencePolicy​(CDOStaleReferencePolicy policy)` | Sets a policy on how to deal with stale references.
    `void` | `setStrongReferencePolicy​(CDOAdapterPolicy policy)` | Sets the policy that determines what object/adapter pairs of this `view` are supposed to be protected against garbage collection.

    - ### Methods inherited from interface org.eclipse.emf.cdo.common.CDOCommonView.Options

      `isLockNotificationEnabled, setLockNotificationEnabled`

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

- - ### Field Detail

    - #### DEFAULT_REVISION_PREFETCHING

          static final int DEFAULT_REVISION_PREFETCHING

      Since:
        3.0
      See Also:
        Constant Field Values

    - #### NO_REVISION_PREFETCHING

          static final int NO_REVISION_PREFETCHING

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getContainer

          CDOView getContainer()

      Returns the `view` of this options object.
      Specified by:
        `getContainer` in interface `org.eclipse.net4j.util.options.IOptions`
      Since:
        4.0

    - #### isLoadNotificationEnabled

          boolean isLoadNotificationEnabled()

      Returns `true` if the `objects` in this view will notify their `adapters` about the fact that they are loaded, `false` otherwise.
      Since:
        4.1

    - #### setLoadNotificationEnabled

          void setLoadNotificationEnabled​(boolean enabled)

      Specifies whether the `objects` in this view will notify their `adapters` about the fact that they are loaded or not.
      Since:
        4.1

    - #### isDetachmentNotificationEnabled

          boolean isDetachmentNotificationEnabled()

      Returns `true` if the `objects` in this view will notify their `adapters` about the fact that they are detached (due to remote changes), `false` otherwise.
      Since:
        4.1
      See Also:
        `CDONotification.DETACH_OBJECT`

    - #### setDetachmentNotificationEnabled

          void setDetachmentNotificationEnabled​(boolean enabled)

      Specifies whether the `objects` in this view will notify their `adapters` about the fact that they are detached (due to remote changes) or not.
      Since:
        4.1
      See Also:
        `CDONotification.DETACH_OBJECT`

    - #### isInvalidationNotificationEnabled

          boolean isInvalidationNotificationEnabled()

      Returns `true` if the `objects` in this view will notify their `adapters` about the fact that they are invalidated (due to remote changes), `false` otherwise.
      See Also:
        `CDOInvalidationNotification`

    - #### setInvalidationNotificationEnabled

          void setInvalidationNotificationEnabled​(boolean enabled)

      Specifies whether the `objects` in this view will notify their `adapters` about the fact that they are invalidated (due to remote changes) or not.
      See Also:
        `CDOInvalidationNotification`

    - #### getInvalidationPolicy

          CDOInvalidationPolicy getInvalidationPolicy()

      Since:
        3.0

    - #### setInvalidationPolicy

          void setInvalidationPolicy​(CDOInvalidationPolicy policy)

      Since:
        3.0

    - #### getChangeSubscriptionPolicies

          CDOAdapterPolicy[] getChangeSubscriptionPolicies()

      Returns the current set of `change subscription policies`.
      Returns:
        The current set of change subscription policies, never `null`.
      See Also:
        `addChangeSubscriptionPolicy(CDOAdapterPolicy)`

    - #### addChangeSubscriptionPolicy

          void addChangeSubscriptionPolicy​(CDOAdapterPolicy policy)

      Adds a change subscription policy to this view.

      To activate a policy, you must do the following:
      `view.options().addChangeSubscriptionPolicy(CDOChangeSubscriptionPolicy.ALL);`

      To register an object, you must add an adapter to the object in which you are interested:
      `eObject.eAdapters().add(myAdapter);`

      By activating this feature, each object having at least one adapter that matches the current policy will be registered with the server and will be notified for each change occurring in the scope of any other transaction.

      - `CDOAdapterPolicy.NONE` - Ignored.
      - `CDOAdapterPolicy.ALL` - Enabled for all adapters used.
      - `CDOAdapterPolicy.CDO` - Enabled only for adapters that implement `CDOAdapter`.
      - Any other class that implements `CDOAdapterPolicy` will enable for whatever rules defined in that class.

      If `myAdapter` in the above example matches the current policy, `eObject` will be registered with the server and you will receive all changes from other transaction.

      When the policy is changed all objects in the cache will automatically be recalculated.

      You can subscribe to temporary objects. Even if you cannot receive notifications from other `CDOTransaction` for these because they are only local to you, at commit time these objects will be registered automatically.

      See Also:
        `removeChangeSubscriptionPolicy(CDOAdapterPolicy)`, `getChangeSubscriptionPolicies()`

    - #### removeChangeSubscriptionPolicy

          void removeChangeSubscriptionPolicy​(CDOAdapterPolicy policy)

      Removes a change subscription policy from this view.
      See Also:
        `addChangeSubscriptionPolicy(CDOAdapterPolicy)`, `getChangeSubscriptionPolicies()`

    - #### getCacheReferenceType

          org.eclipse.net4j.util.ref.ReferenceType getCacheReferenceType()

      Returns the reference type to be used in the internal object cache.
      Returns:
        Either `STRONG`, `SOFT` or `WEAK`.

    - #### setCacheReferenceType

          boolean setCacheReferenceType​(org.eclipse.net4j.util.ref.ReferenceType referenceType)

      Sets the reference type to be used in the internal object cache to either `STRONG`, `SOFT` or `WEAK`. If `null` is passed the default reference type `SOFT` is set. If the given reference type does not differ from the one being currently set the new value is ignored and `false` is returned. Otherwise existing object references are converted to the new type and `true` is returned.

    - #### getStrongReferencePolicy

          CDOAdapterPolicy getStrongReferencePolicy()

      Returns the strong reference policy in use.
      See Also:
        `setStrongReferencePolicy(CDOAdapterPolicy)`

    - #### setStrongReferencePolicy

          void setStrongReferencePolicy​(CDOAdapterPolicy policy)

      Sets the policy that determines what object/adapter pairs of this `view` are supposed to be protected against garbage collection.

      A view uses references of the type determined by `getCacheReferenceType()` to hold on to loaded objects. If this type is not `STRONG` and the application does not hold other strong references to an object then this object and possibly any adapters attached to this object are subject to garbage collection.

      To avoid automatic garbage collection while specific adapters are attached to an object this view calls the `CDOAdapterPolicy.isValid()` method for all adapters that are attached to this object. An extra strong reference to this object is maintained if any of these calls return `true`.

      The following adapter policies can be used as strong reference policies:

      - `CDOAdapterPolicy.NONE` - No adapter will prevent GC.
      - `CDOAdapterPolicy.ALL` - Any adapter prevent GC.
      - `CDOAdapterPolicy.CDO` - Only adapters that implement `CDOAdapter` will prevent GC.
      - Any other class that implements `CDOAdapterPolicy` will prevent GC according to whatever rules defined in that class.

      The default strong reference policy is `CDOAdapterPolicy.ALL`, preventing garbage collection for all adapted objects.

      See Also:
        `getStrongReferencePolicy()`

    - #### getStaleReferenceBehaviour

          @Deprecated
          CDOStaleReferencePolicy getStaleReferenceBehaviour()

      Deprecated.
      Use `getStaleReferencePolicy()`
      Returns the CDOStaleReferencePolicy in use.
      Since:
        3.0

    - #### setStaleReferenceBehaviour

          @Deprecated
          void setStaleReferenceBehaviour​(CDOStaleReferencePolicy policy)

      Deprecated.
      Use `setStaleReferencePolicy(CDOStaleReferencePolicy)`
      Sets a policy on how to deal with stale references.
      Since:
        3.0

    - #### getStaleReferencePolicy

          CDOStaleReferencePolicy getStaleReferencePolicy()

      Returns the CDOStaleReferencePolicy in use.
      Since:
        4.1

    - #### setStaleReferencePolicy

          void setStaleReferencePolicy​(CDOStaleReferencePolicy policy)

      Sets a policy on how to deal with stale references.
      Since:
        4.1

    - #### getRevisionPrefetchingPolicy

          CDORevisionPrefetchingPolicy getRevisionPrefetchingPolicy()

      Returns the CDORevisionPrefetchingPolicy in use.

    - #### setRevisionPrefetchingPolicy

          void setRevisionPrefetchingPolicy​(CDORevisionPrefetchingPolicy prefetchingPolicy)

      The CDORevisionPrefetchingPolicy feature of the CDOView allows CDO users to fetch many objects at a time.

      The difference between the CDOCollectionLoadingPolicy feature and the CDORevisionPrefetchingPolicy feature is subtle. The CDOCollectionLoadingPolicy feature determines how and when to fetch CDOIDs, while the CDORevisionPrefetchingPolicy feature determines how and when to resolve CDOIDs (i.e. fetch the target objects).

      `view.options().setRevisionPrefetchingPolicy (CDONet4jUtil.createRevisionPrefetchingPolicy(10));`

      The end-user could provide its own implementation of the CDORevisionPrefetchingPolicy interface.

    - #### getFeatureAnalyzer

          CDOFeatureAnalyzer getFeatureAnalyzer()

      Since:
        4.1

    - #### setFeatureAnalyzer

          void setFeatureAnalyzer​(CDOFeatureAnalyzer featureAnalyzer)

      Since:
        4.1

    - #### getClearAdapterPolicy

          CDOAdapterPolicy getClearAdapterPolicy()

      Since:
        4.12

    - #### setClearAdapterPolicy

          void setClearAdapterPolicy​(CDOAdapterPolicy policy)

      Since:
        4.12