Version 9.6
 —  CentraSite Application Framework  —

Introduction

The CentraSite Application Framework (CSAF) provides a programming model for developing custom extensions on top of CentraSite. It supports JAXR (Java API for XML Registries) and extends the CentraSite JAXR-based API and the Pluggable UI - the framework on which the CentraSite UI is built.

It contains two independent parts: the persistence framework and the validation framework.

The persistence framework provides the ability to operate on registry data using JavaBeans instead of the JAXR-based API. This is done in a fashion similar to object-relational mapping tools such as Hibernate or Java Persistence API. It this case, Java Beans are mapped to registry objects. All this is done declaratively using Java5 Annotations.

This framework was created with the intention of making it easier to work with registries that support the JAXR-based interface, such as CentraSite. Its usage does not require in general any specific or deep knowledge of this API.

A direct benefit of this is shortened application development time.

The validation framework provides an extensible mechanism for validating Java beans. Multiple numbers of constraints can be attached to each bean. The notion of scopes is also supported, i.e., constraints apply only when specific conditions about the bean are met.

graphics/dia01.png

This figure above shows the architecture of a common CentraSite application extension developed using CSAF.

There are two major points that have to be clear in order to understand how the persistence framework works, namely how the bean model is built based on the RegistryBean interface and the BeanPool.

The following topics are discussed in this document:


RegistryBean

The RegistryBean (com.softwareag.centrasite.appl.framework.beans.RegistryBean) interface has to stay on top of each bean model hierarchy. It contains the properties that a registry object would have, namely a key and a name. Implementing is the only restriction the framework on the application bean model. The user can use DynamicRegistryBean (com.softwareag.centrasite.appl.framework.beans.DynamicRegistryBean) for implementation of RegistryBeans. It implements RegistryBean and RevisionBean (com.softwareag.centrasite.appl.framework.beans.RevisionBean), which is the revision-aware extension of the RegistryBean interface.

There is one more option here. If the registry bean needs to be lifecycle-aware, then the user should use the com.softwareag.centrasite.appl.framework.lcm.beans.LifeCycleAware interface instead of RegistryBean. Its implementation is handled by com.softwareag.centrasite.appl.framework.lcm.beans.LCAwareDynamicRegistryBean.

Top of page

BeanPool

The BeanPool (com.softwareag.centrasite.appl.framework.persistence.BeanPool) is the main interface with which the application interacts in order to use the persistence framework. All CRUD (create, read, update, delete) operations search via this interface, and registry queries are done via this interface. The user must be aware that the BeanPool instances are not thread safe. There can be only one beanPool per SessionContext. CSAF provides the functionality to create beanPool instances by using SessionContext.createBeanPool();. The beanPool can be accessed by SessionContext.getCurrentBeanPool();. This method returns the BeanPool instance that is associated with the given context. The CurrentBeanPoolContext interface defines the contract for implementations which knows how to scope the notion of a current bean pool. An implementation of this interface is provided as ThreadLocalCurrentBeanPoolContext, which maintains current bean pools for the given execution thread. This functionality is extensible, so users can create their own context by implementing CurrentBeanPoolContext.

More information about these interfaces can be found in the Javadoc of the framework.

Top of page

StandaloneRegistryProvider

In order to obtain a connection to the repository, an instance of StandAloneRegistryProvider must be created. This registry provider has several important parameters for its creation that will affect the functionality of CSAF. CSAF supports several constructors which exclude some of the properties and use their default values instead. The constructor with full parameter list is:

StandaloneRegistryProvider(String registryUrl, String user, String password, boolean browserBehaviour){}
registryUrl Specifies the URL to the CentraSite registry. Default value is http://localhost:53307/CentraSite/CentraSite
user The username of the registry user
password The password of the registry user
browserBehaviour Sets the "com.centrasite.jaxr.BrowserBehaviour" property of the connection factory. To enable type management, this flag must be set to "true"; to enable RevisionManagement it must be "false". Default value is "false".

Example for creating a BeanPool instance by using SessionContext and StandaloneRegistryProvider

SessionContext context = null;
RegistryProvider provider = null;
try {
    provider = new StandaloneRegistryProvider(registryUsername,
                            registryPassword, true);

  Configuration conf = new Configuration();
                conf.setRegistryProvider(provider); 

                conf.addBeanType(Item.class);
                conf.addBeanType(Action.class);
                conf.addBeanType(Entry.class);
                conf.addBeanType(ExternalLink.class);
                context = SessionContext.createInstance(conf);
          } catch (CSAppFrameworkException e) {
                // Do something with the exception
          } 

BeanPool beanPool = context.getCurrentBeanPool();

Top of page