merged conflicts with the changes of combining the device controller

and the manager together
application-manager-new
Shabir Mohamed 9 years ago
commit 69dcf064f9

@ -348,6 +348,32 @@
<goal>run</goal>
</goals>
</execution>
<!--Install default samples-->
<execution>
<id>install_libs</id>
<phase>package</phase>
<configuration>
<tasks>
<echo message="Downloading lib source...." />
<mkdir dir="target/libs-temp"/>
<exec dir="target/libs-temp" executable="sh">
<arg line="-c 'svn checkout https://github.com/wso2-incubator/iot-server-appliances/trunk/org.wso2.carbon.devicemgt.grant --non-interactive --trust-server-cert'" />
</exec>
<echo message="building libraries from source" />
<exec dir="target/libs-temp/org.wso2.carbon.devicemgt.grant" executable="sh">
<arg line="-c 'mvn clean install'" />
</exec>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/lib/"
overwrite="true">
<fileset
dir="target/libs-temp/org.wso2.carbon.devicemgt.grant/target/" includes="*.jar"/>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>clean_target</id>
<phase>install</phase>
@ -447,31 +473,31 @@
<token>(jdbc/WSO2CarbonDB)</token>
<value>jdbc/WSO2AM_DB</value>
</replacement>
<!--<replacement>-->
<!--<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>-->
<!--<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler)</token>-->
<!--<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedAuthorizationCodeGrantHandler</value>-->
<!--</replacement>-->
<!--<replacement>-->
<!--<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>-->
<!--<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.PasswordGrantHandler)</token>-->
<!--<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedPasswordGrantHandler</value>-->
<!--</replacement>-->
<!--<replacement>-->
<!--<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>-->
<!--<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.ClientCredentialsGrantHandler)</token>-->
<!--<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedClientCredentialsGrantHandler</value>-->
<!--</replacement>-->
<!--<replacement>-->
<!--<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>-->
<!--<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler)</token>-->
<!--<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedSAML2BearerGrantHandler</value>-->
<!--</replacement>-->
<!--<replacement>-->
<!--<xpath>/Server/OAuth/OAuthCallbackHandlers</xpath>-->
<!--<token>(org.wso2.carbon.identity.oauth.callback.DefaultCallbackHandler)</token>-->
<!--<value>org.wso2.carbon.apimgt.keymgt.util.APIManagerOAuthCallbackHandler</value>-->
<!--</replacement>-->
<replacement>
<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>
<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler)</token>
<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedAuthorizationCodeGrantHandler</value>
</replacement>
<replacement>
<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>
<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.PasswordGrantHandler)</token>
<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedPasswordGrantHandler</value>
</replacement>
<replacement>
<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>
<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.ClientCredentialsGrantHandler)</token>
<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedClientCredentialsGrantHandler</value>
</replacement>
<replacement>
<xpath>/Server/OAuth/SupportedGrantTypes/SupportedGrantType</xpath>
<token>(org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler)</token>
<value>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedSAML2BearerGrantHandler</value>
</replacement>
<replacement>
<xpath>/Server/OAuth/OAuthCallbackHandlers</xpath>
<token>(org.wso2.carbon.identity.oauth.callback.DefaultCallbackHandler)</token>
<value>org.wso2.carbon.apimgt.keymgt.util.APIManagerOAuthCallbackHandler</value>
</replacement>
</replacements>
</configuration>
@ -494,6 +520,39 @@
</replacements>
</configuration>
</execution>
<execution>
<id>replace-for-api-publisher</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/deployment/server/jaggeryapps/api-publisher/site/conf/site.json</file>
<replacements>
<replacement>
<token>(/publisher)</token>
<value>/api-publisher</value>
</replacement>
</replacements>
</configuration>
</execution>
<execution>
<id>replace-for-api-store</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/deployment/server/jaggeryapps/api-store/site/conf/site.json</file>
<replacements>
<replacement>
<token>(/store)</token>
<value>/api-store</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>

@ -102,6 +102,15 @@
<fileMode>755</fileMode>
</fileSet>
<!--copy api related rxts-->
<fileSet>
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/rxts</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/resources/rxts/</outputDirectory>
<includes>
<include>*.rxt</include>
</includes>
</fileSet>
<!-- Multi-tenancy related file -->
<fileSet>
<directory>
@ -128,6 +137,7 @@
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.platform.version}/repository/conf/identity/</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/identity</outputDirectory>
<excludes>
<exclude>**/identity.xml</exclude>
<exclude>**/sso-idp-config.xml</exclude>
<exclude>**/application-authentication.xml</exclude>
</excludes>
@ -207,6 +217,7 @@
<directory>src/repository/conf</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
<includes>
<include>**/identity.xml</include>
<include>**/api-manager.xml</include>
<include>**/sso-idp-config.xml</include>
<include>**/application-authentication.xml</include>
@ -381,6 +392,8 @@
<include>**/org.wso2.ciphertool-1.0.0-wso2v3.jar</include>
</includes>
</fileSet>
<!--============ Added with ES Features ===============-->
<fileSet>
@ -391,6 +404,8 @@
</includes>
</fileSet>
<!--============ Added with ES Features ===============-->
<fileSet>

