||
Skip to end of metadata
Go to start of metadata

This topic explains how to complete the Student Management feature. If you have already created the components of the feature as explained in Step 2, you can now proceed to develop the Carbon feature using those components. We will first create the feature and then install it in the Carbon server by adding the feature to the p2-repository.

See the following topics for details:


Creating Maven sub projects

Create 3 sub Maven projects inside the student-manager-features project.

  • org.wso2.carbon.student.mgt.server.feature
    • artifactId - org.wso2.carbon.student.mgt.server.feature
    • packaging - pom
    • name - WSO2 Carbon - Student Manager Server Feature
    • dependency - org.wso2.carbon.student.mgt
    • plugin - carbon-p2-plugin
  • org.wso2.carbon.student.mgt.ui.feature
    • artifactId - org.wso2.carbon.student.mgt.ui.feature
    • packaging - pom
    • name - WSO2 Carbon - Student Manager UI Feature
    • dependency - org.wso2.carbon.student.mgt.stub
    • dependency - org.wso2.carbon.student.mgt.ui
    • plugin - carbon-p2-plugin
  • org.wso2.carbon.student.mgt.feature
    • artifactId - org.wso2.carbon.student.mgt.feature
    • packaging - pom
    • name - WSO2 Carbon - Student Manager Aggregate Feature
    • dependency - org.wso2.carbon.student.mgt.server.feature (zip type)
    • dependency - org.wso2.carbon.student.mgt.ui.feature (zip type)
    • plugin - carbon-p2-plugin
    • plugin - maven-antrun-plugin

Also, create the following Maven sub project under Student-Manager:

  • student-manager-repository
    • artifactId - student-manager-repository
    • packaging - pom
    • name - WSO2 Carbon - Student Manager Repository

Download the feature.properties file and add it to the student-manager-features folder.

Updating the pom.xml files

  • Update the Student-Manager →student-manager-features→pom.xml file:

     Expand this link to see the updated pom.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <artifactId>student-manager</artifactId>
            <groupId>org.wso2.carbon</groupId>
            <version>4.2.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
     
        <artifactId>student-manager-features</artifactId>
     
        <packaging>pom</packaging>
        <name>WSO2 Carbon - Student Manager Features</name>
    </project>
    <!-- We will be again updating this pom later in this tutorial --><?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <artifactId>student-manager</artifactId>
            <groupId>org.wso2.carbon</groupId>
            <version>4.2.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
     
        <artifactId>student-manager-components</artifactId>
     
        <packaging>pom</packaging>
        <name>WSO2 Carbon - Student Manager Components</name>
     
        <modules>
            <module>org.wso2.carbon.student.mgt</module>
            <!-- There are 2 more projects to be added here later in this tutorial stub, ui -->
        </modules>
    </project>
  • Update the Student-Manager →student-manager-repository→pom.xml file.

     Expand this link to see the updated pom.xml file.
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <artifactId>student-manager</artifactId>
            <groupId>org.wso2.carbon</groupId>
            <version>4.2.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
     
        <artifactId>student-manager-repository</artifactId>
     
        <packaging>pom</packaging>
        <name>WSO2 Carbon - Student Manager Repository</name>
    </project>
    <!-- We will be again updating this pom later in this tutorial -->
  • Update the Student-Manager →pom.xml file.

     Expand this link to see the updated pom.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
     
        <groupId>org.wso2.carbon</groupId>
        <artifactId>student-manager</artifactId>
        <version>4.2.0</version>
        <modules>
            <module>student-manager-components</module>
            <module>student-manager-features</module>
            <module>student-manager-repository</module>
        </modules>
     
        <packaging>pom</packaging>
        <name>WSO2 Carbon - Student Manager</name>
    </project> 
  • Update the org.wso2.carbon.student.mgt.server.feature → pom.xml file.

     Expand this link to see the updated pom.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>student-manager-features</artifactId>
            <version>4.2.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
     
        <artifactId>org.wso2.carbon.student.mgt.server.feature</artifactId>
        <packaging>pom</packaging>
        <name>WSO2 Carbon - Student Manager Server Feature</name>
     
        <dependencies>
            <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.student.mgt</artifactId>
                <version>4.2.0</version>
            </dependency>
        </dependencies>
     
        <build>
            <plugins>
                <plugin>
                    <groupId>org.wso2.maven</groupId>
                    <artifactId>carbon-p2-plugin</artifactId>
                    <version>1.5.3</version>
                    <executions>
                        <execution>
                            <id>p2-feature-generation</id>
                            <phase>package</phase>
                            <goals>
                                <goal>p2-feature-gen</goal>
                            </goals>
                            <configuration>
                                <id>org.wso2.carbon.student.mgt.server</id>
                                <propertiesFile>../feature.properties</propertiesFile>
                                <adviceFile>
                                    <properties>
                                        <propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
                                        <propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
                                    </properties>
                                </adviceFile>
                                <bundles>
                                    <bundleDef>org.wso2.carbon:org.wso2.carbon.student.mgt</bundleDef>
                                </bundles>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
  • Update the org.wso2.carbon.student.mgt.ui.feature → pom.xml file.

     Expand this link to see the updated pom.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>student-manager-features</artifactId>
            <version>4.2.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
     
        <artifactId>org.wso2.carbon.student.mgt.ui.feature</artifactId>
        <name>WSO2 Carbon - Student Manager UI Feature</name>
     
        <dependencies>
            <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.student.mgt.stub</artifactId>
                <version>4.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.student.mgt.ui</artifactId>
                <version>4.2.0</version>
            </dependency>
        </dependencies>
     
        <build>
            <plugins>
                <plugin>
                    <groupId>org.wso2.maven</groupId>
                    <artifactId>carbon-p2-plugin</artifactId>
                    <version>1.5.3</version>
                    <executions>
                        <execution>
                            <id>p2-feature-generation</id>
                            <phase>package</phase>
                            <goals>
                                <goal>p2-feature-gen</goal>
                            </goals>
                            <configuration>
                                <id>org.wso2.carbon.student.mgt.ui</id>
                                <propertiesFile>../feature.properties</propertiesFile>
                                <adviceFile>
                                    <properties>
                                        <propertyDef>org.wso2.carbon.p2.category.type:console</propertyDef>
                                        <propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
                                    </properties>
                                </adviceFile>
                                <bundles>
                                    <bundleDef>org.wso2.carbon:org.wso2.carbon.student.mgt.stub</bundleDef>
                                    <bundleDef>org.wso2.carbon:org.wso2.carbon.student.mgt.ui</bundleDef>
                                </bundles>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
  • Update the org.wso2.carbon.student.mgt.feature → pom.xml file.

     Expand this link to see the updated pom.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>student-manager-features</artifactId>
            <version>4.2.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
     
        <artifactId>org.wso2.carbon.student.mgt.feature</artifactId>
        <packaging>pom</packaging>
     
        <name>WSO2 Carbon - Student Manager Aggregate Feature</name>
     
        <dependencies>
            <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.student.mgt.server.feature</artifactId>
                <version>4.2.0</version>
                <type>zip</type>
            </dependency>
            <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.student.mgt.ui.feature</artifactId>
                <version>4.2.0</version>
                <type>zip</type>
            </dependency>
        </dependencies>
     
        <build>
            <plugins>
                <plugin>
                    <groupId>org.wso2.maven</groupId>
                    <artifactId>carbon-p2-plugin</artifactId>
                    <version>1.5.3</version>
                    <executions>
                        <execution>
                            <id>p2-feature-generation</id>
                            <phase>package</phase>
                            <goals>
                                <goal>p2-feature-gen</goal>
                            </goals>
                            <configuration>
                                <id>org.wso2.carbon.student.mgt</id>
                                <propertiesFile>../feature.properties</propertiesFile>
                                <adviceFile>
                                    <properties>
                                        <propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
                                    </properties>
                                </adviceFile>
                                <includedFeatures>
                                    <includedFeatureDef>org.wso2.carbon:org.wso2.carbon.student.mgt.server.feature</includedFeatureDef>
                                    <includedFeatureDef>org.wso2.carbon:org.wso2.carbon.student.mgt.ui.feature</includedFeatureDef>
                                </includedFeatures>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>clean_target</id>
                            <phase>install</phase>
                            <configuration>
                                <tasks>
                                    <delete dir="src/main/resources"/>
                                    <delete dir="src/main"/>
                                    <delete dir="src"/>
                                </tasks>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>

