+ All Categories
Home > Documents > TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component...

TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component...

Date post: 14-Jun-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
43
TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012
Transcript
Page 1: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

TIBCO ActiveMatrix® Service Grid

Spring Component DevelopmentSoftware Release 3.1.5March 2012

Page 2: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Important Information

SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE.USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE “LICENSE” FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN AGREEMENT TO BE BOUND BY THE SAME.This document contains confidential information that is subject to U.S. and international copyright laws and treaties. No part of this document may be reproduced in any form without the written authorization of TIBCO Software Inc.TIB, TIBCO, TIBCO ActiveMatrix, TIBCO Adapter, TIBCO Administrator, TIBCO AutoMeditate, TIBCO Enterprise Message Service, ActiveMatrix, AutoMediate, Predictive Business, Information Bus, The Power of Now, and TIBCO Rendezvous are either registered trademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries.EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.All other product and company names and marks mentioned in this document are the property of their respective owners and are mentioned for identification purposes only.THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAME TIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC OPERATING SYSTEM PLATFORM.THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME.THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.Copyright © 1999-2012 TIBCO Software Inc. ALL RIGHTS RESERVED.TIBCO Software Inc. Confidential Information

Page 3: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

| iii

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .v

Changes from the Previous Release of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi

Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiTIBCO ActiveMatrix Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiOther TIBCO Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viiThird Party Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .viii

Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

Connecting with TIBCO Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiiiHow to Join TIBCOmmunity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiiiHow to Access All TIBCO Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiiiHow to Contact TIBCO Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii

Chapter 1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Chapter 2 Spring Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3

Creating a Spring Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Configuring a Spring Component’s Custom Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Configuring a Spring Component’s External Custom Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Updating a Spring Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Updating the Spring Component from Existing Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Updating the Spring Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Spring Component Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Chapter 3 Spring Component Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10

Opening a Spring Component Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Generating a Spring Component Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Spring Bean Configuration XML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Generate Spring Implementation Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Regenerating a Spring Component Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Handling Life Cycle Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Accessing a Property. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Invoking a Reference Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

TIBCO ActiveMatrix Spring Component Development

Page 4: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

iv | Contents

Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Referencing a Java Class in an External Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Referencing External Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Referencing an External Spring Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

TIBCO ActiveMatrix Spring Component Development

Page 5: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

| v

Preface

TIBCO ActiveMatrix® is a scalable and extensible platform for developing, deploying, and managing applications that conform to a service-oriented architecture. TIBCO ActiveMatrix® Implementation Type for Spring is a gateway for Spring Developers to the Service Oriented Architecture (SOA) world. The product provides an ActiveMatrix container to deploy services developed in Spring using TIBCO ActiveMatrix Administrator.

Topics

• Related Documentation, page vii

• Typographical Conventions, page x

• Connecting with TIBCO Resources, page xiii

TIBCO ActiveMatrix Spring Component Development

Page 6: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

vi | Changes from the Previous Release of this Guide

Changes from the Previous Release of this Guide

This section itemizes the major changes from the previous release of this guide.

JAXB-based Code Generation

Spring component supports JAXB based code generation. See Generate Spring Implementation Reference, page 15 and TIBCO ActiveMatrix Java Component Development guide for details.

TIBCO ActiveMatrix Spring Component Development

Page 7: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Preface | vii

Related Documentation

This section lists documentation resources you may find useful.

TIBCO ActiveMatrix DocumentationThe following documents form the TIBCO ActiveMatrix documentation set:

• Concepts: Read this manual before reading any other manual in the documentation set. This manual describes terminology and concepts of the TIBCO ActiveMatrix platform. The other manuals in the documentation set assume you are familiar with the information in this manual.

• Development Tutorials: Read this manual for a step-by-step introduction to the process of creating, packaging, and running composites in TIBCO Business Studio.

• Composite Development: Read this manual to learn how to develop and package composites.

• Java Component Development: Read this manual to learn how to configure and implement Java components.

• Mediation Component Development: Read this manual to learn how to configure and implement Mediation components.

• Mediation API Reference: Read this manual to learn how to configure and implement Mediation components.

• Spring Component Development: Read this manual to learn how to configure and implement Spring components.