@ -58,8 +58,8 @@
<parameter name="ModulesDirectory">axis2modules</parameter>
<!-- User agent and the server details to be used in the http communication -->
<parameter name="userAgent" locked="true">WSO2 IOT 1.0.0-SNAPSHOT</parameter>
<parameter name="server" locked="true">WSO2 IOT 1.0.0-SNAPSHOT</parameter>
<parameter name="userAgent" locked="true">WSO2 IoTServer 1.0.0</parameter>
<parameter name="server" locked="true">WSO2 IoTServer 1.0.0</parameter>
<!-- During a fault, stacktrace can be sent with the fault message. The following flag -->
<!-- will control that behaviour -->
@ -153,7 +153,7 @@
<!-- expected to be resolved based on the content type. -->
<messageFormatters>
<messageFormatter contentType="application/x-www-form-urlencoded"
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
class="org.apache.synapse.commons.formatters.XFormURLEncodedFormatter"/>
<messageFormatter contentType="multipart/form-data"
class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
<messageFormatter contentType="application/xml"
@ -167,47 +167,25 @@
<!--JSON Message Formatters-->
<messageFormatter contentType="application/json"
class="org.apache.synapse.commons.json.JsonFormatter"/>
<!--messageFormatter contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamFormatter"/-->
<messageFormatter contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
<messageFormatter contentType="text/javascript"
class="org.apache.axis2.json.JSONMessageFormatter"/>
<!-- See https://wso2.org/jira/browse/ESBJAVA-1725 before enabling bellow line -->
<!--messageFormatter contentType=".*"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
<!--messageFormatter contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="multipart/form-data"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="multipart/related"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="application/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="text/plain"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="application/soap+xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="text/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="application/json"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="application/json/badgerfish"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="text/javascript"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="application/octet-stream"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="multipart/form-data"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="application/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="application/soap+xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="text/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/>
<messageFormatter contentType=""
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--messageFormatter contentType=""
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--messageFormatter contentType="application/edi-hl7"
class="org.wso2.carbon.business.messaging.hl7.message.HL7MessageFormatter"/-->
</messageFormatters>
<!-- ================================================= -->
@ -229,158 +207,69 @@
<!--JSON Message Builders-->
<messageBuilder contentType="application/json"
class="org.apache.synapse.commons.json.JsonBuilder"/>
<!--messageBuilder contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamBuilder"/-->
<messageBuilder contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
<messageBuilder contentType="text/javascript"
class="org.apache.axis2.json.JSONBuilder"/>
<!--messageBuilder contentType="text/javascript"
class="org.apache.axis2.json.JSONStreamBuilder"/-->
<!--See https://wso2.org/jira/browse/ESBJAVA-1725 before enabling bellow line -->
<!--messageBuilder contentType=".*"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<!--messageBuilder contentType="application/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="multipart/form-data"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="multipart/related"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="application/soap+xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="text/plain"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="text/html"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="text/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="application/json"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="application/json/badgerfish"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="text/javascript"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="application/octet-stream"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="multipart/form-data"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="multipart/related"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="application/soap+xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="text/plain"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="text/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/>
<messageBuilder contentType=""
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
<!--messageBuilder contentType=""
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
<!--messageBuilder contentType="application/edi-hl7"
class="org.wso2.carbon.business.messaging.hl7.message.HL7MessageBuilder"/-->
</messageBuilders>
<!-- ================================================= -->
<!-- Transport Ins (Listeners) -->
<!-- ================================================= -->
<!--<transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">-->
<!--<parameter name="port" locked="false">8280</parameter>-->
<!--<parameter name="non-blocking" locked="false">true</parameter>-->
<!--&lt;!&ndash;parameter name="bind-address" locked="false">hostname or IP address</parameter&ndash;&gt;-->
<!--&lt;!&ndash;parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter&ndash;&gt;-->
<!--<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.mediation.transport.handlers.PassThroughNHttpGetProcessor</parameter>-->
<!--&lt;!&ndash;<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>&ndash;&gt;-->
<!--</transportReceiver>-->
<!-- the non blocking http transport based on HttpCore + NIO extensions -->
<!--transportReceiver name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
<transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
<parameter name="port" locked="false">8280</parameter>
<parameter name="non-blocking" locked="false">true</parameter-->
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<!--parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor</parameter-->
<!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>
</transportReceiver-->
<!--<transportReceiver name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLListener">-->
<!--<parameter name="port" locked="false">8243</parameter>-->
<!--<parameter name="non-blocking" locked="false">true</parameter>-->
<!--&lt;!&ndash;parameter name="bind-address" locked="false">hostname or IP address</parameter&ndash;&gt;-->
<!--&lt;!&ndash;parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter&ndash;&gt;-->
<!--<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.mediation.transport.handlers.PassThroughNHttpGetProcessor</parameter>-->
<!--<parameter name="keystore" locked="false">-->
<!--<KeyStore>-->
<!--<Location>repository/resources/security/wso2carbon.jks</Location>-->
<!--<Type>JKS</Type>-->
<!--<Password>wso2carbon</Password>-->
<!--<KeyPassword>wso2carbon</KeyPassword>-->
<!--</KeyStore>-->
<!--</parameter>-->
<!--<parameter name="truststore" locked="false">-->
<!--<TrustStore>-->
<!--<Location>repository/resources/security/client-truststore.jks</Location>-->
<!--<Type>JKS</Type>-->
<!--<Password>wso2carbon</Password>-->
<!--</TrustStore>-->
<!--</parameter>-->
<!--&lt;!&ndash;<parameter name="SSLVerifyClient">require</parameter>-->
<!--supports optional|require or defaults to none &ndash;&gt;-->
<!--</transportReceiver>-->
<parameter name="non-blocking" locked="false">true</parameter>
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.mediation.transport.handlers.PassThroughNHttpGetProcessor</parameter>
<!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>-->
</transportReceiver>
<!-- the non blocking https transport based on HttpCore + SSL-NIO extensions -->
<!--transportReceiver name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLListener">
<transportReceiver name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLListener">
<parameter name="port" locked="false">8243</parameter>
<parameter name="non-blocking" locked="false">true</parameter-->
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>-->
<!--parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/wso2carbon.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter-->
<!--<parameter name="SSLVerifyClient">require</parameter>
supports optional|require or defaults to none -->
<!--/transportReceiver-->
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="HttpsProtocols">TLSv1,TLSv1.1,TLSv1.2</parameter>
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.mediation.transport.handlers.PassThroughNHttpGetProcessor</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/wso2carbon.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter>
<!--<parameter name="SSLVerifyClient">require</parameter>
supports optional|require or defaults to none -->
</transportReceiver>
<transportReceiver name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>
<!-- Pass-through HTTP Transport Receivers -->
<!--<transportReceiver name="passthru-http" class="org.wso2.carbon.transport.passthru.PassThroughHttpListener">
<parameter name="port">8281</parameter>
<parameter name="non-blocking">true</parameter>-->
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<!--</transportReceiver>-->
<!--<transportReceiver name="passthru-https" class="org.wso2.carbon.transport.passthru.PassThroughHttpSSLListener">
<parameter name="port" locked="false">8244</parameter>
<parameter name="non-blocking" locked="false">true</parameter>-->
<!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
<!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
<!--<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/wso2carbon.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter>-->
<!--<parameter name="SSLVerifyClient">require</parameter>
supports optional|require or defaults to none -->
<!--</transportReceiver>-->
<!--<transportReceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener"/>-->
@ -389,32 +278,27 @@
check com.sun.mail.pop3 and com.sun.mail.imap package documentation for more details-->
<!--</transportReceiver>-->
<!--<transportReceiver name="admin/https" class="org.wso2.esb.transport.tomcat.HttpsTransportListener">-->
<!--<parameter name="port" locked="false">9444</parameter>-->
<!--<parameter name="non-blocking" locked="false">true</parameter>-->
<!--</transportReceiver>-->
<!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver>-->
@ -442,53 +326,75 @@
</parameter>
</transportReceiver-->
<!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x -->
<!--transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver-->
<!--Uncomment this for FIX transport support
<transportReceiver name="fix" class="org.apache.synapse.transport.fix.FIXTransportListener"/>
-->
<transportReceiver name="http"
class="org.wso2.carbon.core.transports.http.HttpTransportListener">
<!--
Uncomment the following if you are deploying this within an application server. You
need to specify the HTTP port of the application server
-->
<parameter name="port">9763</parameter>
<!--
Uncomment the following to enable Apache2 mod_proxy. The port on the Apache server is 80
in this case.
-->
<!--<parameter name="proxyPort">80</parameter>-->
</transportReceiver>
<transportReceiver name="https"
class="org.wso2.carbon.core.transports.http.HttpsTransportListener">
<!--
Uncomment the following if you are deploying this within an application server. You
need to specify the HTTPS port of the application server
-->
<parameter name="port">9443</parameter>
<!--transportReceiver name="hl7" class="org.wso2.carbon.business.messaging.hl7.transport.HL7TransportListener"/-->
<!-- SAP Transport Listeners -->
<!-- <transportReceiver name="idoc" class="org.wso2.carbon.transports.sap.SAPTransportListener"/> -->
<!-- <transportReceiver name="bapi" class="org.wso2.carbon.transports.sap.SAPTransportListener"/> -->
<!--Uncomment this and configure as appropriate for RabbitMQ transport support
<transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener">
<parameter name="AMQPConnectionFactory" locked="false">
<parameter name="rabbitmq.server.host.name" locked="false">localhost</parameter>
<parameter name="rabbitmq.server.port" locked="false">5672</parameter>
<parameter name="rabbitmq.server.user.name" locked="false"></parameter>
<parameter name="rabbitmq.server.password" locked="false"></parameter>
<parameter name="rabbitmq.connection.retry.interval" locked="false">10000</parameter>
<parameter name="rabbitmq.connection.retry.count" locked="false">5</parameter>
</parameter>
</transportReceiver-->
<!--
Uncomment the following to enable Apache2 mod_proxy. The port on the Apache server is 443
in this case.
-->
<!--<parameter name="proxyPort">443</parameter>-->
</transportReceiver>
<!-- <transportReceiver name="mqtt" class="org.apache.axis2.transport.mqtt.MqttListener">
<parameter locked="false" name="mqttConFactory">
<parameter locked="false" name="mqtt.server.host.name">localhost</parameter>
<parameter name="mqtt.connection.factory">mqttConFactory</parameter>
<parameter locked="false" name="mqtt.server.port">1883</parameter>
<parameter locked="false" name="mqtt.client.id">client-id-1234</parameter>
<parameter locked="false" name="mqtt.topic.name">esb.test</parameter>
</parameter>
</transportReceiver>-->
<!-- ================================================= -->
<!-- Transport Outs (Senders) -->
<!-- ================================================= -->
<!--<transportSender name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpSender">-->
<!--<parameter name="non-blocking" locked="false">true</parameter>-->
<!--</transportSender>-->
<!-- the non-blocking http transport based on HttpCore + NIO extensions -->
<!--transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender">
<transportSender name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpSender">
<parameter name="non-blocking" locked="false">true</parameter>
<!--<parameter name="warnOnHTTP500" locked="false">*</parameter>-->
<!--parameter name="http.proxyHost" locked="false">localhost</parameter-->
<!--<parameter name="http.proxyPort" locked="false">3128</parameter>-->
<!--<parameter name="http.nonProxyHosts" locked="false">localhost|moon|sun</parameter>-->
</transportSender>
<transportSender name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLSender">
<transportSender name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLSender">
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
@ -504,68 +410,18 @@
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter-->
<!--<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>-->
<!--supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified -->
<!--/transportSender-->
</parameter>
<!--<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>-->
<!--supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified -->
</transportSender>
<!-- Transport sender for the non blocking local transport-->
<!--transportSender name="local" class="org.apache.axis2.transport.local.NonBlockingLocalTransportSender"/-->
<transportSender name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportSender"/>
<!-- Pass-through HTTP Transport Senders -->
<!--<transportSender name="passthru-http" class="org.wso2.carbon.transport.passthru.PassThroughHttpSender">
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="warnOnHTTP500" locked="false">*</parameter>-->
<!--parameter name="http.proxyHost" locked="false">localhost</parameter>
<parameter name="http.proxyPort" locked="false">3128</parameter>
<parameter name="http.nonProxyHosts" locked="false">localhost|moon|sun</parameter-->
<!--</transportSender>-->
<!--<transportSender name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLSender">-->
<!--<parameter name="non-blocking" locked="false">true</parameter>-->
<!--<parameter name="keystore" locked="false">-->
<!--<KeyStore>-->
<!--<Location>repository/resources/security/wso2carbon.jks</Location>-->
<!--<Type>JKS</Type>-->
<!--<Password>wso2carbon</Password>-->
<!--<KeyPassword>wso2carbon</KeyPassword>-->
<!--</KeyStore>-->
<!--</parameter>-->
<!--<parameter name="truststore" locked="false">-->
<!--<TrustStore>-->
<!--<Location>repository/resources/security/client-truststore.jks</Location>-->
<!--<Type>JKS</Type>-->
<!--<Password>wso2carbon</Password>-->
<!--</TrustStore>-->
<!--</parameter>-->
<!--&lt;!&ndash;<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>&ndash;&gt;-->
<!--&lt;!&ndash;supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified &ndash;&gt;-->
<!--</transportSender>-->
<!--<transportSender name="passthru-https" class="org.wso2.carbon.transport.passthru.PassThroughHttpSSLSender">
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/wso2carbon.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter>-->
<!--<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>-->
<!--supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified -->
<!--</transportSender>-->
<!--Uncomment this local transport to use local transport in mediation flow-->
<!--<transportSender name="local" class="org.apache.axis2.transport.local.NonBlockingLocalTransportSender"/>-->
<!-- uncomment this and configure to use connection pools for sending messages>
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/-->
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/-->
<!--transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/-->
@ -585,20 +441,16 @@
<transportSender name="fix" class="org.apache.synapse.transport.fix.FIXTransportSender"/>
-->
<!--<transportSender name="http"-->
<!--class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">-->
<!--<parameter name="PROTOCOL">HTTP/1.1</parameter>-->
<!--<parameter name="Transfer-Encoding">chunked</parameter>-->
<!-- This parameter has been added to overcome problems encounted in SOAP action parameter -->
<!--<parameter name="OmitSOAP12Action">true</parameter>-->
<!--</transportSender>-->
<!--<transportSender name="https"-->
<!--class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">-->
<!--<parameter name="PROTOCOL">HTTP/1.1</parameter>-->
<!--<parameter name="Transfer-Encoding">chunked</parameter>-->
<!-- This parameter has been added to overcome problems encounted in SOAP action parameter -->
<!--<parameter name="OmitSOAP12Action">true</parameter>-->
<!--</transportSender>-->
<!--transportSender name="hl7" class="org.wso2.carbon.business.messaging.hl7.transport.HL7TransportSender"/-->
<!-- SAP Transport Senders -->
<!-- <transportSender name="idoc" class="org.wso2.carbon.transports.sap.SAPTransportSender"/> -->
<!-- <transportSender name="bapi" class="org.wso2.carbon.transports.sap.SAPTransportSender"/> -->
<!-- Uncomment this and configure to use RabbitMQ connection pools for sending messages
<transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender"/-->
<!--<transportSender name="mqtt" class="org.apache.axis2.transport.mqtt.MqttSender"/>-->
<!-- ================================================= -->
<!-- Global Engaged Modules -->
@ -607,13 +459,6 @@
<!-- Comment this out to disable Addressing -->
<module ref="addressing"/>
<!--
Uncomment out the following entry if SOAP (text/xml and application/soap+xml) messages
are processed through the message relay.
-->
<!--module ref="relay"/-->
<!-- ================================================= -->
<!-- Clustering -->
<!-- ================================================= -->
@ -646,7 +491,7 @@
is deemed to have left the cluster, it will be detected by the Group Membership
Service (GMS) using a TCP ping mechanism.
-->
<parameter name="membershipScheme">multicast</parameter>
<parameter name="membershipScheme">wka</parameter>
<!--<parameter name="licenseKey">xxx</parameter>-->
<!--<parameter name="mgtCenterURL">http://localhost:8081/mancenter/</parameter>-->
@ -690,7 +535,7 @@
The TCP port used by this member. This is the port through which other nodes will
contact this member
-->
<parameter name="localMemberPort">4000</parameter>
<parameter name="localMemberPort">4100</parameter>
<!--
The bind port of this member. The difference between localMemberPort & localMemberBindPort
@ -707,7 +552,13 @@
<parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
<property name="subDomain" value="worker"/>
<!-- Manger Setup with Port Mapping-->
<!--property name="port.mapping.8280" value="9764"/>
<property name="port.mapping.8243" value="9444"/>
<property name="subDomain" value="mgt"/-->
<!-- Worker Setup-->
<!--property name="subDomain" value="worker"/-->
</parameter>
<!--
@ -727,8 +578,8 @@
can be defined in this section.
-->
<groupManagement enable="false">
<applicationDomain name="wso2.apim.domain"
description="APIM group"
<applicationDomain name="wso2.esb.domain"
description="ESB group"
agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
subDomain="worker"
port="2222"/>
@ -768,17 +619,14 @@
</phase>
<phase name="Validation"/>
<phase name="Transport">
<!--TEMPORALY-->
<!--handler name="TenantActiveCheckDispatcher"
class="org.wso2.carbon.tenant.dispatcher.TenantActiveCheckDispatcher">
<order phase="Transport"/>
</handler-->
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="CarbonContextConfigurator"
class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>
<handler name="RelaySecuirtyMessageBuilderDispatchandler"
class="org.apache.synapse.transport.passthru.util.RelaySecuirtyMessageBuilderDispatchandler"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
@ -787,21 +635,19 @@
class="org.wso2.carbon.core.transports.smtp.SMTPFaultHandler">
<order phase="Transport"/>
</handler-->
<!-- TEMPORALY-->
<!--handler name="CacheMessageBuilderDispatchandler"
class="org.wso2.carbon.mediation.initializer.handler.CacheMessageBuilderDispatchandler"/-->
<handler name="CarbonContentConfigurator"
class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="PreDispatch">
<!--Uncomment following handler to enable logging in ESB log UI-->
<!--<handler name="TenantDomainSetter"-->
<!--class="org.wso2.carbon.utils.logging.handler.TenantDomainSetter"/>-->
</phase>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
@ -841,7 +687,6 @@
<!--system predefined phase-->
<!--these phase will run irrespective of the service-->
<phase name="PolicyDetermination"/>
<!--security handler for pass through -->
<phase name="PTSecurityOutPhase">
<handler name="RelaySecuirtyMessageBuilderDispatchandler"
class="org.apache.synapse.transport.passthru.util.RelaySecuirtyMessageBuilderDispatchandler"/>
@ -850,7 +695,7 @@
<phase name="Security"/>
<!--
The MsgOutObservation phase is used tju,o observe messages just before the
The MsgOutObservation phase is used to observe messages just before the
responses are sent out. In this phase, we could do some things such as SOAP message
tracing & keeping track of the time at which a particular response was sent.
@ -869,7 +714,6 @@
-->
<phase name="MsgInObservation"/>
<phase name="Validation"/>
<phase name="Transport">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
@ -879,17 +723,13 @@
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="CarbonContentConfigurator"
class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
@ -934,4 +774,4 @@
<phase name="MsgOutObservation"/>
</phaseOrder>
</axisconfig>
</axisconfig>