Note:

  • org.wso2.carbon.p2.category.type: This property is used to define whether the feature is a back-end (server), UI (console) or a common feature. The possible values are serverconsole and common. This property is read by the feature manager for BE, FE filtering.
  • org.eclipse.equinox.p2.type.group: It is important to explicitly set this property to ‘false’ when the feature is not a group type feature and you don’t want it to be listed in the feature manager UI. The possible values are true or false. Note that the group type features are listed in the feature manager UI. For sub features (console, UI), which are dependencies to the aggregate feature, set this property as 'false'.
  • In the server feature, we need to include only the server OSGI bundle: <bundleDef>org.wso2.carbon:org.wso2.carbon.student.mgt</bundleDef>.
  • In the UI feature, we have to include both the UI and stub OSGI bundles as the UI bundle depends on the stub.

Installing the feature in the Carbon server

To install the feature in the Carbon server: 

  1. You must first create a p2 repository y updating the student-manager-repository → pom.xml file as shown below.

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
     <artifactId>student-manager</artifactId>
     <groupId>org.wso2.carbon</groupId>
     <version>4.2.0</version>
     </parent>
     
     <modelVersion>4.0.0</modelVersion>
     
     <artifactId>wso2carbon-student-mgt-repository</artifactId>
     <packaging>pom</packaging>
     <name>WSO2 Carbon - Student Manager Feature Repository</name>
     
     <build>
     <plugins>
     <plugin>
     <groupId>org.wso2.maven</groupId>
     <artifactId>carbon-p2-plugin</artifactId>
     <version>1.5.3</version>
     <executions>
     <execution>
     <id>2-p2-repo-generation</id>
     <phase>package</phase>
     <goals>
     <goal>p2-repo-gen</goal>
     </goals>
     <configuration>
     <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
     <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
     <publishArtifacts>true</publishArtifacts>
     <publishArtifactRepository>true</publishArtifactRepository>
     <featureArtifacts>
     <featureArtifactDef>
     org.wso2.carbon:org.wso2.carbon.student.mgt.feature:4.2.0
     </featureArtifactDef>
     </featureArtifacts>
     </configuration>
     </execution>
     </executions>
     </plugin>
     </plugins>
     </build>
    </project>

    After successfully building the features, we include the final aggregate feature bundle in the p2-repo. After building the student-manager-repository by adding the repository (student-manager-repository/target/p2- repo/) to the Carbon server repository, we can install the feature.

  2. Log in to the management console of the product and go to the Configurations menu.

  3.  Click Features and then click Add Repository.

  4. Give a name for your repository and enter the full path of your local repository (student-manager-repository/target/p2-repo).

  5. Select the repository from the list of repositories, clear the Group features by category check box and click Find Features. Select the Student Manager Aggregate feature and click Install.

  6. Restart the server

  • No labels