Container Managed Persistence (CMP)

The Entity Container API supports the use of Persistence State Service to make the component state durable. Container API defines two types of persistence support:

  • Container-Managed Persistence - The component developer simply defines the state that has to be made persistent. Container automatically saves and restores state as required. Container Managed Persistence is selected by defining abstract state associated with component using persistence state definition language i.e. PSDL (Persistence State Definition Language)

  • Self-Managed Persistence - The component developer assumes the responsibility of managing persistent state of the component.

K2 provides container managed persistence using K2 Persistent State Service(K2 PSS). For CMP, container takes care of managing the persistence for Entity and Process components. For Self Managed Persistence container is not responsible for managing the data persistence of components, instead component developer needs to manage the state of the components.

Developing Entity Component in K2 Component Server v1.5 using K2 PSS

An Entity component has behaviour (possibly transactional), persistence state that is not visible to client and identity, which is visible to client via a primary key. It's useful for exposing database objects directly to clients. CCM Container supports two types of persistence mechanism.

Self Managed Persistence

The component developer assumes the responsibility for saving and restoring persistence data of the component. This requires programmer to implement several call back interfaces to be invoked by container during life cycle of the component. There is an example on Self Managed Persistence distributed along with this version using K2 Persistent State Service.

Container Managed Persistence

The component developer simply specifies abstract state of the component in PSDL, which is a subset of CIDL. Additionally the composition in CIDL needs to include an abstract storage binding with component executor. Both CIDL and PSDL compilers are used to generate entire implementation of the component. The current support for Container Managed Persistent in K2 is using K2 Persistent State Service and the database is by default BerDB. The later version will support Container Managed Persistence Using Oracle. There is an Entity Component example distributed with the current release of K2.

The steps to bulid an entity component:

1. Write the IDL
  Define the interfaces , attributes, components etc. and their homes in the IDL definition.

2. Write the PSDL

Include the IDL, and write the attributes of the IDL, or new data structures to be made persistent.

3. Write the CIDL

Import the IDL, include the PSDL and define the composition. The composition includes psdl home binding with the component home. Composition can also define the delegation of the component home operations to psdl home operations.

4. Write the Primary Key Implementation

All the Entity components are recognized by its identity defined by Primary Key. The Primary Key needs to be implemented.

5. Write the Executor Implementation

This step include implementation of home executor and component executor. Mostly the component executor implementation includes only the business operations defined in the component or component supported interfaces, whereas the home executor includes the implementation of creating the executor segment i.e the component executor.

6. Writing the Client

Write a Client for the application.

The complete process of buidling a Entity Component is defined diagramtically below:

Copyright 2008 iCMG. All rights reserved.
Site Index | Contact Us | Legal & Privacy Policy