@ -1,248 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2005-2011, 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.
-->
<Server xmlns="http://wso2.org/projects/carbon/carbon.xml">
<OpenIDServerUrl>https://localhost:9443/openidserver</OpenIDServerUrl>
<OpenIDUserPattern>https://localhost:9443/openid/</OpenIDUserPattern>
<!-- If the users must be prompted for approval -->
<OpenIDSkipUserConsent>false</OpenIDSkipUserConsent>
<!-- Expiry time of the OpenID RememberMe token in minutes -->
<OpenIDRememberMeExpiry>7200</OpenIDRememberMeExpiry>
<JDBCPersistenceManager>
<DataSource>
<!-- Include a data source name (jndiConfigName) from the set of data sources defined in master-datasources.xml -->
<Name>jdbc/WSO2AM_DB</Name>
</DataSource>
<!-- If the identity database is created from another place and if it is required to skip schema initialization during the server start up, set the following
property to "true". -->
<SkipDBSchemaCreation>true</SkipDBSchemaCreation>
</JDBCPersistenceManager>
<!--
Security configurations
-->
<Security>
<UserTrustedRPStore>
<Location>${carbon.home}/repository/resources/security/userRP.jks</Location>
<!-- Keystore type (JKS/PKCS12 etc.)-->
<Type>JKS</Type>
<!-- Keystore password-->
<Password>wso2carbon</Password>
<!-- Private Key password-->
<KeyPassword>wso2carbon</KeyPassword>
</UserTrustedRPStore>
<!--
The directory under which all other KeyStore files will be stored
-->
<KeyStoresDir>${carbon.home}/conf/keystores</KeyStoresDir>
</Security>
<Identity>
<IssuerPolicy>SelfAndManaged</IssuerPolicy>
<TokenValidationPolicy>CertValidate</TokenValidationPolicy>
<BlackList></BlackList>
<WhiteList></WhiteList>
<System>
<KeyStore></KeyStore>
<StorePass></StorePass>
</System>
</Identity>
<OAuth>
<RequestTokenUrl>https://localhost:9443/oauth/request-token</RequestTokenUrl>
<AccessTokenUrl>https://localhost:9443/oauth/access-token</AccessTokenUrl>
<AuthorizeUrl>https://localhost:9443/oauth/authorize-url</AuthorizeUrl>
<!-- Default validity period for Authorization Code in seconds -->
<AuthorizationCodeDefaultValidityPeriod>300</AuthorizationCodeDefaultValidityPeriod>
<!-- Default validity period for Access Token in seconds -->
<AccessTokenDefaultValidityPeriod>3600</AccessTokenDefaultValidityPeriod>
<!-- Default validity period for Application Access Token in seconds-If want to set this as never expired,set the value as <0 -->
<ApplicationAccessTokenDefaultValidityPeriod>3600</ApplicationAccessTokenDefaultValidityPeriod>
<!-- Default validity period for User Access Token in seconds-->
<UserAccessTokenDefaultValidityPeriod>3600</UserAccessTokenDefaultValidityPeriod>
<!-- Timestamp skew in seconds -->
<TimestampSkew>300</TimestampSkew>
<!-- Enable OAuth caching. This cache has the replication support. -->
<EnableOAuthCache>true</EnableOAuthCache>
<!-- Configure the security measures needs to be done prior to store the token in the database,
such as hashing, encrypting, etc.-->
<TokenPersistenceProcessor>
org.wso2.carbon.identity.oauth.tokenprocessor.PlainTextPersistenceProcessor
</TokenPersistenceProcessor>
<!--<ClientAuthHandlers>
<ClientAuthHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.clientauth.BasicAuthClientAuthHandler</ClientAuthHandlerImplClass>
</ClientAuthHandlers>-->
<ClientAuthHandlers>
<ClientAuthHandler Class="org.wso2.carbon.identity.oauth2.token.handlers.clientauth.BasicAuthClientAuthHandler">
<Property Name="StrictClientCredentialValidation">false</Property>
</ClientAuthHandler>
</ClientAuthHandlers>
<!--TokenPersistenceProcessor>
org.wso2.carbon.identity.oauth.tokenprocessor.EncryptionDecryptionPersistenceProcessor
</TokenPersistenceProcessor-->
<!-- Supported Response Types -->
<SupportedResponseTypes>
<SupportedResponseType>
<ResponseTypeName>token</ResponseTypeName>
<ResponseTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler</ResponseTypeHandlerImplClass>
</SupportedResponseType>
<SupportedResponseType>
<ResponseTypeName>code</ResponseTypeName>
<ResponseTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler</ResponseTypeHandlerImplClass>
</SupportedResponseType>
</SupportedResponseTypes>
<!-- Supported Grant Types -->
<SupportedGrantTypes>
<SupportedGrantType>
<GrantTypeName>authorization_code</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedAuthorizationCodeGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>password</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedPasswordGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<!-- This is commented out intentionally due to a bug-->
<!--<SupportedGrantType>
<GrantTypeName>application_token</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.OpenKeyManagerGrantHandler</GrantTypeHandlerImplClass>
<GrantTypeValidatorImplClass>org.wso2.carbon.apimgt.keymgt.handlers.OpenKeyManagerGrantValidator</GrantTypeValidatorImplClass>
</SupportedGrantType>-->
<SupportedGrantType>
<GrantTypeName>refresh_token</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>client_credentials</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedClientCredentialsGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>urn:ietf:params:oauth:grant-type:saml2-bearer</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.saml.SAML2BearerGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>iwa:ntlm</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.iwa.ntlm.NTLMAuthenticationGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
</SupportedGrantTypes>
<OAuthCallbackHandlers>
<OAuthCallbackHandler Class="org.wso2.carbon.apimgt.keymgt.util.APIManagerOAuthCallbackHandler"/>
</OAuthCallbackHandlers>
<OAuthScopeValidator class="org.wso2.carbon.identity.oauth2.validators.JDBCScopeValidator"/>
<!-- Add custom user headers to the response-->
<!--<RequiredRespHeaderClaimUris>
<ClaimUri>http://wso2.org/claims/emailaddress</ClaimUri>
<ClaimUri>http://wso2.org/claims/gender</ClaimUri>
</RequiredRespHeaderClaimUris>-->
<!-- Enable/Disable OAuth Caching-->
<!--<EnableCache>true</EnableCache>-->
<!-- Assertions can be used to embedd parameters into access token.-->
<EnableAssertions>
<UserName>false</UserName>
</EnableAssertions>
<!-- This should be set to true when using multiple user stores and keys should saved
into different tables according to the user store. By default all the application keys are saved in to the same table.
UserName Assertion should be 'true' to use this.-->
<EnableAccessTokenPartitioning>false</EnableAccessTokenPartitioning>
<!-- user store domain names and mappings to new table names.
eg: if you provide 'A:foo.com', foo.com should be the user store domain name and 'A' represent the relavant mapping of
token storing table, i.e. tokens relevant to the users comming from foo.com user store will be added to a table called
IDN_OAUTH2_ACCESS_TOKEN_A. -->
<AccessTokenPartitioningDomains><!-- A:foo.com, B:bar.com --></AccessTokenPartitioningDomains>
<AuthorizationContextTokenGeneration>
<Enabled>false</Enabled>
<TokenGeneratorImplClass>org.wso2.carbon.identity.oauth2.authcontext.JWTTokenGenerator</TokenGeneratorImplClass>
<ClaimsRetrieverImplClass>org.wso2.carbon.identity.oauth2.authcontext.DefaultClaimsRetriever</ClaimsRetrieverImplClass>
<ConsumerDialectURI>http://wso2.org/claims</ConsumerDialectURI>
<SignatureAlgorithm>SHA256withRSA</SignatureAlgorithm>
<AuthorizationContextTTL>15</AuthorizationContextTTL>
</AuthorizationContextTokenGeneration>
<SAML2Grant>
<!--SAML2TokenHandler></SAML2TokenHandler-->
</SAML2Grant>
<!-- Primary/secondary login configuration for APIstore. If user likes to keep two login attributes in a distributed setup, to login the APIstore,
he should configure this section. Primary login doesn't have a claimUri associated with it. But secondary login, which is a claim attribute,
is associated with a claimuri.-->
<!-- <LoginConfig>
<UserIdLogin primary="true">
<ClaimUri></ClaimUri>
</UserIdLogin>
<EmailLogin primary="false">
<ClaimUri>http://wso2.org/claims/emailaddress</ClaimUri>
</EmailLogin>
</LoginConfig>-->
</OAuth>
<MultifactorAuthentication>
<XMPPSettings>
<XMPPConfig>
<XMPPProvider>gtalk</XMPPProvider>
<XMPPServer>talk.google.com</XMPPServer>
<XMPPPort>5222</XMPPPort>
<XMPPExt>gmail.com</XMPPExt>
<XMPPUserName>multifactor1@gmail.com</XMPPUserName>
<XMPPPassword>wso2carbon</XMPPPassword>
</XMPPConfig>
</XMPPSettings>
</MultifactorAuthentication>
<SSOService>
<IdentityProviderURL>https://localhost:9443/samlsso</IdentityProviderURL>
</SSOService>
<EntitlementSettings>
<!-- Uncomment this to enable on-demand policy loading -->
<!--OnDemandPolicyLoading>
<Enable>true</Enable>
<MaxInMemoryPolicies>100</MaxInMemoryPolicies>
</OnDemandPolicyLoading-->
<DecisionCaching>
<Enable>true</Enable>
<CachingInterval>36000</CachingInterval>
</DecisionCaching>
<AttributeCaching>
<Enable>true</Enable>
</AttributeCaching>
<ThirftBasedEntitlementConfig>
<EnableThriftService>true</EnableThriftService>
<ReceivePort>${Ports.ThriftEntitlementReceivePort}</ReceivePort>
<ClientTimeout>10000</ClientTimeout>
<KeyStore>
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<Password>wso2carbon</Password>
</KeyStore>
</ThirftBasedEntitlementConfig>
</EntitlementSettings>
<!--To do OSGI invocations to OAuth2Service,when the entire server is in one JVM -->
<SeparateBackEnd>false</SeparateBackEnd>
</Server>

