Creating the CS-SDK Maven STS project
- Start SpringSource Tool Suite.
- Goto File->New->Project….
- Select Maven->Maven Project.
- In the New Maven Project Wizard Screen make sure Create a simple project is unchecked.
- Click Next.
- On the next Screen for the Catalog selection, select Default Local.
- From the table select item with
- Group Id: com.citrix.cpbm
- Artifact Id: com-citrix-cpbm-cssdk-archetype
- Click Next.
- On the next screen enter your values for the following fields:
- GroupId - A group under which all services are offered. For instance, com.citrix in case of Citrix.
- ArtifactId - Name of the services which the above group offers. com.citrix.cpbm.cs in case of CloudPlatform service from Accelerite.
- Version - Version of the service offered. For example, for CloudPlatform 3.0.2, the version is 3.0.2.
- Package - Base Java package for the maven project com.citrix.cpbm.cs.sdk in case of Accelerite CloudPlatform Service.
- Set ClassNamePrefix to a preferred prefix for Class Names for the project generated by the Maven archetype.
- Click Finish. This will create a CPBM CS SDK Project.
Note: Updating Maven dependencies on the first project creation might take some time. This is a one-time update.
Referring to the example mentioned above, we specified com.citrix.cpbm.cs.sdk to be the base package for the service that this connector would offer. Taking com.citrix.cpbm.cs.sdk as the base, the script will generate the below Java packages.
- com.citrix.cpbm.cs.sdk.connector - Contains Connector Code
- com.citrix.cpbm.cs.sdk.collectors - Contains Collector Code
- com.citrix.cpbm.cs.sdk.cloud.service - Contains Implementation of Cloud Service
- com.citrix.cpbm.cs.sdk.lifecycle.handlers - Contains various Life Cycle Handlers
- com.citrix.cpbm.cs.sdk.views - Contains the View resolver
Java package | Class Name | Functionality |
com.citrix.cpbm.cs.sdk.connector | ||
<ClassNamePrefix>ServiceConnectorImpl | Implementation class for com.citrix.cpbm.platform.spi .CloudServiceConnector | |
<ClassNamePrefix>MetadataRegistry | Implements com.citrix.cpbm.platform.spi. MetadataRegistry | |
com.citrix.cpbm.cs.sdk.service | ||
<ClassNamePrefix>ServiceImpl | Implements CloudService. Provides the actual service that is offered by this bundle. | |
com.citrix.cpbm.cs.sdk.lifecycle.handlers | ||
<ClassNamePrefix>AccountLifeCycleHandler | Implements com.citrix.cpbm.platform.spi.AccountLifeCycleHandler. | |
<ClassNamePrefix>SubscriptionLifecycleHandler | Implements com.citrix.cpbm.platform.spi. SubscriptionLifecycleHandler | |
<ClassNamePrefix>UserLifeCycleHandler | Implements com.citrix.cpbm.platform.spi. UserLifeCycleHandler | |
com.citrix.cpbm.cs.sdk.collectors | ||
<ClassNamePrefix>UsageCollector | Implements com.citrix.cpbm.platform.spi. UsageCollector | |
<ClassNamePrefix>EventCollector | Implements com.citrix.cpbm.platform.spi. EventCollector | |
com.citrix.cpbm.cs.sdk.views | <ClassNamePrefix>ViewResolver | Implements com.citrix.cpbm.platform.spi.ViewResolver |
serviceDefinition.xml file is located inside "/com.citrix.cpbm.cs/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, CPBM platform searches for "serviceDefinition.xml" file in the root folder of the deployed bundle. On locating the file, CPBM would parse the xml file and execute the steps to register the Cloud Service.
CPBM invokes the initialize method of com.citrix.cpbm.cs.sdk.connector. <ClassNamePrefix>ServiceConnectorImpl whenever required, to retrieve a CloudService instance. On this instance, corresponding lifecycle handlers and collectors are invoked.
Run mvn clean install at the root of the project path. An OSGI bundle jar will be generated in the target folder.
- Secure copy the created bundle jar to the CPBM Development Server at the location /usr/share/vts3/connectors_ext.
Note: Ensure that the copied jar file has group and user set as cloud and cloud.
Use the following command: chown cloud:cloud <file name>
- Add the line <artifact type="bundle" name="<bundle.artifact.id>" version="[<x.x.x>, <x.x.x>]"/> within the plan tag in the file com.citrix.cpbm.connector.plan located at /usr/share/vts3/connectors_ext within the section marked by the xml comment <!--Cloud Service Connectors-->
- To stop CPBM Development Server, run command:
service cloud-portal stop
- To start CPBM Development Server, run command:
service cloud-portal start
Comments