The following topics are discussed in this document:
The beans are mapped to registry objects using Java5 Annotations.
Each bean from the application bean model has to extend or implement the RegistryBean (com.softwareag.centrasite.appl.framework.beans.RegistryBean) interface. If an interface extends the RegistryBean interface, an implementation must be provided and specified using the @Bean annotation:
@RegistryObject(objectTypeName="{http://namespaces.CentraSite.com/csaf}Item") @Bean(implementationClass = "...") public interface Item extends RegistryBean{ ... }
The table below describes the annotations currently supported by the CentraSite Application framework.
Annotations | Scope | Properties | Description |
---|---|---|---|
@RegistryObject | Type |
At least one of the properties must be specified. |
Maps a bean to a registry object with a specific object type. |
@Property | Method | target (optional) –
the name of the target property in the registry object. The property must be a
standard property of a predefined JAXR-based object type. If the target
property is not specified, it is assumed that it matches the name of the bean
property.
|
Maps a bean property to a registry object property. The properties should have the same type. The mapper does not provide type conversion, except for JAXR InternationalString to/from String. |
@Slot | Method |
|
Maps a bean property to a registry object slot. Multivalue slots are supported. Also provided are type conversion slot values which are string to integer, Boolean, date, timestamp and Calendar. |
@Slots | Method | targetType
(mandatory) - the type of bean that is to be mapped to a single slot.
|
Maps all slots of a registry object to a bean property (Collection). |
@SlotProperty | Method | target (mandatory) –
can be one value from the enum SlotPropertyName – NAME, SLOT_TYPE, VALUES.
|
Used in conjunction with the @Slots property. Maps the properties of the bean of the type specified as target type with the @Slots annotation. A slot has a name, slot type and values. All these properties can be mapped using this annotation. |
@TelephoneNumbers | Method | type (optional) –
the type of the telephone numbers.
|
Maps a bean property to the TelephoneNumber object from the JAXR-based infomodel. Such objects are used in the User JAXR Object. |
@ExternalLink | Method |
|
Maps a bean property to a ExternalLink JAXR-based object or a collection of them. |
@Association | Method |
|
Maps a property to an association. It can be either the association object itself or the target of the association. |
@AssociationTarget | Method | None | Used in conjunction with the @Association annotation. Maps a bean to a target of an association. It is used when a bean is mapped to an association object using the @Association annotation. Then inside that bean a property must be mapped to the target. |
@Classification | Method |
|
Maps a bean property to a classification. Both the classification object and its concept can be used. The mapping can be simple – Bean property <-> Classification(Concept) or enumeration – Bean property <-> Classification (Concept) which concept is under a specified parent concept. The latter provides a set of predefined possible concepts, thus is similar to the notion of enumeration. |
@ClassificationConcept | Method | None | Used in conjunction with the @Classification annotation. Maps a bean to the Concept of the Classification specified in the @Classification annotation. |
@ClassifiedInstances | Type | instances
(mandatory) – the array of the instances that this mapping will address.
|
Maps class hierarchy to registry objects. Classifications are used to achieve this. Each registry object that corresponds to a bean from the hierarchy is classified with a concept. The latter belongs to a taxonomy mirroring the class hierarchy. |
@ClassifiedInstance | Type |
|
Sets the information for a specific mapping between a bean from the hierarchy and a registry object. |
@ClassificationAttribute | Method |
|
Annotation for mapping the return value of a (getter) method to the classification attribute specified at type level. The attribute name is mandatory and is used to identify the attribute. This annotation is very similar to the {@link Classification} annotation in terms of supported attributes and underlying representation. The difference is that the taxonomy is obtained from the attribute description. In order to use this annotation, a classification attribute must be defined at type level (the registry object type must have a classification attribute with the same attribute name as specified in the annotation). |
@FileAttribute | Method |
|
Annotation for mapping the return value of a (getter) method to the file attribute specified at type level. The attribute name is mandatory and is used to identify the attribute. This annotation is very similar to the {@link ExternalLink} annotation in terms of supported attributes and underlying representation. In order to use this annotation, a file attribute must be defined at type level (the registry object type must have a file attribute with the same attribute name as specified in the annotation). |
@Relationship | Method |
|
Annotation for mapping the return value of a (getter) method to the attribute specified at type level. The attribute name is mandatory and is used to identify the attribute. This annotation is very similar to the {@link Association} annotation in terms of supported attributes and underlying representation. The difference is that the association and target types are not specified but are obtained from the attribute description. In order to use this annotation, a relationship attribute must be defined at type level (the registry object type must have a relationship attribute with the same attribute name as specified in the annotation). |
/** * Java bean interface representing JAXR-based registry objects of type ServiceInterfaceVersion. */ @RegistryObject(objectTypeName = "{http://namespaces.CentraSite.com/csaf}ServiceInterfaceVersion") @Bean(implementationClass = "com.softwareag.centrasite.appl.framework.persistence.beanmodel.impl.ServiceInterfaceVersionImpl") public interface ServiceInterfaceVersion extends RegistryBean{ @Property(target = "name") public String getName(); public void setName(String name); /** * Returns the description */ @Property(target = "description") public String getDescription(); /** * Sets the description */ public void setDescription(String description); /** * Returns the attachments */ @ExternalLink(type = com.softwareag.centrasite.appl.framework.persistence.beanmodel.ExternalLink.class) public List<com.softwareag.centrasite.appl.framework.persistence.beanmodel.ExternalLink> getAttachments(); /** * Sets the attachments */ public void setAttachments( List<com.softwareag.centrasite.appl.framework.persistence.beanmodel.ExternalLink> attachments); /** * Returns the short name of the interface version. Maps to {http://namespaces.CentraSite.com/csaf}shortName slot. */ @Slot(name = "{http://namespaces.CentraSite.com/csaf}shortName") String getShortName(); /** * Sets the short name property of the interface version. */ void setShortName(String shortName); /** * Returns. */ @Association(type = "HasReviewRequest", targetType = ReviewRequestOutcome.class, cascadeStype = CascadeStyle.DELETE) List<ReviewRequestOutcome> getReviewRequestOutcomes(); /** * @param list */ public void setReviewRequestOutcomes(List<ReviewRequestOutcome> list); /** * Returns the findings, which are attached to the bean. */ @Classification(classificationScheme = "CSAF -Taxonomy", conceptPath = "/ClassificationInstances/Finding", targetType = Finding.class) List<Finding> getFindings(); /** * * @param pFindings */ public void setFindings(List<Finding> pFindings); @Slots(targetType = SlotBean.class) public Collection<SlotBean> getSlots(); public void setSlots(Collection<SlotBean> slots); } /** * Implementation of the {@link ServiceInterfaceVersion} bean interface. */ public class ServiceInterfaceVersionImpl extends DynamicRegistryBean implements ServiceInterfaceVersion { private String _shortName; private List<ReviewRequestOutcome> _reviewRequestOutcomes; private Collection<SlotBean> slots; private String _instanceSlotName; private List<Finding> findings; private List<ExternalLink> externalLinks; /** * {@inheritDoc} */ public String getShortName() { return _shortName; } /** * {@inheritDoc} * * The setter is annotated that modifies the object and it needs to be * updated in the JAXR-based registry. */ public void setShortName(String shortName) { _shortName = shortName; } public List<ReviewRequestOutcome> getReviewRequestOutcomes() { return _reviewRequestOutcomes; } public void setReviewRequestOutcomes(List<ReviewRequestOutcome> list) { _reviewRequestOutcomes = list; } public Collection<SlotBean> getSlots() { return slots; } public void setSlots(Collection<SlotBean> slots) { this.slots = slots; } public String getInstanceSlotName() { return _instanceSlotName; } public void setInstanceSlotName(String slotName) { _instanceSlotName = slotName; } public List<Finding> getFindings() { return findings; } public void setFindings(List<Finding> findings) { this.findings = findings; } public List<ExternalLink> getAttachments() { return externalLinks; } public void setAttachments(List<ExternalLink> attachments) { externalLinks = attachments; } }
The Standard Mappings (com.softwareag.centrasite.appl.framework.beans.standard) are RegistryBeans that represent all supported JAXR-based Registry Objects under the package com.centrasite.jaxr.infomodel. They provide the functionality to operate and manage JAXR-based RegistryObjects through the Application Framework with ease.
There are other kinds of objects that are included in this package
although they are not RegistryObjects (EmailAddress,
PostalAddress, Slot … etc.). The
Application Framework provides a mapping for them as well. Standard Mapping
instances are created by the BeanPool's create(beanClass)
;
standard non-registry object mappings (EmailAddress,
PostalAddress, Slot … etc.) are
managed using the
com.softwareag.centrasite.appl.framework.beans.standard.StandardMappingManager.
For more information about the methods and functionality supported by Standard Mappings API, please refer to the Javadoc of the framework.
//Create a com.softwareag.centrasite.appl.framework.beans.standard.Organization com.softwareag.centrasite.appl.framework.beans.standard.Organization organization = beanPool.create(com.softwareag.centrasite.appl.framework.beans.standard.Organization.class); organization.setName("MyOrganization"); // Create StandardMappingManager for managing Standard non RegistryObjects //mappings StandardMappingManager smm = new StandardMappingManager(registryProvider); //Create a postal address com.softwareag.centrasite.appl.framework.beans.standard.PostalAddress pa = smm.createPostalAddress("streetNumber", "street", "city", "stateOrProvince", "country", "postalCode","type"); organization.setPostalAddress(pa); // Get existing user and add it to the organization com.softwareag.centrasite.appl.framework.beans.standard.User user = beanPool.read(com.softwareag.centrasite.appl.framework.beans.standard.User.class, USER_KEY); Collection<User> users = new ArrayList<User>(); users.add(user); organization.setUsers(users); // save the changes beanPool.flush();
You can use a command line utility to generate registry beans.
Use the following procedure to generate registry beans under Windows:
Open GenerateCSAFBeans.cmd in a text editor.
Add the following property statement:
<CentraSiteInstallDir>\utilities\ GenerateCSAFBeans.cmd -user <USERNAME> -pass <PASSWORD> -url <CENTRASITE-URL> -typename <TYPENAME> -interfacepackage <INTERFACEPACKAGE> -implpackage <IMPLPACKAGE> -destination <DESTINATION>
where, <CentraSiteInstallDir> is the CentraSite installation directory. By default, this is the CentraSite folder under <SuiteInstallDir>.
Use the following procedure to generate registry beans under Linux:
Open GenerateCSAFBeans.sh in a text editor.
Add the following property statement:
<CentraSiteInstallDir>/utilities/ GenerateCSAFBeans.sh -user USERNAME -pass PASSWORD -url CENTRASITE-URL -typename TYPENAME -interfacepackage INTERFACEPACKAGE -implpackage IMPLPACKAGE -destination DESTINATION
where, <CentraSiteInstallDir> is the CentraSite installation directory. By default, this is the CentraSite folder under <SuiteInstallDir>.
The following table describes the complete set of input parameters that you can use to generate the registry beans:
Parameter | Description |
---|---|
USERNAME | Required. Your CentraSite user ID. |
PASSWORD | Required. The password for your CentraSite user account. |
CENTRASITE-URL | Required. The fully qualified URL for
the CentraSite registry/repository.
If you omit this parameter, the importer assumes that the
registry/repository resides at Note: |
TYPENAME | Required. The namespace and name of the type to be generated (mandatory). Example: {http://test}TestService. Or, the name of the virtual type to be generated. Example: "Virtual service" Note: The quotation marks are necessary, in order that "Virtual service" is parsed as a single token. |
INTERFACEPACKAGE | Required. The name of the package in
which the interfaces should be generated. For example:
com.sag.generated |
IMPLPACKAGE | Required. The name of the package in
which the implementation should be generated. For example:
com.sag.generated.impl |
DESTINATION | Required. The location where the generated bean will be stored. |