ArisID Beans

From OpenLiberty.org Wiki
Jump to: navigation, search

Contents

ArisID Beans

Introduction

The ArisID Beans sub-project provides Java APIs as a layer on top of the ArisID API. The ArisID Beans API converts the transactional approach of the ArisID API and represents an object or bean approach. In other words, the beans API enables the creation of Java beans that represent digital subjects that also have various action methods associated with them. Additionally, the API also creates management classes for handling the life-cycle of identity beans.

Java Bean Generator

This project also includes a BeanGenerator for generating the set of java files Base<Bean>Manager.java and <Bean>.java for each CARML file using Apache Velocity.

There are two abstract classes - IGFObjectManager and IGFObject. IGFObjectManager provides the methods for initializing the AttributeService and accessing the interactions defined in the CARML file. IGFObject is a wrapper to org.openliberty.igf.attributeService.IDigitalSubject providing generic get/set methods for the properties.

Requirements

Building Identity Beans from source or using Identity Beans require Java version 1.5 (or greater) and ant 1.6 or greater


Building Identity Beans

All components required to build Identity Beans jar are included in the distribution.

Pre-built jar file igf-idbean_<version>.jar is included with the distribution. To build Identity Beans jar from the source code, go to org.openliberty.igf.idbeans project dir and enter:

ant buildjar

This will create the class files under bin/ and the jar file igf-idbeans_<version>.jar in project dir.

Using Bean Generator

From a CARML declaration Identity Bean code can be generated using Bean Generator.

Sample ant script is provided with the distribution which generates the Bean code from three CARML files and an Object Relationship file

   Samples/IDBeansDemo/

BeanGenrator requires the CLASSPATH to include igf-attrsvc_<version>.jar, igf-idbeans_<version>.jar and all other dependencies included under Samples/IDBeansDemo/lib

Usage:

   java org.openliberty.igf.idbeans.BeanGenerator <PackageName>
        <OutputDir> [<ObjectRelations>] <CARML Declaration>
PackageName Package Name for the generated bean classes
OutputDir Directory where the generated java beans are placed
ObjectRelations (Optional) XML file with Object Relations. Schema Definition of this XML file is available at org.openliberty.igf.idbeans/schemas/ObjectRelation.xsd
CARML Declartion IGF CARML declaration file with Attribute Definitions and Interactions.

BeanGenerator requires following Java System Parameter to be set

igf.carml.schemaloc - CARML schema defintion file with path

 ../org.openliberty.igf.attributeServices/schemas/igf-carml-09.xsd


For each input CARML file, two java files are generated. For example,

CARML File Name Generated Files
user.xml BaseUserManager.java, User.java
role.xml BaseRoleManager.java, Role.java

Generated Base<Bean>Manager class extends IGFObjectManager and contains the methods for each interaction with the same name as defined in CARML declaration. If the ObjectRelations XML is also provided as input, generated class may have additional methods.

Generated <Bean> class extends IGFObject and contains the get/set methods for attributes accessed/modified by the interactions defined in the CARML declaration.


Naming Conventions

In the CARML file, if there are multiple read/find interactions one of them can be made as default interaction by adding the prefix "default_" to the interaction name.

Corresponding method name in the generated bean class does not include the prefix "default_"

Following attribute name in CARML declaration is treated as special attribute subjectdomain - The container where the Digital Subject to be created (optional attribute in Add Interaction).

Using Identity Beans

For using BeanGenerator,

- CLASSPATH should include following dependent jars
       igf-attrsvc_<version>.jar
       axiom-api-1.2.5.jar
       axiom-impl-1.2.5.jar
       axis2-kernel-1.3.jar
       commons-logging-1.0.4.jar
       dom4j-1.6.1.jar
       log4j-1.2.13.jar
       logkit-1.0.1.jar
       neethi-2.0.2.jar
       servlet-api.jar
       stax-api-1.0.1.jar
       velocity-dep-1.5.jar
       wstx-asl-3.2.1.jar
       xalan.jar
       xercesImpl.jar
       xml-apis.jar
       xmlsec-1.3.0.jar

For using generated IdentityBeans,

- CLASSPATH should include following dependent jars
       igf-attrsvc_<version>.jar
       igf-idbeans_<version>.jar
       generated bean class/jar files
       Stack Provider and dependent jars
       asn1c.jar
       axiom-api-1.2.5.jar
       axiom-impl-1.2.5.jar
       axis2-kernel-1.3.jar
       commons-logging-1.0.4.jar
       dom4j-1.6.1.jar
       log4j-1.2.13.jar
       neethi-2.0.2.jar
       stax-api-1.0.1.jar
       wstx-asl-3.2.1.jar
       xercesImpl.jar
- idbeans.properties file in the CLASSPATH with following properties set 
       org.openliberty.igf.attributeService.stack=<Stack Provider Class>
       igf.carml.schemaloc=<CARML schema defintion file with path>
       igf.carml.dir=<CARML Declaration files location>

Project Index

Project Aristotle

Downloads

ArisID

ArisID Providers


Related External Information

Other

OpenAz