Logo
 
 

Creating the CS-SDK Maven STS project

 
 
 
 
 
 
  1. Start SpringSource Tool Suite.
  2. Goto File->New->Project….
  3. Select Maven->Maven Project.
  4. In the New Maven Project Wizard Screen make sure Create a simple project is unchecked.
  5. Click Next.
  6. On the next Screen for the Catalog selection, select Default Local.
  7. From the table select item with
    1. Group Id: com.citrix.cpbm
    2. Artifact Id: com-citrix-cpbm-cssdk-archetype
  8. Click Next.
  9. On the next screen enter your values for the following fields:
    1. GroupId - A group under which all services are offered. For instance, com.citrix in case of Citrix.
    2. ArtifactId - Name of the services which the above group offers. com.citrix.cpbm.cs in case of CloudPlatform service from Accelerite.
    3. Version - Version of the service offered. For example, for CloudPlatform 3.0.2, the version is 3.0.2.
    4. Package - Base Java package for the maven project com.citrix.cpbm.cs.sdk in case of Accelerite CloudPlatform Service.
  10. Set ClassNamePrefix to a preferred prefix for Class Names for the project generated by the Maven archetype.
  11. 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.
 
Package Structure

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.

  1. com.citrix.cpbm.cs.sdk.connector - Contains Connector Code
  2. com.citrix.cpbm.cs.sdk.collectors - Contains Collector Code
  3. com.citrix.cpbm.cs.sdk.cloud.service - Contains Implementation of Cloud Service
  4. com.citrix.cpbm.cs.sdk.lifecycle.handlers - Contains various Life Cycle Handlers
  5. com.citrix.cpbm.cs.sdk.views - Contains the View resolver
 
Default Classes
The project will generate five packages and will have default classes included in these packages. You must rename these classes to suit the functionality provided by the class.
Note: It is a default project structure generated for the ease of use so that the packages/classes can be reorganized.
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
 
Location of Service Definition File

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.

 
CloudService Connector

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.

 
Building OSGi Bundle

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

 
Publishing the Connector to CPBM
  1. 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>

  2. 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-->
  3. To stop CPBM Development Server, run command:

    service cloud-portal stop

  4. To start CPBM Development Server, run command:

    service cloud-portal start

 
他にご質問がございましたら、リクエストを送信してください

コメント

 
Adding comment, please wait....

Provide Feedback on Article:

Subject:
Comments:*
Powered by Zendesk