@ -0,0 +1,359 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ Licensed 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.
-->
<Server xmlns="http://wso2.org/projects/carbon/carbon.xml">
<JDBCPersistenceManager>
<DataSource>
<!-- Include a data source name (jndiConfigName) from the set of data
sources defined in master-datasources.xml -->
<Name>jdbc/WSO2AM_DB</Name>
</DataSource>
<!-- If the identity database is created from another place and if it is
required to skip schema initialization during the server start up, set the
following property to "true". -->
<!-- <SkipDBSchemaCreation>false</SkipDBSchemaCreation> -->
<!--SessionDataPersist>
<Enable>true</Enable>
<EnableCleanUp>true</EnableCleanUp>
<Temporary>false</Temporary-->
<!--/SessionDataPersist-->
</JDBCPersistenceManager>
<!-- Time configurations are in minutes -->
<TimeConfig>
<SessionIdleTimeout>15</SessionIdleTimeout>
<RememberMeTimeout>20160</RememberMeTimeout>
<PersistanceCleanUpTimeout>20160</PersistanceCleanUpTimeout>
<PersistanceCleanUpPeriod>1140</PersistanceCleanUpPeriod>
</TimeConfig>
<!-- Security configurations -->
<Security>
<!-- The directory under which all other KeyStore files will be stored -->
<KeyStoresDir>${carbon.home}/conf/keystores</KeyStoresDir>
</Security>
<Identity>
<IssuerPolicy>SelfAndManaged</IssuerPolicy>
<TokenValidationPolicy>CertValidate</TokenValidationPolicy>
<BlackList/>
<WhiteList/>
<System>
<KeyStore/>
<StorePass/>
</System>
</Identity>
<OpenID>
<!--
Default values for OpenIDServerUrl and OpenIDUSerPattern are built in following format
https://<HostName>:<MgtTrpProxyPort except 443>/<ProxyContextPath>/<context>
If above format doesn't satisfy uncomment the following configs and explicitly configure the values
-->
<!--OpenIDServerUrl>https://localhost:9443/openidserver</OpenIDServerUrl-->
<!--OpenIDUserPattern>https://localhost:9443/openid/</OpenIDUserPattern-->
<!-- If the users must be prompted for approval -->
<OpenIDSkipUserConsent>false</OpenIDSkipUserConsent>
<!-- Expiry time of the OpenID RememberMe token in minutes -->
<OpenIDRememberMeExpiry>7200</OpenIDRememberMeExpiry>
<!-- Multifactor Authentication configuration -->
<UseMultifactorAuthentication>false</UseMultifactorAuthentication>
<!-- To enable or disable openid dumb mode -->
<DisableOpenIDDumbMode>false</DisableOpenIDDumbMode>
<!-- remember me session timeout in seconds -->
<SessionTimeout>36000</SessionTimeout>
<!-- skips authentication if valid SAML2 Web SSO browser session available -->
<AcceptSAMLSSOLogin>false</AcceptSAMLSSOLogin>
<ClaimsRetrieverImplClass>org.wso2.carbon.identity.provider.openid.claims.DefaultClaimsRetriever
</ClaimsRetrieverImplClass>
<!--
OpenID private association store is configurable from following configs.
It includes two new replication stores,
i. OpenIDServerAssociationStore (Default association store)
ii. PrivateAssociationCryptoStore
iii. PrivateAssociationReplicationStore
-->
<!-- Specify full qualified class name of the class which going to use as private association store -->
<!--
<OpenIDPrivateAssociationStoreClass>org.wso2.carbon.identity.provider.openid.PrivateAssociationCryptoStore</OpenIDPrivateAssociationStoreClass>
-->
<!-- The exiration time (in minutes) for the OpenID association -->
<!--
<OpenIDAssociationExpiryTime>15</OpenIDAssociationExpiryTime>
-->
<!-- Configs specific to PrivateAssociationCryptoStore -->
<!-- Server secret. This value should be the same in all nodes in the cluster -->
<!--
<OpenIDPrivateAssociationServerKey>qewlj324lmasc</OpenIDPrivateAssociationServerKey>
-->
<!-- Configs specific to PrivateAssociationCryptoStore -->
<!-- This enable private association cleanup task which cleans expired private associations -->
<!--
<EnableOpenIDAssociationCleanupTask>true</EnableOpenIDAssociationCleanupTask>
-->
<!-- Time Period (in minutes) that cleanup task would run -->
<!--
<OpenIDAssociationCleanupPeriod>15</OpenIDAssociationCleanupPeriod>
-->
</OpenID>
<OAuth>
<AppInfoCacheTimeout>-1</AppInfoCacheTimeout>
<AuthorizationGrantCacheTimeout>-1</AuthorizationGrantCacheTimeout>
<SessionDataCacheTimeout>-1</SessionDataCacheTimeout>
<ClaimCacheTimeout>-1</ClaimCacheTimeout>
<!--
Default values for OAuth1RequestTokenUrl, OAuth1AccessTokenUrl, OAuth1AuthorizeUrl
OAuth2AuthzEPUrl, OAuth2TokenEPUrl and OAuth2UserInfoEPUrl are built in following format
https://<HostName>:<MgtTrpProxyPort except 443>/<ProxyContextPath>/<context>/<path>
If above format doesn't satisfy uncomment the following configs and explicitly configure the values
-->
<!--OAuth1RequestTokenUrl>https://localhost:9443/oauth/request-token</OAuth1RequestTokenUrl-->
<!--OAuth1AuthorizeUrl>https://localhost:9443/oauth/authorize-url</OAuth1AuthorizeUrl-->
<!--OAuth1AccessTokenUrl>https://localhost:9443/oauth/access-token</OAuth1AccessTokenUrl-->
<!--OAuth2AuthzEPUrl>https://localhost:9443/oauth2/authorize</OAuth2AuthzEPUrl-->
<!--OAuth2TokenEPUrl>https://localhost:9443/oauth2/token</OAuth2TokenEPUrl-->
<!--OAuth2UserInfoEPUrl>https://localhost:9443/oauth2/userinfo</OAuth2UserInfoEPUrl-->
<!--OIDCConsentPage>https://localhost:9443/authenticationendpoint/oauth2_consent.do</OIDCConsentPage-->
<!--OAuth2ConsentPage>https://localhost:9443/authenticationendpoint/oauth2_authz.do</OAuth2ConsentPage-->
<!-- Default validity period for Authorization Code in seconds -->
<AuthorizationCodeDefaultValidityPeriod>300</AuthorizationCodeDefaultValidityPeriod>
<!-- Default validity period for application access tokens in seconds -->
<AccessTokenDefaultValidityPeriod>3600</AccessTokenDefaultValidityPeriod>
<!-- Default validity period for user access tokens in seconds -->
<UserAccessTokenDefaultValidityPeriod>3600</UserAccessTokenDefaultValidityPeriod>
<!-- Validity period for refresh token -->
<RefreshTokenValidityPeriod>84600</RefreshTokenValidityPeriod>
<!-- Timestamp skew in seconds -->
<TimestampSkew>300</TimestampSkew>
<!-- Enable OAuth caching -->
<EnableOAuthCache>true</EnableOAuthCache>
<!-- Enable renewal of refresh token for refresh_token grant -->
<RenewRefreshTokenForRefreshGrant>true</RenewRefreshTokenForRefreshGrant>
<!-- Process the token before storing it in database, e.g. encrypting -->
<TokenPersistenceProcessor>org.wso2.carbon.identity.oauth.tokenprocessor.PlainTextPersistenceProcessor</TokenPersistenceProcessor>
<!-- Supported Client Authentication Methods -->
<ClientAuthHandlers>
<ClientAuthHandler Class="org.wso2.carbon.identity.oauth2.token.handlers.clientauth.BasicAuthClientAuthHandler">
<Property Name="StrictClientCredentialValidation">false</Property>
</ClientAuthHandler>
</ClientAuthHandlers>
<!-- Supported Response Types -->
<SupportedResponseTypes>
<SupportedResponseType>
<ResponseTypeName>token</ResponseTypeName>
<ResponseTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler</ResponseTypeHandlerImplClass>
</SupportedResponseType>
<SupportedResponseType>
<ResponseTypeName>code</ResponseTypeName>
<ResponseTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.authz.handlers.CodeResponseTypeHandler</ResponseTypeHandlerImplClass>
</SupportedResponseType>
</SupportedResponseTypes>
<!-- Supported Grant Types -->
<SupportedGrantTypes>
<SupportedGrantType>
<GrantTypeName>authorization_code</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedAuthorizationCodeGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>password</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedPasswordGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>refresh_token</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>client_credentials</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedClientCredentialsGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>urn:ietf:params:oauth:grant-type:saml2-bearer</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.apimgt.keymgt.handlers.ExtendedSAML2BearerGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>iwa:ntlm</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.iwa.ntlm.NTLMAuthenticationGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
<SupportedGrantType>
<GrantTypeName>devicecloud</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.devicemgt.grant.DeviceGrant</GrantTypeHandlerImplClass>
<GrantTypeValidatorImplClass>org.wso2.carbon.devicemgt.grant.DeviceGrantValidator</GrantTypeValidatorImplClass>
</SupportedGrantType>
</SupportedGrantTypes>
<OAuthCallbackHandlers>
<OAuthCallbackHandler Class="org.wso2.carbon.apimgt.keymgt.util.APIManagerOAuthCallbackHandler"/>
</OAuthCallbackHandlers>
<OAuthScopeValidator class="org.wso2.carbon.identity.oauth2.validators.JDBCScopeValidator"/>
<!--TokenValidators>
<TokenValidator type="bearer" class="org.wso2.carbon.identity.oauth2.validators.DefaultOAuth2TokenValidator"/>
</TokenValidators-->
<!-- Assertions can be used to embedd parameters into access token. -->
<EnableAssertions>
<UserName>false</UserName>
</EnableAssertions>
<!-- This should be set to true when using multiple user stores and keys
should saved into different tables according to the user store. By default
all the application keys are saved in to the same table. UserName Assertion
should be 'true' to use this. -->
<EnableAccessTokenPartitioning>false</EnableAccessTokenPartitioning>
<!-- user store domain names and mapping to new table name. eg: if you
provide 'A:foo.com', foo.com should be the user store domain name and 'A'
represent the relavant mapping of token store table, i.e. tokens will be
added to a table called IDN_OAUTH2_ACCESS_TOKEN_A. -->
<AccessTokenPartitioningDomains>
<!-- A:foo.com, B:bar.com -->
</AccessTokenPartitioningDomains>
<AuthorizationContextTokenGeneration>
<Enabled>false</Enabled>
<TokenGeneratorImplClass>org.wso2.carbon.identity.oauth2.authcontext.JWTTokenGenerator</TokenGeneratorImplClass>
<ClaimsRetrieverImplClass>org.wso2.carbon.identity.oauth2.authcontext.DefaultClaimsRetriever</ClaimsRetrieverImplClass>
<ConsumerDialectURI>http://wso2.org/claims</ConsumerDialectURI>
<SignatureAlgorithm>SHA256withRSA</SignatureAlgorithm>
<AuthorizationContextTTL>15</AuthorizationContextTTL>
</AuthorizationContextTokenGeneration>
<SAML2Grant>
<!--SAML2TokenHandler></SAML2TokenHandler-->
</SAML2Grant>
<OpenIDConnect>
<IDTokenBuilder>org.wso2.carbon.identity.openidconnect.DefaultIDTokenBuilder</IDTokenBuilder>
<!--
Default value for IDTokenIssuerID, is OAuth2TokenEPUrl.
If that doesn't satisfy uncomment the following config and explicitly configure the value
-->
<!--IDTokenIssuerID>https://localhost:9443/oauth2/token</IDTokenIssuerID-->
<IDTokenSubjectClaim>http://wso2.org/claims/givenname</IDTokenSubjectClaim>
<IDTokenCustomClaimsCallBackHandler>org.wso2.carbon.identity.openidconnect.SAMLAssertionClaimsCallback</IDTokenCustomClaimsCallBackHandler>
<IDTokenExpiration>3600</IDTokenExpiration>
<UserInfoEndpointClaimDialect>http://wso2.org/claims</UserInfoEndpointClaimDialect>
<UserInfoEndpointClaimRetriever>org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoUserStoreClaimRetriever</UserInfoEndpointClaimRetriever>
<UserInfoEndpointRequestValidator>org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInforRequestDefaultValidator</UserInfoEndpointRequestValidator>
<UserInfoEndpointAccessTokenValidator>org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoISAccessTokenValidator</UserInfoEndpointAccessTokenValidator>
<UserInfoEndpointResponseBuilder>org.wso2.carbon.identity.oauth.endpoint.user.impl.UserInfoJSONResponseBuilder</UserInfoEndpointResponseBuilder>
<SkipUserConsent>false</SkipUserConsent>
</OpenIDConnect>
</OAuth>
<MultifactorAuthentication>
<!--Enable>false</Enable-->
<XMPPSettings>
<XMPPConfig>
<XMPPProvider>gtalk</XMPPProvider>
<XMPPServer>talk.google.com</XMPPServer>
<XMPPPort>5222</XMPPPort>
<XMPPExt>gmail.com</XMPPExt>
<XMPPUserName>multifactor1@gmail.com</XMPPUserName>
<XMPPPassword>wso2carbon</XMPPPassword>
</XMPPConfig>
</XMPPSettings>
</MultifactorAuthentication>
<SSOService>
<PersistanceCacheTimeout>157680000</PersistanceCacheTimeout>
<SessionIndexCacheTimeout>157680000</SessionIndexCacheTimeout>
<EntityId>localhost</EntityId>
<!--
Default value for IdentityProviderURL is built in following format
https://<HostName>:<MgtTrpProxyPort except 443>/<ProxyContextPath>/samlsso
If that doesn't satisfy uncomment the following config and explicitly configure the value
-->
<!--IdentityProviderURL>https://localhost:9443/samlsso</IdentityProviderURL-->
<SingleLogoutRetryCount>5</SingleLogoutRetryCount>
<SingleLogoutRetryInterval>60000</SingleLogoutRetryInterval>
<!-- in milli seconds -->
<TenantPartitioningEnabled>false</TenantPartitioningEnabled>
<SessionTimeout>36000</SessionTimeout>
<!-- remember me session timeout in seconds -->
<!-- skips authentication if valid SAML2 Web SSO browser session available -->
<AttributeStatementBuilder>org.wso2.carbon.identity.sso.saml.attributes.UserAttributeStatementBuilder</AttributeStatementBuilder>
<AttributesClaimDialect>http://wso2.org/claims</AttributesClaimDialect>
<AcceptOpenIDLogin>false</AcceptOpenIDLogin>
<ClaimsRetrieverImplClass>org.wso2.carbon.identity.sso.saml.builders.claims.DefaultClaimsRetriever</ClaimsRetrieverImplClass>
<SAMLSSOAssertionBuilder>org.wso2.carbon.identity.sso.saml.builders.assertion.DefaultSAMLAssertionBuilder</SAMLSSOAssertionBuilder>
<SAMLSSOEncrypter>org.wso2.carbon.identity.sso.saml.builders.encryption.DefaultSSOEncrypter</SAMLSSOEncrypter>
<SAMLSSOSigner>org.wso2.carbon.identity.sso.saml.builders.signature.DefaultSSOSigner</SAMLSSOSigner>
<SAML2HTTPRedirectSignatureValidator>org.wso2.carbon.identity.sso.saml.validators.SAML2HTTPRedirectDeflateSignatureValidator</SAML2HTTPRedirectSignatureValidator>
<!--SAMLSSOResponseBuilder>org.wso2.carbon.identity.sso.saml.builders.DefaultResponseBuilder</SAMLSSOResponseBuilder-->
<!-- SAML Token validity period in minutes -->
<SAMLResponseValidityPeriod>5</SAMLResponseValidityPeriod>
<UseAuthenticatedUserDomainCrypto>false</UseAuthenticatedUserDomainCrypto>
<SAMLDefaultSigningAlgorithmURI>http://www.w3.org/2000/09/xmldsig#rsa-sha1</SAMLDefaultSigningAlgorithmURI>
<SAMLDefaultDigestAlgorithmURI>http://www.w3.org/2000/09/xmldsig#sha1</SAMLDefaultDigestAlgorithmURI>
</SSOService>
<SecurityTokenService>
<!--
Default value for IdentityProviderURL is built in following format
https://<HostName>:<MgtTrpProxyPort except 443>/<ProxyContextPath>/services/wso2carbon-sts
If that doesn't satisfy uncomment the following config and explicitly configure the value
-->
<!--IdentityProviderURL>https://localhost:9443/services/wso2carbon-sts</IdentityProviderURL-->
</SecurityTokenService>
<PassiveSTS>
<!--
Default value for IdentityProviderURL is built in following format
https://<HostName>:<MgtTrpProxyPort except 443>/<ProxyContextPath>/passivests
If that doesn't satisfy uncomment the following config and explicitly configure the value
-->
<!--IdentityProviderURL>https://localhost:9443/passivests</IdentityProviderURL-->
</PassiveSTS>
<EntitlementSettings>
<ThirftBasedEntitlementConfig>
<EnableThriftService>false</EnableThriftService>
<ReceivePort>${Ports.ThriftEntitlementReceivePort}</ReceivePort>
<ClientTimeout>10000</ClientTimeout>
<KeyStore>
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<Password>wso2carbon</Password>
</KeyStore>
<!-- Enable this element to mention the host-name of your IS machine -->
<ThriftHostName>localhost</ThriftHostName>
</ThirftBasedEntitlementConfig>
</EntitlementSettings>
<SCIM>
<!--
Default value for UserEPUrl and GroupEPUrl are built in following format
https://<HostName>:<MgtTrpProxyPort except 443>/<ProxyContextPath>/<context>/<path>
If that doesn't satisfy uncomment the following config and explicitly configure the value
-->
<!--UserEPUrl>https://localhost:9443/wso2/scim/Users</UserEPUrl-->
<!--GroupEPUrl>https://localhost:9443/wso2/scim/Groups</GroupEPUrl-->
<SCIMAuthenticators>
<Authenticator class="org.wso2.carbon.identity.scim.provider.auth.BasicAuthHandler">
<Property name="Priority">5</Property>
</Authenticator>
<Authenticator class="org.wso2.carbon.identity.scim.provider.auth.OAuthHandler">
<Property name="Priority">10</Property>
<Property name="AuthorizationServer">local://services</Property>
<!--Property name="AuthorizationServer">https://localhost:9443/services</Property>
<Property name="UserName">admin</Property>
<Property name="Password">admin</Property-->
</Authenticator>
</SCIMAuthenticators>
</SCIM>
<!--SessionContextCache>
<Enable>true</Enable>
<Capacity>100000</Capacity>
</SessionContextCache-->
<EventListeners>
<EventListener enable="true"
name="org.wso2.carbon.user.mgt.workflow.userstore.UserStoreActionListener"
orderId="10" type="org.wso2.carbon.user.core.listener.UserOperationEventListener"/>
<EventListener enable="false"
name="org.wso2.carbon.identity.mgt.IdentityMgtEventListener"
orderId="50" type="org.wso2.carbon.user.core.listener.UserOperationEventListener"/>
<EventListener enable="false"
name="org.wso2.carbon.identity.oauth.listener.IdentityOathEventListener"
orderId="60" type="org.wso2.carbon.user.core.listener.UserOperationEventListener"/>
<EventListener enable="false"
name="org.wso2.carbon.identity.provider.openid.listener.IdentityOpenIDUserEventListener"
orderId="70" type="org.wso2.carbon.user.core.listener.UserOperationEventListener"/>
</EventListeners>
</Server>

