The following schema fragment specifies the expected content contained within this class.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
property;
-
- /**
- * Gets the value of the property property.
- *
- *
- * 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 getProperty() {
- if (property == null) {
- property = new ArrayList();
- }
- return this.property;
- }
-
-}
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/Property.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/Property.java
deleted file mode 100644
index 7b14dbbe64..0000000000
--- 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/Property.java
+++ /dev/null
@@ -1,104 +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.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-
-
-/**
- * Java class for Property 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 3499cd5e66..0000000000
--- 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 020cfd2cef..0000000000
--- 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;
-
-
-/**
- * Java class for WebsocketValidationConfigs complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <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 cc1eb08c5b..0000000000
--- 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 5d459cd2ee..6391fa07d1 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_CONTEX = "/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
deleted file mode 100644
index ce5aa792b6..0000000000
--- 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
+++ /dev/null
@@ -1,113 +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.internal;
-
-import org.apache.commons.logging.Log;
-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;
-
-/**
- * @scr.component component.name="output.extensions.Ui.AdapterService.component" immediate="true"
- * @scr.reference name="eventStreamService.service"
- * interface="org.wso2.carbon.event.stream.core.EventStreamService" cardinality="1..1"
- * policy="dynamic" bind="setEventStreamService" unbind="unsetEventStreamService"
- */
-public class UILocalEventAdapterServiceComponent {
-
- private static final Log log = LogFactory.getLog(UILocalEventAdapterServiceComponent.class);
-
- /**
- * initialize the websocket adapter service here service here.
- *
- * @param context
- */
- protected void activate(ComponentContext context) {
-
- try {
- OutputEventAdapterFactory uiEventAdapterFactory = new UIEventAdapterFactory();
- context.getBundleContext().registerService(OutputEventAdapterFactory.class.getName(), uiEventAdapterFactory, null);
- UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl =
- new UIOutputCallbackControllerServiceImpl();
- context.getBundleContext().registerService(UIOutputCallbackControllerService.class.getName(),
- UIOutputCallbackRegisterServiceImpl, null);
-
- 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) {
- log.error("Error occurred while activating UI Event Adapter Service Component", e);
- }
- }
-
- protected void setEventStreamService(EventStreamService eventStreamService) {
- if (log.isDebugEnabled()) {
- log.debug("Setting the EventStreamService reference for the UILocalEventAdaptor Service");
- }
- UIEventAdaptorServiceDataHolder.registerEventStreamService(eventStreamService);
- }
-
- protected void unsetEventStreamService(EventStreamService eventStreamService) {
- if (log.isDebugEnabled()) {
- log.debug("Un-Setting the EventStreamService reference for the UILocalEventAdaptor Service");
- }
- UIEventAdaptorServiceDataHolder.registerEventStreamService(null);
- }
-}
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/UIEventAdaptorServiceDataHolder.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/WebsocketEventAdaptorServiceDataHolder.java
similarity index 72%
rename from 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/UIEventAdaptorServiceDataHolder.java
rename to 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/WebsocketEventAdaptorServiceDataHolder.java
index ec3c322177..0485b07103 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/UIEventAdaptorServiceDataHolder.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/WebsocketEventAdaptorServiceDataHolder.java
@@ -18,7 +18,7 @@
*/
package org.wso2.carbon.device.mgt.output.adapter.websocket.internal;
-import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerServiceImpl;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerServiceImpl;
import org.wso2.carbon.event.stream.core.EventStreamService;
import java.util.concurrent.ConcurrentHashMap;
@@ -27,9 +27,9 @@ import java.util.concurrent.LinkedBlockingDeque;
/**
* Creates a holder of type UIOutputCallbackRegisterServiceImpl.
*/
-public final class UIEventAdaptorServiceDataHolder {
+public final class WebsocketEventAdaptorServiceDataHolder {
- private static UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl;
+ private static WebsocketOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl;
private static ConcurrentHashMap>
tenantSpecificOutputEventStreamAdapterMap = new ConcurrentHashMap<>();
private static ConcurrentHashMap>>
@@ -37,21 +37,21 @@ public final class UIEventAdaptorServiceDataHolder {
private static EventStreamService eventStreamService;
public static void registerEventStreamService(EventStreamService eventBuilderService) {
- UIEventAdaptorServiceDataHolder.eventStreamService = eventBuilderService;
+ WebsocketEventAdaptorServiceDataHolder.eventStreamService = eventBuilderService;
}
public static EventStreamService getEventStreamService() {
- return UIEventAdaptorServiceDataHolder.eventStreamService;
+ return WebsocketEventAdaptorServiceDataHolder.eventStreamService;
}
public static void registerUIOutputCallbackRegisterServiceInternal(
- UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl) {
- UIEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl =
+ WebsocketOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl) {
+ WebsocketEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl =
UIOutputCallbackRegisterServiceImpl;
}
- public static UIOutputCallbackControllerServiceImpl getUIOutputCallbackRegisterServiceImpl() {
- return UIEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl;
+ public static WebsocketOutputCallbackControllerServiceImpl getUIOutputCallbackRegisterServiceImpl() {
+ return WebsocketEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl;
}
public static ConcurrentHashMap>
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/WebsocketLocalEventAdapterServiceComponent.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/WebsocketLocalEventAdapterServiceComponent.java
new file mode 100644
index 0000000000..4820d46e61
--- /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/internal/WebsocketLocalEventAdapterServiceComponent.java
@@ -0,0 +1,83 @@
+/*
+ * 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.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.component.ComponentContext;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketEventAdapterFactory;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerServiceImpl;
+import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterFactory;
+import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerService;
+import org.wso2.carbon.event.stream.core.EventStreamService;
+
+/**
+ * @scr.component component.name="output.extensions.secured.websocket.AdapterService.component" immediate="true"
+ * @scr.reference name="eventStreamService.service"
+ * interface="org.wso2.carbon.event.stream.core.EventStreamService" cardinality="1..1"
+ * policy="dynamic" bind="setEventStreamService" unbind="unsetEventStreamService"
+ */
+public class WebsocketLocalEventAdapterServiceComponent {
+
+ private static final Log log = LogFactory.getLog(WebsocketLocalEventAdapterServiceComponent.class);
+
+ /**
+ * initialize the websocket adapter service here service here.
+ *
+ * @param context
+ */
+ protected void activate(ComponentContext context) {
+
+ try {
+ WebsocketEventAdapterFactory websocketEventAdapterFactory = new WebsocketEventAdapterFactory();
+ context.getBundleContext().registerService(OutputEventAdapterFactory.class.getName()
+ , websocketEventAdapterFactory, null);
+ WebsocketOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl =
+ new WebsocketOutputCallbackControllerServiceImpl();
+ context.getBundleContext().registerService(WebsocketOutputCallbackControllerService.class.getName(),
+ UIOutputCallbackRegisterServiceImpl, null);
+
+ websocketEventAdapterFactory.setBundleContext(context.getBundleContext());
+
+ WebsocketEventAdaptorServiceDataHolder.registerUIOutputCallbackRegisterServiceInternal(
+ UIOutputCallbackRegisterServiceImpl);
+ if (log.isDebugEnabled()) {
+ log.debug("Successfully deployed the output websocket adapter service");
+ }
+ } catch (RuntimeException e) {
+ log.error("Can not create the output websocket adapter service ", e);
+ } catch (Throwable e) {
+ log.error("Error occurred while activating UI Event Adapter Service Component", e);
+ }
+ }
+
+ protected void setEventStreamService(EventStreamService eventStreamService) {
+ if (log.isDebugEnabled()) {
+ log.debug("Setting the EventStreamService reference for the UILocalEventAdaptor Service");
+ }
+ WebsocketEventAdaptorServiceDataHolder.registerEventStreamService(eventStreamService);
+ }
+
+ protected void unsetEventStreamService(EventStreamService eventStreamService) {
+ if (log.isDebugEnabled()) {
+ log.debug("Un-Setting the EventStreamService reference for the UILocalEventAdaptor Service");
+ }
+ WebsocketEventAdaptorServiceDataHolder.registerEventStreamService(null);
+ }
+}
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 0000000000..55b6539d7b
--- /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 replaceProperty(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/WebsocketEventAdapterConstants.java
similarity index 90%
rename from 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
rename to 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/WebsocketEventAdapterConstants.java
index bef12b7c3e..7fd15519fc 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/WebsocketEventAdapterConstants.java
@@ -21,9 +21,9 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.util;
/**
* This class contains the constants related to websocket Output Event Adaptor.
*/
-public class UIEventAdapterConstants {
+public class WebsocketEventAdapterConstants {
- private UIEventAdapterConstants() {
+ private WebsocketEventAdapterConstants() {
}
public static final String ADAPTER_TYPE_UI = "secured-websocket";
@@ -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 162bc99559..0000000000
--- 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/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml
index 15f1ac8a92..2ea306b49a 100644
--- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml
+++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml
@@ -20,7 +20,7 @@
org.wso2.carbon.devicemgt-plugins
cdmf-transport-adapters
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../../pom.xml
diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml
index d8b44c000b..2686452249 100644
--- a/components/extensions/cdmf-transport-adapters/pom.xml
+++ b/components/extensions/cdmf-transport-adapters/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt-plugins
extensions
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml
index b7e13a3221..8d77e5a572 100644
--- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml
+++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt-plugins
mb-extensions
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml
index 955aef40b1..d7ff1c8e95 100644
--- a/components/extensions/mb-extensions/pom.xml
+++ b/components/extensions/mb-extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt-plugins
extensions
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml
index cfdeeaffb2..5f1ca115ad 100644
--- a/components/extensions/pom.xml
+++ b/components/extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt-plugins
carbon-device-mgt-plugins-parent
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../../pom.xml
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml
index fa70569575..d1f5e612b2 100644
--- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml
@@ -20,7 +20,7 @@
org.wso2.carbon.devicemgt-plugins
siddhi-extensions
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml
index c2e8e2cb4d..08457f5e6f 100644
--- a/components/extensions/siddhi-extensions/pom.xml
+++ b/components/extensions/siddhi-extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt-plugins
extensions
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml
index 2497c485fb..c19788ccb8 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.devicemgt-plugins
android-plugin
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml
index 017ff5400c..b87cc8e2e0 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml
@@ -21,7 +21,7 @@
android-plugin
org.wso2.carbon.devicemgt-plugins
- 3.0.5-SNAPSHOT
+ 3.0.6-SNAPSHOT
../pom.xml
@@ -143,6 +143,11 @@
org.wso2.carbon.device.mgt.common
provided
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.apimgt.annotations
+ provided
+
org.wso2.carbon.devicemgt
org.wso2.carbon.device.mgt.core
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java
index bf775edfed..41fbb58570 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java
@@ -300,7 +300,7 @@ public class AndroidDeviceInfo extends DeviceInfo implements Serializable {
}
public Date getUpdatedTime() {
- if(this.updatedTime.equals((Object)null)) {
+ if(this.updatedTime == null) {
this.updatedTime = new Date();
}
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java
index a1ae89d151..2976300290 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java
@@ -83,13 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter