Back to top
 
 
 

Customizing Payment Gateway and Ticketing Service

This topic is for the developers/partners who would implement OSS Connector for CloudPortal Business Manager.

System requirements
The document assumes that the developer machine is installed with the following system requirements (and the developer is also aware of the same):
  • Windows XP (32-Bit), Windows Vista or Windows 7 (32- or 64-Bit)
  • JDK Version 1.6
    • Set JAVA_HOME environment variable to the root of the JDK install path
    • Add %JAVA_HOME%bin to the PATH environment variable
  • Spring Tool Suite (STS) Version 3.1.0 or higher
  • Apache Maven Version 3
    • Add <Maven Install Path>bin to the PATH environment variable
  • Running installation of CloudPortal Business Manager

Pre-Requisites

Read the Account Lifecycle, User Lifecycle, and Service Installation and Bootstrap sections of the Connector Development Kit before proceeding.

Downloading and Installing the OSS Service SDK

  • Download the CloudPortal Business Manager Cloud Service SDK.
  • Unzip the content to a local directory in your system.
  • Double-click cssdk-standard.jar or run the command java -jar cssdk-standard.jar to launch CloudPortal Business Manager Cloud Service SDK installer.
Note: For downloading and installing CloudPortal Business Manager, refer to the Installation and Administration Guide.

Creating the CS SDK Maven STS Project

  • Start SpringSource Tool Suite.
  • Go to File > New > Project.
  • Select Maven > Maven Project.
  • In the New Maven Project Wizard Screen, make sure Create a simple project is unchecked.
  • Click Next.
  • In the Catalog selection, select Default Local.
  • From the table select item with:
    • Group Id: com.citrix.cpbm
    • Artifact Id:
      • For Payment gateway: com-citrix-cpbm-payment-gateway-archetype
      • For Ticketing Service: com-citrix-cpbm-ticketing-service-archetype
  • Click Next.
  • Enter the values for the following fields:
    • GroupId - A group under which all services are offered. For instance, com. salesforce in case of Ticketing Service.
    • ArtifactId - Name of the services, which the above group offers. Example, com.salesforce.ticket in case of Ticketing Service for SalesForce.
    • Version - Version of the service offered. For example, for SalesForce with API version 27, the version is 27.
    • Package - Base Java package for the maven project .com.salesforce.ticket in case of SalesForce ticketing service.
  • Click Finish. This will create a OSS SDK Project.
Note: Updating Maven dependencies on the first project creation might take some time. This is a one-time update.

Various package structure and their responsibilities

Referring to the example mentioned above, we specified com.salesforce.ticket to be the base package for the service that this connector would offer. Taking com.salesforce.ticket as the base, the script will generate the below Java packages.
  • com.salesforce.ticket .connector: Contains Connector Code
  • com.salesforce.ticket.service: Contains Implementation of SalesForce ticketing Service
  • com.salesforce.ticket.lifecycle: Contains various Life Cycle Handlers

Default classes generated by the project and their functions

The project will generate three packages and will have default classes included in these packages. You must rename these classes to suit the functionality provided by the class. And also as a note, it is a default project structure generated for the ease of use and so packages/classes can be reorganized.

Java package Class Name Functionality
com.salesforce.ticket.connector
XServiceConnectorImpl Implementation class for com.citrix.cpbm.platform.spi .CloudServiceAdapter
com.salesforce.ticket.service
XServiceImpl Implements respective OSS Service. In case of ticketing it implements TicketService. Provides the actual service that is offered by this bundle.
com.salesforce.ticket.lifecycle
XSAccountLifeCycleHandler Implements com.citrix.cpbm.platform.spi.AccountLifeCycleHandler.
XSUserLifeCycleHandler Implements com.citrix.cpbm.platform.spi. UserLifeCycleHandler
Note: You must rename the X prefix in the generated class to a suitable class name.

Servicedefinition.xml

ServiceDefinition.xml file is located inside /com.salesforce.ticket/src/main/resources/ServiceDefinition.xml. When the mvn install is run, the config file is copied to the root folder of the package. By default, CloudPortal Business Manager platform searches for "ServiceDefinition.xml" file in the root folder of the deployed bundle. On locating the file, CloudPortal Business Manager parses the xml file and executes the steps to register the OSS Service.

OSS Service Connector

You may rename com.salesforce.ticket.connector.XServiceConnectorImpl to an appropriate Cloud Service Connector Implementation and provide its corresponding implementation.

CloudPortal Business Manager invokes this initialize method whenever required, to retrieve a OSS Service instance. On this instance, corresponding lifecycle handlers and collectors are invoked.

Configuring Connector and ServiceDefinition.xml

At this stage, we are ready with the connector and various class implementations required by the OSS Service connector.

Locate the sample ServiceDefinition.xml file and modify the parameters as per your needs. Most important parameters would be the Connector xml tag, ref attribute in the Connector xml tag and vendor version. Ref attribute should be the bean name of the implementation of "CloudConnectorFactory" interface, and version in the vendor should match with the version defined in the pom.xml file of the STS project.

Building OSGI Bundle from the project

Run mvn clean install at the root of the project path. An OSGI bundle jar will be generated in the target folder.

Publishing the OSGI Bundle to CloudPortal Business Manager

  • Stop CloudPortal Business Manager Development Serve by running the command:

    service cloud-portal stop

  • Copy the new bundle into /usr/local/vts3/connectors_ext directory on the CPBM server.
  • Add an entry for the new bundle into the plan /usr/local/vts3/connectors_ext/com.citrix.cpbm.connector.ext.plan.
  • Start CloudPortal Business Manager Development Server by running the command:

    service cloud-portal start

 

Comments