Java class for Authenticator complex type. - * - *
The following schema fragment specifies the expected content contained within this class. - * - *
- * <complexType name="Authenticator"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="Properties" type="{}Properties"/> - * </sequence> - * <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" /> - * </restriction> - * </complexContent> - * </complexType> - *- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Authenticator", propOrder = { - "properties" -}) -public class Authenticator { - - @XmlElement(name = "Properties", required = false) - protected Properties properties; - @XmlAttribute(name = "class") - protected String clazz; - - /** - * Gets the value of the properties property. - * - * @return - * possible object is - * {@link Properties } - * - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the value of the properties property. - * - * @param value - * allowed object is - * {@link Properties } - * - */ - public void setProperties(Properties value) { - this.properties = value; - } - - /** - * Gets the value of the clazz property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClazz() { - return clazz; - } - - /** - * Sets the value of the clazz property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClazz(String value) { - this.clazz = value; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java deleted file mode 100644 index 03cc6b9fd..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *
Java class for Authorizer complex type. - * - *
The following schema fragment specifies the expected content contained within this class. - * - *
- * <complexType name="Authorizer"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="Properties" type="{}Properties"/> - * </sequence> - * <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" /> - * </restriction> - * </complexContent> - * </complexType> - *- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Authorizer", propOrder = { - "properties" -}) -public class Authorizer { - - @XmlElement(name = "Properties", required = false) - protected Properties properties; - @XmlAttribute(name = "class") - protected String clazz; - - /** - * Gets the value of the properties property. - * - * @return - * possible object is - * {@link Properties } - * - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the value of the properties property. - * - * @param value - * allowed object is - * {@link Properties } - * - */ - public void setProperties(Properties value) { - this.properties = value; - } - - /** - * Gets the value of the clazz property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClazz() { - return clazz; - } - - /** - * Sets the value of the clazz property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClazz(String value) { - this.clazz = value; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java deleted file mode 100644 index 9620f46a4..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import java.util.ArrayList; -import java.util.List; - - -/** - *
Java class for Properties complex type. - * - *
The following schema fragment specifies the expected content contained within this class. - * - *
- * <complexType name="Properties"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="Property" type="{}Property" maxOccurs="unbounded" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - *- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Properties", propOrder = { - "property" -}) -public class Properties { - - @XmlElement(name = "Property") - protected List
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a set
method for the property property.
- *
- *
- * For example, to add a new item, do as follows: - *
- * getProperty().add(newItem); - *- * - * - *
- * Objects of the following type(s) are allowed in the list
- * {@link Property }
- *
- *
- */
- public List Java class for Property complex type.
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- * Java class for WebsocketValidationConfigs complex type.
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Property">
- * <simpleContent>
- * <extension base="<http://www.w3.org/2001/XMLSchema>string">
- * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- * </extension>
- * </simpleContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Property", propOrder = {
- "value"
-})
-public class Property {
-
- @XmlValue
- protected String value;
- @XmlAttribute(name = "name")
- protected String name;
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
-
-}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java
deleted file mode 100644
index 3499cd5e6..000000000
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * you may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.carbon.device.mgt.output.adapter.websocket.config;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketUtils;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import java.io.File;
-
-/**
- * This class represents the configuration that are needed for scopes to permission map.
- */
-public class WebsocketConfig {
-
- private static WebsocketConfig config = new WebsocketConfig();
- private WebsocketValidationConfigs websocketValidationConfigs;
- private static final Log log = LogFactory.getLog(WebsocketConfig.class);
-
- private static final String WEBSOCKET_VALIDATION_CONFIG_PATH =
- CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "websocket-validation.xml";
-
- private WebsocketConfig() {
- }
-
- public static WebsocketConfig getInstance() {
- return config;
- }
-
- public void init() throws WebsocketValidationConfigurationFailedException {
- try {
- File deviceMgtConfig = new File(WEBSOCKET_VALIDATION_CONFIG_PATH);
- Document doc = WebsocketUtils.convertToDocument(deviceMgtConfig);
-
- /* Un-marshaling DeviceMGtScope configuration */
- JAXBContext ctx = JAXBContext.newInstance(WebsocketValidationConfigs.class);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- //unmarshaller.setSchema(getSchema());
- websocketValidationConfigs = (WebsocketValidationConfigs) unmarshaller.unmarshal(doc);
- } catch (JAXBException e) {
- throw new WebsocketValidationConfigurationFailedException("Error occurred while un-marshalling Websocket" +
- " Config", e);
- }
- }
-
- public WebsocketValidationConfigs getWebsocketValidationConfigs() {
- if (websocketValidationConfigs == null) {
- try {
- init();
- } catch (WebsocketValidationConfigurationFailedException e) {
- log.error("failed to initialize the config", e);
- }
- }
- return websocketValidationConfigs;
- }
-
- public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigs) {
- websocketValidationConfigs = websocketValidationConfigs;
- }
-}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java
deleted file mode 100644
index 020cfd2ce..000000000
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * you may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.carbon.device.mgt.output.adapter.websocket.config;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-
-/**
- *
- * <complexType name="WebsocketValidationConfigs">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="Authenticator" type="{}Authenticator"/>
- * <element name="Authorizer" type="{}Authorizer"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-
-@XmlRootElement(name = "WebsocketValidationConfigs")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class WebsocketValidationConfigs {
-
- @XmlElement(name = "Authenticator", required = true)
- protected Authenticator authenticator;
- @XmlElement(name = "Authorizer", required = true)
- protected Authorizer authorizer;
-
- /**
- * Gets the value of the authenticator property.
- *
- * @return
- * possible object is
- * {@link Authenticator }
- *
- */
- public Authenticator getAuthenticator() {
- return authenticator;
- }
-
- /**
- * Sets the value of the authenticator property.
- *
- * @param value
- * allowed object is
- * {@link Authenticator }
- *
- */
- public void setAuthenticator(Authenticator value) {
- this.authenticator = value;
- }
-
- /**
- * Gets the value of the authorizer property.
- *
- * @return
- * possible object is
- * {@link Authorizer }
- *
- */
- public Authorizer getAuthorizer() {
- return authorizer;
- }
-
- /**
- * Sets the value of the authorizer property.
- *
- * @param value
- * allowed object is
- * {@link Authorizer }
- *
- */
- public void setAuthorizer(Authorizer value) {
- this.authorizer = value;
- }
-
-}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java
deleted file mode 100644
index cc1eb08c5..000000000
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.carbon.device.mgt.output.adapter.websocket.config;
-
-public class WebsocketValidationConfigurationFailedException extends Exception {
-
- private static final long serialVersionUID = -3151279329290703928L;
-
- public WebsocketValidationConfigurationFailedException(String msg, Exception nestedEx) {
- super(msg, nestedEx);
- }
-
- public WebsocketValidationConfigurationFailedException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public WebsocketValidationConfigurationFailedException(String msg) {
- super(msg);
- }
-
- public WebsocketValidationConfigurationFailedException() {
- super();
- }
-
- public WebsocketValidationConfigurationFailedException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java
index 5d459cd2e..1c1c2af96 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java
@@ -29,7 +29,8 @@ public class WebsocketConstants {
public static final String SCOPE_IDENTIFIER = "scopes";
public static final String MAXIMUM_TOTAL_HTTP_CONNECTION = "maximumTotalHttpConnection";
public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST = "maximumHttpConnectionPerHost";
- public static final String TOKEN_VALIDATION_ENDPOINT_URL = "tokenValidationEndpoint";
+ public static final String TOKEN_VALIDATION_ENDPOINT_URL = "keymanagerUrl";
+ public static final String TOKEN_VALIDATION_CONTEXT = "/services/OAuth2TokenValidationService";
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
public static final String TOKEN_PARAM = "token";
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java
index ce5aa792b..76a92a451 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java
@@ -23,12 +23,6 @@ import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.device.mgt.output.adapter.websocket.UIEventAdapterFactory;
import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerServiceImpl;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.Authenticator;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.Authorizer;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketConfig;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketValidationConfigurationFailedException;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationServiceImpl;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterFactory;
import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerService;
import org.wso2.carbon.event.stream.core.EventStreamService;
@@ -51,45 +45,20 @@ public class UILocalEventAdapterServiceComponent {
protected void activate(ComponentContext context) {
try {
- OutputEventAdapterFactory uiEventAdapterFactory = new UIEventAdapterFactory();
+ UIEventAdapterFactory uiEventAdapterFactory = new UIEventAdapterFactory();
context.getBundleContext().registerService(OutputEventAdapterFactory.class.getName(), uiEventAdapterFactory, null);
UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl =
new UIOutputCallbackControllerServiceImpl();
context.getBundleContext().registerService(UIOutputCallbackControllerService.class.getName(),
UIOutputCallbackRegisterServiceImpl, null);
+ uiEventAdapterFactory.setBundleContext(context.getBundleContext());
+
UIEventAdaptorServiceDataHolder.registerUIOutputCallbackRegisterServiceInternal(
UIOutputCallbackRegisterServiceImpl);
if (log.isDebugEnabled()) {
log.debug("Successfully deployed the output websocket adapter service");
}
- try {
- WebsocketConfig.getInstance().init();
- WebsocketValidationServiceImpl websocketValidationService = new WebsocketValidationServiceImpl();
- String authenticatorClassName = WebsocketConfig.getInstance().getWebsocketValidationConfigs()
- .getAuthenticator().getClazz();
- String authorizerClassName = WebsocketConfig.getInstance().getWebsocketValidationConfigs()
- .getAuthorizer().getClazz();
- if (authenticatorClassName != null && !authenticatorClassName.isEmpty()) {
- Class extends Authenticator> authenticatorClass = Class.forName(authenticatorClassName)
- .asSubclass(Authenticator.class);
- Authenticator authenticator = authenticatorClass.newInstance();
- websocketValidationService.setAuthenticator(authenticator);
- }
- if (authorizerClassName != null && !authorizerClassName.isEmpty()) {
- Class extends Authorizer> authorizerClass = Class.forName(authorizerClassName)
- .asSubclass(Authorizer.class);
- Authorizer authorizer = authorizerClass.newInstance();
- websocketValidationService.setAuthorizer(authorizer);
- }
- context.getBundleContext().registerService(
- WebsocketValidationService.class.getName(), websocketValidationService, null);
- } catch (WebsocketValidationConfigurationFailedException e) {
- log.error("Failed to initialize configuration for websocket.", e);
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
- log.error("Failed to initialize the class authentication and authorization given " +
- "in the websocket validation configuration.", e);
- }
} catch (RuntimeException e) {
log.error("Can not create the output websocket adapter service ", e);
} catch (Throwable e) {
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java
new file mode 100644
index 000000000..414df9c12
--- /dev/null
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+*
+* WSO2 Inc. licenses this file to you under the Apache License,
+* Version 2.0 (the "License"); you may not use this file except
+* in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.wso2.carbon.device.mgt.output.adapter.websocket.util;
+
+import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class PropertyUtils {
+
+ //This method is only used if the mb features are within DAS.
+ public static String replaceMqttProperty(String urlWithPlaceholders) throws OutputEventAdapterException {
+ String regex = "\\$\\{(.*?)\\}";
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matchPattern = pattern.matcher(urlWithPlaceholders);
+ while (matchPattern.find()) {
+ String sysPropertyName = matchPattern.group(1);
+ String sysPropertyValue = System.getProperty(sysPropertyName);
+ if (sysPropertyValue != null && !sysPropertyName.isEmpty()) {
+ urlWithPlaceholders = urlWithPlaceholders.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue);
+ } else {
+ throw new OutputEventAdapterException("System property - " + sysPropertyName
+ + " is not defined, hence cannot resolve : " + urlWithPlaceholders);
+ }
+ }
+ return urlWithPlaceholders;
+ }
+}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java
index bef12b7c3..ba5a1fd8e 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java
@@ -46,5 +46,7 @@ public class UIEventAdapterConstants {
public static final String ADAPTER_EVENT_QUEUE_SIZE_NAME = "eventQueueSize";
public static final int EVENTS_QUEUE_SIZE = 30;
+ public static final String AUTHENTICATOR_CLASS = "authenticator";
+ public static final String AUTHORIZER_CLASS = "authorizer";
}
diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java
deleted file mode 100644
index 162bc9955..000000000
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
- * you may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.wso2.carbon.device.mgt.output.adapter.websocket.util;
-
-import org.w3c.dom.Document;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketValidationConfigurationFailedException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.File;
-
-/**
- * This class holds util methods used by OAuth extension bundle.
- */
-public class WebsocketUtils {
-
- public static Document convertToDocument(File file) throws WebsocketValidationConfigurationFailedException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- try {
- DocumentBuilder docBuilder = factory.newDocumentBuilder();
- return docBuilder.parse(file);
- } catch (Exception e) {
- throw new WebsocketValidationConfigurationFailedException("Error occurred while parsing file, while converting " +
- "to a org.w3c.dom.Document", e);
- }
- }
-
-}
diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml
index 4c028dd9d..d06d6ccce 100644
--- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml
+++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml
@@ -56,10 +56,9 @@