@ -100,6 +100,10 @@
<featureArtifacts>
<!--<featureArtifactDef>-->
<!--org.wso2.carbon:org.wso2.carbon.core.feature:${carbon.kernel.version}-->
<!--</featureArtifactDef>-->
<!--Device Cloud Features -->
<featureArtifactDef>
@ -378,6 +382,15 @@
<featureArtifactDef>
org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.startup.publisher.feature:${carbon.api.mgt.version}
</featureArtifactDef>
<featureArtifactDef>
org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.authenticator.oidc.feature:${carbon.api.mgt.version}
</featureArtifactDef>
<featureArtifactDef>
org.wso2.carbon.apimgt:org.wso2.carbon.apimgt.hostobjects.oidc.feature:${carbon.api.mgt.version}
</featureArtifactDef>
<!--<featureArtifactDef>-->
<!--org.wso2.carbon.apimgt:org.wso2.carbon.forum.server.feature:${carbon.api.mgt.version}-->
<!--</featureArtifactDef>-->
<!-- End of API Management Features -->
<!--- Notification Support: Mail -->
@ -690,6 +703,11 @@
<deleteOldProfileFiles>true</deleteOldProfileFiles>
<features>
<!--<feature>-->
<!--<id>org.wso2.carbon.core.feature.group</id>-->
<!--<version>${carbon.kernel.version}</version>-->
<!--</feature>-->
<!-- IoT Features -->
<feature>
<id>org.wso2.carbon.device.mgt.iot.feature.group</id>
@ -1024,6 +1042,18 @@
<id>org.wso2.carbon.apimgt.startup.publisher.feature.group</id>
<version>${carbon.api.mgt.version}</version>
</feature>
<!--<feature>-->
<!--<id>org.wso2.carbon.forum.server.feature.group</id>-->
<!--<version>${carbon.api.mgt.version}</version>-->
<!--</feature>-->
<feature>
<id>org.wso2.carbon.apimgt.authenticator.oidc.feature.group</id>
<version>${carbon.api.mgt.version}</version>
</feature>
<feature>
<id>org.wso2.carbon.apimgt.hostobjects.oidc.feature.group</id>
<version>${carbon.api.mgt.version}</version>
</feature>
<feature>
<id>org.wso2.carbon.mediation.initializer.feature.group</id>
<version>${carbon.mediation.version}</version>

@ -16,6 +16,7 @@
package org.wso2.carbon.device.mgt.iot.sample.firealarm.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpResponse;
@ -26,26 +27,38 @@ import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfigurationException;
import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.iot.common.DeviceController;
import org.wso2.carbon.device.mgt.iot.common.DeviceManagement;
import org.wso2.carbon.device.mgt.iot.common.DeviceValidator;
import org.wso2.carbon.device.mgt.iot.common.apimgt.AccessTokenInfo;
import org.wso2.carbon.device.mgt.iot.common.apimgt.TokenClient;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppAccount;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppConfig;
import org.wso2.carbon.device.mgt.iot.common.datastore.impl.DataStreamDefinitions;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppServerClient;
import org.wso2.carbon.device.mgt.iot.common.exception.AccessTokenException;
import org.wso2.carbon.device.mgt.iot.common.exception.DeviceControllerException;
import org.wso2.carbon.device.mgt.iot.common.exception.UnauthorizedException;
import org.wso2.carbon.device.mgt.iot.common.util.ZipArchive;
import org.wso2.carbon.device.mgt.iot.common.util.ZipUtil;
import org.wso2.carbon.device.mgt.iot.sample.firealarm.plugin.constants.FireAlarmConstants;
import org.wso2.carbon.device.mgt.iot.sample.firealarm.service.impl.util.DeviceJSON;
import org.wso2.carbon.utils.CarbonUtils;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@ -57,17 +70,26 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
public class FireAlarmControllerService {
//@Path("/FireAlarmDeviceManager")
public class FireAlarmService {
private static Log log = LogFactory.getLog(FireAlarmService.class);
private static Log log = LogFactory.getLog(FireAlarmControllerService.class);
//TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super";
@Context //injected response proxy supporting multiple thread
private HttpServletResponse response;
private static final String TEMPERATURE_STREAM_DEFINITION = "org.wso2.iot.devices.temperature";
private static final String URL_PREFIX = "http://";
@ -79,11 +101,303 @@ public class FireAlarmControllerService {
public static final String HTTP_PROTOCOL = "HTTP";
public static final String MQTT_PROTOCOL = "MQTT";
private static ConcurrentHashMap<String, String> deviceToIpMap = new ConcurrentHashMap<String, String>();
@Path("manager/device/register")
@PUT
public boolean register(@QueryParam("deviceId") String deviceId,
@QueryParam("name") String name, @QueryParam("owner") String owner) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(FireAlarmConstants.DEVICE_TYPE);
try {
if (deviceManagement.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
response.setStatus(Response.Status.CONFLICT.getStatusCode());
return false;
}
Device device = new Device();
device.setDeviceIdentifier(deviceId);
EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
enrolmentInfo.setDateOfEnrolment(new Date().getTime());
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
device.setName(name);
device.setType(FireAlarmConstants.DEVICE_TYPE);
enrolmentInfo.setOwner(owner);
device.setEnrolmentInfo(enrolmentInfo);
boolean added = deviceManagement.getDeviceManagementService().enrollDevice(device);
if (added) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
return added;
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return false;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/remove/{device_id}")
@DELETE
public void removeDevice(@PathParam("device_id") String deviceId,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(FireAlarmConstants.DEVICE_TYPE);
try {
boolean removed = deviceManagement.getDeviceManagementService().disenrollDevice(
deviceIdentifier);
if (removed) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/update/{device_id}")
@POST
public boolean updateDevice(@PathParam("device_id") String deviceId,
@QueryParam("name") String name,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(FireAlarmConstants.DEVICE_TYPE);
try {
Device device = deviceManagement.getDeviceManagementService().getDevice(
deviceIdentifier);
device.setDeviceIdentifier(deviceId);
// device.setDeviceTypeId(deviceTypeId);
device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime());
device.setName(name);
device.setType(FireAlarmConstants.DEVICE_TYPE);
boolean updated = deviceManagement.getDeviceManagementService().modifyEnrollment(
device);
if (updated) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
return updated;
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return false;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/{device_id}")
@GET
@Consumes("application/json")
@Produces("application/json")
public Device getDevice(@PathParam("device_id") String deviceId) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(FireAlarmConstants.DEVICE_TYPE);
try {
return deviceManagement.getDeviceManagementService().getDevice(deviceIdentifier);
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return null;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/devices/{username}")
@GET
@Consumes("application/json")
@Produces("application/json")
public Device[] getFirealarmDevices(@PathParam("username") String username) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
try {
List<Device> userDevices =
deviceManagement.getDeviceManagementService().getDevicesOfUser(
username);
ArrayList<Device> userDevicesforFirealarm = new ArrayList<Device>();
for (Device device : userDevices) {
if (device.getType().equals(FireAlarmConstants.DEVICE_TYPE) &&
device.getEnrolmentInfo().getStatus().equals(
EnrolmentInfo.Status.ACTIVE)) {
userDevicesforFirealarm.add(device);
}
}
return userDevicesforFirealarm.toArray(new Device[]{});
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return null;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/{sketch_type}/download")
@GET
@Produces("application/octet-stream")
public Response downloadSketch(@QueryParam("owner") String owner,
@PathParam("sketch_type") String sketchType) {
ZipArchive zipFile = null;
try {
zipFile = createDownloadFile(owner, sketchType);
Response.ResponseBuilder rb = Response.ok(zipFile.getZipFile());
rb.header("Content-Disposition",
"attachment; filename=\"" + zipFile.getFileName() + "\"");
return rb.build();
} catch (IllegalArgumentException ex) {
return Response.status(400).entity(ex.getMessage()).build();//bad request
} catch (DeviceManagementException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (AccessTokenException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (DeviceControllerException ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
}
@Path("manager/device/{sketch_type}/generate_link")
@GET
public Response generateSketchLink(@QueryParam("owner") String owner,
@PathParam("sketch_type") String sketchType) {
ZipArchive zipFile = null;
try {
zipFile = createDownloadFile(owner, sketchType);
Response.ResponseBuilder rb = Response.ok(zipFile.getDeviceId());
return rb.build();
} catch (IllegalArgumentException ex) {
return Response.status(400).entity(ex.getMessage()).build();//bad request
} catch (DeviceManagementException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (AccessTokenException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (DeviceControllerException ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
}
private ZipArchive createDownloadFile(String owner, String sketchType)
throws DeviceManagementException, AccessTokenException, DeviceControllerException {
if (owner == null) {
throw new IllegalArgumentException("Error on createDownloadFile() Owner is null!");
}
//create new device id
String deviceId = shortUUID();
TokenClient accessTokenClient = new TokenClient(FireAlarmConstants.DEVICE_TYPE);
AccessTokenInfo accessTokenInfo = null;
accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
//create token
String accessToken = accessTokenInfo.getAccess_token();
String refreshToken = accessTokenInfo.getRefresh_token();
//adding registering data
XmppAccount newXmppAccount = new XmppAccount();
newXmppAccount.setAccountName(owner + "_" + deviceId);
newXmppAccount.setUsername(deviceId);
newXmppAccount.setPassword(accessToken);
private static ConcurrentHashMap<String, String> deviceToIpMap =
new ConcurrentHashMap<String, String>();
String xmppEndPoint = XmppConfig.getInstance().getXmppControlQueue().getServerURL();
int indexOfChar = xmppEndPoint.lastIndexOf('/');
if (indexOfChar != -1) {
xmppEndPoint = xmppEndPoint.substring((indexOfChar + 1), xmppEndPoint.length());
}
newXmppAccount.setEmail(deviceId + "@wso2.com");
XmppServerClient xmppServerClient = new XmppServerClient();
xmppServerClient.initControlQueue();
boolean status;
if(XmppConfig.getInstance().isEnabled()) {
status = xmppServerClient.createXMPPAccount(newXmppAccount);
if (!status) {
String msg =
"XMPP Account was not created for device - " + deviceId + " of owner - " +
owner +
". XMPP might have been disabled in org.wso2.carbon.device.mgt.iot.common.config.server.configs";
log.warn(msg);
throw new DeviceManagementException(msg);
}
}
status = register(deviceId, owner + "s_" + sketchType + "_" + deviceId.substring(0,
3),
owner);
if (!status) {
String msg = "Error occurred while registering the device with " + "id: " + deviceId
+ " owner:" + owner;
throw new DeviceManagementException(msg);
}
ZipUtil ziputil = new ZipUtil();
ZipArchive zipFile = null;
zipFile = ziputil.downloadSketch(owner,SUPER_TENANT, sketchType, deviceId, accessToken, refreshToken);
zipFile.setDeviceId(deviceId);
return zipFile;
}
private static String shortUUID() {
UUID uuid = UUID.randomUUID();
long l = ByteBuffer.wrap(uuid.toString().getBytes(StandardCharsets.UTF_8)).getLong();
return Long.toString(l, Character.MAX_RADIX);
}
@Path("/register/{owner}/{deviceId}/{ip}")
@Path("controller/register/{owner}/{deviceId}/{ip}")
@POST
public String registerDeviceIP(@PathParam("owner") String owner,
@PathParam("deviceId") String deviceId,
@ -109,7 +423,7 @@ public class FireAlarmControllerService {
/* Service to switch "ON" and "OFF" the FireAlarm bulb
Called by an external client intended to control the FireAlarm bulb */
@Path("/bulb/{state}")
@Path("controller/bulb/{state}")
@POST
public void switchBulb(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId,
@ -184,7 +498,7 @@ public class FireAlarmControllerService {
}
@Path("/readsonar")
@Path("controller/readsonar")
@GET
public String requestSonarReading(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId,
@ -255,7 +569,7 @@ public class FireAlarmControllerService {
}
@Path("/readtemperature")
@Path("controller/readtemperature")
@GET
public String requestTemperature(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId,
@ -375,7 +689,7 @@ public class FireAlarmControllerService {
// return replyMsg;
// }
@Path("/push_temperature")
@Path("/controller/push_temperature")
@POST
@Consumes(MediaType.APPLICATION_JSON)
public void pushTemperatureData(
@ -389,12 +703,12 @@ public class FireAlarmControllerService {
if (registeredIp == null) {
log.warn("Unregistered IP: Temperature Data Received from an un-registered IP " +
deviceIp + " for device ID - " + deviceId);
deviceIp + " for device ID - " + deviceId);
response.setStatus(Response.Status.PRECONDITION_FAILED.getStatusCode());
return;
} else if (!registeredIp.equals(deviceIp)) {
log.warn("Conflicting IP: Received IP is " + deviceIp + ". Device with ID " +
deviceId + " is already registered under some other IP. Re-registration " + "required");
deviceId + " is already registered under some other IP. Re-registration " + "required");
response.setStatus(Response.Status.CONFLICT.getStatusCode());
return;
}

@ -22,23 +22,10 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="FireAlarmController" address="/controller">
<jaxrs:serviceBeans>
<bean id="FireAlarmControllerService"
class="org.wso2.carbon.device.mgt.iot.sample.firealarm.service.impl.FireAlarmControllerService">
<!--<property name="mqttFireAlarmSubscriber" ref="mqttSubscriber"/>-->
</bean>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
<jaxrs:server id="FireAlarmManager" address="/manager">
<jaxrs:server id="FireAlarm" address="/">
<jaxrs:serviceBeans>
<bean id="FireAlarmManagerService"
class="org.wso2.carbon.device.mgt.iot.sample.firealarm.service.impl.FireAlarmManagerService"/>
<bean id="FireAlarmService"
class="org.wso2.carbon.device.mgt.iot.sample.firealarm.service.impl.FireAlarmService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />

@ -19,5 +19,55 @@
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>isAdminService</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>doAuthentication</param-name>
<param-value>false</param-value>
</context-param>
<!--publish to apim-->
<context-param>
<param-name>managed-api-enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>managed-api-owner</param-name>
<param-value>admin</param-value>
</context-param>
<context-param>
<param-name>managed-api-name</param-name>
<param-value>firealarm</param-value>
</context-param>
<context-param>
<param-name>managed-api-endpoint</param-name>
<param-value>http://localhost:9763/firealarm</param-value>
</context-param>
<context-param>
<param-name>managed-api-version</param-name>
<param-value>1.0.0</param-value>
</context-param>
<context-param>
<param-name>managed-api-context</param-name>
<param-value>/firealarm</param-value>
</context-param>
<context-param>
<param-name>managed-api-isSecured</param-name>
<param-value>true</param-value>
</context-param>
<!-- Below configuration is used to redirect http requests to https -->
<!--<security-constraint>-->
<!--<web-resource-collection>-->
<!--<web-resource-name>IoT</web-resource-name>-->
<!--<url-pattern>/*</url-pattern>-->
<!--</web-resource-collection>-->
<!--<user-data-constraint>-->
<!--<transport-guarantee>CONFIDENTIAL</transport-guarantee>-->
<!--</user-data-constraint>-->
<!--</security-constraint>-->
</web-app>

@ -1,350 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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.iot.sample.virtual.firealarm.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.iot.common.DeviceManagement;
import org.wso2.carbon.device.mgt.iot.common.apimgt.AccessTokenInfo;
import org.wso2.carbon.device.mgt.iot.common.apimgt.TokenClient;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppAccount;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppConfig;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppServerClient;
import org.wso2.carbon.device.mgt.iot.common.exception.AccessTokenException;
import org.wso2.carbon.device.mgt.iot.common.exception.DeviceControllerException;
import org.wso2.carbon.device.mgt.iot.common.util.ZipArchive;
import org.wso2.carbon.device.mgt.iot.common.util.ZipUtil;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.plugin.constants
.VirtualFireAlarmConstants;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
//@Path("/VirtualFireAlarmDeviceManager")
public class VirtualFireAlarmManagerService {
private static Log log = LogFactory.getLog(VirtualFireAlarmManagerService.class);
//TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super";
@Context //injected response proxy supporting multiple thread
private HttpServletResponse response;
@Path("/device/register")
@PUT
public boolean register(@QueryParam("deviceId") String deviceId,
@QueryParam("name") String name, @QueryParam("owner") String owner) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
if (deviceManagement.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
response.setStatus(Response.Status.CONFLICT.getStatusCode());
return false;
}
Device device = new Device();
device.setDeviceIdentifier(deviceId);
EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
enrolmentInfo.setDateOfEnrolment(new Date().getTime());
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
device.setName(name);
device.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
enrolmentInfo.setOwner(owner);
device.setEnrolmentInfo(enrolmentInfo);
boolean added = deviceManagement.getDeviceManagementService().enrollDevice(device);
if (added) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
return added;
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return false;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("/device/remove/{device_id}")
@DELETE
public void removeDevice(@PathParam("device_id") String deviceId,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
boolean removed = deviceManagement.getDeviceManagementService().disenrollDevice(
deviceIdentifier);
if (removed) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("/device/update/{device_id}")
@POST
public boolean updateDevice(@PathParam("device_id") String deviceId,
@QueryParam("name") String name,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
Device device = deviceManagement.getDeviceManagementService().getDevice(
deviceIdentifier);
device.setDeviceIdentifier(deviceId);
// device.setDeviceTypeId(deviceTypeId);
device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime());
device.setName(name);
device.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
boolean updated = deviceManagement.getDeviceManagementService().modifyEnrollment(
device);
if (updated) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
return updated;
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return false;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("/device/{device_id}")
@GET
@Consumes("application/json")
@Produces("application/json")
public Device getDevice(@PathParam("device_id") String deviceId) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
return deviceManagement.getDeviceManagementService().getDevice(deviceIdentifier);
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return null;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("/devices/{username}")
@GET
@Consumes("application/json")
@Produces("application/json")
public Device[] getFirealarmDevices(@PathParam("username") String username) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
try {
List<Device> userDevices =
deviceManagement.getDeviceManagementService().getDevicesOfUser(
username);
ArrayList<Device> userDevicesforFirealarm = new ArrayList<Device>();
for (Device device : userDevices) {
if (device.getType().equals(VirtualFireAlarmConstants.DEVICE_TYPE) &&
device.getEnrolmentInfo().getStatus().equals(
EnrolmentInfo.Status.ACTIVE)) {
userDevicesforFirealarm.add(device);
}
}
return userDevicesforFirealarm.toArray(new Device[]{});
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return null;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("/device/{sketch_type}/download")
@GET
@Produces("application/octet-stream")
public Response downloadSketch(@QueryParam("owner") String owner,
@PathParam("sketch_type") String sketchType) {
ZipArchive zipFile = null;
try {
zipFile = createDownloadFile(owner, sketchType);
Response.ResponseBuilder rb = Response.ok(zipFile.getZipFile());
rb.header("Content-Disposition",
"attachment; filename=\"" + zipFile.getFileName() + "\"");
return rb.build();
} catch (IllegalArgumentException ex) {
return Response.status(400).entity(ex.getMessage()).build();//bad request
} catch (DeviceManagementException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (AccessTokenException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (DeviceControllerException ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
}
@Path("/device/{sketch_type}/generate_link")
@GET
public Response generateSketchLink(@QueryParam("owner") String owner,
@PathParam("sketch_type") String sketchType) {
ZipArchive zipFile = null;
try {
zipFile = createDownloadFile(owner, sketchType);
Response.ResponseBuilder rb = Response.ok(zipFile.getDeviceId());
return rb.build();
} catch (IllegalArgumentException ex) {
return Response.status(400).entity(ex.getMessage()).build();//bad request
} catch (DeviceManagementException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (AccessTokenException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (DeviceControllerException ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
}
private ZipArchive createDownloadFile(String owner, String sketchType)
throws DeviceManagementException, AccessTokenException, DeviceControllerException {
if (owner == null) {
throw new IllegalArgumentException("Error on createDownloadFile() Owner is null!");
}
//create new device id
String deviceId = shortUUID();
TokenClient accessTokenClient = new TokenClient(VirtualFireAlarmConstants.DEVICE_TYPE);
AccessTokenInfo accessTokenInfo = null;
accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
//create token
String accessToken = accessTokenInfo.getAccess_token();
String refreshToken = accessTokenInfo.getRefresh_token();
//adding registering data
XmppAccount newXmppAccount = new XmppAccount();
newXmppAccount.setAccountName(owner + "_" + deviceId);
newXmppAccount.setUsername(deviceId);
newXmppAccount.setPassword(accessToken);
newXmppAccount.setEmail(deviceId + "@wso2.com");
XmppServerClient xmppServerClient = new XmppServerClient();
xmppServerClient.initControlQueue();
boolean status;
if(XmppConfig.getInstance().isEnabled()) {
status = xmppServerClient.createXMPPAccount(newXmppAccount);
if (!status) {
String msg =
"XMPP Account was not created for device - " + deviceId + " of owner - " +
owner +
". XMPP might have been disabled in org.wso2.carbon.device.mgt.iot.common.config.server.configs";
log.warn(msg);
throw new DeviceManagementException(msg);
}
}
status = register(deviceId, owner + "s_" + sketchType + "_" + deviceId.substring(0,
3),
owner);
if (!status) {
String msg = "Error occurred while registering the device with " + "id: " + deviceId
+ " owner:" + owner;
throw new DeviceManagementException(msg);
}
ZipUtil ziputil = new ZipUtil();
ZipArchive zipFile = null;
zipFile = ziputil.downloadSketch(owner,SUPER_TENANT, sketchType, deviceId, accessToken, refreshToken);
zipFile.setDeviceId(deviceId);
return zipFile;
}
private static String shortUUID() {
UUID uuid = UUID.randomUUID();
long l = ByteBuffer.wrap(uuid.toString().getBytes(StandardCharsets.UTF_8)).getLong();
return Long.toString(l, Character.MAX_RADIX);
}
}

@ -16,6 +16,7 @@
package org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpResponse;
@ -26,29 +27,43 @@ import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfigurationException;
import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.iot.common.DeviceController;
import org.wso2.carbon.device.mgt.iot.common.DeviceManagement;
import org.wso2.carbon.device.mgt.iot.common.DeviceValidator;
import org.wso2.carbon.device.mgt.iot.common.apimgt.AccessTokenInfo;
import org.wso2.carbon.device.mgt.iot.common.apimgt.TokenClient;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppAccount;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppConfig;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppServerClient;
import org.wso2.carbon.device.mgt.iot.common.exception.AccessTokenException;
import org.wso2.carbon.device.mgt.iot.common.exception.DeviceControllerException;
import org.wso2.carbon.device.mgt.iot.common.util.ZipArchive;
import org.wso2.carbon.device.mgt.iot.common.util.ZipUtil;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.plugin.constants
.VirtualFireAlarmConstants;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.DeviceJSON;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.VirtualFireAlarmMqttSubscriber;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.VirtualFireAlarmXmppConnector;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util
.VirtualFireAlarmMQTTSubscriber;
import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util
.VirtualFireAlarmXMPPConnector;
import org.wso2.carbon.utils.CarbonUtils;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@ -60,63 +75,359 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
public class VirtualFireAlarmControllerService {
//@Path("/VirtualFireAlarmDeviceManager")
public class VirtualFireAlarmService {
private static Log log = LogFactory.getLog(VirtualFireAlarmControllerService.class);
private static Log log = LogFactory.getLog(VirtualFireAlarmService.class);
//TODO; replace this tenant domain
//TODO; replace this tenant domain
private final String SUPER_TENANT = "carbon.super";
@Context //injected response proxy supporting multiple thread
private HttpServletResponse response;
private static final String TEMPERATURE_STREAM_DEFINITION = "org.wso2.iot.devices.temperature";
public static final String XMPP_PROTOCOL = "XMPP";
public static final String HTTP_PROTOCOL = "HTTP";
public static final String MQTT_PROTOCOL = "MQTT";
private static VirtualFireAlarmMqttSubscriber virtualFireAlarmMqttSubscriber;
private static VirtualFireAlarmXmppConnector virtualFireAlarmXmppConnector;
private static VirtualFireAlarmMQTTSubscriber virtualFireAlarmMQTTSubscriber;
private static VirtualFireAlarmXMPPConnector virtualFireAlarmXMPPConnector;
private static ConcurrentHashMap<String, String> deviceToIpMap =
new ConcurrentHashMap<String, String>();
public void setVirtualFireAlarmXmppConnector(
VirtualFireAlarmXmppConnector virtualFireAlarmXmppConnector) {
VirtualFireAlarmControllerService.virtualFireAlarmXmppConnector =
virtualFireAlarmXmppConnector;
virtualFireAlarmXmppConnector.initConnector();
virtualFireAlarmXmppConnector.connectAndLogin();
public void setVirtualFireAlarmXMPPConnector(
VirtualFireAlarmXMPPConnector virtualFireAlarmXMPPConnector) {
this.virtualFireAlarmXMPPConnector = virtualFireAlarmXMPPConnector;
virtualFireAlarmXMPPConnector.initConnector();
virtualFireAlarmXMPPConnector.connectAndLogin();
}
public void setVirtualFireAlarmMQTTSubscriber(
VirtualFireAlarmMQTTSubscriber virtualFireAlarmMQTTSubscriber) {
this.virtualFireAlarmMQTTSubscriber = virtualFireAlarmMQTTSubscriber;
virtualFireAlarmMQTTSubscriber.initConnector();
virtualFireAlarmMQTTSubscriber.connectAndSubscribe();
}
public VirtualFireAlarmXMPPConnector getVirtualFireAlarmXMPPConnector() {
return virtualFireAlarmXMPPConnector;
}
public VirtualFireAlarmMQTTSubscriber getVirtualFireAlarmMQTTSubscriber() {
return virtualFireAlarmMQTTSubscriber;
}
@Path("manager/device/register")
@PUT
public boolean register(@QueryParam("deviceId") String deviceId,
@QueryParam("name") String name, @QueryParam("owner") String owner) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
if (deviceManagement.getDeviceManagementService().isEnrolled(deviceIdentifier)) {
response.setStatus(Response.Status.CONFLICT.getStatusCode());
return false;
}
Device device = new Device();
device.setDeviceIdentifier(deviceId);
EnrolmentInfo enrolmentInfo = new EnrolmentInfo();
enrolmentInfo.setDateOfEnrolment(new Date().getTime());
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
device.setName(name);
device.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
enrolmentInfo.setOwner(owner);
device.setEnrolmentInfo(enrolmentInfo);
boolean added = deviceManagement.getDeviceManagementService().enrollDevice(device);
if (added) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
return added;
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return false;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/remove/{device_id}")
@DELETE
public void removeDevice(@PathParam("device_id") String deviceId,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
boolean removed = deviceManagement.getDeviceManagementService().disenrollDevice(
deviceIdentifier);
if (removed) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/update/{device_id}")
@POST
public boolean updateDevice(@PathParam("device_id") String deviceId,
@QueryParam("name") String name,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
Device device = deviceManagement.getDeviceManagementService().getDevice(
deviceIdentifier);
device.setDeviceIdentifier(deviceId);
// device.setDeviceTypeId(deviceTypeId);
device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime());
device.setName(name);
device.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
boolean updated = deviceManagement.getDeviceManagementService().modifyEnrollment(
device);
if (updated) {
response.setStatus(Response.Status.OK.getStatusCode());
} else {
response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
}
return updated;
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return false;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/device/{device_id}")
@GET
@Consumes("application/json")
@Produces("application/json")
public Device getDevice(@PathParam("device_id") String deviceId) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(VirtualFireAlarmConstants.DEVICE_TYPE);
try {
return deviceManagement.getDeviceManagementService().getDevice(deviceIdentifier);
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return null;
} finally {
deviceManagement.endTenantFlow();
}
}
@Path("manager/devices/{username}")
@GET
@Consumes("application/json")
@Produces("application/json")
public Device[] getFirealarmDevices(@PathParam("username") String username) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
try {
List<Device> userDevices =
deviceManagement.getDeviceManagementService().getDevicesOfUser(
username);
ArrayList<Device> userDevicesforFirealarm = new ArrayList<Device>();
for (Device device : userDevices) {
if (device.getType().equals(VirtualFireAlarmConstants.DEVICE_TYPE) &&
device.getEnrolmentInfo().getStatus().equals(
EnrolmentInfo.Status.ACTIVE)) {
userDevicesforFirealarm.add(device);
}
}
return userDevicesforFirealarm.toArray(new Device[]{});
} catch (DeviceManagementException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
return null;
} finally {
deviceManagement.endTenantFlow();
}
}
public void setVirtualFireAlarmMqttSubscriber(
VirtualFireAlarmMqttSubscriber virtualFireAlarmMqttSubscriber) {
VirtualFireAlarmControllerService.virtualFireAlarmMqttSubscriber =
virtualFireAlarmMqttSubscriber;
virtualFireAlarmMqttSubscriber.initConnector();
virtualFireAlarmMqttSubscriber.connectAndSubscribe();
@Path("manager/device/{sketch_type}/download")
@GET
@Produces("application/octet-stream")
public Response downloadSketch(@QueryParam("owner") String owner,
@PathParam("sketch_type") String sketchType) {
ZipArchive zipFile = null;
try {
zipFile = createDownloadFile(owner, sketchType);
Response.ResponseBuilder rb = Response.ok(zipFile.getZipFile());
rb.header("Content-Disposition",
"attachment; filename=\"" + zipFile.getFileName() + "\"");
return rb.build();
} catch (IllegalArgumentException ex) {
return Response.status(400).entity(ex.getMessage()).build();//bad request
} catch (DeviceManagementException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (AccessTokenException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (DeviceControllerException ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
}
public VirtualFireAlarmXmppConnector getVirtualFireAlarmXmppConnector() {
return virtualFireAlarmXmppConnector;
@Path("manager/device/{sketch_type}/generate_link")
@GET
public Response generateSketchLink(@QueryParam("owner") String owner,
@PathParam("sketch_type") String sketchType) {
ZipArchive zipFile = null;
try {
zipFile = createDownloadFile(owner, sketchType);
Response.ResponseBuilder rb = Response.ok(zipFile.getDeviceId());
return rb.build();
} catch (IllegalArgumentException ex) {
return Response.status(400).entity(ex.getMessage()).build();//bad request
} catch (DeviceManagementException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (AccessTokenException ex) {
return Response.status(500).entity(ex.getMessage()).build();
} catch (DeviceControllerException ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
}
public VirtualFireAlarmMqttSubscriber getVirtualFireAlarmMqttSubscriber() {
return virtualFireAlarmMqttSubscriber;
private ZipArchive createDownloadFile(String owner, String sketchType)
throws DeviceManagementException, AccessTokenException, DeviceControllerException {
if (owner == null) {
throw new IllegalArgumentException("Error on createDownloadFile() Owner is null!");
}
//create new device id
String deviceId = shortUUID();
TokenClient accessTokenClient = new TokenClient(VirtualFireAlarmConstants.DEVICE_TYPE);
AccessTokenInfo accessTokenInfo = null;
accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
//create token
String accessToken = accessTokenInfo.getAccess_token();
String refreshToken = accessTokenInfo.getRefresh_token();
//adding registering data
XmppAccount newXmppAccount = new XmppAccount();
newXmppAccount.setAccountName(owner + "_" + deviceId);
newXmppAccount.setUsername(deviceId);
newXmppAccount.setPassword(accessToken);
String xmppEndPoint = XmppConfig.getInstance().getXmppControlQueue().getServerURL();
int indexOfChar = xmppEndPoint.lastIndexOf('/');
if (indexOfChar != -1) {
xmppEndPoint = xmppEndPoint.substring((indexOfChar + 1), xmppEndPoint.length());
}
newXmppAccount.setEmail(deviceId + "@wso2.com");
XmppServerClient xmppServerClient = new XmppServerClient();
xmppServerClient.initControlQueue();
boolean status;
if(XmppConfig.getInstance().isEnabled()) {
status = xmppServerClient.createXMPPAccount(newXmppAccount);
if (!status) {
String msg =
"XMPP Account was not created for device - " + deviceId + " of owner - " +
owner +
". XMPP might have been disabled in org.wso2.carbon.device.mgt.iot.common.config.server.configs";
log.warn(msg);
throw new DeviceManagementException(msg);
}
}
status = register(deviceId, owner + "s_" + sketchType + "_" + deviceId.substring(0,
3),
owner);
if (!status) {
String msg = "Error occurred while registering the device with " + "id: " + deviceId
+ " owner:" + owner;
throw new DeviceManagementException(msg);
}
ZipUtil ziputil = new ZipUtil();
ZipArchive zipFile = null;
zipFile = ziputil.downloadSketch(owner,SUPER_TENANT, sketchType, deviceId, accessToken, refreshToken);
zipFile.setDeviceId(deviceId);
return zipFile;
}
private static String shortUUID() {
UUID uuid = UUID.randomUUID();
long l = ByteBuffer.wrap(uuid.toString().getBytes(StandardCharsets.UTF_8)).getLong();
return Long.toString(l, Character.MAX_RADIX);
}
@Path("/register/{owner}/{deviceId}/{ip}")
@Path("controller/register/{owner}/{deviceId}/{ip}")
@POST
public String registerDeviceIP(@PathParam("owner") String owner,
@PathParam("deviceId") String deviceId,
@PathParam("ip") String deviceIP,
@Context HttpServletResponse response) {
@PathParam("deviceId") String deviceId,
@PathParam("ip") String deviceIP,
@Context HttpServletResponse response) {
String result;
log.info("Got register call from IP: " + deviceIP + " for Device ID: " + deviceId +
" of owner: " + owner);
" of owner: " + owner);
deviceToIpMap.put(deviceId, deviceIP);
@ -133,18 +444,18 @@ public class VirtualFireAlarmControllerService {
/* Service to switch "ON" and "OFF" the Virtual FireAlarm bulb
Called by an external client intended to control the Virtual FireAlarm bulb */
@Path("/bulb/{state}")
@Path("controller/bulb/{state}")
@POST
public void switchBulb(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId,
@HeaderParam("protocol") String protocol,
@PathParam("state") String state,
@Context HttpServletResponse response) {
@HeaderParam("deviceId") String deviceId,
@HeaderParam("protocol") String protocol,
@PathParam("state") String state,
@Context HttpServletResponse response) {
try {
DeviceValidator deviceValidator = new DeviceValidator();
if (!deviceValidator.isExist(owner, SUPER_TENANT, new DeviceIdentifier(deviceId,
VirtualFireAlarmConstants.DEVICE_TYPE))) {
VirtualFireAlarmConstants.DEVICE_TYPE))) {
response.setStatus(Response.Status.UNAUTHORIZED.getStatusCode());
return;
}
@ -172,9 +483,8 @@ public class VirtualFireAlarmControllerService {
String protocolString = protocol.toUpperCase();
String callUrlPattern = VirtualFireAlarmConstants.BULB_CONTEXT + switchToState;
log.info("Sending command: '" + callUrlPattern + "' to virtual-firealarm at: " + deviceIP +
" " +
"via" + " " + protocolString);
log.info("Sending command: '" + callUrlPattern + "' to virtual-firealarm at: " + deviceIP + " " +
"via" + " " + protocolString);
try {
switch (protocolString) {
@ -186,7 +496,6 @@ public class VirtualFireAlarmControllerService {
switchToState);
break;
case XMPP_PROTOCOL:
// requestBulbChangeViaXMPP(switchToState, response);
sendCommandViaXMPP(owner, deviceId, VirtualFireAlarmConstants.BULB_CONTEXT, switchToState);
break;
default:
@ -209,19 +518,19 @@ public class VirtualFireAlarmControllerService {
}
@Path("/readsonar")
@Path("controller/readsonar")
@GET
public String requestSonarReading(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId,
@HeaderParam("protocol") String protocol,
@Context HttpServletResponse response) {
@HeaderParam("deviceId") String deviceId,
@HeaderParam("protocol") String protocol,
@Context HttpServletResponse response) {
String replyMsg = "";
DeviceValidator deviceValidator = new DeviceValidator();
try {
if (!deviceValidator.isExist(owner, SUPER_TENANT, new DeviceIdentifier(deviceId,
VirtualFireAlarmConstants
.DEVICE_TYPE))) {
VirtualFireAlarmConstants
.DEVICE_TYPE))) {
response.setStatus(Response.Status.UNAUTHORIZED.getStatusCode());
return "Unauthorized Access";
}
@ -279,12 +588,12 @@ public class VirtualFireAlarmControllerService {
}
@Path("/readtemperature")
@Path("controller/readtemperature")
@GET
public String requestTemperature(@HeaderParam("owner") String owner,
@HeaderParam("deviceId") String deviceId,
@HeaderParam("protocol") String protocol,
@Context HttpServletResponse response) {
@HeaderParam("deviceId") String deviceId,
@HeaderParam("protocol") String protocol,
@Context HttpServletResponse response) {
String replyMsg = "";
DeviceValidator deviceValidator = new DeviceValidator();
@ -324,7 +633,6 @@ public class VirtualFireAlarmControllerService {
case XMPP_PROTOCOL:
log.info("Sending request to read virtual-firealarm-temperature at : " + deviceIp + " via " + XMPP_PROTOCOL);
replyMsg = sendCommandViaXMPP(owner, deviceId, VirtualFireAlarmConstants.TEMPERATURE_CONTEXT, ".");
// replyMsg = requestTemperatureViaXMPP(response);
break;
default:
@ -349,56 +657,7 @@ public class VirtualFireAlarmControllerService {
return replyMsg;
}
// public String requestTemperatureViaXMPP(@Context HttpServletResponse response) {
// String replyMsg = "";
//
// String sep = File.separator;
// String scriptsFolder = "repository" + sep + "resources" + sep + "scripts";
// String scriptPath = CarbonUtils.getCarbonHome() + sep + scriptsFolder + sep
// + "xmpp_client.py -r Temperature";
// String command = "python " + scriptPath;
//
// replyMsg = executeCommand(command);
//
// response.setStatus(HttpStatus.SC_OK);
// return replyMsg;
// }
// public String requestSonarViaXMPP(@Context HttpServletResponse response) {
// String replyMsg = "";
//
// String sep = File.separator;
// String scriptsFolder = "repository" + sep + "resources" + sep + "scripts";
// String scriptPath = CarbonUtils.getCarbonHome() + sep + scriptsFolder + sep
// + "xmpp_client.py -r Sonar";
// String command = "python " + scriptPath;
//
// replyMsg = executeCommand(command);
//
// response.setStatus(HttpStatus.SC_OK);
// return replyMsg;
// }
// public String requestBulbChangeViaXMPP(String state,
// @Context HttpServletResponse response) {
// String replyMsg = "";
//
// String sep = File.separator;
// String scriptsFolder = "repository" + sep + "resources" + sep + "scripts";
// String scriptPath = CarbonUtils.getCarbonHome() + sep + scriptsFolder + sep
// + "xmpp_client.py -r Bulb -s " + state;
// String command = "python " + scriptPath;
//
// replyMsg = executeCommand(command);
//
// response.setStatus(HttpStatus.SC_OK);
// return replyMsg;
// }
@Path("/push_temperature")
@Path("controller/push_temperature")
@POST
@Consumes(MediaType.APPLICATION_JSON)
public void pushTemperatureData(
@ -412,14 +671,12 @@ public class VirtualFireAlarmControllerService {
if (registeredIp == null) {
log.warn("Unregistered IP: Temperature Data Received from an un-registered IP " +
deviceIp + " for device ID - " + deviceId);
deviceIp + " for device ID - " + deviceId);
response.setStatus(Response.Status.PRECONDITION_FAILED.getStatusCode());
return;
} else if (!registeredIp.equals(deviceIp)) {
log.warn("Conflicting IP: Received IP is " + deviceIp + ". Device with ID " +
deviceId +
" is already registered under some other IP. Re-registration " +
"required");
deviceId + " is already registered under some other IP. Re-registration " + "required");
response.setStatus(Response.Status.CONFLICT.getStatusCode());
return;
}
@ -429,13 +686,12 @@ public class VirtualFireAlarmControllerService {
ctx.setTenantDomain(SUPER_TENANT, true);
DeviceAnalyticsService deviceAnalyticsService = (DeviceAnalyticsService) ctx
.getOSGiService(DeviceAnalyticsService.class, null);
Object metdaData[] =
{dataMsg.owner, VirtualFireAlarmConstants.DEVICE_TYPE, dataMsg.deviceId,
System.currentTimeMillis()};
Object metdaData[] = {dataMsg.owner, VirtualFireAlarmConstants.DEVICE_TYPE, dataMsg.deviceId,
System.currentTimeMillis()};
Object payloadData[] = {temperature};
try {
deviceAnalyticsService.publishEvent(TEMPERATURE_STREAM_DEFINITION, "1.0.0",
metdaData, new Object[0], payloadData);
metdaData, new Object[0], payloadData);
} catch (DataPublisherConfigurationException e) {
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
@ -527,7 +783,7 @@ public class VirtualFireAlarmControllerService {
private String sendCommandViaXMPP(String deviceOwner, String deviceId, String resource,
String state) throws DeviceManagementException {
String state) throws DeviceManagementException {
String replyMsg = "";
String scriptArguments = "";
@ -612,7 +868,7 @@ public class VirtualFireAlarmControllerService {
private boolean sendCommandViaMQTT(String deviceOwner, String deviceId, String resource,
String state) throws DeviceManagementException {
String state) throws DeviceManagementException {
boolean result = false;
DeviceController deviceController = new DeviceController();
@ -620,7 +876,7 @@ public class VirtualFireAlarmControllerService {
try {
result = deviceController.publishMqttControl(deviceOwner,
VirtualFireAlarmConstants.DEVICE_TYPE,
deviceId, resource, state);
deviceId, resource, state);
} catch (DeviceControllerException e) {
String errorMsg = "Error whilst trying to publish to MQTT Queue";
log.error(errorMsg);
@ -631,8 +887,8 @@ public class VirtualFireAlarmControllerService {
private String sendCommandViaHTTP(final String deviceIp, int deviceServerPort,
String callUrlPattern,
boolean fireAndForgot)
String callUrlPattern,
boolean fireAndForgot)
throws DeviceManagementException {
if (deviceServerPort == 0) {
@ -716,7 +972,7 @@ public class VirtualFireAlarmControllerService {
/* This methods creates and returns a http connection object */
private HttpURLConnection getHttpConnection(String urlString) throws
DeviceManagementException {
DeviceManagementException {
URL connectionUrl = null;
HttpURLConnection httpConnection = null;

@ -12,8 +12,8 @@ import org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.plugin.constants
import java.io.File;
import java.util.UUID;
public class VirtualFireAlarmMqttSubscriber extends MqttSubscriber {
private static Log log = LogFactory.getLog(VirtualFireAlarmMqttSubscriber.class);
public class VirtualFireAlarmMQTTSubscriber extends MqttSubscriber {
private static Log log = LogFactory.getLog(VirtualFireAlarmMQTTSubscriber.class);
private static final String subscribeTopic =
"wso2" + File.separator + "iot" + File.separator + "+" + File.separator +
@ -22,7 +22,7 @@ public class VirtualFireAlarmMqttSubscriber extends MqttSubscriber {
private static final String iotServerSubscriber = UUID.randomUUID().toString().substring(0, 5);
private static String mqttEndpoint;
private VirtualFireAlarmMqttSubscriber() {
private VirtualFireAlarmMQTTSubscriber() {
super(iotServerSubscriber, VirtualFireAlarmConstants.DEVICE_TYPE,
MqttConfig.getInstance().getMqttQueueEndpoint(), subscribeTopic);
}
@ -56,7 +56,7 @@ public class VirtualFireAlarmMqttSubscriber extends MqttSubscriber {
}
try {
VirtualFireAlarmMqttSubscriber.super.connectAndSubscribe();
VirtualFireAlarmMQTTSubscriber.super.connectAndSubscribe();
} catch (DeviceManagementException e1) {
if (log.isDebugEnabled()) {
log.debug("Attempt to re-connect to MQTT-Queue failed");

@ -7,8 +7,8 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppConfig;
import org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppConnector;
public class VirtualFireAlarmXmppConnector extends XmppConnector {
private static Log log = LogFactory.getLog(VirtualFireAlarmXmppConnector.class);
public class VirtualFireAlarmXMPPConnector extends XmppConnector {
private static Log log = LogFactory.getLog(VirtualFireAlarmXMPPConnector.class);
private static String xmppServerIP;
// private static int xmppServerPort;
@ -16,7 +16,7 @@ public class VirtualFireAlarmXmppConnector extends XmppConnector {
private static String xmppAdminPassword;
private static String xmppAdminAccountJID;
private VirtualFireAlarmXmppConnector() {
private VirtualFireAlarmXMPPConnector() {
super(XmppConfig.getInstance().getXmppServerIP(),
XmppConfig.getInstance().getSERVER_CONNECTION_PORT());
}
@ -57,10 +57,10 @@ public class VirtualFireAlarmXmppConnector extends XmppConnector {
}
try {
VirtualFireAlarmXmppConnector.super.connectAndLogin(xmppAdminUsername,
VirtualFireAlarmXMPPConnector.super.connectAndLogin(xmppAdminUsername,
xmppAdminPassword,
null);
VirtualFireAlarmXmppConnector.super.setMessageFilterOnReceiver(
VirtualFireAlarmXMPPConnector.super.setMessageFilterOnReceiver(
xmppAdminAccountJID);
} catch (DeviceManagementException e1) {
if (log.isDebugEnabled()) {

@ -17,44 +17,45 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="VirtualFireAlarmController" address="/controller">
<jaxrs:serviceBeans>
<bean id="VirtualFireAlarmControllerService"
class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.VirtualFireAlarmControllerService">
<property name="virtualFireAlarmMqttSubscriber" ref="mqttSubscriberBean"/>
<property name="virtualFireAlarmXmppConnector" ref="xmppConnectorBean"/>
</bean>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
<jaxrs:server id="VirtualFireAlarmManager" address="/manager">
<jaxrs:serviceBeans>
<bean id="VirtualFireAlarmManagerService"
class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.VirtualFireAlarmManagerService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
<bean id="mqttSubscriberBean" class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.VirtualFireAlarmMqttSubscriber" >
</bean>
<bean id="xmppConnectorBean" class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.VirtualFireAlarmXmppConnector" >
</bean>
<!--<bean id="mqttSubscriber" class="org.wso2.carbon.device.mgt.iot.firealarm.api.util.MQTTFirealarmSubscriber" >-->
<!-- -->
<!--</bean>-->
<!--<jaxrs:server id="VirtualFireAlarmController" address="/controller">-->
<!--<jaxrs:serviceBeans>-->
<!--<bean id="VirtualFireAlarmControllerService"-->
<!--class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.VirtualFireAlarmControllerService">-->
<!--<property name="virtualFireAlarmMQTTSubscriber" ref="mqttSubscriberBean"/>-->
<!--<property name="virtualFireAlarmXMPPConnector" ref="xmppConnectorBean"/>-->
<!--</bean>-->
<!--</jaxrs:serviceBeans>-->
<!--<jaxrs:providers>-->
<!--<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />-->
<!--</jaxrs:providers>-->
<!--</jaxrs:server>-->
<jaxrs:server id="VirtualFireAlarm" address="/">
<jaxrs:serviceBeans>
<bean id="VirtualFireAlarmService"
class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.VirtualFireAlarmService">
<property name="virtualFireAlarmMQTTSubscriber" ref="mqttSubscriberBean"/>
<property name="virtualFireAlarmXMPPConnector" ref="xmppConnectorBean"/>
</bean>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="mqttSubscriberBean"
class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.VirtualFireAlarmMQTTSubscriber">
</bean>
<bean id="xmppConnectorBean"
class="org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl.util.VirtualFireAlarmXMPPConnector">
</bean>
</beans>

@ -19,5 +19,55 @@
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>isAdminService</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>doAuthentication</param-name>
<param-value>false</param-value>
</context-param>
<!--publish to apim-->
<context-param>
<param-name>managed-api-enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>managed-api-owner</param-name>
<param-value>admin</param-value>
</context-param>
<context-param>
<param-name>managed-api-name</param-name>
<param-value>virtual_firealarm</param-value>
</context-param>
<context-param>
<param-name>managed-api-endpoint</param-name>
<param-value>http://localhost:9763/virtual_firealarm</param-value>
</context-param>
<context-param>
<param-name>managed-api-version</param-name>
<param-value>1.0.0</param-value>
</context-param>
<context-param>
<param-name>managed-api-context</param-name>
<param-value>/virtual_firealarm</param-value>
</context-param>
<context-param>
<param-name>managed-api-isSecured</param-name>
<param-value>true</param-value>
</context-param>
<!-- Below configuration is used to redirect http requests to https -->
<!--<security-constraint>-->
<!--<web-resource-collection>-->
<!--<web-resource-name>IoT</web-resource-name>-->
<!--<url-pattern>/*</url-pattern>-->
<!--</web-resource-collection>-->
<!--<user-data-constraint>-->
<!--<transport-guarantee>CONFIDENTIAL</transport-guarantee>-->
<!--</user-data-constraint>-->
<!--</security-constraint>-->
</web-app>

Loading…
Cancel
Save