Back to top
 
 
 

Connector Fragment

Creation of connector fragment from Archetypes:
  1. Create a new connector fragment maven project by following the steps given below:
    1. Go to File->New->Project…
    2. Select Maven->Maven Project.
    3. In the New Maven Project Wizard screen, make sure Create a simple project is unchecked.
    4. Click Next.
    5. In the next screen, for the Catalog selection, select Default Local in Catalog drop down.
    6. From the table select item with:
      1. Group Id: com.citrix.cpbm
      2. Artifact Id: com-citrix-cpbm-connector-fragment-archetype
    7. Click Next .
    8. In the next screen, enter your values for the following fields:
      1. GroupId: A group under which all services are offered. For instance, org.apache in case of CloudStack.
      2. ArtifactId: Name of the services which the above group offers, cloudstack.fragment in case of Apache CloudStack.
      3. Version: Version of the service offered. For example, for cloudstack.fragment, the version is 1.0.0.
      4. Package: Base Java package for the maven project, org.apache.cloudstack in case of Apache CloudStack.
    9. Click Finish. This will create a Connector Fragment Project.
      Note: If project does not get created, try restarting the STS once.
Default Structure:
      META-INF          readme.txt      src          main              java                  base package name                      ExampleController.java              resources                  css                      ${artifactId}                          example.css                  js                      ${artifactId}                          example.js                  images                      ${artifactId}                          example.png                  META-INF                      MANIFEST.MF                  WEB-INF                      default                          ${artifactId}-tiles-defs.xml                      jsp                          ${artifactId}                              example.jsp                      applicationContext-${artifactId}-fragment.xml      build.properties      pom.xml      template.mf    
File Description:
  • ExampleController.java: It is a Spring MVC controller which will contain the url mapping, which is returned from the connector's view resolver. it returns a tiles view.
  • MANIFEST.MF: It is the bundle manifest specifying the bundle information along with the fragment host. It also contains package imports (if any).
  • applicationContext-${artifactId}-fragment.xml: Spring Context file whose beans will be loaded by the fragment host, Any spring beans should go here.
  • ${artifactId}-tiles-defs.xml: An xml configuration file which contains tiles definitions for custom views which is loaded by fragment-host by file name.
  • example.jsp: An example jsp file which specifies which JSTL tags can be used in the JSP and also provides an example to include a css or a javascript file.
  • example.js: An example js file.
  • example.css: An example css file.
  • example.png: An example image file.
  • pom.xml: The maven project file for dependency and build management.(Please add a maven dependency for the connector project for which this fragment will provide views).
General Guidelines:
  • Use unique filenames and tiles definitions to avoid conflicts with other connector fragments.
  • Use simple version numbers for bundle version to avoid bundle installation problems in Virgo server. Use x.x.x style of versioning, for example 1.0.0.
 

Comments