facilitated to create a feature of given device type dynamically

merge-requests/1/head
GPrathap 9 years ago
parent a9750a2680
commit 84dc857811

@ -16,6 +16,9 @@
~ under the License.
-->
<archetype-descriptor name="${artifactId}">
<requiredProperties>
<requiredProperty key="deviceType"></requiredProperty>
</requiredProperties>
<modules>
<module id="component" dir="component" name="component">
<modules>

@ -27,6 +27,7 @@
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<name>${artifactId}</name>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
@ -50,7 +51,7 @@
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warName>${artifactId}</warName>
<warName>${artifactId}_agent</warName>
</configuration>
</plugin>
</plugins>

@ -46,7 +46,7 @@
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warName>${artifactId}</warName>
<warName>${artifactId}_mgt</warName>
</configuration>
</plugin>
</plugins>

@ -51,7 +51,7 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Name>${artifactId}</Bundle-Name>
<Bundle-Version>${carbon.iot.device.mgt.version}</Bundle-Version>
<Bundle-Version>${version}</Bundle-Version>
<Bundle-Description>IoT Server Impl Bundle</Bundle-Description>
<Private-Package>${package}.${rootArtifactId}.plugin.internal</Private-Package>
<Import-Package>

@ -53,5 +53,168 @@
<version>${version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<version>1.2.140.wso2v3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-jaxrs-manager-war</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>${project-base-package}.manager</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
<destFileName>${rootArtifactId}_mgt.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-jaxrs-controller-war</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>${project-base-package}.controller</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
<destFileName>${rootArtifactId}.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-jaxrs-agent-war</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>${project-base-package}.agent</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
<destFileName>${rootArtifactId}_agent.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>create-${deviceType}-plugin-mgt-schema</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property name="db.dir"
value="src/main/resources/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/${deviceType}DM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<mkdir dir="${basedir}/${db.dir}"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${userid}"
password="${password}"
autocommit="true" onerror="continue">
<classpath refid="maven.dependency.classpath"/>
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
<fileset file="${basedir}/src/main/resources/dbscripts/h2.sql"/>
</sql>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>${project-base-package}</id>
<propertiesFile>../../../features/etc/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>
${groupId}:${project-base-package}.plugin:${version}
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>
<importFeatureDef>org.wso2.carbon.device.mgt.server:${carbon.device.mgt.version}
</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -15,11 +15,11 @@
#
#
#[Device-Configurations]
[Device-Configurations]
owner=${DEVICE_OWNER}
deviceId=${DEVICE_ID}
device-name=${DEVICE_NAME}
controller-context=/digital_display/controller
controller-context=/${deviceType}/controller
mqtt-ep=${MQTT_EP}
auth-method=token
auth-token=${DEVICE_TOKEN}

@ -13,4 +13,4 @@
# * under the License.
# */
templates=deviceConfig.properties
zipfilename=Agent.zip
zipfilename=${deviceType}.zip

@ -18,8 +18,7 @@
-->
<DeviceTypeConfigurations>
<DeviceTypeConfig type="device_type">
<DatasourceName>jdbc/device_typeDM_DB</DatasourceName>
<!--ApiApplicationName>firealarm</ApiApplicationName-->
<DeviceTypeConfig type="${deviceType}">
<DatasourceName>jdbc/${deviceType}DM_DB</DatasourceName>
</DeviceTypeConfig>
</DeviceTypeConfigurations>

@ -22,14 +22,14 @@
</providers>
<datasources>
<datasource>
<name>${rootArtifactId}DM_DB</name>
<name>${deviceType}DM_DB</name>
<description>The datasource used for the this device type </description>
<jndiConfig>
<name>jdbc/device_typeDM_DB</name>
<name>jdbc/${deviceType}DM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/device_typeDM_DB;DB_CLOSE_ON_EXIT=FALSE
<url>jdbc:h2:repository/database/${deviceType}DM_DB;DB_CLOSE_ON_EXIT=FALSE
</url>
<username>wso2carbon</username>
<password>wso2carbon</password>

@ -1,4 +1,11 @@
-- -----------------------------------------------------
-- Agent Database
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `${deviceType}_DEVICE` (
`${deviceType}_DEVICE_ID` VARCHAR(45) NOT NULL ,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`${deviceType}_DEVICE_ID`) );

@ -1,4 +1,11 @@
-- -----------------------------------------------------
-- Agent Database
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `${deviceType}_DEVICE` (
`${deviceType}_DEVICE_ID` VARCHAR(45) NOT NULL ,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`${deviceType}_DEVICE_ID`) )
ENGINE = InnoDB;

@ -7,8 +7,8 @@ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../depl
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/${rootArtifactId}/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/agent/,target:${installFolder}/../../resources/sketches/${rootArtifactId}/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/${rootArtifactId},overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/agent/,target:${installFolder}/../../resources/sketches/${deviceType}/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/${deviceType},overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/${package}.${rootArtifactId}_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\

@ -33,10 +33,13 @@
<project-base-package>${groupId}.${rootArtifactId}</project-base-package>
<junit.version>3.8.1</junit.version>
<carbon.iot.device.mgt.version>1.0.0</carbon.iot.device.mgt.version>
<carbon.kernel.version>4.4.2</carbon.kernel.version>
<carbon.device.mgt.version>0.9.2-SNAPSHOT</carbon.device.mgt.version>
<org.apache.felix.version>1.4.0</org.apache.felix.version>
<maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
</properties>
<pluginRepositories>
<pluginRepository>

Loading…
Cancel
Save