## org.eclipse.emf.cdo.view
Interface CDOAdapterPolicy

All Known Implementing Classes:
  AbstractObjectConflictResolver.MergeLocalChangesPerFeature, AbstractObjectConflictResolver.ThreeWayMerge

    public interface CDOAdapterPolicy

Specifies an adapter policy.

To activate a policy, you must do the following:
`view.setChangeSubscriptionPolicy(CDOAdapterPolicy.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.

`NONE` - Disabled.
`ALL` - Enabled for all adapters used.
`CDO` - Enabled only for adapters that implement `CDOAdapter`.
Any other class that implement `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.

Note: It can be used with `CDOSession.setPassiveUpdate(false)`. In this case, it will receive changes without having the objects changed.

Since:
  2.0
See Also:
  `CDOSessionInvalidationEvent`, `CDOInvalidationNotification`

Field Summary
`static CDOAdapterPolicy` `ALL` A default adapter policy that always triggers special behaviour.
`static CDOAdapterPolicy` `CDO` A default adapter policy that only triggers special behaviour if the adapter under test implements `CDOAdapter`.
`static CDOAdapterPolicy` `NONE` A default adapter policy that never triggers any special behaviour.

Method Summary
`boolean` `isValid(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.notify.Adapter adapter)` Returns `true` if the given adapter on the given object should trigger a certain operation or behaviour, `false` otherwise.

Field Detail

### NONE

    static final CDOAdapterPolicy NONE

  A default adapter policy that never triggers any special behaviour.

### CDO

    static final CDOAdapterPolicy CDO

  A default adapter policy that only triggers special behaviour if the adapter under test implements `CDOAdapter`.

### ALL

    static final CDOAdapterPolicy ALL

  A default adapter policy that always triggers special behaviour.

Method Detail

### isValid

    boolean isValid(org.eclipse.emf.ecore.EObject eObject,
                    org.eclipse.emf.common.notify.Adapter adapter)

  Returns `true` if the given adapter on the given object should trigger a certain operation or behaviour, `false` otherwise.

  See Also:
    `CDOView.Options.addChangeSubscriptionPolicy(CDOAdapterPolicy)`, `CDOView.Options.setStrongReferencePolicy(CDOAdapterPolicy)`

Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. All Rights Reserved.