Working with Views

 

Author: Eike Stepper

This chapter covers view management, resource handling, querying, transactions, and related options in CDO client applications. Views are central to accessing and interacting with model data in a CDO repository. Understanding how to use views effectively is key to building responsive and scalable applications.

1  Understanding Views and Their Types

CDO provides several types of views, including read-only views and transactional views. Read-only views allow safe navigation of repository data without risk of modification, while transactional views enable changes and commits. This section explains the differences, use cases, and lifecycle of each view type.

2  Thread Safety

Views in CDO are inherently thread-safe. This section discusses best practices for managing concurrent access, synchronizing operations, and avoiding race conditions when working with views in multi-threaded environments.

3  Opening and Closing Views

Learn how to open views to access repository data and close them to release resources. Proper management of view lifecycles helps prevent memory leaks and ensures efficient resource usage.

4  Understanding the CDO File System

The CDO repository exposes a virtual file system for organizing model resources. This section describes the structure and usage of the file system, including root resources, folders, and different resource types.

4.1  The Root Resource

The root resource is the entry point to the CDO file system. It contains all top-level folders and resources, providing a hierarchical view of the repository's contents.

4.2  Resource Folders

Resource folders organize model resources into logical groups. Learn how to create, navigate, and manage folders to structure your repository effectively.

4.3  Model Resources

Model resources store EMF model data in the repository. This section explains how to load, save, and query model resources, and how they relate to EMF ResourceSet.

4.4  Binary Resources

Binary resources allow storage of non-model data, such as images or files, within the CDO repository. Learn how to manage binary resources and integrate them with your application.

4.5  Text Resources

Text resources store textual data, such as configuration files or documentation, in the repository. This section covers reading, writing, and organizing text resources.

5  Resource Sets and Their Usage

Resource sets are collections of resources managed together. Learn how to use EMF ResourceSet with CDO, manage resource lifecycles, and optimize performance for large models.

6  Navigating Models

This section provides techniques for traversing and querying model objects within views, including use of EMF APIs and CDO-specific features for efficient navigation.

7  Waiting For Updates

Learn how to synchronize your client with repository changes, block for updates, and react to notifications to keep your application state current.

8  Querying Resources

CDO supports querying resources using various criteria. This section explains how to construct and execute queries to locate resources and model objects efficiently.

9  Querying Model Objects

Learn how to query model objects using CDO's query APIs, including support for OCL, custom queries, and cross-references.

10  Querying Cross References

Cross references allow navigation between related model objects. This section covers techniques for querying and resolving cross references in CDO models.

11  Custom Queries

Extend CDO's querying capabilities with custom query implementations. Learn how to define, register, and execute custom queries for advanced use cases.

12  Units

Units are disjunct subtrees of model objects that can be managed independently. This section explains how to create, open, and close units, and how they can improve performance and consistency in your application.

13  View Events

Views emit events for changes, updates, and errors. This section explains how to listen for and handle view events to build responsive applications.

14  View Options

Configure view options to customize behavior, such as passive updates, notification handling, and more.

15  View Properties

Access and modify view properties to store custom metadata and configuration values.