Difference between revisions of "CDO/Using the User Interface"
(→Register Initial Models)
(→Open a Session)
|(One intermediate revision by one other user not shown)|
|Line 6:||Line 6:|
|Line 19:||Line 19:|
==Register Initial Models==
==Register Initial Models==
Latest revision as of 10:27, 8 March 2011
Open a Session
Have you already used the "CDO Sessions" view? It is the main access point from a client UI to a server repository.
From there you can open CDO sessions:
If the session was successfully opened the view should look like:
Register Initial Models
Note that you can skip this step if you're going to use only packages from the global package registry and you enabled the automatic package registry when you opened the session!
If there are no user packages in the repository, yet, you need to open the Package Manager of the session to add the packages you wish to commit to the repository in your first transaction:
If you generated your models for CDO click the "Generated..." button:
Select all the packages you want to use. CDO native packages show up completely with cyan icons. Legacy packages have magenta icons and converted legacy packages (AspectJ weaver) have a magenta icon with a small cyan corner. You can select multiple packages to be used in the editors of the session but only those that are actually used to create instances will be committed to the repository. Packages that have been committed to the repository once are not required to be added to subsequent sessions thereafter. They are stored in the repository and will be transfered to client's sessions as needed. You can always see them in the Package Manager dialog.
Start a Transaction
When you have added your packages you'll want to start your first transaction through the context menu of the session. CDO transactions are considered light weight compared to CDO sessions. You can open as many of them as you want. Each transaction encapsulates a separate EMF ResourceSet. All the objects in different transactions of the same session share their state. Of course only until they're modified in the scope of a particular transaction.
Create a Resource
Next you'll want to create your first resources through the context menu of a transaction:
This will change the CDO sessions view:
... and open a CDO Editor with an empty resource as input.
Edit the Resource
Now you can add multiple root objects through "New Root" in the context menu of the editor:
Could look like this:
The numbers in brackets are the CDOIDs of the objects. They're always even (means user instances in contrast to meta instances from the package registry) and negative (means state NEW) before you commit the transaction. After the commit they become positive and stay even. It's only technical but the equation -newID == cleanID is usually not true.
Saving the editor will commit the transaction (not only that editor if multiple editors are open on the same transaction). Another way to commit a transaction (and the only way to roll it back) is via the transaction's context menu in the CDO Sessions view.
You can also load resources into read-only views instead of transactions. Another option is to view historical states of the repository by opening an audit view on the session. In fact transactions and audits are special views. All of them share the objects' state as long as it is the same.