• Web Application Component Development: Read this manual to learn how to configure and implement Web Application components.

• Administration: Read this manual to learn how to manage the runtime and deploy and manage applications.

• Release Notes: Read this manual for a list of new and changed features, steps for migrating from a previous release, and lists of known issues and closed issues for the release.

Other TIBCO Product DocumentationYou may find it useful to read the documentation for the following TIBCO products:

• TIBCO ActiveMatrix® Service Bus

TIBCO ActiveMatrix Spring Component Development

Page 8: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

viii | Related Documentation

• TIBCO ActiveMatrix® Service Grid

• TIBCO ActiveMatrix® Registry

• TIBCO ActiveMatrix® Policy Manager

• TIBCO Enterprise Message Service™

• TIBCO Adapter™

• TIBCO Administrator™

• TIBCO Hawk®

• TIBCO Rendezvous®

Third Party Documentation• SCA 1.0 final draft spec for Spring Component

http://www.osoa.org/download/attachments/35/SCA_SpringComponentImplementationSpecification-V100.pdf?version=1

• Spring Framework Reference

http://static.springsource.org/spring/docs/2.5.x/reference/index.html

• White paper on Power Combination of SCA, Spring, and OSGi

http://www.osoa.org/download/attachments/250/Power_Combination_SCA_Spring_OSGi.pdf?version=3

TIBCO ActiveMatrix® software supports the following standards:

• Service Component Architecture

http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications

• World Wide Web Consortium web services activity

http://www.w3.org/2002/ws/

— Simple Object Access Protocol (SOAP) 1.1 W3C Note

http://www.w3.org/TR/2000/NOTE-SOAP-20000508/

— WSDL 1.1 W3C Note

http://www.w3.org/TR/wsdl

• OASIS

TIBCO ActiveMatrix Spring Component Development

Page 9: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Preface | ix

http://www.oasis-open.org/committees/tc_cat.php?cat=ws

— UDDI Version 3 OASIS Standard

http://www.oasis-open.org/specs/index.php#uddiv2

TIBCO ActiveMatrix Spring Component Development

Page 10: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

x | Typographical Conventions

Typographical Conventions

The following typographical conventions are used in this manual.

Table 1 General Typographical Conventions

Convention Use

TIBCO_HOME

ENV_NAME

Many TIBCO products must be installed within the same home directory. This directory is referenced in documentation as TIBCO_HOME. The default value of TIBCO_HOME depends on the operating system. For example, on Windows systems, the default value is C:\tibco.

Other TIBCO products are installed into an installation environment. Incompatible products and multiple instances of the same product are installed into different installation environments. An environment home directory is referenced in documentation as ENV_HOME. The default value of ENV_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco.

code font Code font identifies commands, code examples, filenames, pathnames, and output displayed in a command window. For example:

Use MyCommand to start the foo process.

bold code font Bold code font is used in the following ways:

• In procedures, to indicate what a user types. For example: Type admin.

• In large code samples, to indicate the parts of the sample that are of particular interest.

• In command syntax, to indicate the default parameter for a command. For example, if no parameter is specified, MyCommand is enabled:

MyCommand [enable | disable]

italic font Italic font is used in the following ways:

• To indicate a document title. For example: See TIBCO BusinessWorks Concepts.

• To introduce new terms For example: A portal page may contain several portlets. Portlets are mini-applications that run in a portal.

• To indicate a variable in a command or code syntax that you must replace. For example: MyCommand pathname

TIBCO ActiveMatrix Spring Component Development

Page 11: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Preface | xi

Key combinations Key name separated by a plus sign indicate keys pressed simultaneously. For example: Ctrl+C.

Key names separated by a comma and space indicate keys pressed one after the other. For example: Esc, Ctrl+Q.

The note icon indicates information that is of special interest or importance, for example, an additional action required only in certain circumstances.

The tip icon indicates an idea that could be useful, for example, a way to apply the information provided in the current section to achieve a specific result.

The warning icon indicates the potential for a damaging situation, for example, data loss or corruption if certain steps are taken or not taken.

Table 1 General Typographical Conventions (Cont’d)

Convention Use

Table 2 Syntax Typographical Conventions

Convention Use

[ ] An optional item in a command or code syntax.

