bringing common features to cdmf

revert-70aa11f8
Ace 8 years ago
parent 8293ed43ae
commit 2aa1c98d0b

@ -17,56 +17,52 @@
~ specific language governing permissions and limitations ~ specific language governing permissions and limitations
~ under the License. ~ under the License.
--> -->
<DeviceManagementConfiguration> <DeviceManagementConfiguration name="samples">
<DeviceType>sample</DeviceType>
<ManagementRepository> <License>
<DataSourceConfiguration> <Language>en_US</Language>
<JndiLookupDefinition> <Version>1.0.0</Version>
<Name>jdbc/SampleDM_DB</Name> <Text>This is license text</Text>
</JndiLookupDefinition> </License>
</DataSourceConfiguration>
<DeviceDefinition> <DataSource>
<TableName>SAMPLE_DEVICE</TableName> <jndiConfig>
<!--Primary Key should be the device identifier--> <name>jdbc/SampleDM_DB</name>
</jndiConfig>
<tableDefinitions>
<Table name="SAMPLE_DEVICE">
<PrimaryKey>SAMPLE_DEVICE_ID</PrimaryKey> <PrimaryKey>SAMPLE_DEVICE_ID</PrimaryKey>
<Attributes> <Attributes>
<Attribute>column1</Attribute> <Attribute>column1</Attribute>
<Attribute>column2</Attribute> <Attribute>column2</Attribute>
</Attributes> </Attributes>
<License> </Table>
<Language>en_US</Language> </tableDefinitions>
<Version>1.0.0</Version> </DataSource>
<Text>This is license text</Text>
</License>
<!--if generate is set to true then the feature information will be picked up from the annotation in the api--> <!--if generate is set to true then the feature information will be picked up from the annotation in the api-->
<Features generate="false"> <Features>
<Feature> <Feature code="abc">
<Code>FEATURE_CODE_1</Code> <Name>abc</Name>
<Name>feature name 1</Name> <affectedVersion>5.0.0</affectedVersion>
<Description>description</Description> <Description>this is a feature</Description>
</Feature> <FeatureProperties>
<Feature> <Property name="prop1">place_holder</Property>
<Code>FEATURE_CODE_2</Code> <Property name="prop2">place_holder</Property>
<Name>feature name 2</Name> <Property name="prop3">place_holder</Property>
<Description>description</Description> </FeatureProperties>
</Feature> </Feature>
</Features> </Features>
</DeviceDefinition>
<ProvisioningConfig> <ProvisioningConfig>
<SharedWithAllTenants>false</SharedWithAllTenants> <SharedWithAllTenants>false</SharedWithAllTenants>
</ProvisioningConfig> </ProvisioningConfig>
</ManagementRepository>
<PushNotificationConfiguration> <NotificationProviders>
<!--MQTT Config--> <PushNotificationProvider type="MQTT">
<PushNotificationProvider>MQTT</PushNotificationProvider>
<FileBasedProperties>true</FileBasedProperties> <FileBasedProperties>true</FileBasedProperties>
<!--if file based properties is set to false then the configuration will be picked from platform configuration--> <!--if file based properties is set to false then the configuration will be picked from platform configuration-->
<Properties> <ConfigProperties>
<Property Name="mqtt.adapter.name">sample.mqtt.adapter</Property> <Property Name="mqtt.adapter.name">sample.mqtt.adapter</Property>
<Property Name="url">tcp://localhost:1883</Property> <Property Name="url">tcp://localhost:1883</Property>
<Property Name="username">admin</Property> <Property Name="username">admin</Property>
@ -74,6 +70,8 @@
<Property Name="qos">0</Property> <Property Name="qos">0</Property>
<Property Name="scopes"/> <Property Name="scopes"/>
<Property Name="clearSession">true</Property> <Property Name="clearSession">true</Property>
</Properties> </ConfigProperties>
</PushNotificationConfiguration> </PushNotificationProvider>
</NotificationProviders>
</DeviceManagementConfiguration> </DeviceManagementConfiguration>

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<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>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.2.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.url.printer</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Device Management url printer</name>
<description>WSO2 Carbon - Device Management url printer</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>IoT Server Impl Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.device.mgt.iot.url.printer.internal</Private-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
org.apache.axis2.*;version="${axis2.osgi.version.range}",
org.wso2.carbon.core,
org.wso2.carbon.utils.*,
</Import-Package>
<Export-Package>
!org.wso2.carbon.device.mgt.iot.url.printer.internal,
org.wso2.carbon.device.mgt.iot.url.printer.*;version="${project.version}"
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,60 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.url.printer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.device.mgt.url.printer.internal.UrlPrinterDataHolder;
import org.wso2.carbon.utils.CarbonUtils;
import org.wso2.carbon.utils.ConfigurationContextService;
import org.wso2.carbon.utils.NetworkUtils;
public class URLPrinterStartupHandler implements ServerStartupObserver {
private static final Log log = LogFactory.getLog(URLPrinterStartupHandler.class);
@Override
public void completingServerStartup() {
}
@Override
public void completedServerStartup() {
log.info("IoT Console URL : " + this.getServerUrl());
}
private String getServerUrl() {
// Hostname
String hostName = "localhost";
try {
hostName = NetworkUtils.getMgtHostName();
} catch (Exception ignored) {
}
// HTTPS port
String mgtConsoleTransport = CarbonUtils.getManagementTransport();
ConfigurationContextService configContextService =
UrlPrinterDataHolder.getInstance().getConfigurationContextService();
int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport);
int httpsProxyPort =
CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), mgtConsoleTransport);
if (httpsProxyPort > 0) {
port = httpsProxyPort;
}
return "https://" + hostName + ":" + port + "/devicemgt";
}
}

