From 0b3cf2e59543a2b6f032885f030309fac1c17ba0 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 04:53:01 +0530 Subject: [PATCH 01/24] Adding new andes extensions api --- components/extensions/mb-extensions/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 82fab5824..6664bf79c 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -34,6 +34,7 @@ org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization + org.wso2.carbon.andes.extensions.device.mgt.api From 6deacd1d1951cd4f7152110744c79e360e92c10d Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 05:02:09 +0530 Subject: [PATCH 02/24] Adding new dependencies for andes extensions api --- pom.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pom.xml b/pom.xml index 019717eb2..22f9f446b 100644 --- a/pom.xml +++ b/pom.xml @@ -813,6 +813,11 @@ jackson-jaxrs ${jackson.version} + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations.version} + @@ -1042,6 +1047,11 @@ org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization ${carbon.devicemgt.plugins.version} + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.andes.extensions.device.mgt.api + ${carbon.devicemgt.plugins.version} + commons-lang commons-lang @@ -1067,6 +1077,11 @@ feign-slf4j ${io.github.openfeign.version} + + org.wso2.carbon.messaging + org.wso2.carbon.andes.mqtt.stub + ${carbon.andes.mqtt.version} + @@ -1103,6 +1118,7 @@ [1.6.1.wso2v11, 1.7.0) 1.6.1.wso2v11 + 1.1.0-wso2v10 1.3 @@ -1247,6 +1263,8 @@ 3.1.3 + 2.6.1.wso2v1 + 3.2.1-SNAPSHOT 9.3.1 From 9632095e1fc62cb24f9cb56848e261516cbaae3c Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 07:32:54 +0530 Subject: [PATCH 03/24] Adding mqtt andes extensions api --- .../pom.xml | 145 +++++++++++++ .../device/mgt/jaxrs/ApiOriginFilter.java | 44 ++++ .../device/mgt/jaxrs/beans/ErrorListItem.java | 77 +++++++ .../device/mgt/jaxrs/beans/ErrorResponse.java | 193 ++++++++++++++++++ .../device/mgt/jaxrs/beans/Scope.java | 71 +++++++ .../jaxrs/common/GsonMessageBodyHandler.java | 91 +++++++++ .../ConstraintViolationException.java | 55 +++++ .../device/mgt/jaxrs/exception/ErrorDTO.java | 86 ++++++++ .../jaxrs/exception/ForbiddenException.java | 51 +++++ .../exception/GlobalThrowableMapper.java | 113 ++++++++++ .../jaxrs/exception/NotFoundException.java | 47 +++++ .../UnexpectedServerErrorException.java | 49 +++++ .../exception/ValidationInterceptor.java | 122 +++++++++++ .../device/mgt/jaxrs/util/Constants.java | 42 ++++ .../webapp/META-INF/webapp-classloading.xml | 35 ++++ .../src/main/webapp/WEB-INF/cxf-servlet.xml | 68 ++++++ .../src/main/webapp/WEB-INF/web.xml | 119 +++++++++++ 17 files changed, 1408 insertions(+) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml new file mode 100644 index 000000000..d4f9ebb73 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -0,0 +1,145 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + mb-extensions + 3.0.22-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization + bundle + WSO2 Carbon - Component - MQTT - Authorization Manager + MQTT authorization manager based on Carbon device manager + http://wso2.org + + + + org.wso2.carbon + org.wso2.carbon.utils + + + org.wso2.carbon + org.wso2.carbon.core + + + org.wso2.andes.wso2 + andes + + + org.wso2.carbon + org.wso2.carbon.user.api + + + org.wso2.carbon + org.wso2.carbon.user.core + + + commons-lang + commons-lang + + + io.github.openfeign + feign-core + + + io.github.openfeign + feign-jaxrs + + + io.github.openfeign + feign-gson + + + javax.ws.rs + jsr311-api + + + org.wso2.carbon + javax.cache.wso2 + + + io.github.openfeign + feign-slf4j + + + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.artifactId} + ${project.artifactId} + + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal + + + !org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal, + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.* + + + org.apache.log4j, + org.dna.mqtt.moquette.server, + org.wso2.andes.configuration.enums, + org.wso2.andes.mqtt, + org.wso2.carbon.context, + org.jaxen, + org.apache.axiom.*, + org.wso2.securevault, + org.apache.commons.*, + org.osgi.service.component, + org.wso2.carbon.user.core.service, + org.wso2.carbon.user.core.tenant, + org.wso2.carbon.user.api, + feign, + feign.auth, + feign.codec, + feign.gson, + javax.cache, + javax.xml.namespace, + javax.xml.stream, + org.wso2.carbon.base, + org.wso2.carbon.utils, + javax.net.ssl, + feign.slf4j + + + jsr311-api, + feign-jaxrs + + + + + + + + + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java new file mode 100644 index 000000000..d5f093ef9 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java @@ -0,0 +1,44 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiOriginFilter implements Filter { + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() { + //do nothing + } + + public void init(FilterConfig filterConfig) throws ServletException { + //do nothing + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java new file mode 100644 index 000000000..ebd09a021 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java @@ -0,0 +1,77 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +@ApiModel(description = "") +public class ErrorListItem { + + @NotNull + private String code = null; + @NotNull + private String message = null; + + @ApiModelProperty(required = true, value = "") + @JsonProperty("code") + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + + public ErrorListItem() {} + + public ErrorListItem(String code, String msg) { + this.code = code; + this.message = msg; + } + + + /** + * Description about individual errors occurred + **/ + @ApiModelProperty(required = true, value = "Description about individual errors occurred") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("errorItem {\n"); + + sb.append(" code: ").append(code).append("\n"); + sb.append(" message: ").append(message).append("\n"); + sb.append("}\n"); + return sb.toString(); + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java new file mode 100644 index 000000000..b8e090d38 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java @@ -0,0 +1,193 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; + +@ApiModel(description = "") +public class ErrorResponse { + + private Long code = null; + private String message = null; + private String description = null; + private String moreInfo = null; + private List errorItems = new ArrayList<>(); + + public ErrorResponse() { + } + + @JsonProperty(value = "code") + @ApiModelProperty(required = true, value = "") + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + @JsonProperty(value = "message") + @ApiModelProperty(required = true, value = "ErrorResponse message.") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @JsonProperty(value = "description") + @ApiModelProperty(value = "A detail description about the error message.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty(value = "moreInfo") + @ApiModelProperty(value = "Preferably an url with more details about the error.") + public String getMoreInfo() { + return moreInfo; + } + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public void addErrorListItem(ErrorListItem item) { + this.errorItems.add(item); + } + + /** + * If there are more than one error list them out. \nFor example, list out validation errors by each field. + */ + @JsonProperty(value = "errorItems") + @ApiModelProperty(value = "If there are more than one error list them out. \n" + + "For example, list out validation errors by each field.") + public List getErrorItems() { + return errorItems; + } + + public void setErrorItems(List error) { + this.errorItems = error; + } + + @Override + public String toString() { +// StringBuilder sb = new StringBuilder(); +// sb.append("{"); +// boolean cont = false; +// if (code != null) { +// cont = true; +// sb.append(" \"code\": ").append(code); +// } +// if (message != null) { +// if (cont) { +// sb.append(","); +// } +// cont = true; +// sb.append(" \"message\": \"").append(message).append("\""); +// } +// if (description != null) { +// if (cont) { +// sb.append(","); +// } +// cont = true; +// sb.append(" \"description\": ").append(description).append("\""); +// } +// if (moreInfo != null) { +// if (cont) { +// sb.append(","); +// } +// cont = true; +// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\""); +// } +// if (error != null && error.size() > 0) { +// if (cont) { +// sb.append(","); +// } +// sb.append(" \"errorItems\": ").append(error); +// } +// sb.append("}"); +// return sb.toString(); + return null; + } + + public static class ErrorResponseBuilder { + + private Long code = null; + private String message = null; + private String description = null; + private String moreInfo = null; + private List error; + + + public ErrorResponseBuilder() { + this.error = new ArrayList<>(); + } + + public ErrorResponseBuilder setCode(long code) { + this.code = code; + return this; + } + + public ErrorResponseBuilder setMessage(String message) { + this.message = message; + return this; + } + + public ErrorResponseBuilder setDescription(String description) { + this.description = description; + return this; + } + + public ErrorResponseBuilder setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + return this; + } + + public ErrorResponseBuilder addErrorItem(String code, String msg) { + ErrorListItem item = new ErrorListItem(); + item.setCode(code); + item.setMessage(msg); + this.error.add(item); + return this; + } + + public ErrorResponse build() { + ErrorResponse errorResponse = new ErrorResponse(); + errorResponse.setCode(code); + errorResponse.setMessage(message); + errorResponse.setErrorItems(error); + errorResponse.setDescription(description); + errorResponse.setMoreInfo(moreInfo); + return errorResponse; + } + } + +} + + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java new file mode 100644 index 000000000..171fe7726 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java @@ -0,0 +1,71 @@ +/* +* 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.andes.extensions.device.mgt.jaxrs.beans; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(value = "Scope", description = "Template of the authorization scope") +public class Scope { + + @ApiModelProperty(name = "scope key", value = "An unique string as a key.", required = true) + private String key; + + @ApiModelProperty(name = "scope name", value = "Scope name.", required = true) + private String name; + + @ApiModelProperty(name = "roles", value = "List of roles to be associated with the scope", required = true) + private String roles; + + @ApiModelProperty(name = "scope description", value = "A description of the scope", required = true) + private String description; + + public Scope() { + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRoles() { + return this.roles; + } + + public void setRoles(String roles) { + this.roles = roles; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java new file mode 100644 index 000000000..804244945 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java @@ -0,0 +1,91 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.common; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; +import java.io.*; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; + +@Provider +@Produces(APPLICATION_JSON) +@Consumes(APPLICATION_JSON) +public class GsonMessageBodyHandler implements MessageBodyWriter, MessageBodyReader { + + public static final String DATE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; + private Gson gson; + private static final String UTF_8 = "UTF-8"; + + public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { + return true; + } + + private Gson getGson() { + if (gson == null) { + final GsonBuilder gsonBuilder = new GsonBuilder(); + gson = gsonBuilder.setDateFormat(DATE_FORMAT).create(); + } + return gson; + } + + public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, + MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) + throws IOException, WebApplicationException { + + InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8"); + + try { + return getGson().fromJson(reader, type); + } finally { + reader.close(); + } + } + + public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { + return true; + } + + public long getSize(Object o, Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { + return -1; + } + + public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, + MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) + throws IOException, WebApplicationException { + + OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); + try { + getGson().toJson(object, type, writer); + } finally { + writer.close(); + } + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java new file mode 100644 index 000000000..df8680851 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java @@ -0,0 +1,55 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; +//import org.wso2.carbon.andes.extensionstensions.device.mgt.jaxrs.util.DeviceMgtUtil; + +import javax.validation.ConstraintViolation; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import java.util.Set; + +public class ConstraintViolationException extends WebApplicationException { + private String message; + + public ConstraintViolationException(Set> violations) { +// super(Response.status(Response.Status.BAD_REQUEST) +// .entity(DeviceMgtUtil.getConstraintViolationErrorDTO(violations)) +// .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) +// .build()); +// +// //Set the error message +// StringBuilder stringBuilder = new StringBuilder(); +// for (ConstraintViolation violation : violations) { +// stringBuilder.append(violation.getRootBeanClass().getSimpleName()); +// stringBuilder.append("."); +// stringBuilder.append(violation.getPropertyPath()); +// stringBuilder.append(": "); +// stringBuilder.append(violation.getMessage()); +// stringBuilder.append(", "); +// } + //message = stringBuilder.toString(); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java new file mode 100644 index 000000000..4576fa507 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java @@ -0,0 +1,86 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import java.util.ArrayList; +import java.util.List; + +public class ErrorDTO { + + private Long code = null; + private String message = null; + private String description = null; + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public void setCode(Long code) { + this.code = code; + } + + public void setMessage(String message) { + this.message = message; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setError(List error) { + this.error = error; + } + + private String moreInfo = null; + + public String getMessage() { + return message; + } + + public Long getCode() { + return code; + } + + public String getDescription() { + return description; + } + + public String getMoreInfo() { + return moreInfo; + } + + public List getError() { + return error; + } + + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("class ErrorDTO {\n"); + stringBuilder.append(" code: ").append(code).append("\n"); + stringBuilder.append(" message: ").append(message).append("\n"); + stringBuilder.append(" description: ").append(description).append("\n"); + stringBuilder.append(" moreInfo: ").append(moreInfo).append("\n"); + stringBuilder.append(" error: ").append(error).append("\n"); + stringBuilder.append("}\n"); + return stringBuilder.toString(); + } + + private List error = new ArrayList<>(); + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java new file mode 100644 index 000000000..f6261162a --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java @@ -0,0 +1,51 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +/** + * Exception class that is corresponding to 401 Forbidden response + */ + +public class ForbiddenException extends WebApplicationException { + + private String message; + + public ForbiddenException() { + super(Response.status(Response.Status.FORBIDDEN) + .build()); + } + + public ForbiddenException(ErrorDTO errorDTO) { + super(Response.status(Response.Status.FORBIDDEN) + .entity(errorDTO) + .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) + .build()); + message = errorDTO.getDescription(); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java new file mode 100644 index 000000000..357fe68af --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java @@ -0,0 +1,113 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import com.google.gson.JsonParseException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +//import org.wso2.carbon.andes.extensionsnsions.device.mgt.jaxrs.util.DeviceMgtUtil; + +import javax.naming.AuthenticationException; +import javax.ws.rs.ClientErrorException; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; + +/** + * Handle the cxf level exceptions. + */ +public class GlobalThrowableMapper implements ExceptionMapper { + private static final Log log = LogFactory.getLog(GlobalThrowableMapper.class); + + private ErrorDTO e500 = new ErrorDTO(); + + GlobalThrowableMapper() { + e500.setCode((long) 500); + e500.setMessage("Internal server error."); + e500.setMoreInfo(""); + e500.setDescription("The server encountered an internal error. Please contact administrator."); + + } + + @Override + public Response toResponse(Throwable e) { + +// if (e instanceof JsonParseException) { +// String errorMessage = "Malformed request body."; +// if (log.isDebugEnabled()) { +// log.error(errorMessage, e); +// } +// return DeviceMgtUtil.buildBadRequestException(errorMessage).getResponse(); +// } + if (e instanceof NotFoundException) { + return ((NotFoundException) e).getResponse(); + } + if (e instanceof UnexpectedServerErrorException) { + if (log.isDebugEnabled()) { + log.error("Unexpected server error.", e); + } + return ((UnexpectedServerErrorException) e).getResponse(); + } + if (e instanceof ConstraintViolationException) { + if (log.isDebugEnabled()) { + log.error("Constraint violation.", e); + } + return ((ConstraintViolationException) e).getResponse(); + } + if (e instanceof IllegalArgumentException) { + ErrorDTO errorDetail = new ErrorDTO(); + errorDetail.setCode((long) 400); + errorDetail.setMoreInfo(""); + errorDetail.setMessage(""); + errorDetail.setDescription(e.getMessage()); + return Response + .status(Response.Status.BAD_REQUEST) + .entity(errorDetail) + .build(); + } + if (e instanceof ClientErrorException) { + if (log.isDebugEnabled()) { + log.error("Client error.", e); + } + return ((ClientErrorException) e).getResponse(); + } + if (e instanceof AuthenticationException) { + ErrorDTO errorDetail = new ErrorDTO(); + errorDetail.setCode((long) 401); + errorDetail.setMoreInfo(""); + errorDetail.setMessage(""); + errorDetail.setDescription(e.getMessage()); + return Response + .status(Response.Status.UNAUTHORIZED) + .entity(errorDetail) + .build(); + } + if (e instanceof ForbiddenException) { + if (log.isDebugEnabled()) { + log.error("Resource forbidden.", e); + } + return ((ForbiddenException) e).getResponse(); + } + //unknown exception log and return + if (log.isDebugEnabled()) { + log.error("An Unknown exception has been captured by global exception mapper.", e); + } + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).header("Content-Type", "application/json") + .entity(e500).build(); + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java new file mode 100644 index 000000000..9db522236 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java @@ -0,0 +1,47 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class NotFoundException extends WebApplicationException { + private String message; + private static final long serialVersionUID = 147943572342342340L; + + public NotFoundException(ErrorResponse error) { + super(Response.status(Response.Status.NOT_FOUND).entity(error).build()); + } + public NotFoundException(ErrorDTO errorDTO) { + super(Response.status(Response.Status.NOT_FOUND) + .entity(errorDTO) + .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) + .build()); + message = errorDTO.getDescription(); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java new file mode 100644 index 000000000..cf0ec561b --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java @@ -0,0 +1,49 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class UnexpectedServerErrorException extends WebApplicationException { + private String message; + private static final long serialVersionUID = 147943579458906890L; + + public UnexpectedServerErrorException(ErrorResponse error) { + super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); + } + public UnexpectedServerErrorException(ErrorDTO errorDTO) { + super(Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(errorDTO) + .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) + .build()); + message = errorDTO.getDescription(); + } + + @Override + public String getMessage() { + return message; + } + + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java new file mode 100644 index 000000000..0261945a4 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java @@ -0,0 +1,122 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.jaxrs.lifecycle.ResourceProvider; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageContentsList; +import org.apache.cxf.phase.AbstractPhaseInterceptor; +import org.apache.cxf.phase.Phase; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import javax.validation.ValidatorFactory; +import javax.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Set; + +public class ValidationInterceptor extends AbstractPhaseInterceptor { + private Log log = LogFactory.getLog(getClass()); + private Validator validator = null; //validator interface is thread-safe + + public ValidationInterceptor() { + super(Phase.PRE_INVOKE); + ValidatorFactory defaultFactory = Validation.buildDefaultValidatorFactory(); + validator = defaultFactory.getValidator(); + if (validator == null) { + log.warn("Bean Validation provider could not be found, no validation will be performed"); + } else { + log.debug("Validation In-Interceptor initialized successfully"); + } + } + + @Override + public void handleMessage(Message message) throws Fault { + final OperationResourceInfo operationResource = message.getExchange().get(OperationResourceInfo.class); + if (operationResource == null) { + log.info("OperationResourceInfo is not available, skipping validation"); + return; + } + + final ClassResourceInfo classResource = operationResource.getClassResourceInfo(); + if (classResource == null) { + log.info("ClassResourceInfo is not available, skipping validation"); + return; + } + + final ResourceProvider resourceProvider = classResource.getResourceProvider(); + if (resourceProvider == null) { + log.info("ResourceProvider is not available, skipping validation"); + return; + } + + final List arguments = MessageContentsList.getContentsList(message); + final Method method = operationResource.getAnnotatedMethod(); + final Object instance = resourceProvider.getInstance(message); + if (method != null && arguments != null) { + //validate the parameters(arguments) over the invoked method + validate(method, arguments.toArray(), instance); + + //validate the fields of each argument + for (Object arg : arguments) { + if (arg != null) + validate(arg); + } + } + + } + + public void validate(final Method method, final Object[] arguments, final T instance) { + if (validator == null) { + log.warn("Bean Validation provider could not be found, no validation will be performed"); + return; + } + + ExecutableValidator methodValidator = validator.forExecutables(); + Set> violations = methodValidator.validateParameters(instance, + method, arguments); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } + + public void validate(final T object) { + if (validator == null) { + log.warn("Bean Validation provider could be found, no validation will be performed"); + return; + } + + Set> violations = validator.validate(object); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } + + public void handleFault(org.apache.cxf.message.Message messageParam) { + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java new file mode 100644 index 000000000..be969bb61 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java @@ -0,0 +1,42 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.util; + +/** + * Holds the constants used by DeviceImpl Management Admin web application. + */ +public class Constants { + + public static final String SCOPE = "scope"; + + public final class ErrorMessages { + private ErrorMessages () { throw new AssertionError(); } + + public static final String STATUS_BAD_REQUEST_MESSAGE_DEFAULT = "Bad Request"; + + } + + public final class DeviceConstants { + private DeviceConstants () { throw new AssertionError(); } + + public static final String APPLICATION_JSON = "application/json"; + public static final String HEADER_CONTENT_TYPE = "Content-Type"; + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml new file mode 100644 index 000000000..ed2ed2162 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -0,0 +1,35 @@ + + + + + + + + + false + + + CXF,Carbon + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml new file mode 100644 index 000000000..7ce4b1256 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..ec7a36b5f --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,119 @@ + + + + Admin-Webapp + + JAX-WS/JAX-RS Device Management Endpoint + JAX-WS/JAX-RS Servlet + CXFServlet + + org.apache.cxf.transport.servlet.CXFServlet + + + + swagger.security.filter + ApiAuthorizationFilterImpl + + 1 + + + CXFServlet + /* + + + 60 + + + + doAuthentication + false + + + + + managed-api-enabled + true + + + managed-api-owner + admin + + + isSharedWithAllTenants + true + + + + + + DeviceMgt-Admin + /* + + + CONFIDENTIAL + + + + + ApiOriginFilter + org.wso2.carbon.andes.extensions.device.mgt.jaxrs.ApiOriginFilter + + + + HttpHeaderSecurityFilter + org.apache.catalina.filters.HttpHeaderSecurityFilter + + hstsEnabled + false + + + + + ContentTypeBasedCachePreventionFilter + org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter + + patterns + text/html" ,application/json" ,text/plain + + + filterAction + enforce + + + httpHeaders + Cache-Control: no-store, no-cache, must-revalidate, private + + + + + HttpHeaderSecurityFilter + /* + + + + ContentTypeBasedCachePreventionFilter + /* + + + + ApiOriginFilter + /* + + + From 068ef92a25a692a24afeddca6abbab63132b1322 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 07:35:56 +0530 Subject: [PATCH 04/24] Changing mqtt api utils --- .../mgt/jaxrs/util/MQTTMgtAPIUtils.java | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java new file mode 100644 index 000000000..08951f00f --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java @@ -0,0 +1,136 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +//import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; +import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; +import org.wso2.carbon.device.mgt.common.scope.mgt.ScopeManagementService; +import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; +import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; +import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.InputValidationException; +import org.wso2.carbon.policy.mgt.core.PolicyManagerService; +import org.wso2.carbon.user.api.AuthorizationManager; +import org.wso2.carbon.user.api.UserRealm; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.user.core.service.RealmService; + +import javax.ws.rs.core.MediaType; +import java.util.List; + +/** + * MDMAPIUtils class provides utility function used by CDM REST-API classes. + */ +public class MQTTMgtAPIUtils { + + public static final MediaType DEFAULT_CONTENT_TYPE = MediaType.APPLICATION_JSON_TYPE; + private static final String NOTIFIER_FREQUENCY = "notifierFrequency"; + private static Log log = LogFactory.getLog(MQTTMgtAPIUtils.class); + + public static RealmService getRealmService() throws UserStoreException { + RealmService realmService; + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + if (realmService == null) { + String msg = "Realm service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return realmService; + } + + /** + * Getting the current tenant's user realm + */ + public static UserRealm getUserRealm() throws UserStoreException { + RealmService realmService; + UserRealm realm; + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + + if (realmService == null) { + throw new IllegalStateException("Realm service not initialized"); + } + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + realm = realmService.getTenantUserRealm(tenantId); + return realm; + } + + public static AuthorizationManager getAuthorizationManager() throws UserStoreException { + RealmService realmService; + AuthorizationManager authorizationManager; + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + if (realmService == null) { + throw new IllegalStateException("Realm service is not initialized."); + } + int tenantId = ctx.getTenantId(); + authorizationManager = realmService.getTenantUserRealm(tenantId).getAuthorizationManager(); + + return authorizationManager; + } + + public static ScopeManagementService getScopeManagementService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + ScopeManagementService scopeManagementService = + (ScopeManagementService) ctx.getOSGiService(ScopeManagementService.class, null); + if (scopeManagementService == null) { + throw new IllegalStateException("Scope Management Service has not been initialized."); + } + return scopeManagementService; + } + + public static int getTenantId(String tenantDomain) throws DeviceManagementException { + RealmService realmService = + (RealmService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(RealmService.class, null); + if (realmService == null) { + throw new IllegalStateException("Realm service has not been initialized."); + } + try { + return realmService.getTenantManager().getTenantId(tenantDomain); + } catch (UserStoreException e) { + throw new DeviceManagementException("Error occured while trying to " + + "obtain tenant id of currently logged in user"); + } + } + + public static String getAuthenticatedUser() { + PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + String username = threadLocalCarbonContext.getUsername(); + String tenantDomain = threadLocalCarbonContext.getTenantDomain(); + if (username != null && username.endsWith(tenantDomain)) { + return username.substring(0, username.lastIndexOf("@")); + } + return username; + } + +} From 013a0c8aa2fc3e430de4a6f2e6863b213afeffc7 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:06:02 +0530 Subject: [PATCH 05/24] Adding mqtt admin service --- .../api/admin/MQTTManagementAdminService.java | 154 ++++++++++++++++++ .../admin/MQTTManagementAdminServiceImpl.java | 86 ++++++++++ .../impl/util/InputValidationException.java | 35 ++++ .../impl/util/RequestValidationUtil.java | 43 +++++ 4 files changed, 318 insertions(+) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java new file mode 100644 index 000000000..707e1d757 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java @@ -0,0 +1,154 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.api.admin; + +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "MQTTManagementAdmin"), + @ExtensionProperty(name = "context", value = "/api/mqtt-topics/v1.0/admin/topics"), + }) + } + ), + tags = { + @Tag(name = "device_management", description = "") + } +) +@Path("/admin/topics") +@Api(value = "MQTT Management Administrative Service", description = "This an API intended to be used by " + + "'internal' components to log in as an admin user and view MQTT topics dashboard. " + + "Further, this is strictly restricted to admin users only ") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Getting Details of Topics", + description = "Getting Details of Topics", + key = "perm:admin:topics:view", + permissions = {"/device-mgt/topics/view"} + ) + } +) +public interface MQTTManagementAdminService { + + @GET + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting Details of Topics", + notes = "Get the details of a topic by searching via the topic name, and details.", + response = Device.class, + responseContainer = "List", + tags = "MQTT Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:topics:view") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of topics.", + response = Device.class, + responseContainer = "List", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. Empty body because the client already has the latest version of the " + + "requested resource.\n"), + @ApiResponse( + code = 401, + message = "Unauthorized.\n The unauthorized access to the requested resource.", + response = ErrorResponse.class), + @ApiResponse( + code = 404, + message = "Not Found.\n The specified device does not exist", + response = ErrorResponse.class), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the device list.", + response = ErrorResponse.class) + }) + Response getFilteredSubscriptions( + + @ApiParam( + name = "tenant-domain", + value = "The name of the tenant.\n" + + "The default tenant domain of WSO2 EMM is carbon.super", + required = true, + defaultValue = "carbon.super") + @QueryParam("tenant-domain") String tenantDomain, + @ApiParam( + name = "If-Modified-Since", + value = "Checks if the requested variant was modified, since the specified date-time. \n" + + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z. \n" + + "Example: Mon, 05 Jan 2014 15:10:00 +0200", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @ApiParam( + name = "offset", + value = "The starting pagination index for the complete list of qualified items.", + required = false, + defaultValue = "0") + @QueryParam("offset") int offset, + @ApiParam( + name = "limit", + value = "Provide how many activity details you require from the starting pagination index/offset.", + required = false, + defaultValue = "5") + @QueryParam("limit") int limit); +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java new file mode 100644 index 000000000..e37d158dd --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -0,0 +1,86 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.impl.admin; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.axis2.transport.http.HttpTransportProperties; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.andes.admin.mqtt.internal.xsd.Subscription; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.api.admin.MQTTManagementAdminService; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.MQTTMgtAPIUtils; +import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceBrokerManagerAdminException; +import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceStub; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.servlet.ServletConfig; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.rmi.RemoteException; +import java.util.HashMap; +import java.util.Map; + +@Path("/admin/topics") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminService { + + private static final Log log = LogFactory.getLog(MQTTManagementAdminServiceImpl.class); + private + @Context + ServletConfig config; + private + @Context + HttpServletRequest request; + + @Override + @GET + public Response getFilteredSubscriptions( + @QueryParam("tenant-domain") String tenantDomain, + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @QueryParam("offset") int offset, + @QueryParam("limit") int limit) { + RequestValidationUtil.validatePaginationParameters(offset, limit); + try { + int currentTenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + if (MultitenantConstants.SUPER_TENANT_ID != currentTenantId) { + return Response.status(Response.Status.UNAUTHORIZED).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage( + "Current logged in user is not authorized to perform this operation").build()).build(); + } + return null; + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java new file mode 100644 index 000000000..812c30ee6 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java @@ -0,0 +1,35 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.impl.util; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; + +import javax.ws.rs.BadRequestException; +import javax.ws.rs.core.Response; +import java.io.Serializable; + +public class InputValidationException extends BadRequestException implements Serializable { + + private static final long serialVersionUID = 147843579458906890L; + + public InputValidationException(ErrorResponse error) { + super(Response.status(Response.Status.BAD_REQUEST).entity(error).build()); + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java new file mode 100644 index 000000000..0f479d984 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java @@ -0,0 +1,43 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.impl.util; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.*; + +public class RequestValidationUtil { + public static void validatePaginationParameters(int offset, int limit) { + if (offset < 0) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter offset is s " + + "negative value.").build()); + } + if (limit < 0) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter limit is a " + + "negative value.").build()); + } + if (limit > 100) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter limit should" + + " be less than or equal to 100.").build()); + } + + } + +} From cfa0e4a7cf82733d2ff0268433115aa0fa60b56e Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:09:16 +0530 Subject: [PATCH 06/24] Created mqtt admin service stub --- .../admin/MQTTManagementAdminServiceImpl.java | 69 ++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java index e37d158dd..052322616 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -77,10 +77,77 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic new ErrorResponse.ErrorResponseBuilder().setMessage( "Current logged in user is not authorized to perform this operation").build()).build(); } - return null; + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MQTTMgtAPIUtils.getTenantId(tenantDomain)); + + HttpSession session = request.getSession(); + + AndesMQTTAdminServiceStub andesAdminStub = getAndesMQTTAdminServiceStub(config, session, request); + + Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, + "MQTT", "TOPIC", "", false, + "", false, "All", offset, + 10); + Map subscriptions = new HashMap<>(); + subscriptions.put("subscriptions", filteredNormalTopicSubscriptionList); + return Response.ok().entity(subscriptions).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred at server side while fetching device list."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (AxisFault e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (RemoteException e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (AndesMQTTAdminServiceBrokerManagerAdminException e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } finally { PrivilegedCarbonContext.endTenantFlow(); } } + /** + * Gets the AndesAdminServices stub. + * + * @param config the servlet configuration + * @param session the http session + * @param request the http servlet request + * @return an AndesAdminServiceStub + * @throws AxisFault + */ + private static AndesMQTTAdminServiceStub getAndesMQTTAdminServiceStub(ServletConfig config, + HttpSession session, + HttpServletRequest request) + throws AxisFault { + + String hostName = CarbonUtils.getServerConfiguration().getFirstProperty("HostName"); + final String MQTT_ENDPOINT = "9446"; + + if (hostName == null) { + hostName = System.getProperty("carbon.local.ip"); + } + + String backendServerURL = "https://" + hostName + ":" + MQTT_ENDPOINT + "/services/AndesMQTTAdminService.AndesMQTTAdminServiceHttpsSoap11Endpoint/"; + ConfigurationContext configContext = + (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); + AndesMQTTAdminServiceStub stub = new AndesMQTTAdminServiceStub(configContext, backendServerURL); + HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator(); + basicAuthentication.setUsername("admin"); + basicAuthentication.setPassword("admin"); + stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication); + + return stub; + } + } From eda67e58592dca39c5331483194bc5c3c10ce783 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:28:05 +0530 Subject: [PATCH 07/24] Adding mqtt andes extensions api feature module --- features/extensions-feature/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index bb648ca0c..5c9df383f 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -38,6 +38,7 @@ org.wso2.carbon.appmgt.mdm.restconnector.feature org.wso2.carbon.device.mgt.adapter.feature org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature + org.wso2.carbon.andes.extensions.device.mgt.api.feature org.wso2.extension.siddhi.execution.json.feature From e11f05fc6401eedb35f8ac381fb3506cd2857cfd Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:29:15 +0530 Subject: [PATCH 08/24] MQTT andes extensions api feature added --- .../pom.xml | 126 ++++++++++++++++++ .../src/main/resources/build.properties | 19 +++ .../src/main/resources/p2.inf | 3 + 3 files changed, 148 insertions(+) create mode 100644 features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml create mode 100644 features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties create mode 100644 features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml new file mode 100644 index 000000000..882eab269 --- /dev/null +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -0,0 +1,126 @@ + + + + + + + + org.wso2.carbon.devicemgt-plugins + extensions-feature + 3.0.12-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.andes.extensions.device.mgt.api.feature + pom + WSO2 Carbon - MQTT Topics Management API Feature + http://wso2.org + This feature contains the API feature for the MQTT dashboard + + + + + maven-resources-plugin + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-jaxrs-war + package + + copy + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.andes.extensions.device.mgt.api + war + true + + ${project.build.directory}/maven-shared-archive-resources/webapps/ + + api#mqtt-topics#v1.0.war + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.andes.extensions.device.mgt.api + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:true + + + + + + + + + + + + + + + + + diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties new file mode 100644 index 000000000..ddedd58dc --- /dev/null +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties @@ -0,0 +1,19 @@ +# +# Copyright (c) 2005-2014, 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. +# + +custom = true diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf new file mode 100644 index 000000000..b1f1b35b3 --- /dev/null +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf @@ -0,0 +1,3 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.andes.extensions.device.mgt.api_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ \ No newline at end of file From b3996560bcbb449562df4597bd2d14fd2b4b893c Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 18:17:58 +0530 Subject: [PATCH 09/24] Removed Scope Management Service --- .../pom.xml | 332 +++++++++++++----- .../mgt/jaxrs/util/MQTTMgtAPIUtils.java | 11 - .../pom.xml | 2 +- 3 files changed, 248 insertions(+), 97 deletions(-) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index d4f9ebb73..437163640 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,124 +22,286 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 3.0.22-SNAPSHOT + 3.0.25-SNAPSHOT ../pom.xml 4.0.0 - org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization - bundle - WSO2 Carbon - Component - MQTT - Authorization Manager - MQTT authorization manager based on Carbon device manager + org.wso2.carbon.andes.extensions.device.mgt.api + war + WSO2 Carbon - MQTT Topics Management API + WSO2 Carbon - MQTT Topics Management API http://wso2.org + + + + maven-compiler-plugin + + 1.7 + 1.7 + + + + maven-war-plugin + + WEB-INF/lib/*cxf*.jar + api#mqtt-topics#v1.0 + + + + + + + + deploy + + compile + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + compile + + run + + + + + + + + + + + + + + + + + + client + + test + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + test + + java + + + + + + + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + provided + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + org.apache.cxf + cxf-rt-transports-http + provided + + + junit + junit + test + + + commons-httpclient.wso2 + commons-httpclient + provided + + + javax.ws.rs + jsr311-api + + org.wso2.carbon org.wso2.carbon.utils + provided org.wso2.carbon - org.wso2.carbon.core + org.wso2.carbon.logging + provided - org.wso2.andes.wso2 - andes + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common + provided - org.wso2.carbon - org.wso2.carbon.user.api + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + provided + + + org.apache.axis2.wso2 + axis2 + + + org.apache.axis2.transport + axis2-transport-mail + + + org.apache.ws.commons.axiom.wso2 + axiom + + - org.wso2.carbon - org.wso2.carbon.user.core + org.wso2.carbon.devicemgt + org.wso2.carbon.policy.mgt.core + provided + + + org.apache.axis2.wso2 + axis2-client + + + + + org.wso2.carbon.identity.inbound.auth.oauth2 + org.wso2.carbon.identity.oauth.stub + provided + + + org.apache.axis2.wso2 + axis2 + + + org.apache.axis2.wso2 + axis2-client + + + org.apache.axis2.transport + axis2-transport-mail + + + + + org.json.wso2 + json + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.certificate.mgt.core + provided + + + org.apache.axis2.wso2 + axis2 + + + + + io.swagger + swagger-annotations + + + io.swagger + swagger-core + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + org.slf4j + slf4j-api + + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-core + + + + + io.swagger + swagger-jaxrs + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + org.slf4j + slf4j-api + + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-core + + - commons-lang - commons-lang + javax.servlet + servlet-api + - io.github.openfeign - feign-core + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + provided - io.github.openfeign - feign-jaxrs + org.wso2.orbit.com.fasterxml.jackson.core + jackson-annotations - io.github.openfeign - feign-gson + org.hibernate + hibernate-validator javax.ws.rs - jsr311-api + javax.ws.rs-api - org.wso2.carbon - javax.cache.wso2 + org.wso2.carbon.messaging + org.wso2.carbon.andes.mqtt.stub + + + org.apache.axis2.wso2 + axis2 + + + org.apache.axis2.wso2 + axis2-client + + + org.apache.axis2.transport + axis2-transport-mail + + + org.apache.ws.commons.axiom.wso2 + axiom + + - - io.github.openfeign - feign-slf4j - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.artifactId} - ${project.artifactId} - - org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal - - - !org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal, - org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.* - - - org.apache.log4j, - org.dna.mqtt.moquette.server, - org.wso2.andes.configuration.enums, - org.wso2.andes.mqtt, - org.wso2.carbon.context, - org.jaxen, - org.apache.axiom.*, - org.wso2.securevault, - org.apache.commons.*, - org.osgi.service.component, - org.wso2.carbon.user.core.service, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.user.api, - feign, - feign.auth, - feign.codec, - feign.gson, - javax.cache, - javax.xml.namespace, - javax.xml.stream, - org.wso2.carbon.base, - org.wso2.carbon.utils, - javax.net.ssl, - feign.slf4j - - - jsr311-api, - feign-jaxrs - - - - - - - - diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java index 08951f00f..62043c497 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java @@ -30,7 +30,6 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; -import org.wso2.carbon.device.mgt.common.scope.mgt.ScopeManagementService; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; @@ -99,16 +98,6 @@ public class MQTTMgtAPIUtils { return authorizationManager; } - public static ScopeManagementService getScopeManagementService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ScopeManagementService scopeManagementService = - (ScopeManagementService) ctx.getOSGiService(ScopeManagementService.class, null); - if (scopeManagementService == null) { - throw new IllegalStateException("Scope Management Service has not been initialized."); - } - return scopeManagementService; - } - public static int getTenantId(String tenantDomain) throws DeviceManagementException { RealmService realmService = (RealmService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(RealmService.class, null); diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 882eab269..6e8041e61 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -24,7 +24,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.12-SNAPSHOT + 3.0.25-SNAPSHOT ../pom.xml From e1e483ad17a8ddffe3b2d07392ee827cd0ddce28 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 04:53:01 +0530 Subject: [PATCH 10/24] Adding new andes extensions api --- components/extensions/mb-extensions/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index e8136155e..aabcb9eb2 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -34,6 +34,7 @@ org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization + org.wso2.carbon.andes.extensions.device.mgt.api From be137535e92c22c3581174032f9fd61be52895ae Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 05:02:09 +0530 Subject: [PATCH 11/24] Adding new dependencies for andes extensions api --- pom.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pom.xml b/pom.xml index 186bc1e66..6ad69edb7 100644 --- a/pom.xml +++ b/pom.xml @@ -813,6 +813,11 @@ jackson-jaxrs ${jackson.version} + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations.version} + @@ -1042,6 +1047,11 @@ org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization ${carbon.devicemgt.plugins.version} + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.andes.extensions.device.mgt.api + ${carbon.devicemgt.plugins.version} + commons-lang commons-lang @@ -1067,6 +1077,11 @@ feign-slf4j ${io.github.openfeign.version} + + org.wso2.carbon.messaging + org.wso2.carbon.andes.mqtt.stub + ${carbon.andes.mqtt.version} + @@ -1103,6 +1118,7 @@ [1.6.1.wso2v11, 1.7.0) 1.6.1.wso2v11 + 1.1.0-wso2v10 1.3 @@ -1248,6 +1264,8 @@ 3.1.3 + 2.6.1.wso2v1 + 3.2.1-SNAPSHOT 9.3.1 From 5b94b97ff4197de55196a8f800caf87a2d1457b9 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 07:32:54 +0530 Subject: [PATCH 12/24] Adding mqtt andes extensions api --- .../pom.xml | 145 +++++++++++++ .../device/mgt/jaxrs/ApiOriginFilter.java | 44 ++++ .../device/mgt/jaxrs/beans/ErrorListItem.java | 77 +++++++ .../device/mgt/jaxrs/beans/ErrorResponse.java | 193 ++++++++++++++++++ .../device/mgt/jaxrs/beans/Scope.java | 71 +++++++ .../jaxrs/common/GsonMessageBodyHandler.java | 91 +++++++++ .../ConstraintViolationException.java | 55 +++++ .../device/mgt/jaxrs/exception/ErrorDTO.java | 86 ++++++++ .../jaxrs/exception/ForbiddenException.java | 51 +++++ .../exception/GlobalThrowableMapper.java | 113 ++++++++++ .../jaxrs/exception/NotFoundException.java | 47 +++++ .../UnexpectedServerErrorException.java | 49 +++++ .../exception/ValidationInterceptor.java | 122 +++++++++++ .../device/mgt/jaxrs/util/Constants.java | 42 ++++ .../webapp/META-INF/webapp-classloading.xml | 35 ++++ .../src/main/webapp/WEB-INF/cxf-servlet.xml | 68 ++++++ .../src/main/webapp/WEB-INF/web.xml | 119 +++++++++++ 17 files changed, 1408 insertions(+) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml new file mode 100644 index 000000000..d4f9ebb73 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -0,0 +1,145 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + mb-extensions + 3.0.22-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization + bundle + WSO2 Carbon - Component - MQTT - Authorization Manager + MQTT authorization manager based on Carbon device manager + http://wso2.org + + + + org.wso2.carbon + org.wso2.carbon.utils + + + org.wso2.carbon + org.wso2.carbon.core + + + org.wso2.andes.wso2 + andes + + + org.wso2.carbon + org.wso2.carbon.user.api + + + org.wso2.carbon + org.wso2.carbon.user.core + + + commons-lang + commons-lang + + + io.github.openfeign + feign-core + + + io.github.openfeign + feign-jaxrs + + + io.github.openfeign + feign-gson + + + javax.ws.rs + jsr311-api + + + org.wso2.carbon + javax.cache.wso2 + + + io.github.openfeign + feign-slf4j + + + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.artifactId} + ${project.artifactId} + + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal + + + !org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal, + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.* + + + org.apache.log4j, + org.dna.mqtt.moquette.server, + org.wso2.andes.configuration.enums, + org.wso2.andes.mqtt, + org.wso2.carbon.context, + org.jaxen, + org.apache.axiom.*, + org.wso2.securevault, + org.apache.commons.*, + org.osgi.service.component, + org.wso2.carbon.user.core.service, + org.wso2.carbon.user.core.tenant, + org.wso2.carbon.user.api, + feign, + feign.auth, + feign.codec, + feign.gson, + javax.cache, + javax.xml.namespace, + javax.xml.stream, + org.wso2.carbon.base, + org.wso2.carbon.utils, + javax.net.ssl, + feign.slf4j + + + jsr311-api, + feign-jaxrs + + + + + + + + + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java new file mode 100644 index 000000000..d5f093ef9 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/ApiOriginFilter.java @@ -0,0 +1,44 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiOriginFilter implements Filter { + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() { + //do nothing + } + + public void init(FilterConfig filterConfig) throws ServletException { + //do nothing + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java new file mode 100644 index 000000000..ebd09a021 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorListItem.java @@ -0,0 +1,77 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +@ApiModel(description = "") +public class ErrorListItem { + + @NotNull + private String code = null; + @NotNull + private String message = null; + + @ApiModelProperty(required = true, value = "") + @JsonProperty("code") + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + + public ErrorListItem() {} + + public ErrorListItem(String code, String msg) { + this.code = code; + this.message = msg; + } + + + /** + * Description about individual errors occurred + **/ + @ApiModelProperty(required = true, value = "Description about individual errors occurred") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("errorItem {\n"); + + sb.append(" code: ").append(code).append("\n"); + sb.append(" message: ").append(message).append("\n"); + sb.append("}\n"); + return sb.toString(); + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java new file mode 100644 index 000000000..b8e090d38 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/ErrorResponse.java @@ -0,0 +1,193 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; + +@ApiModel(description = "") +public class ErrorResponse { + + private Long code = null; + private String message = null; + private String description = null; + private String moreInfo = null; + private List errorItems = new ArrayList<>(); + + public ErrorResponse() { + } + + @JsonProperty(value = "code") + @ApiModelProperty(required = true, value = "") + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + @JsonProperty(value = "message") + @ApiModelProperty(required = true, value = "ErrorResponse message.") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @JsonProperty(value = "description") + @ApiModelProperty(value = "A detail description about the error message.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty(value = "moreInfo") + @ApiModelProperty(value = "Preferably an url with more details about the error.") + public String getMoreInfo() { + return moreInfo; + } + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public void addErrorListItem(ErrorListItem item) { + this.errorItems.add(item); + } + + /** + * If there are more than one error list them out. \nFor example, list out validation errors by each field. + */ + @JsonProperty(value = "errorItems") + @ApiModelProperty(value = "If there are more than one error list them out. \n" + + "For example, list out validation errors by each field.") + public List getErrorItems() { + return errorItems; + } + + public void setErrorItems(List error) { + this.errorItems = error; + } + + @Override + public String toString() { +// StringBuilder sb = new StringBuilder(); +// sb.append("{"); +// boolean cont = false; +// if (code != null) { +// cont = true; +// sb.append(" \"code\": ").append(code); +// } +// if (message != null) { +// if (cont) { +// sb.append(","); +// } +// cont = true; +// sb.append(" \"message\": \"").append(message).append("\""); +// } +// if (description != null) { +// if (cont) { +// sb.append(","); +// } +// cont = true; +// sb.append(" \"description\": ").append(description).append("\""); +// } +// if (moreInfo != null) { +// if (cont) { +// sb.append(","); +// } +// cont = true; +// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\""); +// } +// if (error != null && error.size() > 0) { +// if (cont) { +// sb.append(","); +// } +// sb.append(" \"errorItems\": ").append(error); +// } +// sb.append("}"); +// return sb.toString(); + return null; + } + + public static class ErrorResponseBuilder { + + private Long code = null; + private String message = null; + private String description = null; + private String moreInfo = null; + private List error; + + + public ErrorResponseBuilder() { + this.error = new ArrayList<>(); + } + + public ErrorResponseBuilder setCode(long code) { + this.code = code; + return this; + } + + public ErrorResponseBuilder setMessage(String message) { + this.message = message; + return this; + } + + public ErrorResponseBuilder setDescription(String description) { + this.description = description; + return this; + } + + public ErrorResponseBuilder setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + return this; + } + + public ErrorResponseBuilder addErrorItem(String code, String msg) { + ErrorListItem item = new ErrorListItem(); + item.setCode(code); + item.setMessage(msg); + this.error.add(item); + return this; + } + + public ErrorResponse build() { + ErrorResponse errorResponse = new ErrorResponse(); + errorResponse.setCode(code); + errorResponse.setMessage(message); + errorResponse.setErrorItems(error); + errorResponse.setDescription(description); + errorResponse.setMoreInfo(moreInfo); + return errorResponse; + } + } + +} + + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java new file mode 100644 index 000000000..171fe7726 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java @@ -0,0 +1,71 @@ +/* +* 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.andes.extensions.device.mgt.jaxrs.beans; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(value = "Scope", description = "Template of the authorization scope") +public class Scope { + + @ApiModelProperty(name = "scope key", value = "An unique string as a key.", required = true) + private String key; + + @ApiModelProperty(name = "scope name", value = "Scope name.", required = true) + private String name; + + @ApiModelProperty(name = "roles", value = "List of roles to be associated with the scope", required = true) + private String roles; + + @ApiModelProperty(name = "scope description", value = "A description of the scope", required = true) + private String description; + + public Scope() { + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRoles() { + return this.roles; + } + + public void setRoles(String roles) { + this.roles = roles; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java new file mode 100644 index 000000000..804244945 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/common/GsonMessageBodyHandler.java @@ -0,0 +1,91 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.common; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; +import java.io.*; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; + +@Provider +@Produces(APPLICATION_JSON) +@Consumes(APPLICATION_JSON) +public class GsonMessageBodyHandler implements MessageBodyWriter, MessageBodyReader { + + public static final String DATE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; + private Gson gson; + private static final String UTF_8 = "UTF-8"; + + public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { + return true; + } + + private Gson getGson() { + if (gson == null) { + final GsonBuilder gsonBuilder = new GsonBuilder(); + gson = gsonBuilder.setDateFormat(DATE_FORMAT).create(); + } + return gson; + } + + public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, + MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) + throws IOException, WebApplicationException { + + InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8"); + + try { + return getGson().fromJson(reader, type); + } finally { + reader.close(); + } + } + + public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { + return true; + } + + public long getSize(Object o, Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { + return -1; + } + + public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, + MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) + throws IOException, WebApplicationException { + + OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); + try { + getGson().toJson(object, type, writer); + } finally { + writer.close(); + } + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java new file mode 100644 index 000000000..df8680851 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java @@ -0,0 +1,55 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; +//import org.wso2.carbon.andes.extensionstensions.device.mgt.jaxrs.util.DeviceMgtUtil; + +import javax.validation.ConstraintViolation; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import java.util.Set; + +public class ConstraintViolationException extends WebApplicationException { + private String message; + + public ConstraintViolationException(Set> violations) { +// super(Response.status(Response.Status.BAD_REQUEST) +// .entity(DeviceMgtUtil.getConstraintViolationErrorDTO(violations)) +// .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) +// .build()); +// +// //Set the error message +// StringBuilder stringBuilder = new StringBuilder(); +// for (ConstraintViolation violation : violations) { +// stringBuilder.append(violation.getRootBeanClass().getSimpleName()); +// stringBuilder.append("."); +// stringBuilder.append(violation.getPropertyPath()); +// stringBuilder.append(": "); +// stringBuilder.append(violation.getMessage()); +// stringBuilder.append(", "); +// } + //message = stringBuilder.toString(); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java new file mode 100644 index 000000000..4576fa507 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java @@ -0,0 +1,86 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import java.util.ArrayList; +import java.util.List; + +public class ErrorDTO { + + private Long code = null; + private String message = null; + private String description = null; + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public void setCode(Long code) { + this.code = code; + } + + public void setMessage(String message) { + this.message = message; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setError(List error) { + this.error = error; + } + + private String moreInfo = null; + + public String getMessage() { + return message; + } + + public Long getCode() { + return code; + } + + public String getDescription() { + return description; + } + + public String getMoreInfo() { + return moreInfo; + } + + public List getError() { + return error; + } + + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("class ErrorDTO {\n"); + stringBuilder.append(" code: ").append(code).append("\n"); + stringBuilder.append(" message: ").append(message).append("\n"); + stringBuilder.append(" description: ").append(description).append("\n"); + stringBuilder.append(" moreInfo: ").append(moreInfo).append("\n"); + stringBuilder.append(" error: ").append(error).append("\n"); + stringBuilder.append("}\n"); + return stringBuilder.toString(); + } + + private List error = new ArrayList<>(); + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java new file mode 100644 index 000000000..f6261162a --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java @@ -0,0 +1,51 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +/** + * Exception class that is corresponding to 401 Forbidden response + */ + +public class ForbiddenException extends WebApplicationException { + + private String message; + + public ForbiddenException() { + super(Response.status(Response.Status.FORBIDDEN) + .build()); + } + + public ForbiddenException(ErrorDTO errorDTO) { + super(Response.status(Response.Status.FORBIDDEN) + .entity(errorDTO) + .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) + .build()); + message = errorDTO.getDescription(); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java new file mode 100644 index 000000000..357fe68af --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java @@ -0,0 +1,113 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import com.google.gson.JsonParseException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +//import org.wso2.carbon.andes.extensionsnsions.device.mgt.jaxrs.util.DeviceMgtUtil; + +import javax.naming.AuthenticationException; +import javax.ws.rs.ClientErrorException; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; + +/** + * Handle the cxf level exceptions. + */ +public class GlobalThrowableMapper implements ExceptionMapper { + private static final Log log = LogFactory.getLog(GlobalThrowableMapper.class); + + private ErrorDTO e500 = new ErrorDTO(); + + GlobalThrowableMapper() { + e500.setCode((long) 500); + e500.setMessage("Internal server error."); + e500.setMoreInfo(""); + e500.setDescription("The server encountered an internal error. Please contact administrator."); + + } + + @Override + public Response toResponse(Throwable e) { + +// if (e instanceof JsonParseException) { +// String errorMessage = "Malformed request body."; +// if (log.isDebugEnabled()) { +// log.error(errorMessage, e); +// } +// return DeviceMgtUtil.buildBadRequestException(errorMessage).getResponse(); +// } + if (e instanceof NotFoundException) { + return ((NotFoundException) e).getResponse(); + } + if (e instanceof UnexpectedServerErrorException) { + if (log.isDebugEnabled()) { + log.error("Unexpected server error.", e); + } + return ((UnexpectedServerErrorException) e).getResponse(); + } + if (e instanceof ConstraintViolationException) { + if (log.isDebugEnabled()) { + log.error("Constraint violation.", e); + } + return ((ConstraintViolationException) e).getResponse(); + } + if (e instanceof IllegalArgumentException) { + ErrorDTO errorDetail = new ErrorDTO(); + errorDetail.setCode((long) 400); + errorDetail.setMoreInfo(""); + errorDetail.setMessage(""); + errorDetail.setDescription(e.getMessage()); + return Response + .status(Response.Status.BAD_REQUEST) + .entity(errorDetail) + .build(); + } + if (e instanceof ClientErrorException) { + if (log.isDebugEnabled()) { + log.error("Client error.", e); + } + return ((ClientErrorException) e).getResponse(); + } + if (e instanceof AuthenticationException) { + ErrorDTO errorDetail = new ErrorDTO(); + errorDetail.setCode((long) 401); + errorDetail.setMoreInfo(""); + errorDetail.setMessage(""); + errorDetail.setDescription(e.getMessage()); + return Response + .status(Response.Status.UNAUTHORIZED) + .entity(errorDetail) + .build(); + } + if (e instanceof ForbiddenException) { + if (log.isDebugEnabled()) { + log.error("Resource forbidden.", e); + } + return ((ForbiddenException) e).getResponse(); + } + //unknown exception log and return + if (log.isDebugEnabled()) { + log.error("An Unknown exception has been captured by global exception mapper.", e); + } + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).header("Content-Type", "application/json") + .entity(e500).build(); + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java new file mode 100644 index 000000000..9db522236 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java @@ -0,0 +1,47 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class NotFoundException extends WebApplicationException { + private String message; + private static final long serialVersionUID = 147943572342342340L; + + public NotFoundException(ErrorResponse error) { + super(Response.status(Response.Status.NOT_FOUND).entity(error).build()); + } + public NotFoundException(ErrorDTO errorDTO) { + super(Response.status(Response.Status.NOT_FOUND) + .entity(errorDTO) + .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) + .build()); + message = errorDTO.getDescription(); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java new file mode 100644 index 000000000..cf0ec561b --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java @@ -0,0 +1,49 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class UnexpectedServerErrorException extends WebApplicationException { + private String message; + private static final long serialVersionUID = 147943579458906890L; + + public UnexpectedServerErrorException(ErrorResponse error) { + super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); + } + public UnexpectedServerErrorException(ErrorDTO errorDTO) { + super(Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(errorDTO) + .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) + .build()); + message = errorDTO.getDescription(); + } + + @Override + public String getMessage() { + return message; + } + + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java new file mode 100644 index 000000000..0261945a4 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java @@ -0,0 +1,122 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.jaxrs.lifecycle.ResourceProvider; +import org.apache.cxf.jaxrs.model.ClassResourceInfo; +import org.apache.cxf.jaxrs.model.OperationResourceInfo; +import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageContentsList; +import org.apache.cxf.phase.AbstractPhaseInterceptor; +import org.apache.cxf.phase.Phase; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import javax.validation.ValidatorFactory; +import javax.validation.executable.ExecutableValidator; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Set; + +public class ValidationInterceptor extends AbstractPhaseInterceptor { + private Log log = LogFactory.getLog(getClass()); + private Validator validator = null; //validator interface is thread-safe + + public ValidationInterceptor() { + super(Phase.PRE_INVOKE); + ValidatorFactory defaultFactory = Validation.buildDefaultValidatorFactory(); + validator = defaultFactory.getValidator(); + if (validator == null) { + log.warn("Bean Validation provider could not be found, no validation will be performed"); + } else { + log.debug("Validation In-Interceptor initialized successfully"); + } + } + + @Override + public void handleMessage(Message message) throws Fault { + final OperationResourceInfo operationResource = message.getExchange().get(OperationResourceInfo.class); + if (operationResource == null) { + log.info("OperationResourceInfo is not available, skipping validation"); + return; + } + + final ClassResourceInfo classResource = operationResource.getClassResourceInfo(); + if (classResource == null) { + log.info("ClassResourceInfo is not available, skipping validation"); + return; + } + + final ResourceProvider resourceProvider = classResource.getResourceProvider(); + if (resourceProvider == null) { + log.info("ResourceProvider is not available, skipping validation"); + return; + } + + final List arguments = MessageContentsList.getContentsList(message); + final Method method = operationResource.getAnnotatedMethod(); + final Object instance = resourceProvider.getInstance(message); + if (method != null && arguments != null) { + //validate the parameters(arguments) over the invoked method + validate(method, arguments.toArray(), instance); + + //validate the fields of each argument + for (Object arg : arguments) { + if (arg != null) + validate(arg); + } + } + + } + + public void validate(final Method method, final Object[] arguments, final T instance) { + if (validator == null) { + log.warn("Bean Validation provider could not be found, no validation will be performed"); + return; + } + + ExecutableValidator methodValidator = validator.forExecutables(); + Set> violations = methodValidator.validateParameters(instance, + method, arguments); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } + + public void validate(final T object) { + if (validator == null) { + log.warn("Bean Validation provider could be found, no validation will be performed"); + return; + } + + Set> violations = validator.validate(object); + + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } + + public void handleFault(org.apache.cxf.message.Message messageParam) { + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java new file mode 100644 index 000000000..be969bb61 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/Constants.java @@ -0,0 +1,42 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.util; + +/** + * Holds the constants used by DeviceImpl Management Admin web application. + */ +public class Constants { + + public static final String SCOPE = "scope"; + + public final class ErrorMessages { + private ErrorMessages () { throw new AssertionError(); } + + public static final String STATUS_BAD_REQUEST_MESSAGE_DEFAULT = "Bad Request"; + + } + + public final class DeviceConstants { + private DeviceConstants () { throw new AssertionError(); } + + public static final String APPLICATION_JSON = "application/json"; + public static final String HEADER_CONTENT_TYPE = "Content-Type"; + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml new file mode 100644 index 000000000..ed2ed2162 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -0,0 +1,35 @@ + + + + + + + + + false + + + CXF,Carbon + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml new file mode 100644 index 000000000..7ce4b1256 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..ec7a36b5f --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,119 @@ + + + + Admin-Webapp + + JAX-WS/JAX-RS Device Management Endpoint + JAX-WS/JAX-RS Servlet + CXFServlet + + org.apache.cxf.transport.servlet.CXFServlet + + + + swagger.security.filter + ApiAuthorizationFilterImpl + + 1 + + + CXFServlet + /* + + + 60 + + + + doAuthentication + false + + + + + managed-api-enabled + true + + + managed-api-owner + admin + + + isSharedWithAllTenants + true + + + + + + DeviceMgt-Admin + /* + + + CONFIDENTIAL + + + + + ApiOriginFilter + org.wso2.carbon.andes.extensions.device.mgt.jaxrs.ApiOriginFilter + + + + HttpHeaderSecurityFilter + org.apache.catalina.filters.HttpHeaderSecurityFilter + + hstsEnabled + false + + + + + ContentTypeBasedCachePreventionFilter + org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter + + patterns + text/html" ,application/json" ,text/plain + + + filterAction + enforce + + + httpHeaders + Cache-Control: no-store, no-cache, must-revalidate, private + + + + + HttpHeaderSecurityFilter + /* + + + + ContentTypeBasedCachePreventionFilter + /* + + + + ApiOriginFilter + /* + + + From 9ae95e38f984dacecbef5779240e43204587e03f Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 07:35:56 +0530 Subject: [PATCH 13/24] Changing mqtt api utils --- .../mgt/jaxrs/util/MQTTMgtAPIUtils.java | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java new file mode 100644 index 000000000..08951f00f --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java @@ -0,0 +1,136 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +//import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; +import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; +import org.wso2.carbon.device.mgt.common.scope.mgt.ScopeManagementService; +import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; +import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; +import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.InputValidationException; +import org.wso2.carbon.policy.mgt.core.PolicyManagerService; +import org.wso2.carbon.user.api.AuthorizationManager; +import org.wso2.carbon.user.api.UserRealm; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.user.core.service.RealmService; + +import javax.ws.rs.core.MediaType; +import java.util.List; + +/** + * MDMAPIUtils class provides utility function used by CDM REST-API classes. + */ +public class MQTTMgtAPIUtils { + + public static final MediaType DEFAULT_CONTENT_TYPE = MediaType.APPLICATION_JSON_TYPE; + private static final String NOTIFIER_FREQUENCY = "notifierFrequency"; + private static Log log = LogFactory.getLog(MQTTMgtAPIUtils.class); + + public static RealmService getRealmService() throws UserStoreException { + RealmService realmService; + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + if (realmService == null) { + String msg = "Realm service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return realmService; + } + + /** + * Getting the current tenant's user realm + */ + public static UserRealm getUserRealm() throws UserStoreException { + RealmService realmService; + UserRealm realm; + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + + if (realmService == null) { + throw new IllegalStateException("Realm service not initialized"); + } + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + realm = realmService.getTenantUserRealm(tenantId); + return realm; + } + + public static AuthorizationManager getAuthorizationManager() throws UserStoreException { + RealmService realmService; + AuthorizationManager authorizationManager; + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + if (realmService == null) { + throw new IllegalStateException("Realm service is not initialized."); + } + int tenantId = ctx.getTenantId(); + authorizationManager = realmService.getTenantUserRealm(tenantId).getAuthorizationManager(); + + return authorizationManager; + } + + public static ScopeManagementService getScopeManagementService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + ScopeManagementService scopeManagementService = + (ScopeManagementService) ctx.getOSGiService(ScopeManagementService.class, null); + if (scopeManagementService == null) { + throw new IllegalStateException("Scope Management Service has not been initialized."); + } + return scopeManagementService; + } + + public static int getTenantId(String tenantDomain) throws DeviceManagementException { + RealmService realmService = + (RealmService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(RealmService.class, null); + if (realmService == null) { + throw new IllegalStateException("Realm service has not been initialized."); + } + try { + return realmService.getTenantManager().getTenantId(tenantDomain); + } catch (UserStoreException e) { + throw new DeviceManagementException("Error occured while trying to " + + "obtain tenant id of currently logged in user"); + } + } + + public static String getAuthenticatedUser() { + PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + String username = threadLocalCarbonContext.getUsername(); + String tenantDomain = threadLocalCarbonContext.getTenantDomain(); + if (username != null && username.endsWith(tenantDomain)) { + return username.substring(0, username.lastIndexOf("@")); + } + return username; + } + +} From 80470ab668bc33c2e01901c34fc27e1b0a98b79b Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:06:02 +0530 Subject: [PATCH 14/24] Adding mqtt admin service --- .../api/admin/MQTTManagementAdminService.java | 154 ++++++++++++++++++ .../admin/MQTTManagementAdminServiceImpl.java | 86 ++++++++++ .../impl/util/InputValidationException.java | 35 ++++ .../impl/util/RequestValidationUtil.java | 43 +++++ 4 files changed, 318 insertions(+) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java new file mode 100644 index 000000000..707e1d757 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java @@ -0,0 +1,154 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.api.admin; + +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "MQTTManagementAdmin"), + @ExtensionProperty(name = "context", value = "/api/mqtt-topics/v1.0/admin/topics"), + }) + } + ), + tags = { + @Tag(name = "device_management", description = "") + } +) +@Path("/admin/topics") +@Api(value = "MQTT Management Administrative Service", description = "This an API intended to be used by " + + "'internal' components to log in as an admin user and view MQTT topics dashboard. " + + "Further, this is strictly restricted to admin users only ") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Getting Details of Topics", + description = "Getting Details of Topics", + key = "perm:admin:topics:view", + permissions = {"/device-mgt/topics/view"} + ) + } +) +public interface MQTTManagementAdminService { + + @GET + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting Details of Topics", + notes = "Get the details of a topic by searching via the topic name, and details.", + response = Device.class, + responseContainer = "List", + tags = "MQTT Management Administrative Service", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:topics:view") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of topics.", + response = Device.class, + responseContainer = "List", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. Empty body because the client already has the latest version of the " + + "requested resource.\n"), + @ApiResponse( + code = 401, + message = "Unauthorized.\n The unauthorized access to the requested resource.", + response = ErrorResponse.class), + @ApiResponse( + code = 404, + message = "Not Found.\n The specified device does not exist", + response = ErrorResponse.class), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the device list.", + response = ErrorResponse.class) + }) + Response getFilteredSubscriptions( + + @ApiParam( + name = "tenant-domain", + value = "The name of the tenant.\n" + + "The default tenant domain of WSO2 EMM is carbon.super", + required = true, + defaultValue = "carbon.super") + @QueryParam("tenant-domain") String tenantDomain, + @ApiParam( + name = "If-Modified-Since", + value = "Checks if the requested variant was modified, since the specified date-time. \n" + + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z. \n" + + "Example: Mon, 05 Jan 2014 15:10:00 +0200", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @ApiParam( + name = "offset", + value = "The starting pagination index for the complete list of qualified items.", + required = false, + defaultValue = "0") + @QueryParam("offset") int offset, + @ApiParam( + name = "limit", + value = "Provide how many activity details you require from the starting pagination index/offset.", + required = false, + defaultValue = "5") + @QueryParam("limit") int limit); +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java new file mode 100644 index 000000000..e37d158dd --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -0,0 +1,86 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.impl.admin; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.axis2.transport.http.HttpTransportProperties; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.andes.admin.mqtt.internal.xsd.Subscription; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.api.admin.MQTTManagementAdminService; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.MQTTMgtAPIUtils; +import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceBrokerManagerAdminException; +import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceStub; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.servlet.ServletConfig; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.rmi.RemoteException; +import java.util.HashMap; +import java.util.Map; + +@Path("/admin/topics") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminService { + + private static final Log log = LogFactory.getLog(MQTTManagementAdminServiceImpl.class); + private + @Context + ServletConfig config; + private + @Context + HttpServletRequest request; + + @Override + @GET + public Response getFilteredSubscriptions( + @QueryParam("tenant-domain") String tenantDomain, + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @QueryParam("offset") int offset, + @QueryParam("limit") int limit) { + RequestValidationUtil.validatePaginationParameters(offset, limit); + try { + int currentTenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + if (MultitenantConstants.SUPER_TENANT_ID != currentTenantId) { + return Response.status(Response.Status.UNAUTHORIZED).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage( + "Current logged in user is not authorized to perform this operation").build()).build(); + } + return null; + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java new file mode 100644 index 000000000..812c30ee6 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java @@ -0,0 +1,35 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.impl.util; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; + +import javax.ws.rs.BadRequestException; +import javax.ws.rs.core.Response; +import java.io.Serializable; + +public class InputValidationException extends BadRequestException implements Serializable { + + private static final long serialVersionUID = 147843579458906890L; + + public InputValidationException(ErrorResponse error) { + super(Response.status(Response.Status.BAD_REQUEST).entity(error).build()); + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java new file mode 100644 index 000000000..0f479d984 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java @@ -0,0 +1,43 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.service.impl.util; + +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.*; + +public class RequestValidationUtil { + public static void validatePaginationParameters(int offset, int limit) { + if (offset < 0) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter offset is s " + + "negative value.").build()); + } + if (limit < 0) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter limit is a " + + "negative value.").build()); + } + if (limit > 100) { + throw new InputValidationException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request parameter limit should" + + " be less than or equal to 100.").build()); + } + + } + +} From ddb5dc2160ce92c8d51efadbc6694045240a630b Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:09:16 +0530 Subject: [PATCH 15/24] Created mqtt admin service stub --- .../admin/MQTTManagementAdminServiceImpl.java | 69 ++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java index e37d158dd..052322616 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -77,10 +77,77 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic new ErrorResponse.ErrorResponseBuilder().setMessage( "Current logged in user is not authorized to perform this operation").build()).build(); } - return null; + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MQTTMgtAPIUtils.getTenantId(tenantDomain)); + + HttpSession session = request.getSession(); + + AndesMQTTAdminServiceStub andesAdminStub = getAndesMQTTAdminServiceStub(config, session, request); + + Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, + "MQTT", "TOPIC", "", false, + "", false, "All", offset, + 10); + Map subscriptions = new HashMap<>(); + subscriptions.put("subscriptions", filteredNormalTopicSubscriptionList); + return Response.ok().entity(subscriptions).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred at server side while fetching device list."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (AxisFault e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (RemoteException e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (AndesMQTTAdminServiceBrokerManagerAdminException e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } finally { PrivilegedCarbonContext.endTenantFlow(); } } + /** + * Gets the AndesAdminServices stub. + * + * @param config the servlet configuration + * @param session the http session + * @param request the http servlet request + * @return an AndesAdminServiceStub + * @throws AxisFault + */ + private static AndesMQTTAdminServiceStub getAndesMQTTAdminServiceStub(ServletConfig config, + HttpSession session, + HttpServletRequest request) + throws AxisFault { + + String hostName = CarbonUtils.getServerConfiguration().getFirstProperty("HostName"); + final String MQTT_ENDPOINT = "9446"; + + if (hostName == null) { + hostName = System.getProperty("carbon.local.ip"); + } + + String backendServerURL = "https://" + hostName + ":" + MQTT_ENDPOINT + "/services/AndesMQTTAdminService.AndesMQTTAdminServiceHttpsSoap11Endpoint/"; + ConfigurationContext configContext = + (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); + AndesMQTTAdminServiceStub stub = new AndesMQTTAdminServiceStub(configContext, backendServerURL); + HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator(); + basicAuthentication.setUsername("admin"); + basicAuthentication.setPassword("admin"); + stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication); + + return stub; + } + } From 9fd260045427187f35d9dbe62eca55e144d560d9 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:28:05 +0530 Subject: [PATCH 16/24] Adding mqtt andes extensions api feature module --- features/extensions-feature/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index d6420b61b..76110794f 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -38,6 +38,7 @@ org.wso2.carbon.appmgt.mdm.restconnector.feature org.wso2.carbon.device.mgt.adapter.feature org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature + org.wso2.carbon.andes.extensions.device.mgt.api.feature org.wso2.extension.siddhi.execution.json.feature From e4aec55ae49556dc0c91945ec03cfdd48a231c9e Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 08:29:15 +0530 Subject: [PATCH 17/24] MQTT andes extensions api feature added --- .../pom.xml | 126 ++++++++++++++++++ .../src/main/resources/build.properties | 19 +++ .../src/main/resources/p2.inf | 3 + 3 files changed, 148 insertions(+) create mode 100644 features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml create mode 100644 features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties create mode 100644 features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml new file mode 100644 index 000000000..882eab269 --- /dev/null +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -0,0 +1,126 @@ + + + + + + + + org.wso2.carbon.devicemgt-plugins + extensions-feature + 3.0.12-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.andes.extensions.device.mgt.api.feature + pom + WSO2 Carbon - MQTT Topics Management API Feature + http://wso2.org + This feature contains the API feature for the MQTT dashboard + + + + + maven-resources-plugin + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-jaxrs-war + package + + copy + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.andes.extensions.device.mgt.api + war + true + + ${project.build.directory}/maven-shared-archive-resources/webapps/ + + api#mqtt-topics#v1.0.war + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.andes.extensions.device.mgt.api + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:true + + + + + + + + + + + + + + + + + diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties new file mode 100644 index 000000000..ddedd58dc --- /dev/null +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/build.properties @@ -0,0 +1,19 @@ +# +# Copyright (c) 2005-2014, 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. +# + +custom = true diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf new file mode 100644 index 000000000..b1f1b35b3 --- /dev/null +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/src/main/resources/p2.inf @@ -0,0 +1,3 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.andes.extensions.device.mgt.api_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ \ No newline at end of file From a78531964381cec24630026f1779ed5c1dfe3cb7 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 24 Apr 2017 18:17:58 +0530 Subject: [PATCH 18/24] Removed Scope Management Service --- .../pom.xml | 332 +++++++++++++----- .../mgt/jaxrs/util/MQTTMgtAPIUtils.java | 11 - .../pom.xml | 2 +- 3 files changed, 248 insertions(+), 97 deletions(-) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index d4f9ebb73..437163640 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,124 +22,286 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 3.0.22-SNAPSHOT + 3.0.25-SNAPSHOT ../pom.xml 4.0.0 - org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization - bundle - WSO2 Carbon - Component - MQTT - Authorization Manager - MQTT authorization manager based on Carbon device manager + org.wso2.carbon.andes.extensions.device.mgt.api + war + WSO2 Carbon - MQTT Topics Management API + WSO2 Carbon - MQTT Topics Management API http://wso2.org + + + + maven-compiler-plugin + + 1.7 + 1.7 + + + + maven-war-plugin + + WEB-INF/lib/*cxf*.jar + api#mqtt-topics#v1.0 + + + + + + + + deploy + + compile + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + compile + + run + + + + + + + + + + + + + + + + + + client + + test + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + test + + java + + + + + + + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + provided + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + org.apache.cxf + cxf-rt-transports-http + provided + + + junit + junit + test + + + commons-httpclient.wso2 + commons-httpclient + provided + + + javax.ws.rs + jsr311-api + + org.wso2.carbon org.wso2.carbon.utils + provided org.wso2.carbon - org.wso2.carbon.core + org.wso2.carbon.logging + provided - org.wso2.andes.wso2 - andes + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common + provided - org.wso2.carbon - org.wso2.carbon.user.api + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + provided + + + org.apache.axis2.wso2 + axis2 + + + org.apache.axis2.transport + axis2-transport-mail + + + org.apache.ws.commons.axiom.wso2 + axiom + + - org.wso2.carbon - org.wso2.carbon.user.core + org.wso2.carbon.devicemgt + org.wso2.carbon.policy.mgt.core + provided + + + org.apache.axis2.wso2 + axis2-client + + + + + org.wso2.carbon.identity.inbound.auth.oauth2 + org.wso2.carbon.identity.oauth.stub + provided + + + org.apache.axis2.wso2 + axis2 + + + org.apache.axis2.wso2 + axis2-client + + + org.apache.axis2.transport + axis2-transport-mail + + + + + org.json.wso2 + json + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.certificate.mgt.core + provided + + + org.apache.axis2.wso2 + axis2 + + + + + io.swagger + swagger-annotations + + + io.swagger + swagger-core + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + org.slf4j + slf4j-api + + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-core + + + + + io.swagger + swagger-jaxrs + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + org.slf4j + slf4j-api + + + org.wso2.orbit.com.fasterxml.jackson.core + jackson-core + + - commons-lang - commons-lang + javax.servlet + servlet-api + - io.github.openfeign - feign-core + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + provided - io.github.openfeign - feign-jaxrs + org.wso2.orbit.com.fasterxml.jackson.core + jackson-annotations - io.github.openfeign - feign-gson + org.hibernate + hibernate-validator javax.ws.rs - jsr311-api + javax.ws.rs-api - org.wso2.carbon - javax.cache.wso2 + org.wso2.carbon.messaging + org.wso2.carbon.andes.mqtt.stub + + + org.apache.axis2.wso2 + axis2 + + + org.apache.axis2.wso2 + axis2-client + + + org.apache.axis2.transport + axis2-transport-mail + + + org.apache.ws.commons.axiom.wso2 + axiom + + - - io.github.openfeign - feign-slf4j - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.artifactId} - ${project.artifactId} - - org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal - - - !org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.internal, - org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.* - - - org.apache.log4j, - org.dna.mqtt.moquette.server, - org.wso2.andes.configuration.enums, - org.wso2.andes.mqtt, - org.wso2.carbon.context, - org.jaxen, - org.apache.axiom.*, - org.wso2.securevault, - org.apache.commons.*, - org.osgi.service.component, - org.wso2.carbon.user.core.service, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.user.api, - feign, - feign.auth, - feign.codec, - feign.gson, - javax.cache, - javax.xml.namespace, - javax.xml.stream, - org.wso2.carbon.base, - org.wso2.carbon.utils, - javax.net.ssl, - feign.slf4j - - - jsr311-api, - feign-jaxrs - - - - - - - - diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java index 08951f00f..62043c497 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java @@ -30,7 +30,6 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; -import org.wso2.carbon.device.mgt.common.scope.mgt.ScopeManagementService; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; @@ -99,16 +98,6 @@ public class MQTTMgtAPIUtils { return authorizationManager; } - public static ScopeManagementService getScopeManagementService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ScopeManagementService scopeManagementService = - (ScopeManagementService) ctx.getOSGiService(ScopeManagementService.class, null); - if (scopeManagementService == null) { - throw new IllegalStateException("Scope Management Service has not been initialized."); - } - return scopeManagementService; - } - public static int getTenantId(String tenantDomain) throws DeviceManagementException { RealmService realmService = (RealmService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(RealmService.class, null); diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 882eab269..6e8041e61 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -24,7 +24,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.12-SNAPSHOT + 3.0.25-SNAPSHOT ../pom.xml From 3907441cf4d4e0f4d5b3b0f209dc3db8dec39e05 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Tue, 13 Jun 2017 10:20:34 +0530 Subject: [PATCH 19/24] Updated the broker version --- .../pom.xml | 2 +- .../mgt/jaxrs/beans/BasePaginatedResult.java | 42 ++ .../device/mgt/jaxrs/beans/TopicList.java | 55 +++ .../jaxrs/beans/TopicPaginationRequest.java | 114 +++++ .../exception/AuthenticationException.java | 74 ++++ .../exception/TopicManagementException.java | 44 ++ .../api/admin/MQTTManagementAdminService.java | 7 + .../admin/MQTTManagementAdminServiceImpl.java | 267 +++++++++++- .../service/impl/util/TopicManagerUtil.java | 409 ++++++++++++++++++ .../pom.xml | 2 +- pom.xml | 7 +- 11 files changed, 1010 insertions(+), 13 deletions(-) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/BasePaginatedResult.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicPaginationRequest.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/AuthenticationException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/TopicManagementException.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index 437163640..324df3df3 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 3.0.25-SNAPSHOT + 3.0.38-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/BasePaginatedResult.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/BasePaginatedResult.java new file mode 100644 index 000000000..7341f6686 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/BasePaginatedResult.java @@ -0,0 +1,42 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +public class BasePaginatedResult { + + /** + * Number of Resources returned. + */ + @ApiModelProperty( + value = "Number of total resources.", + example = "1") + @JsonProperty("count") + private long count; + + public long getCount() { + return count; + } + + public void setCount(long count) { + this.count = count; + } +} \ No newline at end of file diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java new file mode 100644 index 000000000..554c0d284 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java @@ -0,0 +1,55 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import org.wso2.carbon.andes.admin.mqtt.internal.xsd.Subscription; +import org.wso2.carbon.device.mgt.common.Device; + +import java.util.ArrayList; +import java.util.List; + +public class TopicList extends BasePaginatedResult { + + private List subscriptions = new ArrayList<>(); + + @ApiModelProperty(value = "List of devices returned") + @JsonProperty("subscriptions") + public List getList() { + return subscriptions; + } + + public void setList(List subscriptions) { + this.subscriptions = subscriptions; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{\n"); + + sb.append(" count: ").append(getCount()).append(",\n"); + sb.append(" subscriptions: [").append(subscriptions).append("\n"); + sb.append("]}\n"); + return sb.toString(); + } + +} + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicPaginationRequest.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicPaginationRequest.java new file mode 100644 index 000000000..233b84bb3 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicPaginationRequest.java @@ -0,0 +1,114 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.beans; + +import java.util.Date; + +/** + * This class holds required parameters for a querying a paginated device response. + */ +public class TopicPaginationRequest { + + private int startIndex; + private int rowCount; + private Date since; + private String topic_name; + private int remaining_messages; + private String active; + private String durable; + private String subscriber_name; + private String identifier; + + public TopicPaginationRequest(int start, int rowCount) { + this.startIndex = start; + this.rowCount = rowCount; + } + + public int getStartIndex() { + return startIndex; + } + + public void setStartIndex(int startIndex) { + this.startIndex = startIndex; + } + + public int getRowCount() { + return rowCount; + } + + public void setRowCount(int rowCount) { + this.rowCount = rowCount; + } + + public Date getSince() { + return since; + } + + public void setSince(Date since) { + this.since = since; + } + + public String getTopic_name() { + return topic_name; + } + + public void setTopic_name(String topic_name) { + this.topic_name = topic_name; + } + + public int getRemaining_messages() { + return remaining_messages; + } + + public void setRemaining_messages(int remaining_messages) { + this.remaining_messages = remaining_messages; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public String getDurable() { + return durable; + } + + public void setDurable(String durable) { + this.durable = durable; + } + + public String getSubscriber_name() { + return subscriber_name; + } + + public void setSubscriber_name(String subscriber_name) { + this.subscriber_name = subscriber_name; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/AuthenticationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/AuthenticationException.java new file mode 100644 index 000000000..ce6a5c2c1 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/AuthenticationException.java @@ -0,0 +1,74 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +public class AuthenticationException extends Exception { + + private static final long serialVersionUID = -3151279311929070297L; + + private String errorMessage; + private int errorCode; + + public AuthenticationException(int errorCode, String message) { + super(message); + this.errorCode = errorCode; + } + + public AuthenticationException(int errorCode, String message, Throwable cause) { + super(message, cause); + this.errorCode = errorCode; + } + + public int getErrorCode() { + return errorCode; + } + + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public AuthenticationException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public AuthenticationException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public AuthenticationException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public AuthenticationException() { + super(); + } + + public AuthenticationException(Throwable cause) { + super(cause); + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/TopicManagementException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/TopicManagementException.java new file mode 100644 index 000000000..5e78f8091 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/TopicManagementException.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, 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.andes.extensions.device.mgt.jaxrs.exception; + +public class TopicManagementException extends Exception { + + private static final long serialVersionUID = -3151279311929070297L; + + public TopicManagementException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public TopicManagementException(String message, Throwable cause) { + super(message, cause); + } + + public TopicManagementException(String msg) { + super(msg); + } + + public TopicManagementException() { + super(); + } + + public TopicManagementException(Throwable cause) { + super(cause); + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java index 707e1d757..3db7338b9 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java @@ -125,6 +125,12 @@ public interface MQTTManagementAdminService { }) Response getFilteredSubscriptions( + @QueryParam("topic_name") String topic_name, + @QueryParam("remaining_messages") int remaining_messages, + @QueryParam("active") String active, + @QueryParam("durable") String durable, + @QueryParam("subscriber_name") String subscriber_name, + @QueryParam("identifier") String identifier, @ApiParam( name = "tenant-domain", value = "The name of the tenant.\n" + @@ -132,6 +138,7 @@ public interface MQTTManagementAdminService { required = true, defaultValue = "carbon.super") @QueryParam("tenant-domain") String tenantDomain, + @QueryParam("since") String since, @ApiParam( name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time. \n" + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java index 052322616..926e182dd 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -19,25 +19,45 @@ package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.admin; import org.apache.axis2.AxisFault; +import org.apache.axis2.client.Stub; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HttpTransportProperties; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.juddi.rmi.UDDISubscriptionService; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.andes.admin.mqtt.internal.xsd.Subscription; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.TopicList; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.TopicPaginationRequest; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.exception.AuthenticationException; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.api.admin.MQTTManagementAdminService; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.TopicManagerUtil; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.MQTTMgtAPIUtils; import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceBrokerManagerAdminException; import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceStub; -import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.app.mgt.Application; +import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; +import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.device.details.mgt.dao.DeviceDetailsMgtDAOException; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.CarbonUtils; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @@ -45,9 +65,15 @@ import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import java.io.File; import java.rmi.RemoteException; -import java.util.HashMap; -import java.util.Map; +import java.security.*; +import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +import static sun.audio.AudioDevice.device; @Path("/admin/topics") @Produces(MediaType.APPLICATION_JSON) @@ -55,6 +81,61 @@ import java.util.Map; public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminService { private static final Log log = LogFactory.getLog(MQTTManagementAdminServiceImpl.class); + /** + * required soap header for authorization + */ + private static final String AUTHORIZATION_HEADER = "Authorization"; + + /** + * required soap header value for mutualSSL + */ + private static final String AUTHORIZATION_HEADER_VALUE = "Bearer"; + + private static final String KEY_STORE_TYPE = "JKS"; + /** + * Default truststore type of the client + */ + private static final String TRUST_STORE_TYPE = "JKS"; + /** + * Default keymanager type of the client + */ + private static final String KEY_MANAGER_TYPE = "SunX509"; //Default Key Manager Type + /** + * Default trustmanager type of the client + */ + private static final String TRUST_MANAGER_TYPE = "SunX509"; //Default Trust Manager Type + + private static final String SSLV3 = "SSLv3"; + + + + private KeyStore keyStore; + private KeyStore trustStore; + private char[] keyStorePassword; + private SSLContext sslContext; + + private String tenantDomain; + + private static final String DEFAULT_RESOURCE_LOCATION = "/resources/devicetypes"; + private static final String CAR_FILE_LOCATION = CarbonUtils.getCarbonHome() + File.separator + "repository" + + File.separator + "resources" + File.separator + "devicetypes"; + private static final String DAS_PORT = "${iot.analytics.https.port}"; + private static final String DAS_HOST_NAME = "${iot.analytics.host}"; + private static final String DEFAULT_HTTP_PROTOCOL = "https"; + private static final String IOT_MGT_PORT = "${iot.manager.https.port}"; + private static final String IOT_MGT_HOST_NAME = "${iot.manager.host}"; + private static final String DAS_URL = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME + + ":" + DAS_PORT + "/services/CarbonAppUploader/"; + private static final String DAS_EVENT_RECEIVER_EP = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME + + ":" + DAS_PORT + "/services/EventReceiverAdminService/"; + private static final String DAS_EVENT_STREAM_EP = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME + + ":" + DAS_PORT + "/services/EventStreamAdminService/"; + + private static final String IOT_MGT_URL = DEFAULT_HTTP_PROTOCOL + "://" + IOT_MGT_HOST_NAME + + ":" + IOT_MGT_PORT + "/services/CarbonAppUploader/"; + private static final String MEDIA_TYPE_XML = "application/xml"; + private static final String DEVICE_MANAGEMENT_TYPE = "device_management"; + private static final String TENANT_DOMAIN_PROPERTY = "\\$\\{tenant-domain\\}"; private @Context ServletConfig config; @@ -65,25 +146,66 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic @Override @GET public Response getFilteredSubscriptions( + @QueryParam("topic_name") String topic_name, + @QueryParam("remaining_messages") int remaining_messages, + @QueryParam("active") String active, + @QueryParam("durable") String durable, + @QueryParam("subscriber_name") String subscriber_name, + @QueryParam("identifier") String identifier, @QueryParam("tenant-domain") String tenantDomain, + @QueryParam("since") String since, @HeaderParam("If-Modified-Since") String ifModifiedSince, @QueryParam("offset") int offset, @QueryParam("limit") int limit) { - RequestValidationUtil.validatePaginationParameters(offset, limit); try { + if (!StringUtils.isEmpty(topic_name) && !StringUtils.isEmpty(active)) { + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Request contains both name and role " + + "parameters. Only one is allowed " + + "at once.").build()).build(); + } int currentTenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); if (MultitenantConstants.SUPER_TENANT_ID != currentTenantId) { return Response.status(Response.Status.UNAUTHORIZED).entity( new ErrorResponse.ErrorResponseBuilder().setMessage( "Current logged in user is not authorized to perform this operation").build()).build(); } + String ten_Domain = getTenantDomain(currentTenantId); PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MQTTMgtAPIUtils.getTenantId(tenantDomain)); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(ten_Domain); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MQTTMgtAPIUtils.getTenantId(ten_Domain)); - HttpSession session = request.getSession(); + RequestValidationUtil.validatePaginationParameters(offset, limit); + HttpSession session = request.getSession(); AndesMQTTAdminServiceStub andesAdminStub = getAndesMQTTAdminServiceStub(config, session, request); + TopicPaginationRequest request = new TopicPaginationRequest(offset, limit); + PaginationResult result; + TopicList topics = new TopicList(); + + if (topic_name != null && !topic_name.isEmpty()) { + request.setTopic_name(topic_name); + } + if (remaining_messages != 0) { + request.setRemaining_messages(remaining_messages); + } + if (active != null && !active.isEmpty()) { + request.setActive(active); + } + if (durable != null && !durable.isEmpty()) { + request.setDurable(durable); + } + if (subscriber_name != null && !subscriber_name.isEmpty()) { + request.setSubscriber_name(subscriber_name); + } + if (identifier != null && !identifier.isEmpty()) { + request.setIdentifier(identifier); + } + +// Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredMQTTSubscriptions(false, true, +// "MQTT", "TOPIC", "", false, +// "", false, "All", offset, +// 10,currentTenantId,tenantDomain); Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, "MQTT", "TOPIC", "", false, @@ -91,6 +213,55 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic 10); Map subscriptions = new HashMap<>(); subscriptions.put("subscriptions", filteredNormalTopicSubscriptionList); + + //getPaginatedTopics(request,subscriptions); + + if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { + Date sinceDate; + SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); + try { + sinceDate = format.parse(ifModifiedSince); + } catch (ParseException e) { + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " + + "string is provided in 'If-Modified-Since' header").build()).build(); + } + request.setSince(sinceDate); + result = getPaginatedTopics(request,subscriptions); + if (result == null || result.getData() == null || result.getData().size() <= 0) { + return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " + + "after the timestamp provided in 'If-Modified-Since' header").build(); + } + } else if (since != null && !since.isEmpty()) { + Date sinceDate; + SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); + try { + sinceDate = format.parse(since); + } catch (ParseException e) { + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " + + "string is provided in 'since' filter").build()).build(); + } + request.setSince(sinceDate); + result = getPaginatedTopics(request,subscriptions); + if (result == null || result.getData() == null || result.getData().size() <= 0) { + topics.setList(new ArrayList()); + topics.setCount(0); + return Response.status(Response.Status.OK).entity(topics).build(); + } + } else { + result = getPaginatedTopics(request,subscriptions); + int resultCount = result.getRecordsTotal(); + if (resultCount == 0) { + Response.status(Response.Status.OK).entity(topics).build(); + } + } + + topics.setList((List) result.getData()); + topics.setCount(result.getRecordsTotal()); + + + return Response.ok().entity(subscriptions).build(); } catch (DeviceManagementException e) { String msg = "Error occurred at server side while fetching device list."; @@ -112,6 +283,11 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (AuthenticationException e) { + String msg = "Error occurred at server side while fetching service stub."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } finally { PrivilegedCarbonContext.endTenantFlow(); } @@ -150,4 +326,79 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic return stub; } + + private PaginationResult getPaginatedTopics(TopicPaginationRequest request,Map subscriptions) throws DeviceManagementException { + List devicesForRoles = null; + PaginationResult paginationResult = new PaginationResult(); + List allSubscriptions = new ArrayList<>(); + List sub = new ArrayList<>(); + Map ss = subscriptions; + int count = 0; + int tenantId = this.getTenantId(); + request = TopicManagerUtil.validateTopicListPageSize(request); + + List subscriptionList = new ArrayList(subscriptions.values()); + + allSubscriptions = Arrays.asList(subscriptionList.get(0)); + count = allSubscriptions.size(); + + paginationResult.setData(allSubscriptions); + paginationResult.setRecordsFiltered(count); + paginationResult.setRecordsTotal(count); + return paginationResult; + } + + private int getTenantId() { + return CarbonContext.getThreadLocalCarbonContext().getTenantId(); + } + + private static String getTenantDomain(int tenantId) throws AuthenticationException { + try { + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + + RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); + if (realmService == null) { + String msg = "RealmService is not initialized"; + log.error(msg); + throw new AuthenticationException(msg); + } + + return realmService.getTenantManager().getDomain(tenantId); + + } catch (UserStoreException e) { + String msg = "User store not initialized"; + log.error(msg); + throw new AuthenticationException(msg, e); + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } + } + + /** + * Initializes the SSL Context + */ + private void initSSLConnection() throws NoSuchAlgorithmException, UnrecoverableKeyException, + KeyStoreException, KeyManagementException { + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KEY_MANAGER_TYPE); + keyManagerFactory.init(keyStore, keyStorePassword); + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TRUST_MANAGER_TYPE); + trustManagerFactory.init(trustStore); + + // Create and initialize SSLContext for HTTPS communication + sslContext = SSLContext.getInstance(SSLV3); + sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null); + SSLContext.setDefault(sslContext); + } + + private void cleanup(Stub stub) { + if (stub != null) { + try { + stub.cleanup(); + } catch (AxisFault axisFault) { + //do nothing + } + } + } + } diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java new file mode 100644 index 000000000..c3d15275c --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2014, 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.andes.extensions.device.mgt.jaxrs.service.impl.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Document; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.TopicPaginationRequest; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; +import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; +import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; +import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; +import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO; +import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants; +import org.wso2.carbon.device.mgt.core.operation.mgt.util.DeviceIDHolder; +import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; +import org.wso2.carbon.user.api.TenantManager; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.utils.CarbonUtils; +import org.wso2.carbon.utils.ConfigurationContextService; +import org.wso2.carbon.utils.NetworkUtils; + +import javax.sql.DataSource; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.File; +import java.util.*; + + +public final class TopicManagerUtil { + + private static final Log log = LogFactory.getLog(DeviceManagerUtil.class); + + public static Document convertToDocument(File file) throws DeviceManagementException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + try { + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + return docBuilder.parse(file); + } catch (Exception e) { + throw new DeviceManagementException("Error occurred while parsing file, while converting " + + "to a org.w3c.dom.Document", e); + } + } + + /** + * Resolve data source from the data source definition. + * + * @param config data source configuration + * @return data source resolved from the data source definition + */ + public static DataSource resolveDataSource(DataSourceConfig config) { + DataSource dataSource = null; + if (config == null) { + throw new RuntimeException("Device Management Repository data source configuration is null and thus, " + + "is not initialized"); + } + JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); + if (jndiConfig != null) { + if (log.isDebugEnabled()) { + log.debug("Initializing Device Management Repository data source using the JNDI Lookup Definition"); + } + List jndiPropertyList = + jndiConfig.getJndiProperties(); + if (jndiPropertyList != null) { + Hashtable jndiProperties = new Hashtable(); + for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { + jndiProperties.put(prop.getName(), prop.getValue()); + } + dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); + } else { + dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); + } + } + return dataSource; + } + + /** + * Adds a new device type to the database if it does not exists. + * + * @param typeName device type + * @param tenantId provider tenant Id + * @param isSharedWithAllTenants is this device type shared with all tenants. + * @return status of the operation + */ + public static boolean registerDeviceType(String typeName, int tenantId, boolean isSharedWithAllTenants) + throws DeviceManagementException { + boolean status; + try { + DeviceManagementDAOFactory.beginTransaction(); + DeviceTypeDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); + DeviceType deviceType = deviceTypeDAO.getDeviceType(typeName, tenantId); + if (deviceType == null) { + deviceType = new DeviceType(); + deviceType.setName(typeName); + deviceTypeDAO.addDeviceType(deviceType, tenantId, isSharedWithAllTenants); + } + DeviceManagementDAOFactory.commitTransaction(); + status = true; + } catch (DeviceManagementDAOException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + throw new DeviceManagementException("Error occurred while registering the device type '" + + typeName + "'", e); + } catch (TransactionManagementException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + throw new DeviceManagementException("SQL occurred while registering the device type '" + + typeName + "'", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + return status; + } + + /** + * Un-registers an existing device type from the device management metadata repository. + * + * @param typeName device type + * @return status of the operation + */ + public static boolean unregisterDeviceType(String typeName, int tenantId) throws DeviceManagementException { + try { + DeviceManagementDAOFactory.beginTransaction(); + DeviceTypeDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); + DeviceType deviceType = deviceTypeDAO.getDeviceType(typeName, tenantId); + if (deviceType != null) { + deviceTypeDAO.removeDeviceType(typeName, tenantId); + } + DeviceManagementDAOFactory.commitTransaction(); + return true; + } catch (DeviceManagementDAOException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + throw new DeviceManagementException("Error occurred while registering the device type '" + + typeName + "'", e); + } catch (TransactionManagementException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + throw new DeviceManagementException("SQL occurred while registering the device type '" + + typeName + "'", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + + public static Map convertDevicePropertiesToMap(List properties) { + Map propertiesMap = new HashMap(); + for (Device.Property prop : properties) { + propertiesMap.put(prop.getName(), prop.getValue()); + } + return propertiesMap; + } + + public static List convertDevices(List devices) { + + List deviceIdentifiers = new ArrayList<>(); + for (Device device : devices) { + DeviceIdentifier identifier = new DeviceIdentifier(); + identifier.setId(device.getDeviceIdentifier()); + identifier.setType(device.getType()); + deviceIdentifiers.add(identifier); + } + return deviceIdentifiers; + } + + public static List getValidDeviceIdentifiers(List devices) { + List deviceIdentifiers = new ArrayList<>(); + for (Device device : devices) { + if (device.getEnrolmentInfo() != null) { + switch (device.getEnrolmentInfo().getStatus()) { + case BLOCKED: + case REMOVED: + case SUSPENDED: + break; + default: + DeviceIdentifier identifier = new DeviceIdentifier(); + identifier.setId(device.getDeviceIdentifier()); + identifier.setType(device.getType()); + deviceIdentifiers.add(identifier); + } + } + } + return deviceIdentifiers; + } + + + public static String getServerBaseHttpsUrl() { + String hostName = "localhost"; + try { + hostName = NetworkUtils.getMgtHostName(); + } catch (Exception ignored) { + } + String mgtConsoleTransport = CarbonUtils.getManagementTransport(); + ConfigurationContextService configContextService = + DeviceManagementDataHolder.getInstance().getConfigurationContextService(); + int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport); + int httpsProxyPort = + CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), + mgtConsoleTransport); + if (httpsProxyPort > 0) { + port = httpsProxyPort; + } + return "https://" + hostName + ":" + port; + } + + public static String getServerBaseHttpUrl() { + String hostName = "localhost"; + try { + hostName = NetworkUtils.getMgtHostName(); + } catch (Exception ignored) { + } + ConfigurationContextService configContextService = + DeviceManagementDataHolder.getInstance().getConfigurationContextService(); + int port = CarbonUtils.getTransportPort(configContextService, "http"); + int httpProxyPort = + CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), + "http"); + if (httpProxyPort > 0) { + port = httpProxyPort; + } + return "http://" + hostName + ":" + port; + } + + /** + * returns the tenant Id of the specific tenant Domain + * + * @param tenantDomain + * @return + * @throws DeviceManagementException + */ + public static int getTenantId(String tenantDomain) throws DeviceManagementException { + try { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { + return MultitenantConstants.SUPER_TENANT_ID; + } + TenantManager tenantManager = DeviceManagementDataHolder.getInstance().getTenantManager(); + int tenantId = tenantManager.getTenantId(tenantDomain); + if (tenantId == -1) { + throw new DeviceManagementException("invalid tenant Domain :" + tenantDomain); + } + return tenantId; + } catch (UserStoreException e) { + throw new DeviceManagementException("invalid tenant Domain :" + tenantDomain); + } + } + + public static int validateActivityListPageSize(int limit) throws OperationManagementException { + if (limit == 0) { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + return deviceManagementConfig.getPaginationConfiguration().getActivityListPageSize(); + } else { + throw new OperationManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + return limit; + } + + public static PaginationRequest validateOperationListPageSize(PaginationRequest paginationRequest) throws + OperationManagementException { + if (paginationRequest.getRowCount() == 0) { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration(). + getOperationListPageSize()); + } else { + throw new OperationManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + return paginationRequest; + } + + public static PaginationRequest validateNotificationListPageSize(PaginationRequest paginationRequest) throws + NotificationManagementException { + if (paginationRequest.getRowCount() == 0) { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration(). + getNotificationListPageSize()); + } else { + throw new NotificationManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + return paginationRequest; + } + + public static TopicPaginationRequest validateTopicListPageSize(TopicPaginationRequest paginationRequest) throws + DeviceManagementException { + if (paginationRequest.getRowCount() == 0) { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration(). + getTopicListPageSize()); + } else { + throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + return paginationRequest; + } + + public static GroupPaginationRequest validateGroupListPageSize(GroupPaginationRequest paginationRequest) throws + GroupManagementException { + if (paginationRequest.getRowCount() == 0) { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance() + .getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration() + .getDeviceListPageSize()); + } else { + throw new GroupManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + return paginationRequest; + } + + public static int validateDeviceListPageSize(int limit) throws DeviceManagementException { + if (limit == 0) { + DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig(); + if (deviceManagementConfig != null) { + return deviceManagementConfig.getPaginationConfiguration().getDeviceListPageSize(); + } else { + throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + + "cdm-config.xml file."); + } + } + return limit; + } + + public static DeviceIDHolder validateDeviceIdentifiers(List deviceIDs) { + + List errorDeviceIdList = new ArrayList(); + List validDeviceIDList = new ArrayList(); + + int deviceIDCounter = 0; + for (DeviceIdentifier deviceIdentifier : deviceIDs) { + + deviceIDCounter++; + String deviceID = deviceIdentifier.getId(); + + if (deviceID == null || deviceID.isEmpty()) { + errorDeviceIdList.add(String.format(OperationMgtConstants.DeviceConstants.DEVICE_ID_NOT_FOUND, + deviceIDCounter)); + continue; + } + + try { + + if (isValidDeviceIdentifier(deviceIdentifier)) { + validDeviceIDList.add(deviceIdentifier); + } else { + errorDeviceIdList.add(deviceID); + } + } catch (DeviceManagementException e) { + errorDeviceIdList.add(deviceID); + } + } + + DeviceIDHolder deviceIDHolder = new DeviceIDHolder(); + deviceIDHolder.setValidDeviceIDList(validDeviceIDList); + deviceIDHolder.setErrorDeviceIdList(errorDeviceIdList); + + return deviceIDHolder; + } + + public static boolean isValidDeviceIdentifier(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { + Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier); + if (device == null || device.getDeviceIdentifier() == null || + device.getDeviceIdentifier().isEmpty() || device.getEnrolmentInfo() == null) { + return false; + } else if (EnrolmentInfo.Status.REMOVED.equals(device.getEnrolmentInfo().getStatus())) { + return false; + } + return true; + } +} diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 6e8041e61..04b89d852 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -24,7 +24,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.25-SNAPSHOT + 3.0.38-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 6ad69edb7..ad4f9b0d9 100644 --- a/pom.xml +++ b/pom.xml @@ -1040,7 +1040,7 @@ org.wso2.andes.wso2 andes - ${carbon.messaging.version} + ${andes.version} org.wso2.carbon.devicemgt-plugins @@ -1263,9 +1263,10 @@ [0.0.0,1.0.0) - 3.1.3 + 3.2.6-SNAPSHOT + 3.2.7-SNAPSHOT 2.6.1.wso2v1 - 3.2.1-SNAPSHOT + 3.2.6-SNAPSHOT 9.3.1 From 6098f2eaa86077e7107c085e19b199217fd6e2ca Mon Sep 17 00:00:00 2001 From: Supun94 Date: Thu, 15 Jun 2017 13:16:05 +0530 Subject: [PATCH 20/24] Changing Topics search --- .../admin/MQTTManagementAdminServiceImpl.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java index 926e182dd..5e3166d34 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -146,7 +146,7 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic @Override @GET public Response getFilteredSubscriptions( - @QueryParam("topic_name") String topic_name, + @QueryParam("name") String topic_name, @QueryParam("remaining_messages") int remaining_messages, @QueryParam("active") String active, @QueryParam("durable") String durable, @@ -208,7 +208,7 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic // 10,currentTenantId,tenantDomain); Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, - "MQTT", "TOPIC", "", false, + "MQTT", "TOPIC", topic_name, false, "", false, "All", offset, 10); Map subscriptions = new HashMap<>(); @@ -261,8 +261,8 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic topics.setCount(result.getRecordsTotal()); - - return Response.ok().entity(subscriptions).build(); + return Response.status(Response.Status.OK).entity(subscriptions).build(); +// return Response.ok().entity(subscriptions).build(); } catch (DeviceManagementException e) { String msg = "Error occurred at server side while fetching device list."; log.error(msg, e); @@ -328,21 +328,19 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic private PaginationResult getPaginatedTopics(TopicPaginationRequest request,Map subscriptions) throws DeviceManagementException { - List devicesForRoles = null; PaginationResult paginationResult = new PaginationResult(); List allSubscriptions = new ArrayList<>(); - List sub = new ArrayList<>(); Map ss = subscriptions; int count = 0; int tenantId = this.getTenantId(); request = TopicManagerUtil.validateTopicListPageSize(request); - List subscriptionList = new ArrayList(subscriptions.values()); + List subscriptionList = new ArrayList<>(subscriptions.values()); - allSubscriptions = Arrays.asList(subscriptionList.get(0)); - count = allSubscriptions.size(); +// allSubscriptions = Arrays.asList(subscriptionList.size()); + count = subscriptionList.size(); - paginationResult.setData(allSubscriptions); +// paginationResult.setData(allSubscriptions); paginationResult.setRecordsFiltered(count); paginationResult.setRecordsTotal(count); return paginationResult; From 1b67c3ef4daad7d78c7f1a28c209af03d29ad779 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Fri, 30 Jun 2017 15:38:50 +0530 Subject: [PATCH 21/24] Minor changes in andes extensions api --- .../pom.xml | 2 +- .../{TopicList.java => SubscriptionList.java} | 8 +- .../jaxrs/config/MQTTStubConfigurations.java | 49 +++ .../api/admin/MQTTManagementAdminService.java | 15 +- .../admin/MQTTManagementAdminServiceImpl.java | 332 ++---------------- .../pom.xml | 2 +- 6 files changed, 96 insertions(+), 312 deletions(-) rename components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/{TopicList.java => SubscriptionList.java} (86%) create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/config/MQTTStubConfigurations.java diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index 324df3df3..d2447bdab 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 3.0.38-SNAPSHOT + 4.0.2-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/SubscriptionList.java similarity index 86% rename from components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java rename to components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/SubscriptionList.java index 554c0d284..80a7d8cad 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/TopicList.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/SubscriptionList.java @@ -20,17 +20,17 @@ package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.andes.admin.mqtt.internal.xsd.Subscription; -import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.andes.core.types.xsd.MQTTSubscription; +import org.wso2.carbon.andes.core.types.xsd.Subscription; import java.util.ArrayList; import java.util.List; -public class TopicList extends BasePaginatedResult { +public class SubscriptionList extends BasePaginatedResult { private List subscriptions = new ArrayList<>(); - @ApiModelProperty(value = "List of devices returned") + @ApiModelProperty(value = "List of subscriptions returned") @JsonProperty("subscriptions") public List getList() { return subscriptions; diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/config/MQTTStubConfigurations.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/config/MQTTStubConfigurations.java new file mode 100644 index 000000000..d170dc94c --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/config/MQTTStubConfigurations.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014, 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.andes.extensions.device.mgt.jaxrs.config; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Configurations related to MQTT Stub. + */ +@XmlRootElement(name = "MQTTConfiguration") +public class MQTTStubConfigurations { + private String adminUsername; + private String adminPassword; + + @XmlElement(name = "AdminUsername", required = true) + public String getAdminUsername() { + return adminUsername; + } + + public void setAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + } + + @XmlElement(name = "AdminPassword", required = true) + public String getAdminPassword() { + return adminPassword; + } + + public void setAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + } + +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java index 3db7338b9..acb46ce9e 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java @@ -113,32 +113,21 @@ public interface MQTTManagementAdminService { response = ErrorResponse.class), @ApiResponse( code = 404, - message = "Not Found.\n The specified device does not exist", + message = "Not Found.\n The specified topic does not exist", response = ErrorResponse.class), @ApiResponse( code = 406, message = "Not Acceptable.\n The requested media type is not supported"), @ApiResponse( code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the device list.", + message = "Internal Server Error. \n Server error occurred while fetching the topic list.", response = ErrorResponse.class) }) Response getFilteredSubscriptions( @QueryParam("topic_name") String topic_name, - @QueryParam("remaining_messages") int remaining_messages, @QueryParam("active") String active, @QueryParam("durable") String durable, - @QueryParam("subscriber_name") String subscriber_name, - @QueryParam("identifier") String identifier, - @ApiParam( - name = "tenant-domain", - value = "The name of the tenant.\n" + - "The default tenant domain of WSO2 EMM is carbon.super", - required = true, - defaultValue = "carbon.super") - @QueryParam("tenant-domain") String tenantDomain, - @QueryParam("since") String since, @ApiParam( name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time. \n" + diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java index 5e3166d34..4101194d0 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -19,123 +19,38 @@ package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.admin; import org.apache.axis2.AxisFault; -import org.apache.axis2.client.Stub; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HttpTransportProperties; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.juddi.rmi.UDDISubscriptionService; import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.andes.admin.mqtt.internal.xsd.Subscription; +import org.wso2.carbon.andes.core.types.xsd.MQTTSubscription; +import org.wso2.carbon.andes.core.types.xsd.Subscription; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.TopicList; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.TopicPaginationRequest; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.exception.AuthenticationException; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.SubscriptionList; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.api.admin.MQTTManagementAdminService; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.TopicManagerUtil; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.MQTTMgtAPIUtils; import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceBrokerManagerAdminException; import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceStub; import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.*; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; -import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.core.device.details.mgt.dao.DeviceDetailsMgtDAOException; -import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - - -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManagerFactory; import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.io.File; import java.rmi.RemoteException; -import java.security.*; -import java.sql.SQLException; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.*; -import static sun.audio.AudioDevice.device; - @Path("/admin/topics") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminService { private static final Log log = LogFactory.getLog(MQTTManagementAdminServiceImpl.class); - /** - * required soap header for authorization - */ - private static final String AUTHORIZATION_HEADER = "Authorization"; - - /** - * required soap header value for mutualSSL - */ - private static final String AUTHORIZATION_HEADER_VALUE = "Bearer"; - - private static final String KEY_STORE_TYPE = "JKS"; - /** - * Default truststore type of the client - */ - private static final String TRUST_STORE_TYPE = "JKS"; - /** - * Default keymanager type of the client - */ - private static final String KEY_MANAGER_TYPE = "SunX509"; //Default Key Manager Type - /** - * Default trustmanager type of the client - */ - private static final String TRUST_MANAGER_TYPE = "SunX509"; //Default Trust Manager Type - - private static final String SSLV3 = "SSLv3"; - - - - private KeyStore keyStore; - private KeyStore trustStore; - private char[] keyStorePassword; - private SSLContext sslContext; - - private String tenantDomain; - - private static final String DEFAULT_RESOURCE_LOCATION = "/resources/devicetypes"; - private static final String CAR_FILE_LOCATION = CarbonUtils.getCarbonHome() + File.separator + "repository" + - File.separator + "resources" + File.separator + "devicetypes"; - private static final String DAS_PORT = "${iot.analytics.https.port}"; - private static final String DAS_HOST_NAME = "${iot.analytics.host}"; - private static final String DEFAULT_HTTP_PROTOCOL = "https"; - private static final String IOT_MGT_PORT = "${iot.manager.https.port}"; - private static final String IOT_MGT_HOST_NAME = "${iot.manager.host}"; - private static final String DAS_URL = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME - + ":" + DAS_PORT + "/services/CarbonAppUploader/"; - private static final String DAS_EVENT_RECEIVER_EP = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME - + ":" + DAS_PORT + "/services/EventReceiverAdminService/"; - private static final String DAS_EVENT_STREAM_EP = DEFAULT_HTTP_PROTOCOL + "://" + DAS_HOST_NAME - + ":" + DAS_PORT + "/services/EventStreamAdminService/"; - - private static final String IOT_MGT_URL = DEFAULT_HTTP_PROTOCOL + "://" + IOT_MGT_HOST_NAME - + ":" + IOT_MGT_PORT + "/services/CarbonAppUploader/"; - private static final String MEDIA_TYPE_XML = "application/xml"; - private static final String DEVICE_MANAGEMENT_TYPE = "device_management"; - private static final String TENANT_DOMAIN_PROPERTY = "\\$\\{tenant-domain\\}"; + private static final String PROTOCOL_TYPE = "MQTT"; + private static final String DESTINATION_TYPE = "TOPIC"; private @Context ServletConfig config; @@ -147,149 +62,54 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic @GET public Response getFilteredSubscriptions( @QueryParam("name") String topic_name, - @QueryParam("remaining_messages") int remaining_messages, @QueryParam("active") String active, @QueryParam("durable") String durable, - @QueryParam("subscriber_name") String subscriber_name, - @QueryParam("identifier") String identifier, - @QueryParam("tenant-domain") String tenantDomain, - @QueryParam("since") String since, @HeaderParam("If-Modified-Since") String ifModifiedSince, @QueryParam("offset") int offset, @QueryParam("limit") int limit) { try { - if (!StringUtils.isEmpty(topic_name) && !StringUtils.isEmpty(active)) { - return Response.status(Response.Status.BAD_REQUEST).entity( - new ErrorResponse.ErrorResponseBuilder().setMessage("Request contains both name and role " + - "parameters. Only one is allowed " + - "at once.").build()).build(); - } - int currentTenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - if (MultitenantConstants.SUPER_TENANT_ID != currentTenantId) { - return Response.status(Response.Status.UNAUTHORIZED).entity( - new ErrorResponse.ErrorResponseBuilder().setMessage( - "Current logged in user is not authorized to perform this operation").build()).build(); - } - String ten_Domain = getTenantDomain(currentTenantId); - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(ten_Domain); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MQTTMgtAPIUtils.getTenantId(ten_Domain)); - + String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); RequestValidationUtil.validatePaginationParameters(offset, limit); - HttpSession session = request.getSession(); - AndesMQTTAdminServiceStub andesAdminStub = getAndesMQTTAdminServiceStub(config, session, request); - TopicPaginationRequest request = new TopicPaginationRequest(offset, limit); - PaginationResult result; - TopicList topics = new TopicList(); + AndesMQTTAdminServiceStub andesAdminStub = getAndesMQTTAdminServiceStub(config); + MQTTSubscription mqttSubscription = new MQTTSubscription(); + mqttSubscription.setFilteredNamePattern(""); + mqttSubscription.setDurable(false); + mqttSubscription.setActive(true); + mqttSubscription.setProtocolType(PROTOCOL_TYPE); + mqttSubscription.setDestinationType(DESTINATION_TYPE); + mqttSubscription.setFilteredNameByExactMatch(false); + mqttSubscription.setIdentifierPattern(""); + mqttSubscription.setIdentifierPatternByExactMatch(false); + mqttSubscription.setOwnNodeId("All"); + mqttSubscription.setPageNumber(offset); + mqttSubscription.setSubscriptionCountPerPage(limit); if (topic_name != null && !topic_name.isEmpty()) { - request.setTopic_name(topic_name); - } - if (remaining_messages != 0) { - request.setRemaining_messages(remaining_messages); + mqttSubscription.setFilteredNamePattern(topic_name); } if (active != null && !active.isEmpty()) { - request.setActive(active); + mqttSubscription.setActive(Boolean.parseBoolean(active)); } if (durable != null && !durable.isEmpty()) { - request.setDurable(durable); - } - if (subscriber_name != null && !subscriber_name.isEmpty()) { - request.setSubscriber_name(subscriber_name); + mqttSubscription.setDurable(Boolean.parseBoolean(durable)); } - if (identifier != null && !identifier.isEmpty()) { - request.setIdentifier(identifier); - } - -// Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredMQTTSubscriptions(false, true, -// "MQTT", "TOPIC", "", false, -// "", false, "All", offset, -// 10,currentTenantId,tenantDomain); - Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, - "MQTT", "TOPIC", topic_name, false, - "", false, "All", offset, - 10); - Map subscriptions = new HashMap<>(); - subscriptions.put("subscriptions", filteredNormalTopicSubscriptionList); + Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions( + mqttSubscription, tenantDomain); + SubscriptionList topics = new SubscriptionList(); - //getPaginatedTopics(request,subscriptions); - - if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { - Date sinceDate; - SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); - try { - sinceDate = format.parse(ifModifiedSince); - } catch (ParseException e) { - return Response.status(Response.Status.BAD_REQUEST).entity( - new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " + - "string is provided in 'If-Modified-Since' header").build()).build(); - } - request.setSince(sinceDate); - result = getPaginatedTopics(request,subscriptions); - if (result == null || result.getData() == null || result.getData().size() <= 0) { - return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " + - "after the timestamp provided in 'If-Modified-Since' header").build(); - } - } else if (since != null && !since.isEmpty()) { - Date sinceDate; - SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); - try { - sinceDate = format.parse(since); - } catch (ParseException e) { - return Response.status(Response.Status.BAD_REQUEST).entity( - new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " + - "string is provided in 'since' filter").build()).build(); - } - request.setSince(sinceDate); - result = getPaginatedTopics(request,subscriptions); - if (result == null || result.getData() == null || result.getData().size() <= 0) { - topics.setList(new ArrayList()); - topics.setCount(0); - return Response.status(Response.Status.OK).entity(topics).build(); - } - } else { - result = getPaginatedTopics(request,subscriptions); - int resultCount = result.getRecordsTotal(); - if (resultCount == 0) { - Response.status(Response.Status.OK).entity(topics).build(); - } + if (filteredNormalTopicSubscriptionList != null) { + topics.setList(Arrays.asList(filteredNormalTopicSubscriptionList)); + topics.setCount(filteredNormalTopicSubscriptionList.length); } - topics.setList((List) result.getData()); - topics.setCount(result.getRecordsTotal()); - - - return Response.status(Response.Status.OK).entity(subscriptions).build(); -// return Response.ok().entity(subscriptions).build(); - } catch (DeviceManagementException e) { - String msg = "Error occurred at server side while fetching device list."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } catch (AxisFault e) { - String msg = "Error occurred at server side while fetching service stub."; + return Response.status(Response.Status.OK).entity(topics).build(); + } catch (RemoteException | AndesMQTTAdminServiceBrokerManagerAdminException e) { + String msg = "Error occurred at server side while fetching topic list."; log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } catch (RemoteException e) { - String msg = "Error occurred at server side while fetching service stub."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } catch (AndesMQTTAdminServiceBrokerManagerAdminException e) { - String msg = "Error occurred at server side while fetching service stub."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } catch (AuthenticationException e) { - String msg = "Error occurred at server side while fetching service stub."; - log.error(msg, e); - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); - } finally { - PrivilegedCarbonContext.endTenantFlow(); } } @@ -297,27 +117,26 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic * Gets the AndesAdminServices stub. * * @param config the servlet configuration - * @param session the http session - * @param request the http servlet request * @return an AndesAdminServiceStub * @throws AxisFault */ - private static AndesMQTTAdminServiceStub getAndesMQTTAdminServiceStub(ServletConfig config, - HttpSession session, - HttpServletRequest request) + private static AndesMQTTAdminServiceStub getAndesMQTTAdminServiceStub(ServletConfig config) throws AxisFault { - String hostName = CarbonUtils.getServerConfiguration().getFirstProperty("HostName"); - final String MQTT_ENDPOINT = "9446"; + String hostName = System.getProperty("mqtt.broker.host"); + final String MQTT_ENDPOINT = System.getProperty("mqtt.broker.https.port"); if (hostName == null) { - hostName = System.getProperty("carbon.local.ip"); + hostName = System.getProperty("mqtt.broker.host"); } - String backendServerURL = "https://" + hostName + ":" + MQTT_ENDPOINT + "/services/AndesMQTTAdminService.AndesMQTTAdminServiceHttpsSoap11Endpoint/"; + String backendServerURL = "https://" + hostName + ":" + MQTT_ENDPOINT + + "/services/AndesMQTTAdminService.AndesMQTTAdminServiceHttpsSoap11Endpoint/"; ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); AndesMQTTAdminServiceStub stub = new AndesMQTTAdminServiceStub(configContext, backendServerURL); + + // TODO: Need to use JWT Authenticator instead of Basic Auth HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator(); basicAuthentication.setUsername("admin"); basicAuthentication.setPassword("admin"); @@ -326,77 +145,4 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic return stub; } - - private PaginationResult getPaginatedTopics(TopicPaginationRequest request,Map subscriptions) throws DeviceManagementException { - PaginationResult paginationResult = new PaginationResult(); - List allSubscriptions = new ArrayList<>(); - Map ss = subscriptions; - int count = 0; - int tenantId = this.getTenantId(); - request = TopicManagerUtil.validateTopicListPageSize(request); - - List subscriptionList = new ArrayList<>(subscriptions.values()); - -// allSubscriptions = Arrays.asList(subscriptionList.size()); - count = subscriptionList.size(); - -// paginationResult.setData(allSubscriptions); - paginationResult.setRecordsFiltered(count); - paginationResult.setRecordsTotal(count); - return paginationResult; - } - - private int getTenantId() { - return CarbonContext.getThreadLocalCarbonContext().getTenantId(); - } - - private static String getTenantDomain(int tenantId) throws AuthenticationException { - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - - RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); - if (realmService == null) { - String msg = "RealmService is not initialized"; - log.error(msg); - throw new AuthenticationException(msg); - } - - return realmService.getTenantManager().getDomain(tenantId); - - } catch (UserStoreException e) { - String msg = "User store not initialized"; - log.error(msg); - throw new AuthenticationException(msg, e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - - /** - * Initializes the SSL Context - */ - private void initSSLConnection() throws NoSuchAlgorithmException, UnrecoverableKeyException, - KeyStoreException, KeyManagementException { - KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KEY_MANAGER_TYPE); - keyManagerFactory.init(keyStore, keyStorePassword); - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TRUST_MANAGER_TYPE); - trustManagerFactory.init(trustStore); - - // Create and initialize SSLContext for HTTPS communication - sslContext = SSLContext.getInstance(SSLV3); - sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null); - SSLContext.setDefault(sslContext); - } - - private void cleanup(Stub stub) { - if (stub != null) { - try { - stub.cleanup(); - } catch (AxisFault axisFault) { - //do nothing - } - } - } - } diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 04b89d852..7b5195f1e 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -24,7 +24,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.38-SNAPSHOT + 4.0.2-SNAPSHOT ../pom.xml From 639341c545c043c2db727109209c10fcefdb0df1 Mon Sep 17 00:00:00 2001 From: WSO2 Builder Date: Tue, 19 Sep 2017 09:00:19 +0000 Subject: [PATCH 22/24] [WSO2 Release] [Jenkins #3017] [Release 4.0.81] prepare release v4.0.81 --- .../org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml | 2 +- .../org.wso2.carbon.appmgt.mdm.restconnector/pom.xml | 2 +- components/extensions/appm-connector/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/pull-notification-listeners/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- .../org.wso2.gpl.siddhi.extension.geo.script/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.windows/pom.xml | 2 +- components/mobile-plugins/windows-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 6 +++--- .../pom.xml | 6 +++--- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/windows-plugin-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 91 files changed, 114 insertions(+), 114 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index 4f0459ef3..ebe53dd8d 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 636be96a1..e3257bcb1 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index 39e5abd0a..b3b38e415 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index 1fc3b8499..3424093b2 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index be71bc608..bbad960cf 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index a50107f8e..fd4ae28bd 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 2403bd5fa..188718efe 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index d0da371f7..2ee551274 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index 9f0d90288..f148a9dc6 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 94d7b04ea..4fd490e55 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 67e3ddb1a..304a5e1d6 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index f300d829d..14472489b 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index e981b2c3f..a8514a8d7 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 8a5df0c51..f88de0578 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 9c55cdb04..b700af153 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index 90af06d70..c59235ad5 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index d9dab18a1..be627ac58 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index a7a0a1892..14e592873 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index e4187eac2..eea673c97 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index e83c9ec1a..a3ba447da 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index 9c37bdedb..771e95df4 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 8d4ab5718..c29b05e63 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 2de0f548c..09edb3e47 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 5e61156fc..4cbfa5312 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml index 0d6479a33..62bb646d4 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml index b9bae117f..f8bb091e7 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/appm-connector/pom.xml b/components/extensions/appm-connector/pom.xml index fdd268c10..c06e3fe4f 100644 --- a/components/extensions/appm-connector/pom.xml +++ b/components/extensions/appm-connector/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 85e13b251..e03e578c0 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index 584fbca39..e5fc90edd 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index 05d318e44..efc6716ab 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index 9d3419459..437e9e2a9 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 4777a67a5..5657d62dc 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 4e4e9bb03..47937da76 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index 20d2fe395..ad09c7b1e 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index ded1bc8d3..a08b449b4 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 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 e05ccaa49..590065029 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 - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 481bd0e57..9ec5b3bcb 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 - 4.0.81-SNAPSHOT + 4.0.81 ../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 8a8fff345..3357e66fa 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 - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 5254cd0d1..4c6948fd1 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 - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index b578abac3..805d3857d 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 - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index 224c9d4e1..87d7b1121 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index ec45c5baa..10d748a70 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.0.81-SNAPSHOT + 4.0.81 ../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 ade0fd038..e7f2af5ec 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 - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index 7c3746c81..d05d0461a 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index aabab1ee1..53a428941 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 - 4.0.81-SNAPSHOT + 4.0.81 ../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 f66026707..c9558953b 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 - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index c9f75453f..7ca15a523 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index a382b811f..1d90a21f1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index a70b06474..0fc65fe0b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 215091065..c61006620 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 8c130ed6c..9cc04f06d 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index b0eaf7517..19746b5a6 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -21,7 +21,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml index 8639667d5..824b0d58c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml @@ -23,13 +23,13 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.ui - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Mobile Windows UI pom diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml index 208d6ce1e..03f08e7d9 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml @@ -22,7 +22,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index 6ce2dfa4e..b7fefe6c3 100644 --- a/components/mobile-plugins/windows-plugin/pom.xml +++ b/components/mobile-plugins/windows-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml index 1b0ad8fca..494a5ad9f 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index 60f38fdc5..58859e06d 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 803e002fb..ed0fb8cb5 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index 1a030fa7b..6deff866a 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 7ed34ca09..83ab44acc 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml index 2b089a189..b21d264ad 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - IoT Server Android Sense Analytics Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml index 2531dc2e1..572d24885 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.backend.feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - IoT Server Android Sense Backend Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml index 7cbc94aa3..7b5a91442 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.ui.feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - IoT Server Android Sense UI Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index 4620c0dc4..80332b582 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml index f71fa4855..c6477e60b 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml index cc41e58fe..145043a20 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml index dea416132..d5f5a07a7 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index a76075691..043c614c7 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index a6b20734f..5c5bd5918 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 device-types-feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml index 41de557a5..f3b213454 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml index fd900befd..914cd58f2 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml index 711d0589d..7824bdf43 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index c358ae93e..5593236dc 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml index f9d00a6a7..1c0fdc2f3 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml index 22d577539..c9950f99b 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml index 4d18b50d8..dc90e7ed1 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index cce7a6430..c20201ae3 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index ff41ef7f2..2d6d014b4 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml index 6215bcb96..265c4cd94 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml org.wso2.carbon.appmgt.mdm.osgiconnector.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - App management MDM OSGI Connector http://wso2.org This feature contains the core bundles required for APP management OSGI MDM connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.osgiconnector - 4.0.81-SNAPSHOT + 4.0.81 org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml index b13b41c39..1ccdc138d 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml org.wso2.carbon.appmgt.mdm.restconnector.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - App management MDM REST Connector http://wso2.org This feature contains the core bundles required for APP management MDM REST connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.restconnector - 4.0.81-SNAPSHOT + 4.0.81 org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index 808179c98..099e705c9 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml index 12ef039f9..f73c5c6bc 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.notification.listener.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Notification Listener http://wso2.org This feature contains the core bundles required iot core listeners diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index a4da49725..83807499c 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml index c658f3375..f4a73733b 100644 --- a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml +++ b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 53721e071..4f600cc2d 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 extensions-feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - Device Management Extensions http://wso2.org diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml index 48dea896b..d7db79226 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index a362e00eb..bb98d51a0 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 android-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index 7e2b2dd8a..0af4d9c1e 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81-SNAPSHOT + 4.0.81 ../../pom.xml 4.0.0 mobile-plugins-feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml index 8efe4f1b6..25866d484 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins windows-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.feature pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Windows Device Management Feature http://wso2.org This feature contains the core bundles required for Windows Device Management diff --git a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml index 7bdd7edf9..47084caf5 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 4.0.81-SNAPSHOT + 4.0.81 ../pom.xml 4.0.0 windows-plugin-feature - 4.0.81-SNAPSHOT + 4.0.81 pom WSO2 Carbon - Device Management Windows Plugin Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 1e806074b..052aeb837 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 4.0.81-SNAPSHOT + 4.0.81 WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1148,7 +1148,7 @@ 1.2.40 - 4.0.81-SNAPSHOT + 4.0.81 4.4.8 @@ -1275,7 +1275,7 @@ scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git - HEAD + v4.0.81 From 58d6611076cd5cbb2dfedca9302c10ec99dcfe31 Mon Sep 17 00:00:00 2001 From: WSO2 Builder Date: Tue, 19 Sep 2017 09:00:33 +0000 Subject: [PATCH 23/24] [WSO2 Release] [Jenkins #3017] [Release 4.0.81] prepare for next development iteration --- .../org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml | 2 +- .../org.wso2.carbon.appmgt.mdm.restconnector/pom.xml | 2 +- components/extensions/appm-connector/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/pull-notification-listeners/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- .../org.wso2.gpl.siddhi.extension.geo.script/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.windows/pom.xml | 2 +- components/mobile-plugins/windows-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 6 +++--- .../pom.xml | 6 +++--- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/windows-plugin-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 91 files changed, 114 insertions(+), 114 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index ebe53dd8d..4bf295490 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index e3257bcb1..6a15b1397 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index b3b38e415..eef2ad9cd 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index 3424093b2..0c23584b1 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index bbad960cf..eaeb2a4f3 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index fd4ae28bd..d73a48515 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 188718efe..e1ec91ce7 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 2ee551274..fb46e6d21 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index f148a9dc6..0b59bb05d 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 4fd490e55..d0c48c27a 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 304a5e1d6..7654b0352 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index 14472489b..c830201c6 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index a8514a8d7..89ece8c5a 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index f88de0578..8f12f7232 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index b700af153..a179faae7 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index c59235ad5..f79628fcf 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index be627ac58..cd093372b 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index 14e592873..65b0371b4 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index eea673c97..c554762d2 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index a3ba447da..bcd4193b6 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index 771e95df4..44435357e 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index c29b05e63..7565fcf30 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 09edb3e47..70e737391 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 4cbfa5312..becf56b36 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml index 62bb646d4..b00a2a97b 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml index f8bb091e7..c642c1501 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/pom.xml b/components/extensions/appm-connector/pom.xml index c06e3fe4f..740d9b987 100644 --- a/components/extensions/appm-connector/pom.xml +++ b/components/extensions/appm-connector/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index e03e578c0..3f95eb545 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index e5fc90edd..56a94cff4 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index efc6716ab..e45aa47cc 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index 437e9e2a9..8a5f09fd0 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 5657d62dc..31c9994aa 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 47937da76..1eeb21466 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index ad09c7b1e..ebea30133 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index a08b449b4..0daa178b1 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 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 590065029..2c11b6c12 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 - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 9ec5b3bcb..d590ef4e7 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 - 4.0.81 + 4.0.82-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 3357e66fa..4ea37d3e0 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 - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 4c6948fd1..bddf02d41 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 - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 805d3857d..e17c39691 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 - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index 87d7b1121..2f924bf15 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index 10d748a70..6adc12a7a 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.0.81 + 4.0.82-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 e7f2af5ec..cb926020f 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 - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index d05d0461a..9923b8eab 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index 53a428941..7c62325ca 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 - 4.0.81 + 4.0.82-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 c9558953b..1f6b83c65 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 - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index 7ca15a523..90572e61a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index 1d90a21f1..59bb8500e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index 0fc65fe0b..9fc8fb443 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index c61006620..6648eeea4 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 9cc04f06d..5df367b11 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index 19746b5a6..a93f8d42e 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -21,7 +21,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml index 824b0d58c..4cdf5149e 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml @@ -23,13 +23,13 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.ui - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Mobile Windows UI pom diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml index 03f08e7d9..f95188c08 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml @@ -22,7 +22,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index b7fefe6c3..fc0e0752d 100644 --- a/components/mobile-plugins/windows-plugin/pom.xml +++ b/components/mobile-plugins/windows-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml index 494a5ad9f..a7f49bb98 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index 58859e06d..2d7ee8ac3 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index ed0fb8cb5..1be314ff6 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index 6deff866a..0c5604934 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 83ab44acc..04a24a96c 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml index b21d264ad..29d614403 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Analytics Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml index 572d24885..37ff896c7 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.backend.feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Backend Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml index 7b5a91442..93409cbab 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.ui.feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense UI Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index 80332b582..2b5275aa6 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml index c6477e60b..5410627ce 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml index 145043a20..f5fb418e7 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml index d5f5a07a7..d9a662f0a 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index 043c614c7..ed68d8842 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 5c5bd5918..a37f94392 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 device-types-feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml index f3b213454..48922d4d3 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml index 914cd58f2..7e0e5a6e9 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml index 7824bdf43..84411ae64 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 5593236dc..fa8815705 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml index 1c0fdc2f3..75384bb76 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml index c9950f99b..002dec38d 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml index dc90e7ed1..8ed5593ae 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index c20201ae3..125df664b 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index 2d6d014b4..648619620 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml index 265c4cd94..fe7d86868 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml org.wso2.carbon.appmgt.mdm.osgiconnector.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - App management MDM OSGI Connector http://wso2.org This feature contains the core bundles required for APP management OSGI MDM connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.osgiconnector - 4.0.81 + 4.0.82-SNAPSHOT org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml index 1ccdc138d..e86dd7361 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml org.wso2.carbon.appmgt.mdm.restconnector.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - App management MDM REST Connector http://wso2.org This feature contains the core bundles required for APP management MDM REST connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.restconnector - 4.0.81 + 4.0.82-SNAPSHOT org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index 099e705c9..fdb148af6 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml index f73c5c6bc..407d30bdf 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.notification.listener.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Notification Listener http://wso2.org This feature contains the core bundles required iot core listeners diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 83807499c..0d2079638 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml index f4a73733b..e0ccd2015 100644 --- a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml +++ b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 4f600cc2d..e4607dda7 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 extensions-feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - Device Management Extensions http://wso2.org diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml index d7db79226..70496160f 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index bb98d51a0..cbfe39226 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 android-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index 0af4d9c1e..1a786bea0 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.81 + 4.0.82-SNAPSHOT ../../pom.xml 4.0.0 mobile-plugins-feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml index 25866d484..5ed1d4565 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins windows-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.feature pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Windows Device Management Feature http://wso2.org This feature contains the core bundles required for Windows Device Management diff --git a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml index 47084caf5..3f17adfff 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 4.0.81 + 4.0.82-SNAPSHOT ../pom.xml 4.0.0 windows-plugin-feature - 4.0.81 + 4.0.82-SNAPSHOT pom WSO2 Carbon - Device Management Windows Plugin Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 052aeb837..181c081af 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 4.0.81 + 4.0.82-SNAPSHOT WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1148,7 +1148,7 @@ 1.2.40 - 4.0.81 + 4.0.82-SNAPSHOT 4.4.8 @@ -1275,7 +1275,7 @@ scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git - v4.0.81 + HEAD From 057b735b77305c140af182a407a3d39c88e760e5 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Tue, 19 Sep 2017 15:47:19 -0500 Subject: [PATCH 24/24] Refactored MQTT management admin service component --- .../pom.xml | 2 +- .../device/mgt/jaxrs/beans/Scope.java | 71 --- .../ConstraintViolationException.java | 55 --- .../device/mgt/jaxrs/exception/ErrorDTO.java | 86 ---- .../jaxrs/exception/ForbiddenException.java | 51 --- .../exception/GlobalThrowableMapper.java | 113 ----- .../exception/MQTTConfigurationException.java | 59 +++ .../jaxrs/exception/NotFoundException.java | 47 -- .../UnexpectedServerErrorException.java | 49 --- .../exception/ValidationInterceptor.java | 122 ------ .../MQTTManagementAdminService.java | 2 +- .../MQTTManagementAdminServiceImpl.java | 31 +- .../service/impl/util/TopicManagerUtil.java | 409 ------------------ .../util/InputValidationException.java | 2 +- .../mgt/jaxrs/util/MQTTMgtAPIUtils.java | 15 - .../impl => }/util/RequestValidationUtil.java | 2 +- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 6 +- .../pom.xml | 2 +- pom.xml | 2 +- 19 files changed, 84 insertions(+), 1042 deletions(-) delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java create mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/MQTTConfigurationException.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java rename components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/{api/admin => }/MQTTManagementAdminService.java (99%) rename components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/{admin => }/MQTTManagementAdminServiceImpl.java (84%) delete mode 100644 components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java rename components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/{service/impl => }/util/InputValidationException.java (93%) rename components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/{service/impl => }/util/RequestValidationUtil.java (95%) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index d2447bdab..04c69ee68 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 4.0.2-SNAPSHOT + 4.0.73-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java deleted file mode 100644 index 171fe7726..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/beans/Scope.java +++ /dev/null @@ -1,71 +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.andes.extensions.device.mgt.jaxrs.beans; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -@ApiModel(value = "Scope", description = "Template of the authorization scope") -public class Scope { - - @ApiModelProperty(name = "scope key", value = "An unique string as a key.", required = true) - private String key; - - @ApiModelProperty(name = "scope name", value = "Scope name.", required = true) - private String name; - - @ApiModelProperty(name = "roles", value = "List of roles to be associated with the scope", required = true) - private String roles; - - @ApiModelProperty(name = "scope description", value = "A description of the scope", required = true) - private String description; - - public Scope() { - } - - public String getKey() { - return this.key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public String getRoles() { - return this.roles; - } - - public void setRoles(String roles) { - this.roles = roles; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java deleted file mode 100644 index df8680851..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ConstraintViolationException.java +++ /dev/null @@ -1,55 +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.andes.extensions.device.mgt.jaxrs.exception; - -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; -//import org.wso2.carbon.andes.extensionstensions.device.mgt.jaxrs.util.DeviceMgtUtil; - -import javax.validation.ConstraintViolation; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import java.util.Set; - -public class ConstraintViolationException extends WebApplicationException { - private String message; - - public ConstraintViolationException(Set> violations) { -// super(Response.status(Response.Status.BAD_REQUEST) -// .entity(DeviceMgtUtil.getConstraintViolationErrorDTO(violations)) -// .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) -// .build()); -// -// //Set the error message -// StringBuilder stringBuilder = new StringBuilder(); -// for (ConstraintViolation violation : violations) { -// stringBuilder.append(violation.getRootBeanClass().getSimpleName()); -// stringBuilder.append("."); -// stringBuilder.append(violation.getPropertyPath()); -// stringBuilder.append(": "); -// stringBuilder.append(violation.getMessage()); -// stringBuilder.append(", "); -// } - //message = stringBuilder.toString(); - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.java deleted file mode 100644 index 4576fa507..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ErrorDTO.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.andes.extensions.device.mgt.jaxrs.exception; - -import java.util.ArrayList; -import java.util.List; - -public class ErrorDTO { - - private Long code = null; - private String message = null; - private String description = null; - - public void setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - } - - public void setCode(Long code) { - this.code = code; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setError(List error) { - this.error = error; - } - - private String moreInfo = null; - - public String getMessage() { - return message; - } - - public Long getCode() { - return code; - } - - public String getDescription() { - return description; - } - - public String getMoreInfo() { - return moreInfo; - } - - public List getError() { - return error; - } - - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("class ErrorDTO {\n"); - stringBuilder.append(" code: ").append(code).append("\n"); - stringBuilder.append(" message: ").append(message).append("\n"); - stringBuilder.append(" description: ").append(description).append("\n"); - stringBuilder.append(" moreInfo: ").append(moreInfo).append("\n"); - stringBuilder.append(" error: ").append(error).append("\n"); - stringBuilder.append("}\n"); - return stringBuilder.toString(); - } - - private List error = new ArrayList<>(); - -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java deleted file mode 100644 index f6261162a..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ForbiddenException.java +++ /dev/null @@ -1,51 +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.andes.extensions.device.mgt.jaxrs.exception; - -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -/** - * Exception class that is corresponding to 401 Forbidden response - */ - -public class ForbiddenException extends WebApplicationException { - - private String message; - - public ForbiddenException() { - super(Response.status(Response.Status.FORBIDDEN) - .build()); - } - - public ForbiddenException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.FORBIDDEN) - .entity(errorDTO) - .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java deleted file mode 100644 index 357fe68af..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/GlobalThrowableMapper.java +++ /dev/null @@ -1,113 +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.andes.extensions.device.mgt.jaxrs.exception; - -import com.google.gson.JsonParseException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -//import org.wso2.carbon.andes.extensionsnsions.device.mgt.jaxrs.util.DeviceMgtUtil; - -import javax.naming.AuthenticationException; -import javax.ws.rs.ClientErrorException; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; - -/** - * Handle the cxf level exceptions. - */ -public class GlobalThrowableMapper implements ExceptionMapper { - private static final Log log = LogFactory.getLog(GlobalThrowableMapper.class); - - private ErrorDTO e500 = new ErrorDTO(); - - GlobalThrowableMapper() { - e500.setCode((long) 500); - e500.setMessage("Internal server error."); - e500.setMoreInfo(""); - e500.setDescription("The server encountered an internal error. Please contact administrator."); - - } - - @Override - public Response toResponse(Throwable e) { - -// if (e instanceof JsonParseException) { -// String errorMessage = "Malformed request body."; -// if (log.isDebugEnabled()) { -// log.error(errorMessage, e); -// } -// return DeviceMgtUtil.buildBadRequestException(errorMessage).getResponse(); -// } - if (e instanceof NotFoundException) { - return ((NotFoundException) e).getResponse(); - } - if (e instanceof UnexpectedServerErrorException) { - if (log.isDebugEnabled()) { - log.error("Unexpected server error.", e); - } - return ((UnexpectedServerErrorException) e).getResponse(); - } - if (e instanceof ConstraintViolationException) { - if (log.isDebugEnabled()) { - log.error("Constraint violation.", e); - } - return ((ConstraintViolationException) e).getResponse(); - } - if (e instanceof IllegalArgumentException) { - ErrorDTO errorDetail = new ErrorDTO(); - errorDetail.setCode((long) 400); - errorDetail.setMoreInfo(""); - errorDetail.setMessage(""); - errorDetail.setDescription(e.getMessage()); - return Response - .status(Response.Status.BAD_REQUEST) - .entity(errorDetail) - .build(); - } - if (e instanceof ClientErrorException) { - if (log.isDebugEnabled()) { - log.error("Client error.", e); - } - return ((ClientErrorException) e).getResponse(); - } - if (e instanceof AuthenticationException) { - ErrorDTO errorDetail = new ErrorDTO(); - errorDetail.setCode((long) 401); - errorDetail.setMoreInfo(""); - errorDetail.setMessage(""); - errorDetail.setDescription(e.getMessage()); - return Response - .status(Response.Status.UNAUTHORIZED) - .entity(errorDetail) - .build(); - } - if (e instanceof ForbiddenException) { - if (log.isDebugEnabled()) { - log.error("Resource forbidden.", e); - } - return ((ForbiddenException) e).getResponse(); - } - //unknown exception log and return - if (log.isDebugEnabled()) { - log.error("An Unknown exception has been captured by global exception mapper.", e); - } - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).header("Content-Type", "application/json") - .entity(e500).build(); - } -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/MQTTConfigurationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/MQTTConfigurationException.java new file mode 100644 index 000000000..d11ae3d70 --- /dev/null +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/MQTTConfigurationException.java @@ -0,0 +1,59 @@ +/* + * 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.andes.extensions.device.mgt.jaxrs.exception; + +/** + * This class is used to handle MQTT configuration related exceptions + */ +public class MQTTConfigurationException extends Exception { + + private static final long serialVersionUID = -3151279311929070288L; + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + setErrorMessage(errorMessage); + } + + public MQTTConfigurationException(String errorMessage) { + super(errorMessage); + } + + public MQTTConfigurationException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public MQTTConfigurationException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public MQTTConfigurationException() { + super(); + } + + public MQTTConfigurationException(Throwable cause) { + super(cause); + } +} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java deleted file mode 100644 index 9db522236..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/NotFoundException.java +++ /dev/null @@ -1,47 +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.andes.extensions.device.mgt.jaxrs.exception; - - -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class NotFoundException extends WebApplicationException { - private String message; - private static final long serialVersionUID = 147943572342342340L; - - public NotFoundException(ErrorResponse error) { - super(Response.status(Response.Status.NOT_FOUND).entity(error).build()); - } - public NotFoundException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.NOT_FOUND) - .entity(errorDTO) - .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java deleted file mode 100644 index cf0ec561b..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/UnexpectedServerErrorException.java +++ /dev/null @@ -1,49 +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.andes.extensions.device.mgt.jaxrs.exception; - - -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.Constants; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class UnexpectedServerErrorException extends WebApplicationException { - private String message; - private static final long serialVersionUID = 147943579458906890L; - - public UnexpectedServerErrorException(ErrorResponse error) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); - } - public UnexpectedServerErrorException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(errorDTO) - .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } - - -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java deleted file mode 100644 index 0261945a4..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/exception/ValidationInterceptor.java +++ /dev/null @@ -1,122 +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.andes.extensions.device.mgt.jaxrs.exception; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.jaxrs.lifecycle.ResourceProvider; -import org.apache.cxf.jaxrs.model.ClassResourceInfo; -import org.apache.cxf.jaxrs.model.OperationResourceInfo; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageContentsList; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import javax.validation.executable.ExecutableValidator; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Set; - -public class ValidationInterceptor extends AbstractPhaseInterceptor { - private Log log = LogFactory.getLog(getClass()); - private Validator validator = null; //validator interface is thread-safe - - public ValidationInterceptor() { - super(Phase.PRE_INVOKE); - ValidatorFactory defaultFactory = Validation.buildDefaultValidatorFactory(); - validator = defaultFactory.getValidator(); - if (validator == null) { - log.warn("Bean Validation provider could not be found, no validation will be performed"); - } else { - log.debug("Validation In-Interceptor initialized successfully"); - } - } - - @Override - public void handleMessage(Message message) throws Fault { - final OperationResourceInfo operationResource = message.getExchange().get(OperationResourceInfo.class); - if (operationResource == null) { - log.info("OperationResourceInfo is not available, skipping validation"); - return; - } - - final ClassResourceInfo classResource = operationResource.getClassResourceInfo(); - if (classResource == null) { - log.info("ClassResourceInfo is not available, skipping validation"); - return; - } - - final ResourceProvider resourceProvider = classResource.getResourceProvider(); - if (resourceProvider == null) { - log.info("ResourceProvider is not available, skipping validation"); - return; - } - - final List arguments = MessageContentsList.getContentsList(message); - final Method method = operationResource.getAnnotatedMethod(); - final Object instance = resourceProvider.getInstance(message); - if (method != null && arguments != null) { - //validate the parameters(arguments) over the invoked method - validate(method, arguments.toArray(), instance); - - //validate the fields of each argument - for (Object arg : arguments) { - if (arg != null) - validate(arg); - } - } - - } - - public void validate(final Method method, final Object[] arguments, final T instance) { - if (validator == null) { - log.warn("Bean Validation provider could not be found, no validation will be performed"); - return; - } - - ExecutableValidator methodValidator = validator.forExecutables(); - Set> violations = methodValidator.validateParameters(instance, - method, arguments); - - if (!violations.isEmpty()) { - throw new ConstraintViolationException(violations); - } - } - - public void validate(final T object) { - if (validator == null) { - log.warn("Bean Validation provider could be found, no validation will be performed"); - return; - } - - Set> violations = validator.validate(object); - - if (!violations.isEmpty()) { - throw new ConstraintViolationException(violations); - } - } - - public void handleFault(org.apache.cxf.message.Message messageParam) { - } -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/MQTTManagementAdminService.java similarity index 99% rename from components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java rename to components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/MQTTManagementAdminService.java index acb46ce9e..614b30f20 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/api/admin/MQTTManagementAdminService.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/MQTTManagementAdminService.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.api.admin; +package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Info; diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/MQTTManagementAdminServiceImpl.java similarity index 84% rename from components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java rename to components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/MQTTManagementAdminServiceImpl.java index 4101194d0..dc62c7a40 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/MQTTManagementAdminServiceImpl.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.admin; +package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; @@ -29,11 +29,15 @@ import org.wso2.carbon.andes.core.types.xsd.MQTTSubscription; import org.wso2.carbon.andes.core.types.xsd.Subscription; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.SubscriptionList; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.api.admin.MQTTManagementAdminService; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.exception.MQTTConfigurationException; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.MQTTManagementAdminService; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.MQTTMgtAPIUtils; +import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util.RequestValidationUtil; import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceBrokerManagerAdminException; import org.wso2.carbon.andes.mqtt.stub.AndesMQTTAdminServiceStub; import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.user.api.UserStoreException; + import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; @@ -105,7 +109,8 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic } return Response.status(Response.Status.OK).entity(topics).build(); - } catch (RemoteException | AndesMQTTAdminServiceBrokerManagerAdminException e) { + } catch (RemoteException | AndesMQTTAdminServiceBrokerManagerAdminException | + UserStoreException | MQTTConfigurationException e) { String msg = "Error occurred at server side while fetching topic list."; log.error(msg, e); return Response.serverError().entity( @@ -118,28 +123,28 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic * * @param config the servlet configuration * @return an AndesAdminServiceStub - * @throws AxisFault + * @throws AxisFault, UserStoreException */ private static AndesMQTTAdminServiceStub getAndesMQTTAdminServiceStub(ServletConfig config) - throws AxisFault { + throws AxisFault, UserStoreException, MQTTConfigurationException { String hostName = System.getProperty("mqtt.broker.host"); - final String MQTT_ENDPOINT = System.getProperty("mqtt.broker.https.port"); + String mqttPort = System.getProperty("mqtt.broker.https.port"); - if (hostName == null) { - hostName = System.getProperty("mqtt.broker.host"); + if (hostName == null || mqttPort == null) { + throw new MQTTConfigurationException("MQTT hostname/port configuration is not available in system " + + "properties"); } - String backendServerURL = "https://" + hostName + ":" + MQTT_ENDPOINT + + String backendServerURL = "https://" + hostName + ":" + mqttPort + "/services/AndesMQTTAdminService.AndesMQTTAdminServiceHttpsSoap11Endpoint/"; ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); AndesMQTTAdminServiceStub stub = new AndesMQTTAdminServiceStub(configContext, backendServerURL); - // TODO: Need to use JWT Authenticator instead of Basic Auth HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator(); - basicAuthentication.setUsername("admin"); - basicAuthentication.setPassword("admin"); + basicAuthentication.setUsername(MQTTMgtAPIUtils.getUserRealm().getRealmConfiguration().getAdminUserName()); + basicAuthentication.setPassword(MQTTMgtAPIUtils.getUserRealm().getRealmConfiguration().getAdminPassword()); stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication); return stub; diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java deleted file mode 100644 index c3d15275c..000000000 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/TopicManagerUtil.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2014, 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.andes.extensions.device.mgt.jaxrs.service.impl.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.TopicPaginationRequest; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.device.mgt.common.*; -import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; -import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; -import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; -import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; -import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; -import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO; -import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; -import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; -import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants; -import org.wso2.carbon.device.mgt.core.operation.mgt.util.DeviceIDHolder; -import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; -import org.wso2.carbon.user.api.TenantManager; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.ConfigurationContextService; -import org.wso2.carbon.utils.NetworkUtils; - -import javax.sql.DataSource; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; -import java.util.*; - - -public final class TopicManagerUtil { - - private static final Log log = LogFactory.getLog(DeviceManagerUtil.class); - - public static Document convertToDocument(File file) throws DeviceManagementException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - return docBuilder.parse(file); - } catch (Exception e) { - throw new DeviceManagementException("Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document", e); - } - } - - /** - * Resolve data source from the data source definition. - * - * @param config data source configuration - * @return data source resolved from the data source definition - */ - public static DataSource resolveDataSource(DataSourceConfig config) { - DataSource dataSource = null; - if (config == null) { - throw new RuntimeException("Device Management Repository data source configuration is null and thus, " + - "is not initialized"); - } - JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); - if (jndiConfig != null) { - if (log.isDebugEnabled()) { - log.debug("Initializing Device Management Repository data source using the JNDI Lookup Definition"); - } - List jndiPropertyList = - jndiConfig.getJndiProperties(); - if (jndiPropertyList != null) { - Hashtable jndiProperties = new Hashtable(); - for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { - jndiProperties.put(prop.getName(), prop.getValue()); - } - dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); - } else { - dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); - } - } - return dataSource; - } - - /** - * Adds a new device type to the database if it does not exists. - * - * @param typeName device type - * @param tenantId provider tenant Id - * @param isSharedWithAllTenants is this device type shared with all tenants. - * @return status of the operation - */ - public static boolean registerDeviceType(String typeName, int tenantId, boolean isSharedWithAllTenants) - throws DeviceManagementException { - boolean status; - try { - DeviceManagementDAOFactory.beginTransaction(); - DeviceTypeDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); - DeviceType deviceType = deviceTypeDAO.getDeviceType(typeName, tenantId); - if (deviceType == null) { - deviceType = new DeviceType(); - deviceType.setName(typeName); - deviceTypeDAO.addDeviceType(deviceType, tenantId, isSharedWithAllTenants); - } - DeviceManagementDAOFactory.commitTransaction(); - status = true; - } catch (DeviceManagementDAOException e) { - DeviceManagementDAOFactory.rollbackTransaction(); - throw new DeviceManagementException("Error occurred while registering the device type '" - + typeName + "'", e); - } catch (TransactionManagementException e) { - DeviceManagementDAOFactory.rollbackTransaction(); - throw new DeviceManagementException("SQL occurred while registering the device type '" - + typeName + "'", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - return status; - } - - /** - * Un-registers an existing device type from the device management metadata repository. - * - * @param typeName device type - * @return status of the operation - */ - public static boolean unregisterDeviceType(String typeName, int tenantId) throws DeviceManagementException { - try { - DeviceManagementDAOFactory.beginTransaction(); - DeviceTypeDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); - DeviceType deviceType = deviceTypeDAO.getDeviceType(typeName, tenantId); - if (deviceType != null) { - deviceTypeDAO.removeDeviceType(typeName, tenantId); - } - DeviceManagementDAOFactory.commitTransaction(); - return true; - } catch (DeviceManagementDAOException e) { - DeviceManagementDAOFactory.rollbackTransaction(); - throw new DeviceManagementException("Error occurred while registering the device type '" + - typeName + "'", e); - } catch (TransactionManagementException e) { - DeviceManagementDAOFactory.rollbackTransaction(); - throw new DeviceManagementException("SQL occurred while registering the device type '" + - typeName + "'", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - } - - public static Map convertDevicePropertiesToMap(List properties) { - Map propertiesMap = new HashMap(); - for (Device.Property prop : properties) { - propertiesMap.put(prop.getName(), prop.getValue()); - } - return propertiesMap; - } - - public static List convertDevices(List devices) { - - List deviceIdentifiers = new ArrayList<>(); - for (Device device : devices) { - DeviceIdentifier identifier = new DeviceIdentifier(); - identifier.setId(device.getDeviceIdentifier()); - identifier.setType(device.getType()); - deviceIdentifiers.add(identifier); - } - return deviceIdentifiers; - } - - public static List getValidDeviceIdentifiers(List devices) { - List deviceIdentifiers = new ArrayList<>(); - for (Device device : devices) { - if (device.getEnrolmentInfo() != null) { - switch (device.getEnrolmentInfo().getStatus()) { - case BLOCKED: - case REMOVED: - case SUSPENDED: - break; - default: - DeviceIdentifier identifier = new DeviceIdentifier(); - identifier.setId(device.getDeviceIdentifier()); - identifier.setType(device.getType()); - deviceIdentifiers.add(identifier); - } - } - } - return deviceIdentifiers; - } - - - public static String getServerBaseHttpsUrl() { - String hostName = "localhost"; - try { - hostName = NetworkUtils.getMgtHostName(); - } catch (Exception ignored) { - } - String mgtConsoleTransport = CarbonUtils.getManagementTransport(); - ConfigurationContextService configContextService = - DeviceManagementDataHolder.getInstance().getConfigurationContextService(); - int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport); - int httpsProxyPort = - CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), - mgtConsoleTransport); - if (httpsProxyPort > 0) { - port = httpsProxyPort; - } - return "https://" + hostName + ":" + port; - } - - public static String getServerBaseHttpUrl() { - String hostName = "localhost"; - try { - hostName = NetworkUtils.getMgtHostName(); - } catch (Exception ignored) { - } - ConfigurationContextService configContextService = - DeviceManagementDataHolder.getInstance().getConfigurationContextService(); - int port = CarbonUtils.getTransportPort(configContextService, "http"); - int httpProxyPort = - CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), - "http"); - if (httpProxyPort > 0) { - port = httpProxyPort; - } - return "http://" + hostName + ":" + port; - } - - /** - * returns the tenant Id of the specific tenant Domain - * - * @param tenantDomain - * @return - * @throws DeviceManagementException - */ - public static int getTenantId(String tenantDomain) throws DeviceManagementException { - try { - if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { - return MultitenantConstants.SUPER_TENANT_ID; - } - TenantManager tenantManager = DeviceManagementDataHolder.getInstance().getTenantManager(); - int tenantId = tenantManager.getTenantId(tenantDomain); - if (tenantId == -1) { - throw new DeviceManagementException("invalid tenant Domain :" + tenantDomain); - } - return tenantId; - } catch (UserStoreException e) { - throw new DeviceManagementException("invalid tenant Domain :" + tenantDomain); - } - } - - public static int validateActivityListPageSize(int limit) throws OperationManagementException { - if (limit == 0) { - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). - getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - return deviceManagementConfig.getPaginationConfiguration().getActivityListPageSize(); - } else { - throw new OperationManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); - } - } - return limit; - } - - public static PaginationRequest validateOperationListPageSize(PaginationRequest paginationRequest) throws - OperationManagementException { - if (paginationRequest.getRowCount() == 0) { - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). - getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration(). - getOperationListPageSize()); - } else { - throw new OperationManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); - } - } - return paginationRequest; - } - - public static PaginationRequest validateNotificationListPageSize(PaginationRequest paginationRequest) throws - NotificationManagementException { - if (paginationRequest.getRowCount() == 0) { - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). - getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration(). - getNotificationListPageSize()); - } else { - throw new NotificationManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); - } - } - return paginationRequest; - } - - public static TopicPaginationRequest validateTopicListPageSize(TopicPaginationRequest paginationRequest) throws - DeviceManagementException { - if (paginationRequest.getRowCount() == 0) { - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). - getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration(). - getTopicListPageSize()); - } else { - throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); - } - } - return paginationRequest; - } - - public static GroupPaginationRequest validateGroupListPageSize(GroupPaginationRequest paginationRequest) throws - GroupManagementException { - if (paginationRequest.getRowCount() == 0) { - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance() - .getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - paginationRequest.setRowCount(deviceManagementConfig.getPaginationConfiguration() - .getDeviceListPageSize()); - } else { - throw new GroupManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); - } - } - return paginationRequest; - } - - public static int validateDeviceListPageSize(int limit) throws DeviceManagementException { - if (limit == 0) { - DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). - getDeviceManagementConfig(); - if (deviceManagementConfig != null) { - return deviceManagementConfig.getPaginationConfiguration().getDeviceListPageSize(); - } else { - throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + - "cdm-config.xml file."); - } - } - return limit; - } - - public static DeviceIDHolder validateDeviceIdentifiers(List deviceIDs) { - - List errorDeviceIdList = new ArrayList(); - List validDeviceIDList = new ArrayList(); - - int deviceIDCounter = 0; - for (DeviceIdentifier deviceIdentifier : deviceIDs) { - - deviceIDCounter++; - String deviceID = deviceIdentifier.getId(); - - if (deviceID == null || deviceID.isEmpty()) { - errorDeviceIdList.add(String.format(OperationMgtConstants.DeviceConstants.DEVICE_ID_NOT_FOUND, - deviceIDCounter)); - continue; - } - - try { - - if (isValidDeviceIdentifier(deviceIdentifier)) { - validDeviceIDList.add(deviceIdentifier); - } else { - errorDeviceIdList.add(deviceID); - } - } catch (DeviceManagementException e) { - errorDeviceIdList.add(deviceID); - } - } - - DeviceIDHolder deviceIDHolder = new DeviceIDHolder(); - deviceIDHolder.setValidDeviceIDList(validDeviceIDList); - deviceIDHolder.setErrorDeviceIdList(errorDeviceIdList); - - return deviceIDHolder; - } - - public static boolean isValidDeviceIdentifier(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { - Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier); - if (device == null || device.getDeviceIdentifier() == null || - device.getDeviceIdentifier().isEmpty() || device.getEnrolmentInfo() == null) { - return false; - } else if (EnrolmentInfo.Status.REMOVED.equals(device.getEnrolmentInfo().getStatus())) { - return false; - } - return true; - } -} diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/InputValidationException.java similarity index 93% rename from components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java rename to components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/InputValidationException.java index 812c30ee6..51d511dd6 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/InputValidationException.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/InputValidationException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util; +package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java index 62043c497..725c79450 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/MQTTMgtAPIUtils.java @@ -20,31 +20,16 @@ package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; //import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService; import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; -import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; -import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; -import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; -import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util.InputValidationException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.user.api.AuthorizationManager; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; import javax.ws.rs.core.MediaType; -import java.util.List; /** * MDMAPIUtils class provides utility function used by CDM REST-API classes. diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/RequestValidationUtil.java similarity index 95% rename from components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java rename to components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/RequestValidationUtil.java index 0f479d984..481b5d100 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/util/RequestValidationUtil.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.util; +package org.wso2.carbon.andes.extensions.device.mgt.jaxrs.util; import org.wso2.carbon.andes.extensions.device.mgt.jaxrs.beans.*; diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 7ce4b1256..49017b42b 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -37,10 +37,6 @@ - - @@ -56,7 +52,7 @@ + class="org.wso2.carbon.andes.extensions.device.mgt.jaxrs.service.impl.MQTTManagementAdminServiceImpl"/> diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 7b5195f1e..c0e83fcd6 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -24,7 +24,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 4.0.2-SNAPSHOT + 4.0.73-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index ad4f5c6e9..7f528f659 100644 --- a/pom.xml +++ b/pom.xml @@ -1157,7 +1157,7 @@ 1.1.1 - 3.0.75 + 3.0.107-SNAPSHOT [3.0.0, 4.0.0)