For example:

MyCommand [optional_parameter] required_parameter

| A logical ’OR’ that separates multiple items of which only one may be chosen.

For example, you can select only one of the following parameters:

MyCommand para1 | param2 | param3

TIBCO ActiveMatrix Spring Component Development

Page 12: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

xii | Typographical Conventions

{ } A logical group of items in a command. Other syntax notations may appear within each logical group.

For example, the following command requires two parameters, which can be either the pair param1 and param2, or the pair param3 and param4.

MyCommand {param1 param2} | {param3 param4}

In the next example, the command requires two parameters. The first parameter can be either param1 or param2 and the second can be either param3 or param4:

MyCommand {param1 | param2} {param3 | param4}

In the next example, the command can accept either two or three parameters. The first parameter must be param1. You can optionally include param2 as the second parameter. And the last parameter is either param3 or param4.

MyCommand param1 [param2] {param3 | param4}

Table 2 Syntax Typographical Conventions

Convention Use

TIBCO ActiveMatrix Spring Component Development

Page 13: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Preface | xiii

Connecting with TIBCO Resources

How to Join TIBCOmmunityTIBCOmmunity is an online destination for TIBCO customers, partners, and resident experts, a place to share and access the collective experience of the TIBCO community. TIBCOmmunity offers forums, blogs, and access to a variety of resources. To register, go to http://www.tibcommunity.com.

How to Access All TIBCO DocumentationAfter you join TIBCOmmunity, you can access the documentation for all supported product versions here:

http://docs.tibco.com/TibcoDoc

How to Contact TIBCO SupportFor comments or problems with this manual or the software it addresses, please contact TIBCO Support as follows.

• For an overview of TIBCO Support, and information about getting started with TIBCO Support, visit this site:

http://www.tibco.com/services/support

• If you already have a valid maintenance or support contract, visit this site:

https://support.tibco.com

Entry to this site requires a user name and password. If you do not have a user name, you can request one.

TIBCO ActiveMatrix Spring Component Development

Page 14: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

xiv | Connecting with TIBCO Resources

TIBCO ActiveMatrix Spring Component Development

Page 15: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

| 1

Chapter 1 Overview

This chapter provides an overview of the Spring component and approaches to the component development process.

Topics

• Overview, page 2

TIBCO ActiveMatrix Spring Component Development

Page 16: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

2 | Chapter 1 Overview

Overview

Spring is a Java framework that allows applications to be built as a collection of simple Java beans.

Service Component Architecture (SCA) is a set of specifications which describe a model for building applications and systems using a Service Oriented Architecture.

SCA models solutions as sets of service components offering services and making references to services supplied by others which are combined together by composites. The composites wire references to services, declaratively apply bindings for communication methods, and also apply policies for aspects such as security and transactions.

SCA is used to extend the capabilities of Spring components by publishing Spring beans as services accessed by other remote components as well as by providing Spring beans with service references wired to services of other components.

TIBCO Business Studio facilitates Spring component implementation by providing a rich set of automatic code generation and synchronization features. TIBCO Business Studio supports WSDL-first development for Spring components.

You can develop Spring components starting from WSDL files and generate classes that conform to the WSDL specification. When you add a service, reference, or property to a Spring component, TIBCO Business Studio adds fields and methods that represent the service, reference, or property to the component's implementation classes and corresponding Spring bean configuration XML file.

You can also update the Spring component with additional services, references, or properties and regenerate the component implementation.

TIBCO ActiveMatrix Spring Component Development

Page 17: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Spring Components | 3

Chapter 2 Spring Components

This chapter describes how to create and configure a Spring component.

Topics

• Creating a Spring Component, page 4

• Configuring a Spring Component’s Custom Feature, page 5

• Configuring a Spring Component’s External Custom Feature, page 6

• Updating a Spring Component, page 7

• Spring Component Reference, page 9

TIBCO ActiveMatrix Spring Component Development

Page 18: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

4 | Chapter 2 Spring Components

Creating a Spring Component

Choose an option and follow the relevant procedure.

A Spring component is added to the canvas and its implementation is configured.

Option Description

Wizard 1. Create an SOA project selecting the SOA Project from WSDL project type.

2. In the Component Details page of the wizard, specify Spring for the component implementation type.

3. Specify code generation details as described in Generate Spring Implementation Reference on page 15.

Manual 1. Create an SOA project.

2. Open the composite created in the project.

3. Do one of the following:

— Click the Spring icon in the Palette and click the canvas.

— Click the canvas and click the Spring icon in the pop-up toolbar.

— Right-click the canvas and select Add > Spring.

4. Configure the Spring Component and add services, references, and properties to the component as required.

5. Generate the Spring implementation as described in Generating a Spring Component Implementation on page 12.

TIBCO ActiveMatrix Spring Component Development

Page 19: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Configuring a Spring Component’s Custom Feature | 5

Configuring a Spring Component’s Custom Feature

When you generate a Spring component implementation, the component’s custom feature field is automatically created and configured.

TIBCO ActiveMatrix Spring Component Development

Page 20: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

6 | Chapter 2 Spring Components

Configuring a Spring Component’s External Custom Feature

If the Spring component implementation references a plug-in containing a shared library, you must add the custom feature that contains the plug-in to the Spring component’s configuration.

1. Click the component.

2. In the Properties view, click the Implementation tab.

3. Click the button to the right of the Features table.

The Select a Feature dialog displays.

4. Click the feature containing the shared library plug-in.

5. Click OK.

The feature is added to the component’s features list.

TIBCO ActiveMatrix Spring Component Development

Page 21: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Updating a Spring Component | 7

Updating a Spring Component

You can typically update a component after you have configured its implementation. If you modify or update the Spring component or its implementation after the implementation has been generated, an error marker with the following message displays: "The component componentName is out of sync with its implementation". In such a case, you can choose to either:

— Update the component from existing implementation

— Update the Spring implementation

Updating the Spring Component from Existing ImplementationChoose an option and follow the relevant procedure:

All the changes made to the component after the last implementation generation (regeneration or updation) are discarded and the component is refreshed using the implementation.

Control Procedure

Canvas Right-click the component and select Refresh from Implementation.

Canvas Right-click the component and select Quick Fixes > Update Component from Implementation.

Properties View 1. In the Validation Report area on the General tab of the component’s Property View click the fix... link.

2. Select Update Component from Implementation.

Problems View 1. In the Problems view, right-click an error of the form The component "componentName" is out of sync with its implementation and select Quick Fix.

2. In the Quick Fix dialog, select Update Component from Implementation.

3. Click Finish.

TIBCO ActiveMatrix Spring Component Development

Page 22: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

8 | Chapter 2 Spring Components

Updating the Spring ImplementationChoose an option and follow the relevant procedure.

The Spring implementation and bean configuration XML file are updated.

Control Procedure

Canvas Right-click the component and select Regenerate Spring Implementation.

Canvas Right-click a component and select Quick Fixes > Update Spring Configuration.

Properties View 1. In the Validation Report area on the General tab of the component’s Properties view click the fix... link.

2. Select Update Spring Configuration.

Problems View 1. In the Problems view, right-click an error of the form The component "componentName" is out of sync with its implementation and select Quick Fix.

2. In the Quick Fix dialog, select Update Spring Configuration.

3. Click Finish.

TIBCO ActiveMatrix Spring Component Development

Page 23: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Spring Component Reference | 9

Spring Component Reference

Select the Spring Component on the canvas and in the Properties view, click the Implementation tab.

Features

The custom features on which the implementation depends.

Field Description

Plug-in Project Name The plug-in project name that contains the Spring bean configuration file.

Spring Bean File Location

The location of the Spring bean configuration file in the workspace, relative to the plug-in project.

Thread Context Class Loader Type

Configures the Thread context class loader when the Spring ApplicationContext is initialized. Setting the following value controls the value of the call: Thread.currentThread().getContextClassLoader(); when the user code (or any thirdparty code that the user code may use) is executing.

• component - the Thread context class loader will be the class loader of the component configured on the Composite.

• bundle - the Thread context class loader will be the class loader of the bundle (that is, plugin) that contains the application context/Spring beans XML file

• none - the Thread context class loader will be null

Field Description

Feature ID The ID of the feature.

Version Range The range of feature versions that the component requires.

TIBCO ActiveMatrix Spring Component Development

Page 24: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

10 | Chapter 3 Spring Component Implementations

Chapter 3 Spring Component Implementations

This chapter describes how to generate and work with a Spring component implementation.

Topics

• Opening a Spring Component Implementation, page 11

• Generating a Spring Component Implementation, page 12

• Generate Spring Implementation Reference, page 15

• Regenerating a Spring Component Implementation, page 17

• Handling Life Cycle Events, page 19

• Accessing a Property, page 20

• Invoking a Reference Operation, page 21

• Logging, page 22

• Handling Errors, page 23

• Referencing a Java Class in an External Project, page 24

• Referencing External Libraries, page 25

• Referencing an External Spring Application, page 26

TIBCO ActiveMatrix Spring Component Development

Page 25: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Opening a Spring Component Implementation | 11

Opening a Spring Component Implementation

Choose an initial control and follow the relevant procedure.

The implementation file opens in the XML editor.

Control Procedure

Canvas Double-click the component.

Canvas Right-click the component and select Open Implementation.

Project Explorer Right-click the implementation file and select Open With > XML Editor.

TIBCO ActiveMatrix Spring Component Development

Page 26: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

12 | Chapter 3 Spring Component Implementations

Generating a Spring Component Implementation

1. Choose an initial control and follow the relevant procedure.

The Create Spring Bean dialog displays.

2. Complete the Generate Spring Implementation Reference on page 15 dialog.

If the component has multiple services, and at least one property or reference is specified, the reference and/or property association dialog appears. A Component Properties dialog for every property and a Component References dialog for every reference is displayed.

Choose a bean to associate the reference or property with the available service beans. If there is only one service defined for the component, all the references and properties are automatically mapped to the single service.

3. Click Finish.

Control Procedure

Properties View 1. In the Validation Report area on the General tab of the component’s Properties view, click the fix... link.

2. Select Generate Spring Implementation.

Canvas Right-click the component and select Quick Fixes > Generate Spring Implementation.

Canvas Right-click the component and select Generate Spring Implementation.

Problems View 1. In the Problems view, right-click an error of the form Component "componentName" is not configured. and select Quick Fix.

2. In the Quick Fix dialog, select Generate Spring Implementation.

3. Click Finish.

TIBCO ActiveMatrix Spring Component Development

Page 27: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Generating a Spring Component Implementation | 13

The Spring bean configuration XML file is generated. If the composite name is compositeName and component name is componentName, the bean configuration XML file is named compositeName_componentName_beans.xml and is located in the implementation project under the folder config-CompositeName-componentName. See Spring Bean Configuration XML File on page 13 for details about the contents of the XML file.

Abstract and concrete implementation classes are also generated. If the implementation class is named ImplClass, the abstract implementation class is named AbstractImplClass. Additional code is generated based on the component elements as follows:

• Service - An interface is generated. If the port type is named PortType, the interface is named PortType. The clause implements PortType is added to the abstract class.

• Reference - Field and accessor methods are added to the abstract class.

• Property - Field and accessor methods are added to the abstract class.

Spring Bean Configuration XML FileWhen you generate the implementation for a Spring component, the Spring bean configuration XML file containing information to access the services, references, and properties of the component is generated.

The following XML snippets illustrate the contents of a bean configuration XML file for a Spring component with a HelloWorld service and a SpringGreeting property.

Define Namespace Define the namespace in the bean configuration XML file to make Spring aware of the related beans.

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context" xmlns:sca="http://www.springframework.org/schema/sca"xmlns:tibco="http://xsd.tns.tibco.com/2008/amf/extension/spring"

xsi:schemaLocation="http://xsd.tns.tibco.com/2008/amf/extension/spring http://xsd.tns.tibco.com/schema/sca/tibco-ext-spring-sca.xsd http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd

Do not edit the generated Spring bean configuration XML file except when you need to import an existing Spring bean.

TIBCO ActiveMatrix Spring Component Development

Page 28: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

14 | Chapter 3 Spring Component Implementations

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

Bean Definition

<bean id="HelloWorldPTBean" class="com.example.www.SOAPJava._gen.HelloWorldPTImpl"destroy-method="destroy" init-method="init"><property name="springGreeting" ref="SpringGreeting" />