@ -0,0 +1,42 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.url.printer.internal;
import org.wso2.carbon.utils.ConfigurationContextService;
public class UrlPrinterDataHolder {
private ConfigurationContextService configurationContextService;
private static UrlPrinterDataHolder thisInstance = new UrlPrinterDataHolder();
private UrlPrinterDataHolder() {}
public static UrlPrinterDataHolder getInstance() {
return thisInstance;
}
public ConfigurationContextService getConfigurationContextService() {
return configurationContextService;
}
public void setConfigurationContextService(ConfigurationContextService configurationContextService) {
this.configurationContextService = configurationContextService;
}
}

@ -0,0 +1,79 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.url.printer.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.device.mgt.url.printer.URLPrinterStartupHandler;
import org.wso2.carbon.utils.ConfigurationContextService;
/**
* @scr.component name="UrlPrinterServiceComponent"
* immediate="true"
* @scr.reference name="config.context.service"
* interface="org.wso2.carbon.utils.ConfigurationContextService"
* cardinality="0..1"
* policy="dynamic"
* bind="setConfigurationContextService"
* unbind="unsetConfigurationContextService"
*/
public class UrlPrinterServiceComponent {
private static final Log log = LogFactory.getLog(UrlPrinterServiceComponent.class);
protected void activate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("Activating Url printer Service Component");
}
try {
BundleContext bundleContext = ctx.getBundleContext();
bundleContext.registerService(ServerStartupObserver.class.getName(), new URLPrinterStartupHandler(), null);
if (log.isDebugEnabled()) {
log.debug("Url printer Service Component has been successfully activated");
}
} catch (Throwable e) {
log.error("Error occurred while activating Url printer Service Component", e);
}
}
protected void deactivate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("De-activating Url printer Service Component");
}
}
protected void setConfigurationContextService(ConfigurationContextService configurationContextService) {
if (log.isDebugEnabled()) {
log.debug("Setting ConfigurationContextService");
}
UrlPrinterDataHolder.getInstance().setConfigurationContextService(configurationContextService);
}
protected void unsetConfigurationContextService(ConfigurationContextService configurationContextService) {
if (log.isDebugEnabled()) {
log.debug("Un-setting ConfigurationContextService");
}
UrlPrinterDataHolder.getInstance().setConfigurationContextService(null);
}
}

@ -40,6 +40,7 @@
<module>org.wso2.carbon.device.mgt.analytics.dashboard</module> <module>org.wso2.carbon.device.mgt.analytics.dashboard</module>
<module>org.wso2.carbon.device.mgt.api</module> <module>org.wso2.carbon.device.mgt.api</module>
<module>org.wso2.carbon.device.mgt.analytics.data.publisher</module> <module>org.wso2.carbon.device.mgt.analytics.data.publisher</module>
<module>org.wso2.carbon.device.mgt.url.printer</module>
</modules> </modules>
</project> </project>

@ -40,6 +40,10 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.url.printer</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId> <artifactId>org.wso2.carbon.device.mgt.common</artifactId>

@ -168,6 +168,11 @@
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
<version>${carbon.device.mgt.version}</version> <version>${carbon.device.mgt.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.url.printer</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId> <artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>

Loading…
Cancel
Save