Jump to: navigation, search

CDO/Legacy Mode

< CDO
Revision as of 06:38, 26 March 2010 by Martin.fluegge.gmx.de (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Advantages

Drawbacks

Switch me on

We decided to make the legacy mode switchable. This has two reasons. First, native mode is always recommended. Use legacy objects only if you have not other chance. But then you should be aware of the disadvantaged. The second reason is the automatically attaching EObject to CDO could be harder to debug. Guess a user forgot to convert it’s model by accident and than receives an error which is related to legacy. This fact might not be show in the behaior of the error or even the stack trace of the exception. With a switchable legacy mode we can assure the user who are using legacy know what they do and that they are aware of using legacy.


public interface InternalCDOSession extends CDOSession, PackageProcessor, PackageLoader, RevisionLocker, ILifecycle {

...
 public void setLegacyEnabled(boolean legacyEnabled);
 public boolean isLegacyEnabled();

}


public interface InternalCDOSession extends CDOSession, PackageProcessor, PackageLoader, RevisionLocker, ILifecycle {

public void setLegacyEnabled(boolean legacyEnabled);
public boolean isLegacyEnabled();

}


 ((InternalCDOSession)session).setLegacyEnabled(true);

((InternalCDOTransaction)transaction).setLegacyEnabled(isLegacyEnabled()); DynamicEObjects

While it was forbidden and punished with an exception to use DynamicEObjects on CDO this is now possible. You can create the dynamic objects as you are used to and store them in CDO. But remember that this is not the recommended way. Cause dynamic EObject can easily be converted to CDO you encouraged to use CDOUtil.prepareDynamicEPackage(dynamicMapEPackage) whenever possible to convert your dynamic model to a CDO native one. For this reason the tracer, when activated, gives a warning if you have not done so.

Mixed Mode

Performance

Due to its nature legacy mode is slower than the native approach. But have in mind that the loss of performance only applies to the client site. For the communication and the server side legacy is transparent.