</bean>

Component Services Component services are declared in the configuration file as an SCA service tag which captures the service details:

<sca:service name="HelloWorldPT" target="HelloWorldPTBean"type="com.example.www.SOAPJava._gen.HelloWorldPT" /><tibco:service-metadata name="HelloWorldPT"wsdl-location="/spring.wrapper.soa/Service Descriptors/HelloWorld_gen.wsdl"wsdl-interface="http://www.example.com/SOAPJava/_gen#HelloWorldP

T" />

Component Properties Component properties are declared in the configuration file as an SCA property tag which captures the property details:

<sca:property id="SpringGreeting" name="SpringGreeting"type="java.lang.String" /></beans>

Component References The component references (if any) are declared in the bean configuration file as an SCA reference tag which captures the reference details:

<sca:reference name="" target="" type="" />

TIBCO ActiveMatrix Spring Component Development

Page 29: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Generate Spring Implementation Reference | 15

Generate Spring Implementation Reference

Spring component supports JAXB based code generation. For details, refer TIBCO ActiveMatrix Java Component Development guide.

Field Description

Code Generation Details

Project The name of the Spring plug-in project to contain the implementation.

Default: com.sample.spring

Source Folder The name of the source folder in the plug-in project.

Default: src.

Beans Definition File The name of the Spring bean configuration XML file.

Default: config-compositeName-componentName/compositeName_componentName_beans.xml.

Data binding type The type of the data binding classes: XMLBeans or JAXB.

Default: XMLBeans.

Note: Generating implementations for two or more components in the same Java plug-in project using different binding methods is not supported.

New Bean Definition

Bean Id The name of the generated bean.

Default: serviceNameBean

If no service is defined on the component, the default bean id is componentNameBean.

Java Package The name of the package of the implementation.

Java Class The name of the class of the implementation.

Default: serviceNameImpl

If no service is defined on the component, the default class name is componentName

TIBCO ActiveMatrix Spring Component Development

Page 30: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

16 | Chapter 3 Spring Component Implementations

Use default location for the generated superclass

Default: Checked

Superclass package The name of the package of the abstract superclass of the implementation class.

Superclass class The name of the abstract superclass of the implementation class.

Default: AbstractJavaClassName

Component Properties

This dialog displays only when more than one service is defined on the component.

PropertyName Choose the bean to associate the named property.

Field Description

TIBCO ActiveMatrix Spring Component Development

Page 31: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Regenerating a Spring Component Implementation | 17

Regenerating a Spring Component Implementation

The implementation must have been originally generated before you can regenerate.

You should regenerate the component implementation after you add (or delete) a service, reference, or property to the component.

Choose an initial control and follow the relevant procedure.

Control Procedure

Canvas Right-click the component and select Regenerate Spring Implementation.

Problems View 1. In the Problems view, right-click an error of the form The component "componentName" is out of sync with its implementation and select Quick Fix.

2. In the Quick Fix dialog, select Update Spring Configuration.

3. Click Finish.

The Code Generation Details dialog displays the information of the implementation in read-only mode.

4. Click Next.

If a new service has been added, the New Bean Definition dialog displays.

If there are more than one service or reference, click Next. Else, go to step 6

5. The Component Properties dialog displays. Choose a bean to associate the named property.

6. Click Finish.

The Spring configuration file is updated, or a new implementation and a configuration file are created if you entered new bean definition details in step 4.

TIBCO ActiveMatrix Spring Component Development

Page 32: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

18 | Chapter 3 Spring Component Implementations

The implementation is updated to match the component.

Problems View 1. In the Problems view, right-click an error of the form The component "componentName" is out of sync with its implementation and select Quick Fix.

2. In the Quick Fix dialog, select Update Component from Implementation.

3. Click Finish.

The Spring component is updated. All changes made to the component after the last implementation generation (or regeneration or updation) are discarded.

Control Procedure

TIBCO ActiveMatrix Spring Component Development

Page 33: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Handling Life Cycle Events | 19

Handling Life Cycle Events

The runtime exposes component life cycle events — Init, Start, Stop, and Destroy — to component implementations.

