r1 - 20 Aug 2007 - 15:37:14 - RandyLetnessYou are here: OSAF >  Journal Web  >  ContributorNotes > RandyLetnessNotes > CosmoZeroPointSevenModelDocs > CosmoZeroPointSevenServiceLayer

Cosmo 0.7 Service Layer Notes

The service layer consists of a group of interfaces and implementations that provide high-level apis for the application to use. For Cosmo it consists of UserService and ContentService .

UserService contains an api for managing users and ContentService contains an api for managing items.

The implementations for these services are found in org.osaf.cosmo.service.impl

StandardContentService

The ContentService implementation uses a LockManager to synchronize updates to collections. The morse code protocol implementation requires that access to collections must be synchronized. Two threads can't simultaneously update the same collection (add/update/remove item or modify collection details). For each method that updates a collection, locks to all collections involved must be obtained before the transaction completes. The default implementation for LockManager is SingleVMLockManager , which is a simple lock manager that works in a single vm (won't work in a clustered environment). Different LockManager implementations can easily be plugged-in using Spring.

Transactions

Each service implementation is configured in Spring using a TransactionalProxyFactoryBean , meaning the transaction boundary in Cosmo is the service layer. Each exposed service method is executed in a new transaction. Typically an update request results in the use of a single update service call. This ensures that if the service call fails, the transaction will be rolled back and the database will be returned to the state before the service call. If multiple service calls are required, then it is time to add a new service api that encompasses all the necessary logic for the transaction to be atomic.

-- RandyLetness - 20 Aug 2007

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.