When TIBCO Business Studio generates a Spring component implementation, it automatically adds the init and destroy method attributes on the generated bean in the generated Spring bean configuration XML file.

<bean id="HelloWorldPTBean" class="com.example.www.SOAPJava._gen.HelloWorldPTImpl"destroy-method="destroy" init-method="init"><property name="springGreeting" ref="SpringGreeting" />

</bean>

The following initialization and destroy methods are automatically added:

public void init() {// Component initialization code.// All properties are initialized and references are injected.

}

public void destroy() {// Component disposal code.// All properties are disposed.

}

Additionally, you can manually add the start and stop annotations to the custom code.

TIBCO ActiveMatrix Spring Component Development

Page 34: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

20 | Chapter 3 Spring Component Implementations

Accessing a Property

When you generate a Spring component implementation for a component with a property, the details of the property are captured in the <sca:property> tag which is added to the bean configuration XML file.

<sca:property id="SpringGreeting" name="SpringGreeting" type="java.lang.String" />

A field that represents the property and accessor methods to the Spring component’s abstract implementation class is added.

For example, if you add a property named SpringGreeting of type String to the Spring component, the following field and methods are added:

private java.lang.String SpringGreeting;public void setSpringGreeting(java.lang.String SpringGreeting) {

this.SpringGreeting = SpringGreeting;}

public java.lang.String getSpringGreeting() {return SpringGreeting;

}

The runtime initializes the property with an object of the type of the resource. To reference the property, invoke the accessor methods. For example:

resp.setHelloResponse(getSpringGreeting() + " " + name + "! " + "This is the Spring component.\n");

To use resource template in your component implementations, create a property of the resource type in the component.

<sca:property name="database" type="javax.sql.DataSource" />

The required imports, fields, and methods to use the resource are added.

import javax.sql.DataSource;private DataSource database;

public void setDatabase(DataSource database) {this.database = database;

}

public DataSource getDatabase() {return database;

}

To reference the resource, invoke the accessor methods:

DataSource ds = getDatabase();try {Connection connection = ds.getConnection();...} catch (SQLException e) {

...}

TIBCO ActiveMatrix Spring Component Development

Page 35: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Invoking a Reference Operation | 21

Invoking a Reference Operation

When you add a reference to a Spring component and generate the Spring implementation, the details are captured in the <sca:reference> tag added to the generated bean configuration XML file.

<sca:reference name="" target="" type="" />

Also, the field and accessor methods are added to the component.

public void setDateManagerPT(DateManagerPT DateManagerPT) {this.DateManagerPT = DateManagerPT;

}

public DateManagerPT getDateManagerPT() {return this.DateManagerPT;

}

To invoke the reference operation from a Java method, add the statement getReference().operation, where Reference is the name of the reference and operation is the name of the operation. For example, the following statement invokes a getCurrentTime operation on a reference named DateManagerPT:

TimeResponseDocument currentTime = getDateManagerPT().getCurrentTime(req)

TIBCO ActiveMatrix Spring Component Development

Page 36: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

22 | Chapter 3 Spring Component Implementations

Logging

TIBCO ActiveMatrix Service Grid supports logging to standard out and using a logging API. For simple demonstration applications, you can log to standard out. However, for product applications you should use the logging API.

See TIBCO ActiveMatrix Java Component Development for details.

TIBCO ActiveMatrix Spring Component Development

Page 37: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Handling Errors | 23

Handling Errors

The Web Application component handles errors in the same way as the Java component. See TIBCO ActiveMatrix Java Component Development for details on handling declared and undeclared faults.

TIBCO ActiveMatrix Spring Component Development

Page 38: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

24 | Chapter 3 Spring Component Implementations

Referencing a Java Class in an External Project

If a Spring component implementation references a Java class in another project in the same workspace as the component implementation, the referenced class must be contained in a Java plug-in project. See TIBCO ActiveMatrix Java Component Development for details.

TIBCO ActiveMatrix Spring Component Development

Page 39: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Referencing External Libraries | 25

Referencing External Libraries

If the Spring component implementation references a library in the runtime or a library that you have added to your project, you must import the referenced library’s packages in the plug-in project manifest. See TIBCO ActiveMatrix Java Component Development for details.

TIBCO ActiveMatrix Spring Component Development

Page 40: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

26 | Chapter 3 Spring Component Implementations

Referencing an External Spring Application

To reference external Spring applications from your Spring component implementation, do the following:

1. Import the external Spring application into the workspace as a plug-in project.

a. Create a new plug-in project using the Plug-in Development > Plug-in from existing JAR archives wizard.

b. In the JAR selection screen, click Add External... and select the external Spring application JAR file.

c. Enter the plug-in properties and uncheck the Unzip the JAR archives into the project checkbox.

2. Export all the packages that need to be exposed.

a. Expand the META-INF directory of the plug-in project.

b. Double-click MANIFEST.MF.

c. In the Manifest editor, click the Runtime tab.

d. In the Exported Packages area, click the Add... button and check the Show non Java Packages checkbox.

e. Select the library JAR file and click OK to add it.

f. Repeat step d and step e to add multiple JAR files.

3. Create the TIBCO SOA Project and the Spring component. Add the services, references, and properties to the component and generate the component implementation.

4. Add import entries in the generated Spring project.

a. Edit the bean configuration XML file and add the import statement to the bean definition:

<import resource="classpath:/location_of_external_springbean.xml">

5. Specify the plug-in project of the referenced class in the dependencies of the component implementation.

a. Expand the META_INF directory of the plug-in project.

b. Double-click MANIFEST.MF.

c. In the Manifest editor, click the Dependencies tab.

d. Click Add... in the Imported Packages area.

e. Select the referenced package and click OK.

TIBCO ActiveMatrix Spring Component Development

Page 41: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

Referencing an External Spring Application | 27

6. Edit the Spring bean configuration XML file and add the property tags from the external Spring application to the bean definition. For example:

<property name="propertyName" ref="BeanId_External">

7. Edit the generated Java implementation class to delegate calls to the external Spring classes.

The following example illustrates how to delegate calls from class HelloWorldPTImpl to the external Spring class MyLegacyJavaClass:

public class HelloWorldPTImpl extends AbstractHelloWorldPTImpl {/*** Initialization of ReuseLegacySpringComponent component.*/private MyLegacyJavaClass legacyBean;public void init() {// Component initialization code.// All properties are initialized and references are injected.if(this.legacyBean !=null){

System.out.println( "Legacy Bean Initilized...");System.out.println( this.legacyBean.sayHello("World"));

} else {throw new IllegalStateException("Injected bean is null");}

}

/*** Disposal of ReuseLegacySpringComponent component.*/@Destroypublic void destroy() {

// Component disposal code.// All properties are disposed.

}

/*** Implementation of the WSDL operation: sayHello */public HelloResponseDocument sayHello(HelloRequestDocument

firstName) {HelloResponseDocument

hrd=HelloResponseDocument.Factory.newInstance();hrd.setHelloResponse(getLegacyBean().sayHello(firstName.getHel

loRequest()).toString());return hrd;

}public MyLegacyJavaClass getLegacyBean() {

return legacyBean;}public void setLegacyBean(MyLegacyJavaClass legacyBean) {

this.legacyBean = legacyBean;}

}

8. Edit the custom feature for the Spring component to include the plug-in generated from the external Spring application.

TIBCO ActiveMatrix Spring Component Development

Page 42: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

28 | Chapter 3 Spring Component Implementations

TIBCO ActiveMatrix Spring Component Development

Page 43: TIBCO ActiveMatrix® Service Grid€¦ · TIBCO ActiveMatrix® Service Grid Spring Component Development Software Release 3.1.5 March 2012

TIBCO ActiveMatrix Spring Component Development

| 29

Index

A

accessing properties 20

C

changes from the previous release vicomponent

configure custom feature 5configure external custom feature 6create 4update 7

from implementation 7implementation 8

component implementationgenerate 12generate implementation reference 15open 11regenerate 17

customer support xiii, xiii

H

handling errors 23handling life cycle events 19

I

invoking reference operation 21

R

referencingexternal libraries 25external Spring application 26Java class 24

related documentation vii, vii

S

support, contacting xiii, xiii

T

technical support xiii, xiiiTIBCO_HOME x


Recommended