diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java index 452b02d56ba..fdd2e5bb2dd 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/util/APIUtil.java @@ -46,6 +46,8 @@ public class APIUtil { private static final String DEFAULT_APP_MGT_TAG = "application_management"; private static final String DEFAULT_APP_MGT_REVIEW_MGT_TAG = "review_management"; private static final String DEFAULT_APP_MGT_SUB_MGT_TAG = "subscription_management"; + private static final String DEFAULT_ANALYTICS_ARTIFACT_TAG = "analytics_artifacts_management"; + public static final String PERMISSION_PROPERTY_NAME = "name"; public static String getAuthenticatedUser() { @@ -113,6 +115,7 @@ public class APIUtil { allowedApisTags.add(DEFAULT_APP_MGT_TAG); allowedApisTags.add(DEFAULT_APP_MGT_REVIEW_MGT_TAG); allowedApisTags.add(DEFAULT_APP_MGT_SUB_MGT_TAG); + allowedApisTags.add(DEFAULT_ANALYTICS_ARTIFACT_TAG); return allowedApisTags; } diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml new file mode 100644 index 00000000000..3186aa53f1a --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml @@ -0,0 +1,277 @@ + + + + + + + device-mgt + org.wso2.carbon.devicemgt + 3.2.9-SNAPSHOT + ../pom.xml + + + 4.0.0 + io.entgra.carbon.device.mgt.config.api + war + Entgra Carbon - Mobile Device Management Configuration API + Entgra Carbon - Mobile Device Management Configuration API + https://entgra.io + + + + + maven-compiler-plugin + + 1.8 + 1.8 + + + + maven-war-plugin + + WEB-INF/lib/*cxf*.jar + api#device-mgt-config#v1.0 + + + + org.jacoco + jacoco-maven-plugin + + ${basedir}/target/coverage-reports/jacoco-unit.exec + + + + jacoco-initialize + + prepare-agent + + + + jacoco-site + test + + report + + + ${basedir}/target/coverage-reports/jacoco-unit.exec + ${basedir}/target/coverage-reports/site + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + file:src/test/resources/log4j.properties + + + src/test/resources/testng.xml + + + + + + + + + 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-jaxrs + provided + + + org.apache.cxf + cxf-rt-transports-http + provided + + + javax.ws.rs + jsr311-api + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + provided + + + org.apache.axis2.wso2 + axis2-client + + + org.mockito + mockito-core + + + javassist + javassist + + + + + org.wso2.carbon.devicemgt + org.wso2.carbon.certificate.mgt.core + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + + + org.wso2.carbon.identity.framework + org.wso2.carbon.user.mgt + + + + + 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 + + + + + javax.servlet + javax.servlet-api + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + provided + + + javax.ws.rs + javax.ws.rs-api + + + org.powermock + powermock-module-testng + test + + + org.powermock + powermock-api-mockito + test + + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.jwt.client.extension + provided + + + org.wso2.tomcat + tomcat + + + org.wso2.tomcat + tomcat-servlet-api + + + + + diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/ApiOriginFilter.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/ApiOriginFilter.java new file mode 100644 index 00000000000..ae3103866fa --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/ApiOriginFilter.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.jaxrs; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +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/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/beans/ErrorListItem.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/beans/ErrorListItem.java new file mode 100644 index 00000000000..34939b3859b --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/beans/ErrorListItem.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.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/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/beans/ErrorResponse.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/beans/ErrorResponse.java new file mode 100644 index 00000000000..8a6cf834ccc --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/beans/ErrorResponse.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.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. For 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; + } + + 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/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/common/GsonMessageBodyHandler.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/common/GsonMessageBodyHandler.java new file mode 100644 index 00000000000..484c8df866c --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/common/GsonMessageBodyHandler.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.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.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +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/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java new file mode 100644 index 00000000000..4742548f66d --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.jaxrs.service; + +import io.entgra.carbon.device.mgt.config.jaxrs.beans.ErrorResponse; +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.Extension; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Info; +import io.swagger.annotations.ResponseHeader; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Tag; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration; +import org.wso2.carbon.device.mgt.common.search.PropertyMap; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +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 = "DeviceManagementConfiguration"), + @ExtensionProperty(name = "context", + value = "/api/device-mgt-config/v1.0/configurations"), + }) + } + ), + tags = { + @Tag(name = "device_management", description = "") + } +) +@Path("/configurations") +@Api(value = "Device Management Configuration") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Scopes(scopes = { + @Scope( + name = "View configurations", + description = "", + key = "perm:view-configuration", + permissions = {"/device-mgt/platform-configurations/view"} + ) +} +) +public interface DeviceManagementConfigService { + + @GET + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting General device Configurations", + notes = "This API is responsible for send device configuration data to an IOT device when the " + + "device starts provisioning", + tags = "Device Management Configuration" + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched the device configurations.", + response = DeviceConfiguration.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 has been modified " + + "the last time.Used by caches, or in " + + "conditional requests."), + } + ), + @ApiResponse( + code = 400, + message = "Bad request.\n The request contains invalid parameters"), + @ApiResponse( + code = 401, + message = "Unauthorized.\n The requested is not authorized"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while " + + "fetching device configurations.", + response = ErrorResponse.class) + }) + Response getConfiguration(@ApiParam( + name = "token", + value = "value for identify an already enrolled and authorized device", + required = true) + @HeaderParam("token") + String token, + @ApiParam( + name = "properties", + value = "The properties list using for query a device", + required = true) + @QueryParam("properties") + String properties); +} diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java new file mode 100644 index 00000000000..b34f964b177 --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.jaxrs.service.impl; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.entgra.carbon.device.mgt.config.jaxrs.beans.ErrorResponse; +import io.entgra.carbon.device.mgt.config.jaxrs.service.DeviceManagementConfigService; +import io.entgra.carbon.device.mgt.config.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.AppRegistrationCredentials; +import org.wso2.carbon.device.mgt.common.ApplicationRegistrationException; +import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; +import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; +import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.Map; + +@Path("/configurations") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class DeviceManagementConfigServiceImpl implements DeviceManagementConfigService { + + private static final Log log = LogFactory.getLog(DeviceManagementConfigServiceImpl.class); + + @Override + @GET + public Response getConfiguration(@HeaderParam("token") String token, + @QueryParam("properties") String properties) { + DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService(); + try { + if (token == null || token.isEmpty()) { + String msg = "No valid token property found"; + log.error(msg); + return Response.status(Response.Status.UNAUTHORIZED).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build() + ).build(); + } + + if (properties == null || properties.isEmpty()) { + String msg = "Devices configuration retrieval criteria cannot be null or empty."; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build() + ).build(); + } + + ObjectMapper mapper = new ObjectMapper(); + properties = parseUriParamsToJSON(properties); + Map deviceProps = mapper.readValue(properties, + new TypeReference>() { + }); + deviceProps.put("token", token); + DeviceConfiguration devicesConfiguration = + dms.getDeviceConfiguration(deviceProps); + setAccessTokenToDeviceConfigurations(devicesConfiguration); + return Response.status(Response.Status.OK).entity(devicesConfiguration).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred while retrieving configurations"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (DeviceNotFoundException e) { + log.error(e.getMessage(), e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(e.getMessage()).build()).build(); + } catch (AmbiguousConfigurationException e) { + String msg = "Configurations are ambiguous"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (JsonParseException | JsonMappingException e) { + String msg = "Malformed device property structure"; + log.error(msg.concat(" ").concat(properties), e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } catch (IOException e) { + String msg = "Error occurred while parsing query param JSON data"; + log.error(msg.concat(" ").concat(properties), e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); + } + } + + private String parseUriParamsToJSON(String uriParams) { + uriParams = uriParams.replaceAll("=", "\":\""); + uriParams = uriParams.replaceAll("&", "\",\""); + return "{\"" + uriParams + "\"}"; + } + + private void setAccessTokenToDeviceConfigurations(DeviceConfiguration devicesConfiguration) + throws DeviceManagementException { + try { + AppRegistrationCredentials credentials = + DeviceManagerUtil.getApplicationRegistrationCredentials( + System.getProperty(DeviceManagementConstants + .ConfigurationManagement.IOT_GATEWAY_HOST), + System.getProperty(DeviceManagementConstants + .ConfigurationManagement.IOT_GATEWAY_HTTPS_PORT), + DeviceManagementConstants.ConfigurationManagement.ADMIN_CREDENTIALS); + AccessTokenInfo accessTokenForAdmin = DeviceManagerUtil.getAccessTokenForDeviceOwner( + DeviceManagementConstants.ConfigurationManagement.SCOPES_FOR_TOKEN, + credentials.getClient_id(), credentials.getClient_secret(), + devicesConfiguration.getDeviceOwner()); + devicesConfiguration.setAccessToken(accessTokenForAdmin.getAccessToken()); + devicesConfiguration.setRefreshToken(accessTokenForAdmin.getRefreshToken()); + } catch (ApplicationRegistrationException e) { + String msg = "Failure on retrieving application registration"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (JWTClientException e) { + String msg = "Error occurred while creating JWT client : " + e.getMessage(); + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } + } + +} diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java new file mode 100644 index 00000000000..874a644bba0 --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/util/DeviceMgtAPIUtils.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 io.entgra.carbon.device.mgt.config.jaxrs.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; + +/** + * MDMAPIUtils class provides utility function used by CDM REST-API classes. + */ +public class DeviceMgtAPIUtils { + private static Log log = LogFactory.getLog(DeviceMgtAPIUtils.class); + + public static DeviceManagementProviderService getDeviceManagementService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + DeviceManagementProviderService deviceManagementProviderService = + (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null); + if (deviceManagementProviderService == null) { + String msg = "DeviceImpl Management provider service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return deviceManagementProviderService; + } +} diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/permissions.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/permissions.xml new file mode 100644 index 00000000000..8b5c48b01ca --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/permissions.xml @@ -0,0 +1,39 @@ + + + + + + + + + Device Management Configuration + /device-mgt-config + / + GET + + diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml new file mode 100644 index 00000000000..01aceabde5b --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -0,0 +1,35 @@ + + + + + + + + + false + + + CXF,Carbon + diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml new file mode 100644 index 00000000000..e7426237cb2 --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..0c2afe4a6f5 --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,126 @@ + + + + Device-Config-Webapp + + JAX-WS/JAX-RS Device Configuration Endpoint + JAX-WS/JAX-RS Servlet + CXFServlet + + org.apache.cxf.transport.servlet.CXFServlet + + + + swagger.security.filter + ApiAuthorizationFilterImpl + + 1 + + + CXFServlet + /* + + + 60 + + + + doAuthentication + true + + + + nonSecuredEndPoints + + /api/device-mgt-config/v1.0/configurations + + + + + + managed-api-enabled + true + + + managed-api-owner + admin + + + isSharedWithAllTenants + true + + + + + + DeviceMgt-Admin + /* + + + CONFIDENTIAL + + + + + ApiOriginFilter + io.entgra.carbon.device.mgt.config.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 + /* + + + \ No newline at end of file diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/test/resources/testng.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/test/resources/testng.xml new file mode 100644 index 00000000000..5fe82227d37 --- /dev/null +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/test/resources/testng.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Adapter.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Adapter.java new file mode 100644 index 00000000000..f3d3bcb639f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Adapter.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; + +/** + * Receiver definition including : + * Attributes : Name, type, config and attached stream. + */ +public class Adapter { + @ApiModelProperty(value = "Adapter name") + private String adapterName; + @ApiModelProperty(value = "Attached stream name:version") + private String eventStreamWithVersion; + @ApiModelProperty(value = "Adapter type") + private AdapterType adapterType; + @ApiModelProperty(value = "Adapter main configurations") + private AdapterConfiguration adapterConfiguration; + + public String getAdapterName() { + return adapterName; + } + + public void setAdapterName(String adapterName) { + this.adapterName = adapterName; + } + + public String getEventStreamWithVersion() { + return eventStreamWithVersion; + } + + public void setEventStreamWithVersion(String eventStreamWithVersion) { + this.eventStreamWithVersion = eventStreamWithVersion; + } + + public AdapterType getAdapterType() { + return adapterType; + } + + public void setAdapterType(AdapterType adapterType) { + this.adapterType = adapterType; + } + + public AdapterConfiguration getAdapterConfiguration() { + return adapterConfiguration; + } + + public void setAdapterConfiguration( + AdapterConfiguration adapterConfiguration) { + this.adapterConfiguration = adapterConfiguration; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterConfiguration.java new file mode 100644 index 00000000000..5c0b820f412 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterConfiguration.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * Adapter main configurations + * Attributes : Adapter properties list, custom-mapping flag, mapping configurations + */ +public class AdapterConfiguration { + @ApiModelProperty(value = "Adapter properties list") + private List adapterProperties = new ArrayList<>(); + @ApiModelProperty(value = "Custom-mapping flag") + private boolean isCustomMappingEnabled; + @ApiModelProperty(value = "Mapping configurations") + private AdapterMappingConfiguration adapterMappingConfiguration; + + public List getAdapterProperties() { + return adapterProperties; + } + + public void setAdapterProperties( + List adapterProperties) { + this.adapterProperties = adapterProperties; + } + + public boolean isCustomMappingEnabled() { + return isCustomMappingEnabled; + } + + public void setCustomMappingEnabled(boolean customMappingEnabled) { + isCustomMappingEnabled = customMappingEnabled; + } + + public AdapterMappingConfiguration getAdapterMappingConfiguration() { + return adapterMappingConfiguration; + } + + public void setAdapterMappingConfiguration( + AdapterMappingConfiguration adapterMappingConfiguration) { + this.adapterMappingConfiguration = adapterMappingConfiguration; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterMappingConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterMappingConfiguration.java new file mode 100644 index 00000000000..3984b23065e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterMappingConfiguration.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; +import java.util.List; + +/** + * Adapter mapping configuration definition + * Attributes : Mapping format and lists for each type of property + */ +public class AdapterMappingConfiguration { + @ApiModelProperty(value = "Mapping format") + private MessageFormat messageFormat; + @ApiModelProperty(value = "Input mapping for json,text and xml mappings") + private String inputMappingString; + @ApiModelProperty(value = "Input mapping for json,map and xml mappings") + private List inputMappingProperties; + @ApiModelProperty(value = "Name-scape mapping for xml mapping") + private List namespaceMappingProperties; + @ApiModelProperty(value = "Correlation mapping for wso2 mapping") + private List correlationMappingProperties; + @ApiModelProperty(value = "Payload mapping for wso2 mapping") + private List payloadMappingProperties; + @ApiModelProperty(value = "Meta mapping for wso2 mapping") + private List metaMappingProperties; + + public MessageFormat getMessageFormat() { + return messageFormat; + } + + public void setMessageFormat(MessageFormat messageFormat) { + this.messageFormat = messageFormat; + } + + public String getInputMappingString() { + return inputMappingString; + } + + public void setInputMappingString(String inputMappingString) { + this.inputMappingString = inputMappingString; + } + + public List getInputMappingProperties() { + return inputMappingProperties; + } + + public void setInputMappingProperties( + List inputMappingProperties) { + this.inputMappingProperties = inputMappingProperties; + } + + public List getNamespaceMappingProperties() { + return namespaceMappingProperties; + } + + public void setNamespaceMappingProperties( + List namespaceMappingProperties) { + this.namespaceMappingProperties = namespaceMappingProperties; + } + + public List getCorrelationMappingProperties() { + return correlationMappingProperties; + } + + public void setCorrelationMappingProperties( + List correlationMappingProperties) { + this.correlationMappingProperties = correlationMappingProperties; + } + + public List getPayloadMappingProperties() { + return payloadMappingProperties; + } + + public void setPayloadMappingProperties( + List payloadMappingProperties) { + this.payloadMappingProperties = payloadMappingProperties; + } + + public List getMetaMappingProperties() { + return metaMappingProperties; + } + + public void setMetaMappingProperties( + List metaMappingProperties) { + this.metaMappingProperties = metaMappingProperties; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterProperty.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterProperty.java new file mode 100644 index 00000000000..4457da1c2a6 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterProperty.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +/** + * Receiver properties with it's display name(key) and user input(value) + */ +public class AdapterProperty { + private String key; + private String value; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterType.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterType.java new file mode 100644 index 00000000000..413be9fd907 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AdapterType.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +/** + * Available adapter types + */ +public enum AdapterType { + EMAIL, FILE_TAIL, HTTP, IOT_EVENT, JMS, KAFKA, MQTT, OAUTH_MQTT, SOAP, WEBSOCKET, WEBSOCKET_LOCAL, + WSO2_EVENT, XMPP, UI, RDBMS, SECURED_WEBSOCKET, CASSANDRA, LOGGER; + + public String toStringFormatted() { + return super.toString().toLowerCase().replace("_", "-"); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Attribute.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Attribute.java index 276fea9ee47..e112782a641 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Attribute.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/Attribute.java @@ -1,20 +1,19 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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 + * Entgra (pvt) Ltd. 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. + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; @@ -22,14 +21,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; /** - * This hold the attribute definition. + * Each attribute definition + * Attributes : name, type */ public class Attribute { - - @ApiModelProperty(value = "Event Attribute Name") + @ApiModelProperty(value = "Event attribute name") @JsonProperty("name") private String name; - @ApiModelProperty(value = "Event Attribute Type") + @ApiModelProperty(value = "Event attribute data type") @JsonProperty("type") private AttributeType type; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AttributeType.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AttributeType.java index 23235612b93..1fde19f8a91 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AttributeType.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/AttributeType.java @@ -1,32 +1,26 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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 + * Entgra (pvt) Ltd. 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. + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; /** - * This hold the definition of the attribute type for the attributes. + * Attribute data types */ public enum AttributeType { STRING, LONG, BOOL, INT, FLOAT, DOUBLE; - - @Override - public String toString() { - return super.toString().toLowerCase(); - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/DeviceTypeEvent.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/DeviceTypeEvent.java index 7ff162b357a..b8e07df6d54 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/DeviceTypeEvent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/DeviceTypeEvent.java @@ -1,20 +1,19 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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 + * Entgra (pvt) Ltd. 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. + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventAttributeList.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventAttributeList.java index fe9bd39e032..a80604bbe62 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventAttributeList.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventAttributeList.java @@ -1,20 +1,19 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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 + * Entgra (pvt) Ltd. 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. + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventPublisher.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventPublisher.java new file mode 100644 index 00000000000..a7e7a1f84b8 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventPublisher.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; + +public class EventPublisher { + @ApiModelProperty(value = "Publisher definition") + private String definition; + + public String getDefinition() { + return definition; + } + + public void setDefinition(String definition) { + this.definition = definition; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventReceiver.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventReceiver.java new file mode 100755 index 00000000000..dd0c00f8db5 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventReceiver.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; + +public class EventReceiver { + @ApiModelProperty(value = "Stream definition") + private String definition; + + public String getDefinition() { + return definition; + } + + public void setDefinition(String definition) { + this.definition = definition; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventRecords.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventRecords.java index 0dacde38330..84589cd8917 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventRecords.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventRecords.java @@ -1,20 +1,19 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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 + * Entgra (pvt) Ltd. 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. + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventStream.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventStream.java new file mode 100644 index 00000000000..17100e75f2b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/EventStream.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import com.sun.istack.NotNull; +import io.swagger.annotations.ApiModelProperty; +import org.hibernate.validator.constraints.NotEmpty; + +import java.util.List; + +/** + * Stream definition + * Attributes : name, version, definition and attribute data + */ +public class EventStream { + @ApiModelProperty(value = "Stream name") + private String name; + @ApiModelProperty(value = "Stream version") + private String version; + @ApiModelProperty(value = "Stream nickName") + private String nickName; + @ApiModelProperty(value = "Stream description") + private String description; + @ApiModelProperty(value = "Meta attribute list") + private List metaData; + @ApiModelProperty(value = "Correlation attribute list") + private List correlationData; + @ApiModelProperty(value = "Payload attribute list") + private List payloadData; + @ApiModelProperty(value = "Stream definition") @NotNull @NotEmpty + private String definition; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getMetaData() { + return metaData; + } + + public void setMetaData( + List metaData) { + this.metaData = metaData; + } + + public List getCorrelationData() { + return correlationData; + } + + public void setCorrelationData( + List correlationData) { + this.correlationData = correlationData; + } + + public List getPayloadData() { + return payloadData; + } + + public void setPayloadData( + List payloadData) { + this.payloadData = payloadData; + } + + public String getDefinition() { + return definition; + } + + public void setDefinition(String definition) { + this.definition = definition; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/MappingProperty.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/MappingProperty.java new file mode 100644 index 00000000000..1fbbc600643 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/MappingProperty.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; + +/** + * Mapping property data + * Attributes : name, data type and mapping value name + */ +public class MappingProperty { + @ApiModelProperty(value = "Property name") + private String name; + @ApiModelProperty(value = "Property data type") + private String type; + @ApiModelProperty(value = "Property mapping value name") + private String valueOf; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getValueOf() { + return valueOf; + } + + public void setValueOf(String valueOf) { + this.valueOf = valueOf; + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/MessageFormat.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/MessageFormat.java new file mode 100644 index 00000000000..f1ef70de918 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/MessageFormat.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +/** + * Message protocol types + */ +public enum MessageFormat { + JSON, MAP, XML, WSO2EVENT, TEXT; + + @Override + public String toString() { + return super.toString().toLowerCase(); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/SiddhiExecutionPlan.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/SiddhiExecutionPlan.java new file mode 100644 index 00000000000..597a932516f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/SiddhiExecutionPlan.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; + +import io.swagger.annotations.ApiModelProperty; + +/** + * Execution plan definition including : + * Attributes : Plan data. + */ +public class SiddhiExecutionPlan { + @ApiModelProperty(value = "Execution plan definition") + private String definition; + + public String getDefinition() { + return definition; + } + + public void setDefinition(String definition) { + this.definition = definition; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/TransportType.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/TransportType.java index 58eae4e6165..abf6122459f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/TransportType.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/analytics/TransportType.java @@ -1,20 +1,19 @@ /* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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 + * Entgra (pvt) Ltd. 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. + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.device.mgt.jaxrs.beans.analytics; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/exception/InvalidExecutionPlanException.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/exception/InvalidExecutionPlanException.java new file mode 100644 index 00000000000..c366b37ef4b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/exception/InvalidExecutionPlanException.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.exception; + +import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class InvalidExecutionPlanException extends WebApplicationException { + private String message; + private static final long serialVersionUID = 7583096344745990515L; + + public InvalidExecutionPlanException(ErrorResponse error) { + super(Response.status(Response.Status.NOT_FOUND).entity(error).build()); + } + + public InvalidExecutionPlanException(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/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/AnalyticsArtifactsManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/AnalyticsArtifactsManagementService.java new file mode 100644 index 00000000000..260ec66a11f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/AnalyticsArtifactsManagementService.java @@ -0,0 +1,454 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.service.api; + +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.Adapter; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventStream; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.SiddhiExecutionPlan; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventPublisher; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventReceiver; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Extension; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Info; +import io.swagger.annotations.ResponseHeader; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Tag; + +import javax.validation.Valid; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +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 = "AnalyticsArtifactsManagement"), + @ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/analytics/artifacts"), + }) + } + ), + tags = { + @Tag(name = "analytics_artifacts_management", description = "") + } +) +@Scopes( + scopes = { + @Scope( + name = "Create Event Stream Artifact", + description = "Create Event Stream Artifact", + key = "perm:analytics:artifacts:stream", + permissions = {"/device-mgt/analytics/artifacts/stream/add"} + ), + @Scope( + name = "Create Event Receiver Artifact", + description = "Create Event Receiver Artifact", + key = "perm:analytics:artifacts:receiver", + permissions = {"/device-mgt/analytics/artifacts/receiver/add"} + ), + @Scope( + name = "Create Event Publisher Artifact", + description = "Create Event Publisher Artifact", + key = "perm:analytics:artifacts:publisher", + permissions = {"/device-mgt/analytics/artifacts/publisher/add"} + ), + @Scope( + name = "Create Siddhi Script Artifact", + description = "Create Siddhi Script Artifact", + key = "perm:analytics:artifacts:siddhi", + permissions = {"/device-mgt/analytics/artifacts/siddhi-script/add"} + ) + } +) + +@Path("/analytics/artifacts") +@Api(value = "Analytics Artifacts Management", description = "This API corresponds to services" + + " related to Analytics Artifacts management") +public interface AnalyticsArtifactsManagementService { + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/stream/{id}") + @ApiOperation( + httpMethod = "POST", + value = "Create Event Stream Artifact as String", + notes = "Deploy a Json Stream Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:stream") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Stream Artifact.", + 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 = 400, + message = "Bad Request."), + @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 deploying the " + + "Stream Artifact.", + response = ErrorResponse.class) + } + ) + Response deployEventDefinitionAsString(@PathParam("id") String id, + @QueryParam("isEdited") boolean isEdited, + @Valid EventStream stream); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/stream") + @ApiOperation( + httpMethod = "POST", + value = "Create Event Stream Artifact as DTO", + notes = "Deploy a Json Stream Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:stream") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Stream Artifact.", + 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 = 400, + message = "Bad Request."), + @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 deploying the " + + "Stream Artifact.", + response = ErrorResponse.class) + } + ) + Response deployEventDefinitionAsDto(@Valid EventStream stream); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/receiver/{name}") + @ApiOperation( + httpMethod = "POST", + value = "Create Event Receiver Artifact as String", + notes = "Deploy a XML Event Receiver Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:receiver") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Receiver Artifact.", + 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 = 400, + message = + "Bad Request."), + @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 deploying the " + + "Event Receiver Artifact.", + response = ErrorResponse.class) + } + ) + Response deployEventReceiverAsString(@PathParam("name") String name, + @QueryParam("isEdited") boolean isEdited, + @Valid EventReceiver receiver); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/receiver") + @ApiOperation( + httpMethod = "POST", + value = "Create Event Receiver Artifact as DTO", + notes = "Deploy a JSON Event Receiver Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:receiver") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Receiver Artifact.", + 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 = 400, + message = + "Bad Request."), + @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 deploying the " + + "Event Receiver Artifact.", + response = ErrorResponse.class) + } + ) + Response deployEventReceiverAsDto(@Valid Adapter receiver); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/publisher/{name}") + @ApiOperation( + httpMethod = "POST", + value = "Create Event Publisher Artifact as String", + notes = "Deploy a XML Event Publisher Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:publisher") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Publisher Artifact.", + 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 = 400, + message = + "Bad Request."), + @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 deploying the " + + "Event Publisher Artifact.", + response = ErrorResponse.class) + } + ) + Response deployEventPublisherAsString(@PathParam("name") String name, + @QueryParam("isEdited") boolean isEdited, + @Valid EventPublisher publisher); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/publisher") + @ApiOperation( + httpMethod = "POST", + value = "Create Event Publisher Artifact as DTO", + notes = "Deploy a JSON Event Publisher Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:publisher") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Publisher Artifact.", + 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 = 400, + message = + "Bad Request."), + @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 deploying the " + + "Event Publisher Artifact.", + response = ErrorResponse.class) + } + ) + Response deployEventPublisherAsDto(@Valid Adapter publisher); + + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Path("/siddhi-script/{name}") + @ApiOperation( + httpMethod = "POST", + value = "Create Siddhi Script Artifact as String", + notes = "Deploy a SiddhiQL Siddhi script Artifact in Analytics server.", + tags = "Analytics Artifacts Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "perm:analytics:artifacts:siddhi") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deployed the Siddhi script Artifact.", + 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 = 400, + message = + "Bad Request."), + @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 " + + "deploying the Siddhi script Artifact.", + response = ErrorResponse.class) + } + ) + Response deploySiddhiExecutableScript( + @PathParam("name") String name, @QueryParam("isEdited") boolean isEdited, + @Valid SiddhiExecutionPlan plan); +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java index 26904a9cdff..c49f9698c1b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceEventManagementService.java @@ -123,6 +123,7 @@ public interface DeviceEventManagementService { Response deployDeviceTypeEventDefinition(@ApiParam(name = "type", value = "The device type, such as android, ios," + " and windows.", required = false) @PathParam("type")String deviceType, + @QueryParam("skipPersist")boolean skipPersist, @ApiParam(name = "deviceTypeEvent", value = "Add the data to complete " + "the DeviceTypeEvent object.", required = true) @Valid DeviceTypeEvent deviceTypeEvent); @@ -357,7 +358,7 @@ public interface DeviceEventManagementService { @QueryParam("max") double max ); - + @GET @Path("/{type}") @ApiOperation( @@ -411,4 +412,4 @@ public interface DeviceEventManagementService { " ios, or windows.", required = false) @PathParam("type")String deviceType) ; -} \ No newline at end of file +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java new file mode 100644 index 00000000000..21583f0f281 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java @@ -0,0 +1,724 @@ +/* + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.carbon.device.mgt.jaxrs.service.impl; + +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.Attribute; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.AdapterMappingConfiguration; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.MappingProperty; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.AdapterConfiguration; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.AdapterProperty; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.MessageFormat; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.SiddhiExecutionPlan; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventPublisher; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventReceiver; +import org.wso2.carbon.device.mgt.jaxrs.exception.ErrorDTO; +import org.wso2.carbon.device.mgt.jaxrs.exception.InvalidExecutionPlanException; +import org.wso2.carbon.device.mgt.jaxrs.service.api.AnalyticsArtifactsManagementService; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.Adapter; +import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventStream; +import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; +import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; +import org.wso2.carbon.event.publisher.stub.EventPublisherAdminServiceStub; +import org.wso2.carbon.event.publisher.stub.types.BasicOutputAdapterPropertyDto; +import org.wso2.carbon.event.publisher.stub.types.EventPublisherConfigurationDto; +import org.wso2.carbon.event.receiver.stub.EventReceiverAdminServiceStub; +import org.wso2.carbon.event.receiver.stub.types.BasicInputAdapterPropertyDto; +import org.wso2.carbon.event.receiver.stub.types.EventMappingPropertyDto; +import org.wso2.carbon.event.receiver.stub.types.EventReceiverConfigurationDto; +import org.wso2.carbon.event.stream.stub.EventStreamAdminServiceStub; +import org.wso2.carbon.event.stream.stub.types.EventStreamAttributeDto; +import org.wso2.carbon.event.stream.stub.types.EventStreamDefinitionDto; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; +import org.wso2.carbon.user.api.UserStoreException; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.Stub; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.validation.Valid; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; +import java.nio.charset.StandardCharsets; +import java.rmi.RemoteException; +import java.util.List; + +/** + * This class is used to create endpoints to serve the deployment of streams, publishers, receivers, + * siddhi scripts to the Analytics server as Artifacts + */ +@Path("/analytics/artifacts") +public class AnalyticsArtifactsManagementServiceImpl implements AnalyticsArtifactsManagementService { + private static final Log log = LogFactory.getLog(AnalyticsArtifactsManagementServiceImpl.class); + + /** + * @param stream EventStream object with the properties of the stream + * @return A status code depending on the code result + * Function - Used to deploy stream as an artifact using a String + */ + @Override + @POST + @Path("/stream/{id}") + public Response deployEventDefinitionAsString(@PathParam("id") String id, + @QueryParam("isEdited") boolean isEdited, + @Valid EventStream stream) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + EventStreamAdminServiceStub eventStreamAdminServiceStub = null; + try { + String streamDefinition = new String(stream.getDefinition().getBytes(), StandardCharsets.UTF_8); + eventStreamAdminServiceStub = DeviceMgtAPIUtils.getEventStreamAdminServiceStub(); + if (!isEdited) { + eventStreamAdminServiceStub.addEventStreamDefinitionAsString(streamDefinition); + } else { + // Find and edit stream + if (eventStreamAdminServiceStub.getStreamDetailsForStreamId(id) != null) { + eventStreamAdminServiceStub.editEventStreamDefinitionAsString(streamDefinition, id); + } + } + return Response.ok().build(); + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } finally { + cleanup(eventStreamAdminServiceStub); + } + } + + /** + * @param stream EventStream object with the properties of the stream + * @return A status code depending on the code result + * Function - Used to deploy stream as an artifact using a DTO + */ + @Override + @POST + @Path("/stream") + public Response deployEventDefinitionAsDto(@Valid EventStream stream) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + // Categorize attributes to three lists depending on their type + List metaData = stream.getMetaData(); + List payloadData = stream.getPayloadData(); + List correlationData = stream.getCorrelationData(); + + try { + /* Conditions + * - At least one list should always be not null + */ + if (metaData == null && correlationData == null && payloadData == null) { + log.error("Invalid payload: event attributes"); + return Response.status(Response.Status.BAD_REQUEST).build(); + + } else { + // Publish the event stream + publishStream(stream, metaData, correlationData, payloadData); + return Response.ok().build(); + } + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + } + + /** + * @param name Receiver name + * @param isEdited If receiver is created or edited + * @param receiver Receiver object with the properties of the receiver + * @return A status code depending on the code result + * Function - Used to deploy receiver as an artifact using a String + */ + @Override + @POST + @Path("/receiver/{name}") + public Response deployEventReceiverAsString(@PathParam("name") String name, + @QueryParam("isEdited") boolean isEdited, + @Valid EventReceiver receiver) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + EventReceiverAdminServiceStub eventReceiverAdminServiceStub; + try { + String receiverDefinition = receiver.getDefinition(); + eventReceiverAdminServiceStub = DeviceMgtAPIUtils.getEventReceiverAdminServiceStub(); + if (!isEdited) { + eventReceiverAdminServiceStub.deployEventReceiverConfiguration(receiverDefinition); + } else { + eventReceiverAdminServiceStub.editActiveEventReceiverConfiguration(receiverDefinition, name); + } + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + return Response.ok().entity(name).build(); + } + + /** + * @param receiver Receiver object with the properties of the receiver + * @return A status code depending on the code result + * Function - Used to deploy receiver as an artifact using a DTO + */ + @Override + @POST + @Path("/receiver") + public Response deployEventReceiverAsDto(@Valid Adapter receiver) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + String receiverName = receiver.getAdapterName(); + String adapterType = receiver.getAdapterType().toStringFormatted(); + AdapterConfiguration adapterConfiguration = receiver.getAdapterConfiguration(); + AdapterMappingConfiguration adapterMappingConfiguration = adapterConfiguration.getAdapterMappingConfiguration(); + + try { + List adapterProperties = adapterConfiguration.getAdapterProperties(); + if (adapterProperties == null) { + log.error("Invalid attribute payload"); + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + boolean customMapping = adapterConfiguration.isCustomMappingEnabled(); + List inputMappingProperties = adapterMappingConfiguration.getInputMappingProperties(); + List namespaceMappingProperties = adapterMappingConfiguration.getNamespaceMappingProperties(); + List correlationMappingProperties = adapterMappingConfiguration.getCorrelationMappingProperties(); + List payloadMappingProperties = adapterMappingConfiguration.getPayloadMappingProperties(); + List metaMappingProperties = adapterMappingConfiguration.getMetaMappingProperties(); + MessageFormat messageFormat = adapterMappingConfiguration.getMessageFormat(); + /* + * Conditions + * - if CustomMappingEnabled check validity of property lists + * - if both inputMappingProperties and namespaceMappingProperties null check remaining property lists + * - if all correlationMappingProperties, payloadMappingProperties, metaMappingProperties null log error + * - if message format is null change the final result to TRUE + * - else continue + * */ + if ((customMapping && + (inputMappingProperties == null && namespaceMappingProperties == null) && + (correlationMappingProperties == null && payloadMappingProperties == null && + metaMappingProperties == null)) || messageFormat == null) { + String errMsg = "Invalid mapping payload"; + log.error(errMsg); + return Response.status(Response.Status.BAD_REQUEST).entity(errMsg).build(); + } + String eventStreamWithVersion = receiver.getEventStreamWithVersion(); + + publishReceiver(receiverName, adapterType, adapterProperties, customMapping, inputMappingProperties, + namespaceMappingProperties, correlationMappingProperties, payloadMappingProperties, + metaMappingProperties, messageFormat, eventStreamWithVersion); + return Response.ok().build(); + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + } + + /** + * @param name Publisher name + * @param isEdited If receiver is created or edited + * @param publisher Publisher object with the properties of the publisher + * @return A status code depending on the code result + * Function - Used to deploy publisher as an artifact using a String + */ + @Override + @POST + @Path("/publisher/{name}") + public Response deployEventPublisherAsString(@PathParam("name") String name, + @QueryParam("isEdited") boolean isEdited, + @Valid EventPublisher publisher) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + EventPublisherAdminServiceStub eventPublisherAdminServiceStub; + + try { + String publisherDefinition = publisher.getDefinition(); + + eventPublisherAdminServiceStub = DeviceMgtAPIUtils.getEventPublisherAdminServiceStub(); + if (!isEdited) { + eventPublisherAdminServiceStub.deployEventPublisherConfiguration(publisherDefinition); + } else { + eventPublisherAdminServiceStub.editActiveEventPublisherConfiguration(publisherDefinition, name); + } + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + return Response.ok().entity(publisher).build(); + } + + /** + * @param publisher Publisher object with the properties of the publisher + * @return A status code depending on the code result + * Function - Used to deploy publisher as an artifact using a DTO + */ + @Override + @POST + @Path("/publisher") + public Response deployEventPublisherAsDto(@Valid Adapter publisher) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + String publisherName = publisher.getAdapterName(); + String adapterType = publisher.getAdapterType().toStringFormatted(); + AdapterConfiguration adapterConfiguration = publisher.getAdapterConfiguration(); + AdapterMappingConfiguration adapterMappingConfiguration = adapterConfiguration.getAdapterMappingConfiguration(); + + try { + List adapterProperties = adapterConfiguration.getAdapterProperties(); + if (adapterProperties == null) { + log.error("Invalid attribute payload"); + return Response.status(Response.Status.BAD_REQUEST).build(); + } + + boolean customMapping = adapterConfiguration.isCustomMappingEnabled(); + String inputMappingString = adapterMappingConfiguration.getInputMappingString(); + List inputMappingProperties = adapterMappingConfiguration.getInputMappingProperties(); + List correlationMappingProperties = adapterMappingConfiguration.getCorrelationMappingProperties(); + List payloadMappingProperties = adapterMappingConfiguration.getPayloadMappingProperties(); + List metaMappingProperties = adapterMappingConfiguration.getMetaMappingProperties(); + MessageFormat messageFormat = adapterMappingConfiguration.getMessageFormat(); + /* + * Conditions + * - if CustomMappingEnabled check validity of property lists + * - if all correlationMappingProperties, payloadMappingProperties, metaMappingProperties null log error + * - if message format is null change the final result to TRUE + * - else continue + */ + if ((customMapping && + (inputMappingProperties == null && inputMappingString == null) && + (correlationMappingProperties == null && payloadMappingProperties == null && + metaMappingProperties == null)) || messageFormat == null) { + String errMsg = "Invalid mapping payload"; + log.error(errMsg); + return Response.status(Response.Status.BAD_REQUEST).entity(errMsg).build(); + } + String eventStreamWithVersion = publisher.getEventStreamWithVersion(); + + publishPublisher(publisherName, adapterType, adapterProperties, customMapping + , inputMappingString, inputMappingProperties, correlationMappingProperties + , payloadMappingProperties, metaMappingProperties, messageFormat + , eventStreamWithVersion); + return Response.ok().build(); + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + } + + /** + * @param name Siddhi plan name + * @param isEdited If receiver is created or edited + * @param plan Siddhi plan definition + * @return a status code depending on the code execution + * Function - Used to deploy Siddhi script as an artifact using a String + */ + @Override + @POST + @Path("/siddhi-script/{name}") + public Response deploySiddhiExecutableScript(@PathParam("name") String name, + @QueryParam("isEdited") boolean isEdited, + @Valid SiddhiExecutionPlan plan) { + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + try { + publishSiddhiExecutionPlan(name, isEdited, plan.getDefinition()); + return Response.ok().build(); + } catch (AxisFault e) { + log.error("Failed to create event definitions for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (RemoteException e) { + log.error("Failed to connect with the remote services for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (InvalidExecutionPlanException e) { + log.error("Invalid Execution plan: " + tenantDomain, e); + return e.getResponse(); + } catch (JWTClientException e) { + log.error("Failed to generate jwt token for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (UserStoreException e) { + log.error("Failed to connect with the user store for tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + } + + /** + * @param stream Stream definition + * @param metaData Meta attributes of the stream + * @param correlationData Correlation attributes of the stream + * @param payloadData Payload attributes of the stream + * @throws RemoteException exception that may occur during a remote method call + * @throws UserStoreException exception that may occur during JWT token generation + * @throws JWTClientException exception that may occur during connecting to client store + */ + private void publishStream(EventStream stream, List metaData, + List correlationData, List payloadData) + throws RemoteException, UserStoreException, JWTClientException { + EventStreamAdminServiceStub eventStreamAdminServiceStub = + DeviceMgtAPIUtils.getEventStreamAdminServiceStub(); + try { + EventStreamDefinitionDto eventStreamDefinitionDto = new EventStreamDefinitionDto(); + eventStreamDefinitionDto.setName(stream.getName()); + eventStreamDefinitionDto.setVersion(stream.getVersion()); + eventStreamDefinitionDto.setNickName(stream.getNickName()); + eventStreamDefinitionDto.setDescription(stream.getDescription()); + eventStreamDefinitionDto.setMetaData(addEventAttributesToDto(metaData)); + eventStreamDefinitionDto.setPayloadData(addEventAttributesToDto(payloadData)); + eventStreamDefinitionDto.setCorrelationData(addEventAttributesToDto(correlationData)); + String streamId = stream.getName() + ":" + stream.getVersion(); + if (eventStreamAdminServiceStub.getStreamDefinitionDto(streamId) != null) { + eventStreamAdminServiceStub.editEventStreamDefinitionAsDto(eventStreamDefinitionDto, streamId); + } else { + eventStreamAdminServiceStub.addEventStreamDefinitionAsDto(eventStreamDefinitionDto); + } + } finally { + cleanup(eventStreamAdminServiceStub); + } + + } + + /** + * @param receiverName Receiver name + * @param adapterType Receiver type + * @param adapterProperties Receiver properties + * @param customMapping Is receiver mapped + * @param inputMappingProperties Receiver input attribute mapping + * @param namespaceMappingProperties Receiver name-scape attribute mapping + * @param correlationMappingProperties Receiver correlation attribute mapping + * @param payloadMappingProperties Receiver payload attribute mapping + * @param metaMappingProperties Receiver meta attribute mapping + * @param messageFormat Receiver mapping format + * @param eventStreamWithVersion Attached stream + * @throws RemoteException exception that may occur during a remote method call + * @throws UserStoreException exception that may occur during JWT token generation + * @throws JWTClientException exception that may occur during connecting to client store + */ + private void publishReceiver(String receiverName, String adapterType, + List adapterProperties, boolean customMapping, + List inputMappingProperties, + List namespaceMappingProperties, + List correlationMappingProperties, + List payloadMappingProperties, + List metaMappingProperties, + MessageFormat messageFormat, + String eventStreamWithVersion) + throws RemoteException, UserStoreException, JWTClientException { + EventReceiverAdminServiceStub eventReceiverAdminServiceStub = DeviceMgtAPIUtils.getEventReceiverAdminServiceStub(); + + try { + EventReceiverConfigurationDto eventReceiverConfigurationDto = eventReceiverAdminServiceStub + .getActiveEventReceiverConfiguration(receiverName); + + // Check if adapter already exists, if so un-deploy it + if (eventReceiverConfigurationDto != null) { + eventReceiverAdminServiceStub.undeployActiveEventReceiverConfiguration(receiverName); + } + + // Adding attribute properties to DTOs + BasicInputAdapterPropertyDto[] basicInputAdapterPropertyDtos = + addReceiverConfigToDto(adapterProperties); + + if (eventReceiverAdminServiceStub.getActiveEventReceiverConfiguration(receiverName) == null) { + // Call stub deploy methods according to the message format + if (!messageFormat.toString().equals("wso2event")) { + EventMappingPropertyDto[] inputMappingPropertyDtos = + addReceiverMappingToDto(inputMappingProperties); + if (messageFormat.toString().equals("xml")) { + EventMappingPropertyDto[] namespaceMappingPropertyDtos = + addReceiverMappingToDto(namespaceMappingProperties); + + eventReceiverAdminServiceStub.deployXmlEventReceiverConfiguration(receiverName + , eventStreamWithVersion, adapterType, null + , namespaceMappingPropertyDtos, inputMappingPropertyDtos + , basicInputAdapterPropertyDtos, customMapping); + } else { + if (messageFormat.toString().equals("map")) { + eventReceiverAdminServiceStub.deployMapEventReceiverConfiguration(receiverName + , eventStreamWithVersion, adapterType, inputMappingPropertyDtos + , basicInputAdapterPropertyDtos, customMapping); + } else if (messageFormat.toString().equals("text")) { + eventReceiverAdminServiceStub.deployTextEventReceiverConfiguration(receiverName + , eventStreamWithVersion, adapterType, inputMappingPropertyDtos + , basicInputAdapterPropertyDtos, customMapping); + } else { + eventReceiverAdminServiceStub.deployJsonEventReceiverConfiguration(receiverName + , eventStreamWithVersion, adapterType, inputMappingPropertyDtos + , basicInputAdapterPropertyDtos, customMapping); + } + } + } else { + EventMappingPropertyDto[] correlationMappingPropertyDtos = addReceiverMappingToDto(correlationMappingProperties); + EventMappingPropertyDto[] metaMappingPropertyDtos = addReceiverMappingToDto(metaMappingProperties); + EventMappingPropertyDto[] payloadMappingPropertyDtos = addReceiverMappingToDto(payloadMappingProperties); + + eventReceiverAdminServiceStub.deployWso2EventReceiverConfiguration(receiverName + , eventStreamWithVersion, adapterType, metaMappingPropertyDtos + , correlationMappingPropertyDtos, payloadMappingPropertyDtos + , basicInputAdapterPropertyDtos, customMapping + , eventStreamWithVersion); + } + + } + } finally { + cleanup(eventReceiverAdminServiceStub); + } + } + + /** + * @param publisherName Publisher name + * @param adapterType Publisher type + * @param adapterProperties Publisher properties + * @param customMapping Is publisher mapped + * @param correlationMappingProperties Publisher correlation attribute mapping + * @param payloadMappingProperties Publisher payload attribute mapping + * @param metaMappingProperties Publisher meta attribute mapping + * @param messageFormat Publisher mapping format + * @param eventStreamWithVersion Attached stream + * @throws RemoteException exception that may occur during a remote method call + * @throws UserStoreException exception that may occur during JWT token generation + * @throws JWTClientException exception that may occur during connecting to client store + */ + private void publishPublisher(String publisherName, String adapterType, + List adapterProperties, + boolean customMapping, + String inputMappingString, + List inputMappingProperties, + List correlationMappingProperties, + List payloadMappingProperties, + List metaMappingProperties, + MessageFormat messageFormat, + String eventStreamWithVersion) + throws RemoteException, UserStoreException, JWTClientException { + EventPublisherAdminServiceStub eventPublisherAdminServiceStub = DeviceMgtAPIUtils.getEventPublisherAdminServiceStub(); + // Check if adapter already exists, if so un-deploy it + try { + EventPublisherConfigurationDto eventPublisherConfigurationDto = eventPublisherAdminServiceStub + .getActiveEventPublisherConfiguration(publisherName); + if (eventPublisherConfigurationDto != null) { + eventPublisherAdminServiceStub.undeployActiveEventPublisherConfiguration(publisherName); + } + + // Adding attribute properties to DTOs + BasicOutputAdapterPropertyDto[] basicOutputAdapterPropertyDtos = + addPublisherConfigToDto(adapterProperties); + + if (eventPublisherAdminServiceStub.getActiveEventPublisherConfiguration(publisherName) == null) { + // Call stub deploy methods according to the message format + if (!messageFormat.toString().equals("wso2event")) { + if (!messageFormat.toString().equals("map")) { + if (messageFormat.toString().equals("xml")) { + eventPublisherAdminServiceStub.deployXmlEventPublisherConfiguration(publisherName + , eventStreamWithVersion, adapterType, inputMappingString + , basicOutputAdapterPropertyDtos, eventStreamWithVersion + , customMapping); + } else if (messageFormat.toString().equals("text")) { + eventPublisherAdminServiceStub.deployTextEventPublisherConfiguration(publisherName + , eventStreamWithVersion, adapterType, inputMappingString + , basicOutputAdapterPropertyDtos, eventStreamWithVersion + , customMapping); + } else { + eventPublisherAdminServiceStub.deployJsonEventPublisherConfiguration(publisherName + , eventStreamWithVersion, adapterType, inputMappingString + , basicOutputAdapterPropertyDtos, eventStreamWithVersion + , customMapping); + } + } else { + org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[] inputMappingPropertyDtos = + addPublisherMappingToDto(inputMappingProperties); + eventPublisherAdminServiceStub.deployMapEventPublisherConfiguration(publisherName + , eventStreamWithVersion, adapterType, inputMappingPropertyDtos + , basicOutputAdapterPropertyDtos, customMapping); + } + } else { + org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[] correlationMappingPropertyDtos = + addPublisherMappingToDto(correlationMappingProperties); + org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[] metaMappingPropertyDtos = + addPublisherMappingToDto(metaMappingProperties); + org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[] payloadMappingPropertyDtos = + addPublisherMappingToDto(payloadMappingProperties); + + eventPublisherAdminServiceStub.deployWSO2EventPublisherConfiguration(publisherName + , eventStreamWithVersion, adapterType, metaMappingPropertyDtos + , correlationMappingPropertyDtos, payloadMappingPropertyDtos + , basicOutputAdapterPropertyDtos, customMapping + , eventStreamWithVersion); + } + + } + } finally { + cleanup(eventPublisherAdminServiceStub); + } + } + + /** + * @param name plan name + * @param isEdited is plan edited + * @param plan plan data + * @throws RemoteException exception that may occur during a remote method call + * @throws UserStoreException exception that may occur during JWT token generation + * @throws JWTClientException exception that may occur during connecting to client store + * @throws InvalidExecutionPlanException exception that may occur if execution plan validation fails + */ + private void publishSiddhiExecutionPlan(String name, boolean isEdited, + String plan) + throws RemoteException, UserStoreException, JWTClientException, + InvalidExecutionPlanException { + EventProcessorAdminServiceStub eventProcessorAdminServiceStub = null; + try { + eventProcessorAdminServiceStub = DeviceMgtAPIUtils.getEventProcessorAdminServiceStub(); + // Validate the plan code + String validationResponse = eventProcessorAdminServiceStub.validateExecutionPlan(plan); + if (validationResponse.equals("success")) { + if (!isEdited) { + // Create a new plan + eventProcessorAdminServiceStub.deployExecutionPlan(plan); + } else { + // Edit plan + eventProcessorAdminServiceStub.editActiveExecutionPlan(plan, name); + } + } else { + ErrorDTO errorDTO = new ErrorDTO(); + errorDTO.setMessage(validationResponse); + throw new InvalidExecutionPlanException(errorDTO); + } + } finally { + cleanup(eventProcessorAdminServiceStub); + } + } + + private EventStreamAttributeDto[] addEventAttributesToDto(List attributes) { + EventStreamAttributeDto[] eventStreamAttributeDtos = new EventStreamAttributeDto[attributes.size()]; + for (int i = 0; i < attributes.size(); i++) { + EventStreamAttributeDto eventStreamAttributeDto = new EventStreamAttributeDto(); + eventStreamAttributeDto.setAttributeName(attributes.get(i).getName()); + eventStreamAttributeDto.setAttributeType(attributes.get(i).getType().toString()); + eventStreamAttributeDtos[i] = eventStreamAttributeDto; + } + return eventStreamAttributeDtos; + } + + + private BasicInputAdapterPropertyDto[] addReceiverConfigToDto( + List adapterProperties) { + BasicInputAdapterPropertyDto[] basicInputAdapterPropertyDtos + = new BasicInputAdapterPropertyDto[adapterProperties.size()]; + for (int i = 0; i < adapterProperties.size(); i++) { + BasicInputAdapterPropertyDto basicInputAdapterPropertyDto = new BasicInputAdapterPropertyDto(); + basicInputAdapterPropertyDto.setKey(adapterProperties.get(i).getKey()); + basicInputAdapterPropertyDto.setValue(adapterProperties.get(i).getValue()); + basicInputAdapterPropertyDtos[i] = basicInputAdapterPropertyDto; + } + return basicInputAdapterPropertyDtos; + } + + private EventMappingPropertyDto[] addReceiverMappingToDto(List mapProperties) { + EventMappingPropertyDto[] eventMappingPropertyDtos = new EventMappingPropertyDto[mapProperties.size()]; + for (int i = 0; i < mapProperties.size(); i++) { + EventMappingPropertyDto eventMappingPropertyDto = new EventMappingPropertyDto(); + eventMappingPropertyDto.setName(mapProperties.get(i).getName()); + eventMappingPropertyDto.setType(mapProperties.get(i).getType()); + eventMappingPropertyDto.setValueOf(mapProperties.get(i).getValueOf()); + eventMappingPropertyDtos[i] = eventMappingPropertyDto; + } + return eventMappingPropertyDtos; + } + + private BasicOutputAdapterPropertyDto[] addPublisherConfigToDto( + List adapterProperties) { + BasicOutputAdapterPropertyDto[] basicOutputAdapterPropertyDtos = + new BasicOutputAdapterPropertyDto[adapterProperties.size()]; + for (int i = 0; i < adapterProperties.size(); i++) { + BasicOutputAdapterPropertyDto basicOutputAdapterPropertyDto = + new BasicOutputAdapterPropertyDto(); + basicOutputAdapterPropertyDto.setKey(adapterProperties.get(i).getKey()); + basicOutputAdapterPropertyDto.setValue(adapterProperties.get(i).getValue()); + basicOutputAdapterPropertyDtos[i] = basicOutputAdapterPropertyDto; + } + return basicOutputAdapterPropertyDtos; + } + + private org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[] addPublisherMappingToDto + (List mapProperties) { + org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[] eventMappingPropertyDtos + = new org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto[mapProperties.size()]; + for (int i = 0; i < mapProperties.size(); i++) { + org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto eventMappingPropertyDto + = new org.wso2.carbon.event.publisher.stub.types.EventMappingPropertyDto(); + eventMappingPropertyDto.setName(mapProperties.get(i).getName()); + eventMappingPropertyDto.setType(mapProperties.get(i).getType()); + eventMappingPropertyDto.setValueOf(mapProperties.get(i).getValueOf()); + eventMappingPropertyDtos[i] = eventMappingPropertyDto; + } + return eventMappingPropertyDtos; + } + + private void cleanup(Stub stub) { + if (stub != null) { + try { + stub.cleanup(); + } catch (AxisFault axisFault) { + log.warn("Failed to clean the stub " + stub.getClass()); + } + } + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java index 1e0ad92632b..12a1f9ddd9a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceEventManagementServiceImpl.java @@ -192,6 +192,7 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe @Path("/{type}") @Override public Response deployDeviceTypeEventDefinition(@PathParam("type") String deviceType, + @QueryParam("skipPersist") boolean skipPersist, @Valid DeviceTypeEvent deviceTypeEvent) { TransportType transportType = deviceTypeEvent.getTransportType(); EventAttributeList eventAttributes = deviceTypeEvent.getEventAttributeList(); @@ -208,7 +209,9 @@ public class DeviceEventManagementServiceImpl implements DeviceEventManagementSe String streamNameWithVersion = streamName + ":" + Constants.DEFAULT_STREAM_VERSION; publishStreamDefinitons(streamName, Constants.DEFAULT_STREAM_VERSION, deviceType, eventAttributes); publishEventReceivers(streamNameWithVersion, transportType, tenantDomain, deviceType); - publishEventStore(streamName, Constants.DEFAULT_STREAM_VERSION, eventAttributes); + if (!skipPersist) { + publishEventStore(streamName, Constants.DEFAULT_STREAM_VERSION, eventAttributes); + } publishWebsocketPublisherDefinition(streamNameWithVersion, deviceType); try { PrivilegedCarbonContext.startTenantFlow(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java index 2c7a3651eb9..aff56f14cf7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java @@ -58,6 +58,7 @@ import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeVersionWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.analytics.EventAttributeList; import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.InputValidationException; +import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; import org.wso2.carbon.event.publisher.stub.EventPublisherAdminServiceStub; import org.wso2.carbon.event.receiver.stub.EventReceiverAdminServiceStub; import org.wso2.carbon.event.stream.stub.EventStreamAdminServiceStub; @@ -110,6 +111,7 @@ public class DeviceMgtAPIUtils { private static final String EVENT_PUBLISHER_CONTEXT = "EventPublisherAdminService/"; private static final String EVENT_STREAM_CONTEXT = "EventStreamAdminService/"; private static final String EVENT_PERSISTENCE_CONTEXT = "EventStreamPersistenceAdminService/"; + private static final String EVENT_PROCESSOR_CONTEXT = "EventProcessorAdminService"; private static final String AUTHORIZATION_HEADER = "Authorization"; private static final String AUTHORIZATION_HEADER_VALUE = "Bearer"; public static final String DAS_PORT = "${iot.analytics.https.port}"; @@ -638,6 +640,41 @@ public class DeviceMgtAPIUtils { return eventStreamPersistenceAdminServiceStub; } + public static EventProcessorAdminServiceStub getEventProcessorAdminServiceStub() + throws AxisFault, UserStoreException, JWTClientException { + EventProcessorAdminServiceStub eventProcessorAdminServiceStub = new EventProcessorAdminServiceStub( + Utils.replaceSystemProperty(DAS_ADMIN_SERVICE_EP + EVENT_PROCESSOR_CONTEXT)); + Options eventProcessorOption = eventProcessorAdminServiceStub._getServiceClient().getOptions(); + if (eventProcessorOption == null) { + eventProcessorOption = new Options(); + } + // Get the tenant Domain + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm() + .getRealmConfiguration().getAdminUserName() + "@" + tenantDomain; + // Create the SSL context with the loaded TrustStore/keystore. + JWTClient jwtClient = getJWTClientManagerService().getJWTClient(); + + String authValue = AUTHORIZATION_HEADER_VALUE + " " + new String(Base64.encodeBase64( + jwtClient.getJwtToken(username).getBytes())); + + List
list = new ArrayList<>(); + Header httpHeader = new Header(); + httpHeader.setName(AUTHORIZATION_HEADER); + httpHeader.setValue(authValue); + list.add(httpHeader);//"https" + + eventProcessorOption.setProperty(HTTPConstants.HTTP_HEADERS, list); + eventProcessorOption.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER + , new Protocol(DEFAULT_HTTP_PROTOCOL + , (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslContext) + , Integer.parseInt(Utils.replaceSystemProperty(DAS_PORT)))); + + eventProcessorAdminServiceStub._getServiceClient().setOptions(eventProcessorOption); + return eventProcessorAdminServiceStub; + } + /** * This method is used to create the Cache that holds the event definition of the device type.. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 7a2013037a5..f08b6ebda1e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -46,6 +46,7 @@ + @@ -93,6 +94,7 @@ + @@ -101,4 +103,4 @@ - \ No newline at end of file + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/AppRegistrationCredentials.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/AppRegistrationCredentials.java new file mode 100644 index 00000000000..191ee0d3d48 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/AppRegistrationCredentials.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common; + +/** + * Wrap application registration response payload + */ +public class AppRegistrationCredentials { + private String client_id; + private String client_secret; + + public String getClient_id() { + return client_id; + } + + public void setClient_id(String client_id) { + this.client_id = client_id; + } + + public String getClient_secret() { + return client_secret; + } + + public void setClient_secret(String client_secret) { + this.client_secret = client_secret; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/ApplicationRegistration.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/ApplicationRegistration.java new file mode 100644 index 00000000000..13d6c9d53c8 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/ApplicationRegistration.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common; + +import java.util.List; + +/** + * This class is use to wrap and send + * Application registration data to the API publisher + * Use only for application registration doing inside the IoTs + */ +public class ApplicationRegistration { + private String applicationName; + private List tags; + private boolean isAllowedToAllDomains; + private long validityPeriod; + + public String getApplicationName() { + return applicationName; + } + + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public boolean isAllowedToAllDomains() { + return isAllowedToAllDomains; + } + + public void setAllowedToAllDomains(boolean allowedToAllDomains) { + isAllowedToAllDomains = allowedToAllDomains; + } + + public long getValidityPeriod() { + return validityPeriod; + } + + public void setValidityPeriod(long validityPeriod) { + this.validityPeriod = validityPeriod; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/ApplicationRegistrationException.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/ApplicationRegistrationException.java new file mode 100644 index 00000000000..6ccfe677ef7 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/ApplicationRegistrationException.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common; + +/** + * Throw this if any errors throw when the application registration API calling + */ +public class ApplicationRegistrationException extends Exception { + private static final long serialVersionUID = 4718132518977041928L; + + public ApplicationRegistrationException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public ApplicationRegistrationException(String message, Throwable cause) { + super(message, cause); + } + + public ApplicationRegistrationException(String msg) { + super(msg); + } + + public ApplicationRegistrationException() { + super(); + } + + public ApplicationRegistrationException(Throwable cause) { + super(cause); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/InvalidArgumentException.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/InvalidArgumentException.java new file mode 100644 index 00000000000..194f9713188 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/InvalidArgumentException.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common; + +/** + * Throws if any arguments send to an API is wrong or invalid + */ +public class InvalidArgumentException extends Exception { + private static final long serialVersionUID = -2365244687985953509L; + + public InvalidArgumentException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public InvalidArgumentException(String message, Throwable cause) { + super(message, cause); + } + + public InvalidArgumentException(String msg) { + super(msg); + } + + public InvalidArgumentException() { + super(); + } + + public InvalidArgumentException(Throwable cause) { + super(cause); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/AmbiguousConfigurationException.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/AmbiguousConfigurationException.java new file mode 100644 index 00000000000..a18f437528a --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/AmbiguousConfigurationException.java @@ -0,0 +1,25 @@ +package org.wso2.carbon.device.mgt.common.configuration.mgt; + +public class AmbiguousConfigurationException extends Exception{ + private static final long serialVersionUID = 7039039961721642766L; + + public AmbiguousConfigurationException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public AmbiguousConfigurationException(String message, Throwable cause) { + super(message, cause); + } + + public AmbiguousConfigurationException(String msg) { + super(msg); + } + + public AmbiguousConfigurationException() { + super(); + } + + public AmbiguousConfigurationException(Throwable cause) { + super(cause); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java new file mode 100644 index 00000000000..c3020098e73 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.configuration.mgt; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +/** + * This class is use to wrap and send device configuration data + * to the device + */ +@ApiModel(value = "DeviceConfiguration", description = "This class carries all information related to " + + "Device configurations required to communicate with " + + "the server") +public class DeviceConfiguration { + @ApiModelProperty(name = "deviceId", value = "ID of the device", required = true) + private String deviceId; + + @ApiModelProperty(name = "deviceType", value = "Type of the device", required = true) + private String deviceType; + + @ApiModelProperty(name = "tenantDomain", value = "Tenant which the device owned") + private String tenantDomain; + + @ApiModelProperty(name = "configurationEntries", value = "Platform Configurations", required = true) + private List configurationEntries; + + @ApiModelProperty(name = "accessToken", value = "Token that can be use to communicate with the server") + private String accessToken; + + @ApiModelProperty(name = "refreshToken", value = "Token that can be use to communicate with the server") + private String refreshToken; + + @ApiModelProperty(name = "deviceOwner", value = "Owner of the selected device", required = true) + private String deviceOwner; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getTenantDomain() { + return tenantDomain; + } + + public void setTenantDomain(String tenantDomain) { + this.tenantDomain = tenantDomain; + } + + public List getConfigurationEntries() { + return configurationEntries; + } + + public void setConfigurationEntries( + List configurationEntries) { + this.configurationEntries = configurationEntries; + } + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public String getDeviceOwner() { + return deviceOwner; + } + + public void setDeviceOwner(String deviceOwner) { + this.deviceOwner = deviceOwner; + } + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DevicePropertyInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DevicePropertyInfo.java new file mode 100644 index 00000000000..1af7982252e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DevicePropertyInfo.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.configuration.mgt; + +/** + * This bean is use for retrieve and wrap device property info get from DB + */ +public class DevicePropertyInfo { + private String deviceIdentifier = "default"; + private String deviceTypeName = "default"; + private String tenantId = "default"; + + public String getDeviceIdentifier() { + return deviceIdentifier; + } + + public void setDeviceIdentifier(String deviceIdentifier) { + this.deviceIdentifier = deviceIdentifier; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getDeviceTypeName() { + return deviceTypeName; + } + + public void setDeviceTypeName(String deviceTypeName) { + this.deviceTypeName = deviceTypeName; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof DevicePropertyInfo) { + DevicePropertyInfo devicePropertyInfo = (DevicePropertyInfo)obj; + return devicePropertyInfo.getDeviceIdentifier().equals(this.deviceIdentifier) + && devicePropertyInfo.getDeviceTypeName().equals(this.deviceTypeName) + && devicePropertyInfo.getTenantId().equals(this.tenantId); + } + return false; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/group/mgt/DeviceGroup.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/group/mgt/DeviceGroup.java index b107d79e878..9dff8756724 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/group/mgt/DeviceGroup.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/group/mgt/DeviceGroup.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; +import java.util.Map; /** * Holds Device Group details and expose to external access @@ -43,6 +44,8 @@ public class DeviceGroup implements Serializable { private String owner; + private Map groupProperties; + public DeviceGroup() {} public DeviceGroup(String name) { @@ -81,4 +84,12 @@ public class DeviceGroup implements Serializable { this.owner = owner; } + public Map getGroupProperties() { + return groupProperties; + } + + public void setGroupProperties(Map groupProperties) { + this.groupProperties = groupProperties; + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java index 57b00cb5a8c..7c7f265353a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementConstants.java @@ -27,6 +27,21 @@ public final class DeviceManagementConstants { public static final String DEVICE_CACHE = "DEVICE_CACHE"; public static final String ENROLLMENT_NOTIFICATION_API_ENDPOINT = "/api/device-mgt/enrollment-notification"; + public static final class ConfigurationManagement { + private ConfigurationManagement(){ + throw new AssertionError(); + } + public static final String ADMIN_CREDENTIALS = "admin:admin"; + public static final String SCOPES_FOR_TOKEN = "perm:device:operations perm:device:publish-event"; + public static final String IOT_GATEWAY_HOST = "iot.gateway.host"; + public static final String IOT_GATEWAY_HTTPS_PORT = "iot.gateway.https.port"; + public static final String MQTT_ENDPOINTS = "mqttEndpoints"; + public static final String APPLICATION_REGISTRATION_API_ENDPOINT = + "/api-application-registration/register"; + public static final String AUTHORIZATION_HEADER = "authorization"; + public static final String BASIC_AUTH = "Basic"; + + } public static final class Common { private Common() { throw new AssertionError(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java index f62d915d1ba..f824a2255b9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java @@ -40,6 +40,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status; import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DevicePropertyInfo; import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.geo.GeoCluster; import org.wso2.carbon.device.mgt.core.geo.geoHash.GeoCoordinate; @@ -190,6 +191,15 @@ public interface DeviceDAO { */ List getDeviceBasedOnDeviceProperties(Map deviceProps, int tenantId) throws DeviceManagementDAOException; + /** + * Retrieves a list of devices based on a given criteria of properties + * This will ignores the tenant and it will return devices registered under every tenants + * @param deviceProps properties by which devices need to be filtered + * @return list of devices with properties + * @throws DeviceManagementDAOException if the SQL query has failed to be executed + */ + List getDeviceBasedOnDeviceProperties(Map deviceProps) + throws DeviceManagementDAOException; /** * Retrieves properties of given device identifier diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceNotFoundDAOException.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceNotFoundDAOException.java new file mode 100644 index 00000000000..b4479ed20ae --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceNotFoundDAOException.java @@ -0,0 +1,28 @@ +package org.wso2.carbon.device.mgt.core.dao; + +/** + * Throws if the querying device is not found in the DB + */ +public class DeviceNotFoundDAOException extends Exception { + private static final long serialVersionUID = 2126172787830234694L; + + public DeviceNotFoundDAOException(String msg, Exception nestedEx) { + super(msg, nestedEx); + } + + public DeviceNotFoundDAOException(String message, Throwable cause) { + super(message, cause); + } + + public DeviceNotFoundDAOException(String msg) { + super(msg); + } + + public DeviceNotFoundDAOException() { + super(); + } + + public DeviceNotFoundDAOException(Throwable cause) { + super(cause); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/GroupDAO.java index c00237389cc..c181004dc49 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/GroupDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/GroupDAO.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.GroupPaginationRequest; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import java.util.List; +import java.util.Map; /** * This interface represents the key operations associated with persisting group related information. @@ -38,6 +39,49 @@ public interface GroupDAO { */ int addGroup(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException; + /** + * Add properties for device group. + * Note that groupId parameter is considered seperately due to the groupId parameter passed with + * device group Payload is ignored in the add/update logic instead the internal groupId reference is used. + * + * @param deviceGroup to be added. + * @param tenantId of the group. + * @return sql execution result. + * @throws GroupManagementDAOException + */ + boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException; + + /** + * Update properties for device group. + * Note that groupId parameter is considered seperately due to the groupId parameter passed with + * device group Payload is ignored in the add/update logic instead the internal groupId reference is used. + * + * @param deviceGroup to be updated. + * @param tenantId of the group. + * @return sql execution result. + * @throws GroupManagementDAOException + */ + boolean updateGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException; + + /** + * Remove properties for device group. + * + * @param groupId to be deleted. + * @param tenantId of the group. + * @throws GroupManagementDAOException + */ + void deleteAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException; + + /** + * Retrives all properties stored against a group. + * + * @param groupId to be deleted. + * @param tenantId of the group. + * @return sql execution result. + * @throws GroupManagementDAOException + */ + Map getAllGroupProperties(int groupId, int tenantId) throws GroupManagementDAOException; + /** * Update an existing Device Group. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 413e9bc56c3..6e5ef3a5861 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -42,6 +42,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status; import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DevicePropertyInfo; import org.wso2.carbon.device.mgt.core.dao.DeviceDAO; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; @@ -62,6 +63,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringJoiner; +import java.util.concurrent.atomic.AtomicInteger; public abstract class AbstractDeviceDAOImpl implements DeviceDAO { @@ -71,6 +73,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { private static final String PROPERTY_VALUE_COLUMN_NAME = "PROPERTY_VALUE"; private static final String PROPERTY_DEVICE_TYPE_NAME = "DEVICE_TYPE_NAME"; private static final String PROPERTY_DEVICE_IDENTIFICATION = "DEVICE_IDENTIFICATION"; + private static final String PROPERTY_TENANT_ID = "TENANT_ID"; @Override public int addDevice(int typeId, Device device, int tenantId) throws DeviceManagementDAOException { @@ -330,6 +333,65 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { return devices; } + @Override + public List getDeviceBasedOnDeviceProperties(Map deviceProps) + throws DeviceManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + ResultSet resultSet = null; + List deviceProperties = new ArrayList<>(); + try { + conn = this.getConnection(); + List> outputLists = new ArrayList<>(); + String sql = "SELECT " + + "p.DEVICE_IDENTIFICATION, " + + "p.DEVICE_TYPE_NAME, " + + "p.TENANT_ID FROM " + + "DM_DEVICE_PROPERTIES p "; + + String groupByClause = "GROUP BY " + + "p.DEVICE_IDENTIFICATION, " + + "p.DEVICE_TYPE_NAME, " + + "p.TENANT_ID"; + + int iterationCount = 0; + StringBuilder propertyQuery = new StringBuilder(" "); + for (Map.Entry stringStringEntry : deviceProps.entrySet()) { + String tempTableId = "t".concat(Integer.toString(iterationCount++)); + propertyQuery.append("JOIN DM_DEVICE_PROPERTIES ") + .append(tempTableId).append(" ").append("ON p.DEVICE_IDENTIFICATION = ") + .append(tempTableId).append(".DEVICE_IDENTIFICATION ") + .append("AND ") + .append(tempTableId).append(".PROPERTY_NAME = ? ") + .append("AND ") + .append(tempTableId).append(".PROPERTY_VALUE = ? "); + } + sql = sql.concat(propertyQuery.toString()).concat(groupByClause); + stmt = conn.prepareStatement(sql); + int index = 1; + for (Map.Entry entry : deviceProps.entrySet()) { + stmt.setString(index++, entry.getKey()); + stmt.setString(index++, entry.getValue()); + } + resultSet = stmt.executeQuery(); + while (resultSet.next()) { + DevicePropertyInfo devicePropertyInfo = new DevicePropertyInfo(); + devicePropertyInfo + .setDeviceIdentifier(resultSet.getString(PROPERTY_DEVICE_IDENTIFICATION)); + devicePropertyInfo.setTenantId(resultSet.getString(PROPERTY_TENANT_ID)); + devicePropertyInfo.setDeviceTypeName(resultSet.getString(PROPERTY_DEVICE_TYPE_NAME)); + deviceProperties.add(devicePropertyInfo); + } + return deviceProperties; + } catch (SQLException e) { + String msg = "Error occurred while fetching devices against criteria : '" + deviceProps; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } finally { + DeviceManagementDAOUtil.cleanupResources(stmt, resultSet); + } + } + @Override public Device getDeviceProps(String deviceId, int tenantId) throws DeviceManagementDAOException { Connection conn = null; @@ -385,7 +447,6 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { return intersectedResult; } - @Override public Device getDevice(String deviceIdentifier, Date since, int tenantId) throws DeviceManagementDAOException { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index dea2912776a..cb893438b44 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -32,7 +32,9 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * This class represents implementation of GroupDAO @@ -66,6 +68,62 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { } } + public boolean addGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) + throws GroupManagementDAOException { + boolean status; + PreparedStatement stmt = null; + try { + Connection conn = GroupManagementDAOFactory.getConnection(); + stmt = conn.prepareStatement( + "INSERT INTO GROUP_PROPERTIES(GROUP_ID, PROPERTY_NAME, " + + "PROPERTY_VALUE, TENANT_ID) VALUES (?, ?, ?, ?)"); + for (Map.Entry entry : deviceGroup.getGroupProperties().entrySet()) { + stmt.setInt(1, groupId); + stmt.setString(2, entry.getKey()); + stmt.setString(3, entry.getValue()); + stmt.setInt(4, tenantId); + stmt.addBatch(); + } + stmt.executeBatch(); + status = true; + } catch (SQLException e) { + String msg = "Error occurred while adding properties for group '" + + deviceGroup.getName() + "' values : " + deviceGroup.getGroupProperties(); + throw new GroupManagementDAOException(msg, e); + } finally { + GroupManagementDAOUtil.cleanupResources(stmt, null); + } + return status; + } + + public boolean updateGroupProperties(DeviceGroup deviceGroup, int groupId, int tenantId) + throws GroupManagementDAOException { + boolean status; + PreparedStatement stmt = null; + try { + Connection conn = GroupManagementDAOFactory.getConnection(); + stmt = conn.prepareStatement( + "UPDATE GROUP_PROPERTIES SET PROPERTY_VALUE = ? WHERE GROUP_ID = ? AND " + + "TENANT_ID = ? AND PROPERTY_NAME = ?"); + for (Map.Entry entry : deviceGroup.getGroupProperties().entrySet()) { + stmt.setString(1, entry.getValue()); + stmt.setInt(2, groupId); + stmt.setInt(3, tenantId); + stmt.setString(4, entry.getKey()); + stmt.addBatch(); + } + stmt.executeBatch(); + status = true; + } catch (SQLException e) { + String msg = "Error occurred while adding properties for group '" + + deviceGroup.getName() + "' values : " + deviceGroup.getGroupProperties(); + throw new GroupManagementDAOException(msg, e); + } finally { + GroupManagementDAOUtil.cleanupResources(stmt, null); + } + return status; + } + @Override public void updateGroup(DeviceGroup deviceGroup, int groupId, int tenantId) throws GroupManagementDAOException { @@ -130,6 +188,49 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { } } + public void deleteAllGroupProperties(int groupId, int tenantId) + throws GroupManagementDAOException { + PreparedStatement stmt = null; + try { + Connection conn = GroupManagementDAOFactory.getConnection(); + stmt = conn.prepareStatement( + "DELETE GROUP_PROPERTIES WHERE GROUP_ID = ? AND TENANT_ID = ?"); + stmt.setInt(1, groupId); + stmt.setInt(2, tenantId); + stmt.executeUpdate(); + } catch (SQLException e) { + String msg = "Error occurred while deleting group ID : " + groupId; + throw new GroupManagementDAOException(msg, e); + } finally { + GroupManagementDAOUtil.cleanupResources(stmt, null); + } + } + + public Map getAllGroupProperties(int groupId, int tenantId) + throws GroupManagementDAOException { + PreparedStatement stmt = null; + ResultSet resultSet = null; + Map properties = new HashMap(); + try { + Connection conn = GroupManagementDAOFactory.getConnection(); + stmt = conn.prepareStatement( + "SELECT PROPERTY_NAME, PROPERTY_VALUE FROM GROUP_PROPERTIES WHERE GROUP_ID = ? AND TENANT_ID = ?"); + stmt.setInt(1, groupId); + stmt.setInt(2, tenantId); + resultSet = stmt.executeQuery(); + while (resultSet.next()) { + properties.put(resultSet.getString("PROPERTY_NAME"), + resultSet.getString("PROPERTY_VALUE")); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting group ID : " + groupId; + throw new GroupManagementDAOException(msg, e); + } finally { + GroupManagementDAOUtil.cleanupResources(stmt, null); + } + return properties; + } + @Override public DeviceGroup getGroup(int groupId, int tenantId) throws GroupManagementDAOException { PreparedStatement stmt = null; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 296cf8db7c9..d83f1cf4832 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -240,6 +240,7 @@ public class OperationManagerImpl implements OperationManager { } int operationId = this.lookupOperationDAO(operation).addOperation(operationDto); + operation.setId(operationId); boolean isScheduled = false; NotificationStrategy notificationStrategy = getNotificationStrategy(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java index ff402f7e977..efabf9bee60 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java @@ -79,6 +79,10 @@ public class OperationDAOUtil { dtoOperation.setControl(Operation.Control.valueOf(operation.getControl().toString())); } + if (operation.getInitiatedBy() != null) { + dtoOperation.setInitiatedBy(operation.getInitiatedBy()); + } + return dtoOperation; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index ddcad309e5b..10cbe96df23 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -38,6 +38,7 @@ package org.wso2.carbon.device.mgt.core.service; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceTypeNotFoundException; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.FeatureManager; @@ -46,9 +47,12 @@ import org.wso2.carbon.device.mgt.common.MonitoringOperation; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; +import org.wso2.carbon.device.mgt.common.exceptions.UnauthorizedDeviceAccessException; import org.wso2.carbon.device.mgt.common.exceptions.UserNotFoundException; import org.wso2.carbon.device.mgt.common.StartupOperationConfig; +import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; @@ -741,4 +745,19 @@ public interface DeviceManagementProviderService { DeviceTypeVersion getDeviceTypeVersion(String deviceTypeName, String version) throws DeviceManagementException; + + /** + * Retrieves a list of configurations of a specific device + * using the device's properties + * @param propertyMap properties by which devices need to be drawn + * @return list of device configuration + * @throws DeviceManagementException if any service level or DAO level error occurs + * @throws DeviceNotFoundException if there is no any device can found for specified properties + * @throws UnauthorizedDeviceAccessException if the required token property is not found on + * @throws AmbiguousConfigurationException if configuration is ambiguous + * the property payload + */ + DeviceConfiguration getDeviceConfiguration(Map propertyMap) + throws DeviceManagementException, DeviceNotFoundException, UnauthorizedDeviceAccessException, + AmbiguousConfigurationException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 2f6d4104cb8..c6fa1ebb71f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -66,10 +66,15 @@ import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.exceptions.TransactionManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.UnauthorizedDeviceAccessException; import org.wso2.carbon.device.mgt.common.exceptions.UserNotFoundException; import org.wso2.carbon.device.mgt.common.StartupOperationConfig; import org.wso2.carbon.device.mgt.common.app.mgt.Application; +import org.wso2.carbon.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; +import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DeviceConfiguration; +import org.wso2.carbon.device.mgt.common.configuration.mgt.DevicePropertyInfo; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; @@ -3439,4 +3444,83 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return versions; } + @Override + public DeviceConfiguration getDeviceConfiguration(Map deviceProps) + throws DeviceManagementException, DeviceNotFoundException, UnauthorizedDeviceAccessException, + AmbiguousConfigurationException { + + if (log.isDebugEnabled()) { + log.debug("Attempting to get device configurations based on properties."); + } + + DevicePropertyInfo deviceProperties; + List devicePropertyList; + try { + DeviceManagementDAOFactory.openConnection(); + devicePropertyList = deviceDAO.getDeviceBasedOnDeviceProperties(deviceProps); + if (devicePropertyList == null || devicePropertyList.isEmpty()) { + String msg = "Cannot find device for specified properties"; + log.info(msg); + throw new DeviceNotFoundException(msg); + } + //In this service, there should be only one device for the specified property values + //If multiple values retrieved, It'll be marked as ambiguous. + if (devicePropertyList.size() > 1) { + String msg = "Device property list contains more than one element"; + log.error(msg); + throw new AmbiguousConfigurationException(msg); + } + //Get the only existing value of the list + deviceProperties = devicePropertyList.get(0); + + } catch (SQLException e) { + String msg = "Error occurred while opening a connection to the data source"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (DeviceManagementDAOException e) { + String msg = "Devices configuration retrieval criteria cannot be null or empty."; + log.error(msg); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + + try { + Device device = this.getDevice(new DeviceIdentifier(deviceProperties.getDeviceIdentifier(), + deviceProperties.getDeviceTypeName()), false); + String owner = device.getEnrolmentInfo().getOwner(); + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + ctx.setTenantId(Integer.parseInt(deviceProperties.getTenantId()), true); + PlatformConfiguration configuration = this.getConfiguration(device.getType()); + List configurationEntries = new ArrayList<>(); + if (configuration != null) { + configurationEntries = configuration.getConfiguration(); + } + return wrapConfigurations(device, ctx.getTenantDomain(), configurationEntries, owner); + } finally { + PrivilegedCarbonContext.endTenantFlow(); + } + } + + /** + * Wrap the device configuration data into DeviceConfiguration bean + * @param device Device queried using the properties + * @param tenantDomain tenant domain + * @param configurationEntries platformConfiguration list + * @param deviceOwner name of the device owner + * @return Wrapped {@link DeviceConfiguration} object with data + */ + private DeviceConfiguration wrapConfigurations(Device device, + String tenantDomain, + List configurationEntries, + String deviceOwner) { + DeviceConfiguration deviceConfiguration = new DeviceConfiguration(); + deviceConfiguration.setDeviceId(device.getDeviceIdentifier()); + deviceConfiguration.setDeviceType(device.getType()); + deviceConfiguration.setTenantDomain(tenantDomain); + deviceConfiguration.setConfigurationEntries(configurationEntries); + deviceConfiguration.setDeviceOwner(deviceOwner); + return deviceConfiguration; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 62a5a7982c4..0f115cd7881 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -83,7 +83,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid GroupManagementDAOFactory.beginTransaction(); DeviceGroup existingGroup = this.groupDAO.getGroup(deviceGroup.getName(), tenantId); if (existingGroup == null) { - this.groupDAO.addGroup(deviceGroup, tenantId); + int updatedGroupID = this.groupDAO.addGroup(deviceGroup, tenantId); + if (deviceGroup.getGroupProperties() != null && deviceGroup.getGroupProperties().size() > 0) { + this.groupDAO.addGroupProperties(deviceGroup, updatedGroupID, tenantId); + } GroupManagementDAOFactory.commitTransaction(); } else { throw new GroupAlreadyExistException("Group exist with name " + deviceGroup.getName()); @@ -132,6 +135,9 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid DeviceGroup existingGroup = this.groupDAO.getGroup(groupId, tenantId); if (existingGroup != null) { this.groupDAO.updateGroup(deviceGroup, groupId, tenantId); + if (deviceGroup.getGroupProperties() != null && deviceGroup.getGroupProperties().size() > 0) { + this.groupDAO.updateGroupProperties(deviceGroup, groupId, tenantId); + } GroupManagementDAOFactory.commitTransaction(); } else { throw new GroupNotExistException("Group with ID - '" + groupId + "' doesn't exists!"); @@ -171,6 +177,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid try { GroupManagementDAOFactory.beginTransaction(); this.groupDAO.deleteGroup(groupId, CarbonContext.getThreadLocalCarbonContext().getTenantId()); + this.groupDAO.deleteAllGroupProperties(groupId, CarbonContext.getThreadLocalCarbonContext().getTenantId()); GroupManagementDAOFactory.commitTransaction(); if (log.isDebugEnabled()) { log.debug("DeviceGroup " + deviceGroup.getName() + " removed."); @@ -206,6 +213,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid try { GroupManagementDAOFactory.openConnection(); deviceGroup = this.groupDAO.getGroup(groupId, CarbonContext.getThreadLocalCarbonContext().getTenantId()); + if(deviceGroup != null && deviceGroup.getGroupId() > 0) { + deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(), + CarbonContext.getThreadLocalCarbonContext().getTenantId())); + } } catch (GroupManagementDAOException e) { String msg = "Error occurred while obtaining group '" + groupId + "'"; log.error(msg, e); @@ -241,6 +252,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid try { GroupManagementDAOFactory.openConnection(); deviceGroup = this.groupDAO.getGroup(groupName, CarbonContext.getThreadLocalCarbonContext().getTenantId()); + if(deviceGroup != null && deviceGroup.getGroupId() > 0) { + deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(), + CarbonContext.getThreadLocalCarbonContext().getTenantId())); + } } catch (GroupManagementDAOException e) { String msg = "Error occurred while obtaining group with name: '" + groupName + "'"; log.error(msg, e); @@ -269,6 +284,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); GroupManagementDAOFactory.openConnection(); deviceGroups = this.groupDAO.getGroups(tenantId); + if(deviceGroups != null && !deviceGroups.isEmpty()) { + for (DeviceGroup group : deviceGroups) { + group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId)); + } + } } catch (GroupManagementDAOException e) { String msg = "Error occurred while retrieving all groups in tenant"; log.error(msg, e); @@ -303,6 +323,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); GroupManagementDAOFactory.openConnection(); deviceGroups = this.groupDAO.getGroups(request, tenantId); + if(deviceGroups != null && !deviceGroups.isEmpty()) { + for (DeviceGroup group : deviceGroups) { + group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId)); + } + } } catch (GroupManagementDAOException e) { String msg = "Error occurred while retrieving all groups in tenant"; log.error(msg, e); @@ -348,6 +373,9 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } deviceGroups = this.groupDAO.getGroups(roleList, tenantId); for (DeviceGroup deviceGroup : deviceGroups) { + if(deviceGroup != null && deviceGroup.getGroupId() > 0) { + deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(), tenantId)); + } groups.put(deviceGroup.getGroupId(), deviceGroup); } } catch (UserStoreException | SQLException | GroupManagementDAOException e) { @@ -410,6 +438,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); GroupManagementDAOFactory.openConnection(); allMatchingGroups = this.groupDAO.getGroups(request, allDeviceGroupIdsOfUser, tenantId); + if(allMatchingGroups != null && !allMatchingGroups.isEmpty()) { + for (DeviceGroup group : allMatchingGroups) { + group.setGroupProperties(this.groupDAO.getAllGroupProperties(group.getGroupId(), tenantId)); + } + } } catch (GroupManagementDAOException | SQLException e) { String msg = "Error occurred while retrieving all groups in tenant"; log.error(msg, e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 14a00443464..6ceb93ba464 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -17,13 +17,25 @@ */ package org.wso2.carbon.device.mgt.core.util; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.protocol.HTTP; import org.w3c.dom.Document; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.caching.impl.CacheImpl; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; +import org.wso2.carbon.device.mgt.common.AppRegistrationCredentials; +import org.wso2.carbon.device.mgt.common.ApplicationRegistration; +import org.wso2.carbon.device.mgt.common.ApplicationRegistrationException; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; @@ -48,6 +60,10 @@ 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.util.DeviceIDHolder; +import org.wso2.carbon.identity.jwt.client.extension.JWTClient; +import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import org.wso2.carbon.user.api.TenantManager; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.CarbonUtils; @@ -62,9 +78,13 @@ import javax.sql.DataSource; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import java.io.BufferedReader; import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Base64; import java.util.HashMap; import java.util.Hashtable; import java.util.List; @@ -576,4 +596,102 @@ public final class DeviceManagerUtil { } return deviceCache; } + + /** + * Create an app and get app registration token from the application registration endpoint + * + * @return AppRegistrationToken object which contains access and refresh tokens + * @throws ApplicationRegistrationException when application fails to connect with the app registration + * endpoint + */ + @SuppressWarnings("PackageAccessibility") + public static AppRegistrationCredentials getApplicationRegistrationCredentials(String host, String port, + String credentials) + throws ApplicationRegistrationException { + if (host == null || port == null) { + String msg = "Required gatewayHost or gatewayPort system property is null"; + log.error(msg); + throw new ApplicationRegistrationException(msg); + } + String internalServerAddr = "https://".concat(host).concat(":").concat(port); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpPost apiEndpoint = new HttpPost( + internalServerAddr + DeviceManagementConstants.ConfigurationManagement + .APPLICATION_REGISTRATION_API_ENDPOINT); + + apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); + apiEndpoint.setHeader(DeviceManagementConstants.ConfigurationManagement.AUTHORIZATION_HEADER, + DeviceManagementConstants.ConfigurationManagement.BASIC_AUTH.concat(" ") + .concat(getBase64EncodedCredentials(credentials))); + apiEndpoint.setEntity(constructApplicationRegistrationPayload()); + HttpResponse response = client.execute(apiEndpoint); + if (response != null) { + log.info("Obtained client credentials: " + response.getStatusLine().getStatusCode()); + BufferedReader rd = new BufferedReader( + new InputStreamReader(response.getEntity().getContent())); + StringBuilder result = new StringBuilder(); + String line; + while ((line = rd.readLine()) != null) { + result.append(line); + } + return new ObjectMapper().readValue(result.toString(), AppRegistrationCredentials.class); + } else { + String msg = "Response is 'NUll' for the Application Registration API call."; + log.error(msg); + throw new ApplicationRegistrationException(msg); + } + } catch (IOException e) { + throw new ApplicationRegistrationException( + "Error occurred when invoking API. API endpoint: " + + internalServerAddr + DeviceManagementConstants.ConfigurationManagement + .APPLICATION_REGISTRATION_API_ENDPOINT, e); + } + } + + /** + * Use default admin credentials and encode them in Base64 + * + * @return Base64 encoded client credentials + */ + private static String getBase64EncodedCredentials(String credentials) { + return Base64.getEncoder().encodeToString(credentials.getBytes()); + } + + /** + * Create a JSON payload for application registration + * + * @return Generated JSON payload + */ + @SuppressWarnings("PackageAccessibility") + private static StringEntity constructApplicationRegistrationPayload() { + ApplicationRegistration applicationRegistration = new ApplicationRegistration(); + applicationRegistration.setApplicationName("MyApp"); + applicationRegistration.setAllowedToAllDomains(false); + List tags = new ArrayList<>(); + tags.add("device_management"); + applicationRegistration.setTags(tags); + applicationRegistration.setValidityPeriod(3600); + Gson gson = new Gson(); + String payload = gson.toJson(applicationRegistration); + return new StringEntity(payload, ContentType.APPLICATION_JSON); + } + + /** + * Retrieves access token for a given device + * @param scopes scopes for token + * @param clientId clientId + * @param clientSecret clientSecret + * @param deviceOwner owner of the device that is going to generate token + * @return @{@link AccessTokenInfo} wrapped object of retrieved access token and refresh token + * @throws JWTClientException if an error occurs when the jwt client creation or token retrieval + */ + public static AccessTokenInfo getAccessTokenForDeviceOwner(String scopes, String clientId, + String clientSecret, String deviceOwner) + throws JWTClientException { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + JWTClientManagerService jwtClientManagerService = (JWTClientManagerService) ctx + .getOSGiService(JWTClientManagerService.class, null); + JWTClient jwtClient = jwtClientManagerService.getJWTClient(); + return jwtClient.getAccessToken(clientId, clientSecret, deviceOwner, scopes); + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql index 6a7ff488144..89eaa6d335d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql @@ -50,6 +50,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES ( PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID) ); +CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES ( + GROUP_ID INTEGER NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID VARCHAR(100), + PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +); + CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( ID INTEGER AUTO_INCREMENT NOT NULL, DEVICE_ID INTEGER DEFAULT NULL, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/public/js/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/public/js/device.js index e7a216dd3e6..e18af314333 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/public/js/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.analytics-view/public/js/device.js @@ -45,7 +45,14 @@ function drawTable(from, to) { order: [], ajax: { url: "/devicemgt/api/stats/paginate", - data: buildAjaxData + data: buildAjaxData, + dataSrc: function(json) { + return json.data.map(function(event) { + event[0] = new moment(event[0]). + format("YYYY-MM-DD HH:mm:ss.SSS"); + return event; + }) + } } }); } @@ -71,4 +78,4 @@ function buildAjaxData (){ return obj; -} \ No newline at end of file +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css index 27a469d35f8..97d9bfbce43 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css @@ -2401,7 +2401,7 @@ a.list-group-item:hover { } .tree-view li > .icon { - font-family: "font-wso2"; + font-family: "font-entgra"; font-style: normal; background: #2c313b; color: #ffffff; @@ -2686,7 +2686,7 @@ a.list-group-item:hover { text-align: center; background: #2c313b; color: #fff; - font-family: font-wso2; + font-family: font-entgra; } .checkbox > input[type=checkbox]:not(:checked) + .helper:after { @@ -4433,7 +4433,7 @@ a.wr-side-panel-toggle-btn.selected { text-align: center; background: #008cc4; color: #fff; - font-family: font-wso2; + font-family: font-entgra; } .wr-input-control.checkbox input[type="checkbox"]:not(:checked) + .helper:after { @@ -6624,7 +6624,7 @@ ul.tiles .icon { } .tree-view li > .icon { - font-family: 'font-wso2'; + font-family: 'font-entgra'; font-style: normal; background: #2c313b; color: #ffffff; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css index cbff8ffd9c1..bf28c543e5a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css @@ -8053,7 +8053,7 @@ a.list-group-item:hover { } .tree-view li > .icon { - font-family: "font-wso2"; + font-family: "font-entgra"; font-style: normal; background: #008cc4; color: #ffffff; @@ -8295,7 +8295,7 @@ a.list-group-item:hover { text-align: center; background: #004675; color: #fff; - font-family: font-wso2; + font-family: font-entgra; } .checkbox > input[type=checkbox]:not(:checked) + .helper:after { display: none; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/css/font-wso2.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.css old mode 100644 new mode 100755 similarity index 91% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/css/font-wso2.css rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.css index c6544d6f2eb..1665602d069 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/css/font-wso2.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.css @@ -1,5 +1,5 @@ /*! -~ Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved. +~ Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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. @@ -16,20 +16,20 @@ @font-face { - font-family:"font-wso2"; - src:local("font-wso2"), url("../fonts/font-wso2.eot?6563fa91278f239ef8c827d90a165223"); - src:local("font-wso2"), - url("../fonts/font-wso2.eot?#iefix") format("embedded-opentype"), - url("../fonts/font-wso2.woff2?6563fa91278f239ef8c827d90a165223") format("woff2"), - url("../fonts/font-wso2.woff?6563fa91278f239ef8c827d90a165223") format("woff"), - url("../fonts/font-wso2.ttf?6563fa91278f239ef8c827d90a165223") format("truetype"), - url("../fonts/font-wso2.svg?6563fa91278f239ef8c827d90a165223#font-wso2") format("svg"); + font-family:"font-entgra"; + src:local("font-entgra"), url("../fonts/font-entgra.eot?3990d6a2bf7b820a842f9dc0774c990e"); + src:local("font-entgra"), + url("../fonts/font-entgra.eot?3990d6a2bf7b820a842f9dc0774c990e#iefix") format("embedded-opentype"), + url("../fonts/font-entgra.woff2?3990d6a2bf7b820a842f9dc0774c990e") format("woff2"), + url("../fonts/font-entgra.woff?3990d6a2bf7b820a842f9dc0774c990e") format("woff"), + url("../fonts/font-entgra.ttf?3990d6a2bf7b820a842f9dc0774c990e") format("truetype"), + url("../fonts/font-entgra.svg?3990d6a2bf7b820a842f9dc0774c990e#font-entgra") format("svg"); font-weight:normal; font-style:normal; } .fw, [class^="fw-"], [class*=" fw-"] { - font: normal normal normal 14px/1 font-wso2; + font: normal normal normal 14px/1 font-entgra; display: inline-block; font-weight: normal; font-style: normal; @@ -304,10 +304,18 @@ content:"\e6cf"; } +.fw-activesync:before { + content:"\e745"; +} + .fw-add:before { content:"\e615"; } +.fw-aggregate:before { + content:"\e742"; +} + .fw-airplay:before { content:"\e600"; } @@ -348,7 +356,7 @@ content:"\e602"; } -.fw-ios:before { +.fw-apple:before { content:"\e604"; } @@ -380,6 +388,10 @@ content:"\e60a"; } +.fw-bean:before { + content:"\e743"; +} + .fw-blank-document:before { content:"\e60c"; } @@ -416,6 +428,10 @@ content:"\e612"; } +.fw-call-mediator:before { + content:"\e736"; +} + .fw-camera:before { content:"\e613"; } @@ -480,7 +496,7 @@ content:"\e653"; } -.fw-configarations:before { +.fw-configurations:before { content:"\e609"; } @@ -500,6 +516,10 @@ content:"\e620"; } +.fw-continue:before { + content:"\e73e"; +} + .fw-contract:before { content:"\e614"; } @@ -516,6 +536,10 @@ content:"\e622"; } +.fw-data-mapper:before { + content:"\e735"; +} + .fw-database:before { content:"\e623"; } @@ -628,6 +652,10 @@ content:"\e628"; } +.fw-dollar:before { + content:"\e741"; +} + .fw-down-arrow:before { content:"\e689"; } @@ -672,6 +700,10 @@ content:"\e6e3"; } +.fw-event-simulator:before { + content:"\e744"; +} + .fw-expand:before { content:"\e61c"; } @@ -716,6 +748,10 @@ content:"\e62e"; } +.fw-foreach:before { + content:"\e73ab"; +} + .fw-fork-join:before { content:"\e720"; } @@ -764,6 +800,10 @@ content:"\e6da"; } +.fw-google-glass:before { + content:"\e732"; +} + .fw-google-plus:before { content:"\e6d9"; } @@ -800,6 +840,10 @@ content:"\e639"; } +.fw-header:before { + content:"\e734"; +} + .fw-heart:before { content:"\e6c3"; } @@ -832,6 +876,10 @@ content:"\e63c"; } +.fw-in-sequence:before { + content:"\e739"; +} + .fw-incoming-call:before { content:"\e63d"; } @@ -844,6 +892,10 @@ content:"\e6db"; } +.fw-integration:before { + content:"\e73f"; +} + .fw-invitation:before { content:"\e63f"; } @@ -896,6 +948,10 @@ content:"\e647"; } +.fw-kiosk:before { + content:"\e746"; +} + .fw-laptop:before { content:"\e648"; } @@ -960,6 +1016,10 @@ content:"\e64e"; } +.fw-log:before { + content:"\e738"; +} + .fw-logical:before { content:"\e702"; } @@ -976,6 +1036,10 @@ content:"\e650"; } +.fw-mapping:before { + content:"\e73c"; +} + .fw-menu:before { content:"\e651"; } @@ -1004,6 +1068,10 @@ content:"\e655"; } +.fw-namespace:before { + content:"\e740"; +} + .fw-nodejs:before { content:"\e656"; } @@ -1016,6 +1084,10 @@ content:"\e6ac"; } +.fw-out-sequence:before { + content:"\e73a"; +} + .fw-own:before { content:"\e6c8"; } @@ -1032,6 +1104,10 @@ content:"\e658"; } +.fw-payload-factory:before { + content:"\e733"; +} + .fw-pdf:before { content:"\e659"; } @@ -1060,6 +1136,10 @@ content:"\e70d"; } +.fw-property:before { + content:"\e737"; +} + .fw-prototype:before { content:"\e6cc"; } @@ -1088,6 +1168,10 @@ content:"\e65d"; } +.fw-reduce:before { + content:"\e73d"; +} + .fw-refresh:before { content:"\e692"; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.min.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.min.css new file mode 100755 index 00000000000..6ecdc547205 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/css/font-entgra.min.css @@ -0,0 +1,15 @@ +/*! +~ Copyright (c) WSO2 Inc. (http://wso2.com) 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. +*/@font-face{font-family:font-entgra;src:local("font-entgra"),url(../fonts/font-entgra.eot?3990d6a2bf7b820a842f9dc0774c990e);src:local("font-entgra"),url(../fonts/font-entgra.eot?3990d6a2bf7b820a842f9dc0774c990e#iefix) format("embedded-opentype"),url(../fonts/font-entgra.woff2?3990d6a2bf7b820a842f9dc0774c990e) format("woff2"),url(../fonts/font-entgra.woff?3990d6a2bf7b820a842f9dc0774c990e) format("woff"),url(../fonts/font-entgra.ttf?3990d6a2bf7b820a842f9dc0774c990e) format("truetype"),url(../fonts/font-entgra.svg?3990d6a2bf7b820a842f9dc0774c990e#font-entgra) format("svg");font-weight:400;font-style:normal}.fw,[class*=" fw-"],[class^=fw-]{font:normal normal normal 14px/1 font-entgra;display:inline-block;font-weight:400;font-style:normal;font-size:inherit;font-variant:normal;speak:none;text-decoration:inherit;text-transform:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fw-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fw-2x{font-size:2em}.fw-3x{font-size:3em}.fw-4x{font-size:4em}.fw-5x{font-size:5em}.fw-fw{width:1.28571429em;text-align:center}.fw-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fw-ul>li{position:relative}.fw-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fw-li.fw-lg{left:-1.85714286em}.fw-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fw-background{background:#888;border-radius:.3em;padding:.4em .5em .45em}.fw-pull-left{float:left}.fw-pull-right{float:right}.fw.fw-pull-left{margin-right:.3em}.fw.fw-pull-right{margin-left:.3em}.fw-spin{-webkit-animation:fw-spin 2s infinite linear;animation:fw-spin 2s infinite linear}@-webkit-keyframes fw-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fw-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fw-pulse{-webkit-animation:fw-pulse 2s ease-out infinite;animation:fw-pulse 2s ease-out infinite}@-webkit-keyframes fw-pulse{0%,30%{opacity:.3}40%{opacity:1}100%{opacity:.3}}@keyframes fw-pulse{0%,30%{opacity:.3}40%{opacity:1}100%{opacity:.3}}.fw-rotate-90{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fw-rotate-180{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fw-rotate-270{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fw-flip-horizontal{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fw-flip-vertical{-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fw-flip-horizontal,:root .fw-flip-vertical,:root .fw-rotate-180,:root .fw-rotate-270,:root .fw-rotate-90{filter:none}.fw-helper,.fw-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:1.85em;vertical-align:middle}.fw-helper:after,.fw-helper:before,.fw-stack-1x,.fw-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fw-helper:before,.fw-stack-1x{line-height:inherit}.fw-helper:after,.fw-stack-2x{font-size:1.9em}.fw-helper-slash:before{font-size:1.4em}.fw-helper-circle:before,.fw-helper-square:before{z-index:1}.fw-helper-circle-outline:after{content:"\e61f"}.fw-helper-circle:after{content:"\e61a"}.fw-helper-square-outline:after{content:"\e6b2"}.fw-helper-square:after{content:"\e6b1"}.fw-helper-slash:after{content:"\e6e1"}.fw-stack>.fw-stack{position:absolute;font-size:.5em}.fw-stack>.fw-stack.fw-move-top{top:-.2em}.fw-stack>.fw-stack.fw-move-bottom{bottom:-.2em}.fw-stack>.fw.stack.fw-move-left{left:-.5em}.fw-stack>.fw-stack.fw-move-right{right:-.5em}.fw-helper-inverse:after,.fw-inverse:before,.fw-number{color:#fff}.fw-helper-shadow:after,.fw-shadow:before{text-shadow:#fff 1px 1px 0}.fw-helper-stroke:after,.fw-stroke:before{text-shadow:-2px -2px 0 #fff,2px -2px 0 #fff,-2px 2px 0 #fff,2px 2px 0 #fff}.fw-number{line-height:2em;font-family:Arial,Helvetica,sans-serif}.fw-abort:before{content:"\e72a"}.fw-action-invoke:before{content:"\e6fe"}.fw-action:before{content:"\e709"}.fw-activate:before{content:"\e6cf"}.fw-activesync:before{content:"\e745"}.fw-add:before{content:"\e615"}.fw-aggregate:before{content:"\e742"}.fw-airplay:before{content:"\e600"}.fw-alarm:before{content:"\e6c2"}.fw-alert:before{content:"\e6be"}.fw-analytics-extensions:before{content:"\e6e2"}.fw-android-logcat:before{content:"\e72c"}.fw-android-sense:before{content:"\e72d"}.fw-android:before{content:"\e606"}.fw-annotation:before{content:"\e6e6"}.fw-api:before{content:"\e601"}.fw-apn:before{content:"\e602"}.fw-apple:before{content:"\e604"}.fw-application:before{content:"\e608"}.fw-arduino:before{content:"\e6ab"}.fw-assign:before{content:"\e6ff"}.fw-ballerina-service:before{content:"\e729"}.fw-ballerina:before{content:"\e728"}.fw-bar-chart:before{content:"\e690"}.fw-battery:before{content:"\e60a"}.fw-bean:before{content:"\e743"}.fw-blank-document:before{content:"\e60c"}.fw-block:before{content:"\e695"}.fw-bookmark:before{content:"\e60d"}.fw-bpel:before{content:"\e60e"}.fw-bpmn:before{content:"\e60f"}.fw-break:before{content:"\e721"}.fw-bug:before{content:"\e611"}.fw-build:before{content:"\e6c1"}.fw-calendar:before{content:"\e612"}.fw-call-mediator:before{content:"\e736"}.fw-camera:before{content:"\e613"}.fw-cancel:before{content:"\e618"}.fw-carbon:before{content:"\e6c5"}.fw-chat:before{content:"\e65b"}.fw-check:before{content:"\e617"}.fw-checklist:before{content:"\e619"}.fw-circle-outline:before{content:"\e61f"}.fw-circle:before{content:"\e61a"}.fw-clear:before{content:"\e61b"}.fw-clock:before{content:"\e61d"}.fw-cloud:before{content:"\e61e"}.fw-code-view:before{content:"\e70e"}.fw-code:before{content:"\e6f1"}.fw-comment:before{content:"\e710"}.fw-compare:before{content:"\e610"}.fw-computer:before{content:"\e653"}.fw-configurations:before{content:"\e609"}.fw-connector:before{content:"\e700"}.fw-console:before{content:"\e71d"}.fw-constant:before{content:"\e701"}.fw-contact:before{content:"\e620"}.fw-continue:before{content:"\e73e"}.fw-contract:before{content:"\e614"}.fw-copy:before{content:"\e621"}.fw-cut:before{content:"\e6f2"}.fw-dashboard:before{content:"\e622"}.fw-data-mapper:before{content:"\e735"}.fw-database:before{content:"\e623"}.fw-delete:before{content:"\e624"}.fw-depend:before{content:"\e6c6"}.fw-deploy:before{content:"\e625"}.fw-deprecate:before{content:"\e6cb"}.fw-design-view:before{content:"\e70f"}.fw-devices:before{content:"\e704"}.fw-dgm-action-invoke:before{content:"\e712"}.fw-dgm-action:before{content:"\e711"}.fw-dgm-connector:before{content:"\e6f4"}.fw-dgm-constant-definition:before{content:"\e6f5"}.fw-dgm-fork:before{content:"\e6e7"}.fw-dgm-header:before{content:"\e6e8"}.fw-dgm-if-else:before{content:"\e6e9"}.fw-dgm-import:before{content:"\e717"}.fw-dgm-lifeline:before{content:"\e6ea"}.fw-dgm-logger:before{content:"\e6eb"}.fw-dgm-resource:before{content:"\e6f6"}.fw-dgm-service:before{content:"\e6f7"}.fw-dgm-try-catch:before{content:"\e6ec"}.fw-dgm-type-convertor:before{content:"\e6f8"}.fw-dgm-type:before{content:"\e6f9"}.fw-dgm-while:before{content:"\e707"}.fw-dial-up:before{content:"\e627"}.fw-disabled:before{content:"\e6d1"}.fw-display:before{content:"\e626"}.fw-docker:before{content:"\e70c"}.fw-document:before{content:"\e628"}.fw-dollar:before{content:"\e741"}.fw-down-arrow:before{content:"\e689"}.fw-down:before{content:"\e685"}.fw-download:before{content:"\e65f"}.fw-dss:before{content:"\e62a"}.fw-ebook:before{content:"\e62b"}.fw-edit:before{content:"\e62c"}.fw-ellipsis:before{content:"\e629"}.fw-endpoint:before{content:"\e62d"}.fw-enterprise:before{content:"\e6b6"}.fw-error:before{content:"\e630"}.fw-esb-connector:before{content:"\e6e3"}.fw-event-simulator:before{content:"\e744"}.fw-expand:before{content:"\e61c"}.fw-export:before{content:"\e631"}.fw-extensions:before{content:"\e6e4"}.fw-facebook:before{content:"\e6d3"}.fw-factory-reset:before{content:"\e632"}.fw-fan:before{content:"\e678"}.fw-faq:before{content:"\e62f"}.fw-file-browse:before{content:"\e633"}.fw-filter:before{content:"\e634"}.fw-folder-open:before{content:"\e70b"}.fw-folder:before{content:"\e62e"}.fw-foreach:before{content:"\e73ab"}.fw-fork-join:before{content:"\e720"}.fw-format:before{content:"\e6fa"}.fw-forum:before{content:"\e636"}.fw-function-invoke:before{content:"\e713"}.fw-function:before{content:"\e6fb"}.fw-gadget:before{content:"\e637"}.fw-geo-fence-inbound:before{content:"\e72e"}.fw-geo-fence-outbound:before{content:"\e72f"}.fw-github:before{content:"\e6d4"}.fw-globe:before{content:"\e697"}.fw-google-docs:before{content:"\e6d6"}.fw-google-drive:before{content:"\e6da"}.fw-google-glass:before{content:"\e732"}.fw-google-plus:before{content:"\e6d9"}.fw-google-sheets:before{content:"\e6d7"}.fw-google-slides:before{content:"\e6d8"}.fw-google:before{content:"\e6d5"}.fw-grid:before{content:"\e638"}.fw-grip:before{content:"\e6b7"}.fw-group:before{content:"\e6af"}.fw-hardware:before{content:"\e6a9"}.fw-hdd:before{content:"\e639"}.fw-header:before{content:"\e734"}.fw-heart:before{content:"\e6c3"}.fw-hide:before{content:"\e6d2"}.fw-home:before{content:"\e63a"}.fw-hour-glass:before{content:"\e63b"}.fw-html:before{content:"\e69d"}.fw-http:before{content:"\e705"}.fw-image:before{content:"\e70a"}.fw-import:before{content:"\e63c"}.fw-in-sequence:before{content:"\e739"}.fw-incoming-call:before{content:"\e63d"}.fw-info:before{content:"\e63e"}.fw-instagram:before{content:"\e6db"}.fw-integration:before{content:"\e73f"}.fw-invitation:before{content:"\e63f"}.fw-invoke:before{content:"\e6ed"}.fw-is-connector:before{content:"\e6e5"}.fw-iterate:before{content:"\e71f"}.fw-jaggery:before{content:"\e640"}.fw-java-spring:before{content:"\e644"}.fw-java:before{content:"\e641"}.fw-javaee:before{content:"\e642"}.fw-javascript:before{content:"\e643"}.fw-jaxrs:before{content:"\e645"}.fw-jaxws:before{content:"\e6c7"}.fw-jquery:before{content:"\e646"}.fw-key:before{content:"\e647"}.fw-kiosk:before{content:"\e746"}.fw-laptop:before{content:"\e648"}.fw-layout:before{content:"\e6bf"}.fw-ldap:before{content:"\e649"}.fw-left-arrow:before{content:"\e68a"}.fw-left:before{content:"\e686"}.fw-lifecycle:before{content:"\e64a"}.fw-light:before{content:"\e680"}.fw-linkedin:before{content:"\e6dc"}.fw-list-sort:before{content:"\e64d"}.fw-list:before{content:"\e64c"}.fw-loader:before{content:"\e6b4"}.fw-loader2:before{content:"\e6ba"}.fw-loader3:before{content:"\e6bb"}.fw-loader4:before{content:"\e6bc"}.fw-loader5:before{content:"\e6bd"}.fw-lock:before{content:"\e64e"}.fw-log:before{content:"\e738"}.fw-logical:before{content:"\e702"}.fw-mail:before{content:"\e64f"}.fw-main-function:before{content:"\e706"}.fw-map-location:before{content:"\e650"}.fw-mapping:before{content:"\e73c"}.fw-menu:before{content:"\e651"}.fw-message:before{content:"\e635"}.fw-micro-services:before{content:"\e6ce"}.fw-dash:before,.fw-hyphen:before,.fw-minus:before{content:"\e616"}.fw-mobile:before{content:"\e652"}.fw-ms-document:before{content:"\e654"}.fw-mute:before{content:"\e655"}.fw-namespace:before{content:"\e740"}.fw-nodejs:before{content:"\e656"}.fw-notification:before{content:"\e60b"}.fw-organization:before{content:"\e6ac"}.fw-out-sequence:before{content:"\e73a"}.fw-own:before{content:"\e6c8"}.fw-package:before{content:"\e6fd"}.fw-pages:before{content:"\e6c0"}.fw-paste:before{content:"\e658"}.fw-payload-factory:before{content:"\e733"}.fw-pdf:before{content:"\e659"}.fw-pending:before{content:"\e727"}.fw-php:before{content:"\e6c9"}.fw-pie-chart:before{content:"\e65a"}.fw-pinterest:before{content:"\e6dd"}.fw-policy:before{content:"\e67d"}.fw-polygon:before{content:"\e70d"}.fw-property:before{content:"\e737"}.fw-prototype:before{content:"\e6cc"}.fw-proxy:before{content:"\e699"}.fw-public:before{content:"\e6ad"}.fw-publish:before{content:"\e65c"}.fw-question:before{content:"\e6b0"}.fw-raspberry:before{content:"\e6aa"}.fw-redo:before{content:"\e65d"}.fw-reduce:before{content:"\e73d"}.fw-refresh:before{content:"\e692"}.fw-register:before{content:"\e65e"}.fw-rename:before{content:"\e6fc"}.fw-reply:before{content:"\e714"}.fw-resource:before{content:"\e660"}.fw-rest-api:before{content:"\e661"}.fw-rest-service:before{content:"\e662"}.fw-resume:before{content:"\e71e"}.fw-retire:before{content:"\e6cd"}.fw-return:before{content:"\e715"}.fw-retweet:before{content:"\e6b9"}.fw-right-arrow:before{content:"\e68b"}.fw-right:before{content:"\e687"}.fw-ringing:before{content:"\e694"}.fw-rules:before{content:"\e664"}.fw-run:before{content:"\e708"}.fw-save:before{content:"\e665"}.fw-scep:before{content:"\e666"}.fw-schema:before{content:"\e667"}.fw-search:before{content:"\e668"}.fw-security-policy:before{content:"\e67e"}.fw-security:before{content:"\e669"}.fw-paper-rocket:before,.fw-send:before{content:"\e66a"}.fw-sequence:before{content:"\e66b"}.fw-server:before{content:"\e66c"}.fw-service-provider:before{content:"\e66e"}.fw-cogwheels:before,.fw-gears:before,.fw-service:before,.fw-sprockets:before{content:"\e66d"}.fw-cogwheel:before,.fw-gear:before,.fw-settings:before,.fw-sprocket:before{content:"\e66f"}.fw-share:before{content:"\e670"}.fw-shell:before{content:"\e730"}.fw-shortcut:before{content:"\e725"}.fw-sign-in:before{content:"\e671"}.fw-sign-out:before{content:"\e6b8"}.fw-skype:before{content:"\e6de"}.fw-slash:before{content:"\e6e1"}.fw-soap:before{content:"\e672"}.fw-sort-down:before{content:"\e663"}.fw-sort-up:before{content:"\e64b"}.fw-sort:before{content:"\e673"}.fw-speed-alert:before{content:"\e731"}.fw-square-outline:before{content:"\e6b2"}.fw-square:before{content:"\e6b1"}.fw-star:before{content:"\e674"}.fw-start:before{content:"\e718"}.fw-statistics:before{content:"\e675"}.fw-stepin:before{content:"\e719"}.fw-stepout:before{content:"\e71a"}.fw-stepover:before{content:"\e71b"}.fw-stop:before{content:"\e71c"}.fw-cart:before,.fw-store:before{content:"\e676"}.fw-struct:before{content:"\e716"}.fw-subscribe:before{content:"\e677"}.fw-success:before{content:"\e657"}.fw-swagger:before{content:"\e679"}.fw-sync:before{content:"\e6b3"}.fw-table:before{content:"\e6c4"}.fw-tag:before{content:"\e67a"}.fw-task:before{content:"\e67b"}.fw-text:before{content:"\e67c"}.fw-theme:before{content:"\e726"}.fw-throttling-policy:before{content:"\e67f"}.fw-throw:before{content:"\e722"}.fw-tiles:before{content:"\e681"}.fw-transaction:before{content:"\e72b"}.fw-try-catch:before{content:"\e703"}.fw-twitter:before{content:"\e6df"}.fw-type-converter:before{content:"\e6f3"}.fw-uncheck:before{content:"\e682"}.fw-undo:before{content:"\e683"}.fw-ungroup:before{content:"\e6b5"}.fw-unmute:before{content:"\e6ae"}.fw-up-arrow:before{content:"\e688"}.fw-up:before{content:"\e684"}.fw-upload:before{content:"\e68c"}.fw-uri:before{content:"\e68d"}.fw-usb-drive:before{content:"\e68e"}.fw-use:before{content:"\e6ca"}.fw-user:before{content:"\e68f"}.fw-variable:before{content:"\e6ee"}.fw-view:before{content:"\e691"}.fw-vpn:before{content:"\e603"}.fw-wadl:before{content:"\e6a1"}.fw-war:before{content:"\e69e"}.fw-warning:before{content:"\e693"}.fw-web-app:before{content:"\e696"}.fw-web-clip:before{content:"\e698"}.fw-web-service:before{content:"\e69a"}.fw-website:before{content:"\e69b"}.fw-wifi:before{content:"\e607"}.fw-windows:before{content:"\e605"}.fw-worker-invoke:before{content:"\e723"}.fw-worker-reply:before{content:"\e724"}.fw-worker:before{content:"\e6ef"}.fw-wsdl:before{content:"\e6a0"}.fw-wso2-logo:before{content:"\e6a7"}.fw-wso2:before{content:"\e6a8"}.fw-xacml:before{content:"\e69f"}.fw-xml:before{content:"\e69c"}.fw-xq:before{content:"\e6a2"}.fw-xsd:before{content:"\e6a3"}.fw-xslt:before{content:"\e6a4"}.fw-youtube:before{content:"\e6e0"}.fw-zoom-in:before{content:"\e6a5"}.fw-zoom-out:before{content:"\e6a6"} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.eot b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.eot new file mode 100755 index 00000000000..0f604db5fe8 Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.eot differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.svg b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.svg new file mode 100755 index 00000000000..9a249e0d165 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.svg @@ -0,0 +1,1162 @@ + + + + +Created by FontForge 20190801 at Wed Aug 28 15:47:29 2019 + By Ruwan Yatawara + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.ttf b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.ttf new file mode 100755 index 00000000000..1f5109266ca Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.ttf differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff new file mode 100755 index 00000000000..ca3c31d0539 Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff2 b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff2 new file mode 100755 index 00000000000..6f1ff3a522d Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/fonts/font-entgra.woff2 differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/icons.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/icons.json old mode 100644 new mode 100755 similarity index 92% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/icons.json rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/icons.json index 0bd52ef51eb..df9ca285539 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/icons.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/icons.json @@ -8,7 +8,7 @@ "android": "", "wifi": "", "application": "", - "configarations": "", + "configurations": "", "battery": "", "notification": "", "blank-document": "", @@ -156,7 +156,7 @@ "web-service": "", "website": "", "xml": "", - "html": "\t\t\t\t", + "html": "", "war": "", "xacml": "", "wsdl": "", @@ -236,7 +236,7 @@ "dgm-logger": "\t", "dgm-try-catch": "", "invoke": "", - "variable": "", + "variable": "", "worker": "", "code": "", "cut": "", @@ -276,11 +276,11 @@ "reply": "", "return": "", "struct": "", - "dgm-import": "", + "dgm-import": "", "start": "", "stepin": "", "stepout": "", - "stepover": "", + "stepover": "", "stop": "", "console": "", "resume": "", @@ -297,10 +297,31 @@ "ballerina-service": "", "abort": "", "transaction": "", - "android-logcat": "", + "android-logcat": "", "android-sense": "", "geo-fence-inbound": "", "geo-fence-outbound": "", "shell": "", - "speed-alert": "" + "speed-alert": "", + "google-glass": "", + "payload-factory": "", + "header": "", + "data-mapper": "", + "call-mediator": "", + "property": "", + "log": "", + "in-sequence": "", + "out-sequence": "", + "foreach": "", + "mapping": "", + "reduce": "", + "continue": "", + "integration": "", + "namespace": "", + "dollar": "", + "aggregate": "", + "bean": "", + "event-simulator": "", + "activesync": " ", + "kiosk": " " } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/scss/_mixin.scss b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/scss/_mixin.scss old mode 100644 new mode 100755 similarity index 92% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/scss/_mixin.scss rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/scss/_mixin.scss index fb6ac90f8bd..56ac8bba23a --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/scss/_mixin.scss +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-entgra-1.4.0/scss/_mixin.scss @@ -1,1252 +1,1336 @@ -/*! -~ Copyright (c) WSO2 Inc. (http://wso2.com) 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. -*/ - -%icon-base { - &:before { - font-family: "font-wso2"; - -webkit-font-smoothing: antialiased; - } - b { - // hide text - height: 0; - display: block; - text-indent: 100%; - white-space: nowrap; - overflow: hidden; - } -} - -@mixin font-wso2($icon) { - @extend %icon-base; - - - @if ($icon == "abort") { - content:"\e72a"; - } - - @else if ($icon == "action-invoke") { - content:"\e6fe"; - } - - @else if ($icon == "action") { - content:"\e709"; - } - - @else if ($icon == "activate") { - content:"\e6cf"; - } - - @else if ($icon == "add") { - content:"\e615"; - } - - @else if ($icon == "airplay") { - content:"\e600"; - } - - @else if ($icon == "alarm") { - content:"\e6c2"; - } - - @else if ($icon == "alert") { - content:"\e6be"; - } - - @else if ($icon == "analytics-extensions") { - content:"\e6e2"; - } - - @else if ($icon == "android-logcat") { - content:"\e72c"; - } - - @else if ($icon == "android-sense") { - content:"\e72d"; - } - - @else if ($icon == "android") { - content:"\e606"; - } - - @else if ($icon == "annotation") { - content:"\e6e6"; - } - - @else if ($icon == "api") { - content:"\e601"; - } - - @else if ($icon == "apn") { - content:"\e602"; - } - - @else if ($icon == "apple") { - content:"\e604"; - } - - @else if ($icon == "application") { - content:"\e608"; - } - - @else if ($icon == "arduino") { - content:"\e6ab"; - } - - @else if ($icon == "assign") { - content:"\e6ff"; - } - - @else if ($icon == "ballerina-service") { - content:"\e729"; - } - - @else if ($icon == "ballerina") { - content:"\e728"; - } - - @else if ($icon == "bar-chart") { - content:"\e690"; - } - - @else if ($icon == "battery") { - content:"\e60a"; - } - - @else if ($icon == "blank-document") { - content:"\e60c"; - } - - @else if ($icon == "block") { - content:"\e695"; - } - - @else if ($icon == "bookmark") { - content:"\e60d"; - } - - @else if ($icon == "bpel") { - content:"\e60e"; - } - - @else if ($icon == "bpmn") { - content:"\e60f"; - } - - @else if ($icon == "break") { - content:"\e721"; - } - - @else if ($icon == "bug") { - content:"\e611"; - } - - @else if ($icon == "build") { - content:"\e6c1"; - } - - @else if ($icon == "calendar") { - content:"\e612"; - } - - @else if ($icon == "camera") { - content:"\e613"; - } - - @else if ($icon == "cancel") { - content:"\e618"; - } - - @else if ($icon == "carbon") { - content:"\e6c5"; - } - - @else if ($icon == "chat") { - content:"\e65b"; - } - - @else if ($icon == "check") { - content:"\e617"; - } - - @else if ($icon == "checklist") { - content:"\e619"; - } - - @else if ($icon == "circle-outline") { - content:"\e61f"; - } - - @else if ($icon == "circle") { - content:"\e61a"; - } - - @else if ($icon == "clear") { - content:"\e61b"; - } - - @else if ($icon == "clock") { - content:"\e61d"; - } - - @else if ($icon == "cloud") { - content:"\e61e"; - } - - @else if ($icon == "code-view") { - content:"\e70e"; - } - - @else if ($icon == "code") { - content:"\e6f1"; - } - - @else if ($icon == "comment") { - content:"\e710"; - } - - @else if ($icon == "compare") { - content:"\e610"; - } - - @else if ($icon == "computer") { - content:"\e653"; - } - - @else if ($icon == "configarations") { - content:"\e609"; - } - - @else if ($icon == "connector") { - content:"\e700"; - } - - @else if ($icon == "console") { - content:"\e71d"; - } - - @else if ($icon == "constant") { - content:"\e701"; - } - - @else if ($icon == "contact") { - content:"\e620"; - } - - @else if ($icon == "contract") { - content:"\e614"; - } - - @else if ($icon == "copy") { - content:"\e621"; - } - - @else if ($icon == "cut") { - content:"\e6f2"; - } - - @else if ($icon == "dashboard") { - content:"\e622"; - } - - @else if ($icon == "database") { - content:"\e623"; - } - - @else if ($icon == "delete") { - content:"\e624"; - } - - @else if ($icon == "depend") { - content:"\e6c6"; - } - - @else if ($icon == "deploy") { - content:"\e625"; - } - - @else if ($icon == "deprecate") { - content:"\e6cb"; - } - - @else if ($icon == "design-view") { - content:"\e70f"; - } - - @else if ($icon == "devices") { - content:"\e704"; - } - - @else if ($icon == "dgm-action-invoke") { - content:"\e712"; - } - - @else if ($icon == "dgm-action") { - content:"\e711"; - } - - @else if ($icon == "dgm-connector") { - content:"\e6f4"; - } - - @else if ($icon == "dgm-constant-definition") { - content:"\e6f5"; - } - - @else if ($icon == "dgm-fork") { - content:"\e6e7"; - } - - @else if ($icon == "dgm-header") { - content:"\e6e8"; - } - - @else if ($icon == "dgm-if-else") { - content:"\e6e9"; - } - - @else if ($icon == "dgm-import") { - content:"\e717"; - } - - @else if ($icon == "dgm-lifeline") { - content:"\e6ea"; - } - - @else if ($icon == "dgm-logger") { - content:"\e6eb"; - } - - @else if ($icon == "dgm-resource") { - content:"\e6f6"; - } - - @else if ($icon == "dgm-service") { - content:"\e6f7"; - } - - @else if ($icon == "dgm-try-catch") { - content:"\e6ec"; - } - - @else if ($icon == "dgm-type-convertor") { - content:"\e6f8"; - } - - @else if ($icon == "dgm-type") { - content:"\e6f9"; - } - - @else if ($icon == "dgm-while") { - content:"\e707"; - } - - @else if ($icon == "dial-up") { - content:"\e627"; - } - - @else if ($icon == "disabled") { - content:"\e6d1"; - } - - @else if ($icon == "display") { - content:"\e626"; - } - - @else if ($icon == "docker") { - content:"\e70c"; - } - - @else if ($icon == "document") { - content:"\e628"; - } - - @else if ($icon == "down-arrow") { - content:"\e689"; - } - - @else if ($icon == "down") { - content:"\e685"; - } - - @else if ($icon == "download") { - content:"\e65f"; - } - - @else if ($icon == "dss") { - content:"\e62a"; - } - - @else if ($icon == "ebook") { - content:"\e62b"; - } - - @else if ($icon == "edit") { - content:"\e62c"; - } - - @else if ($icon == "ellipsis") { - content:"\e629"; - } - - @else if ($icon == "endpoint") { - content:"\e62d"; - } - - @else if ($icon == "enterprise") { - content:"\e6b6"; - } - - @else if ($icon == "error") { - content:"\e630"; - } - - @else if ($icon == "esb-connector") { - content:"\e6e3"; - } - - @else if ($icon == "expand") { - content:"\e61c"; - } - - @else if ($icon == "export") { - content:"\e631"; - } - - @else if ($icon == "extensions") { - content:"\e6e4"; - } - - @else if ($icon == "facebook") { - content:"\e6d3"; - } - - @else if ($icon == "factory-reset") { - content:"\e632"; - } - - @else if ($icon == "fan") { - content:"\e678"; - } - - @else if ($icon == "faq") { - content:"\e62f"; - } - - @else if ($icon == "file-browse") { - content:"\e633"; - } - - @else if ($icon == "filter") { - content:"\e634"; - } - - @else if ($icon == "folder-open") { - content:"\e70b"; - } - - @else if ($icon == "folder") { - content:"\e62e"; - } - - @else if ($icon == "fork-join") { - content:"\e720"; - } - - @else if ($icon == "format") { - content:"\e6fa"; - } - - @else if ($icon == "forum") { - content:"\e636"; - } - - @else if ($icon == "function-invoke") { - content:"\e713"; - } - - @else if ($icon == "function") { - content:"\e6fb"; - } - - @else if ($icon == "gadget") { - content:"\e637"; - } - - @else if ($icon == "geo-fence-inbound") { - content:"\e72e"; - } - - @else if ($icon == "geo-fence-outbound") { - content:"\e72f"; - } - - @else if ($icon == "github") { - content:"\e6d4"; - } - - @else if ($icon == "globe") { - content:"\e697"; - } - - @else if ($icon == "google-docs") { - content:"\e6d6"; - } - - @else if ($icon == "google-drive") { - content:"\e6da"; - } - - @else if ($icon == "google-plus") { - content:"\e6d9"; - } - - @else if ($icon == "google-sheets") { - content:"\e6d7"; - } - - @else if ($icon == "google-slides") { - content:"\e6d8"; - } - - @else if ($icon == "google") { - content:"\e6d5"; - } - - @else if ($icon == "grid") { - content:"\e638"; - } - - @else if ($icon == "grip") { - content:"\e6b7"; - } - - @else if ($icon == "group") { - content:"\e6af"; - } - - @else if ($icon == "hardware") { - content:"\e6a9"; - } - - @else if ($icon == "hdd") { - content:"\e639"; - } - - @else if ($icon == "heart") { - content:"\e6c3"; - } - - @else if ($icon == "hide") { - content:"\e6d2"; - } - - @else if ($icon == "home") { - content:"\e63a"; - } - - @else if ($icon == "hour-glass") { - content:"\e63b"; - } - - @else if ($icon == "html") { - content:"\e69d"; - } - - @else if ($icon == "http") { - content:"\e705"; - } - - @else if ($icon == "image") { - content:"\e70a"; - } - - @else if ($icon == "import") { - content:"\e63c"; - } - - @else if ($icon == "incoming-call") { - content:"\e63d"; - } - - @else if ($icon == "info") { - content:"\e63e"; - } - - @else if ($icon == "instagram") { - content:"\e6db"; - } - - @else if ($icon == "invitation") { - content:"\e63f"; - } - - @else if ($icon == "invoke") { - content:"\e6ed"; - } - - @else if ($icon == "is-connector") { - content:"\e6e5"; - } - - @else if ($icon == "iterate") { - content:"\e71f"; - } - - @else if ($icon == "jaggery") { - content:"\e640"; - } - - @else if ($icon == "java-spring") { - content:"\e644"; - } - - @else if ($icon == "java") { - content:"\e641"; - } - - @else if ($icon == "javaee") { - content:"\e642"; - } - - @else if ($icon == "javascript") { - content:"\e643"; - } - - @else if ($icon == "jaxrs") { - content:"\e645"; - } - - @else if ($icon == "jaxws") { - content:"\e6c7"; - } - - @else if ($icon == "jquery") { - content:"\e646"; - } - - @else if ($icon == "key") { - content:"\e647"; - } - - @else if ($icon == "laptop") { - content:"\e648"; - } - - @else if ($icon == "layout") { - content:"\e6bf"; - } - - @else if ($icon == "ldap") { - content:"\e649"; - } - - @else if ($icon == "left-arrow") { - content:"\e68a"; - } - - @else if ($icon == "left") { - content:"\e686"; - } - - @else if ($icon == "lifecycle") { - content:"\e64a"; - } - - @else if ($icon == "light") { - content:"\e680"; - } - - @else if ($icon == "linkedin") { - content:"\e6dc"; - } - - @else if ($icon == "list-sort") { - content:"\e64d"; - } - - @else if ($icon == "list") { - content:"\e64c"; - } - - @else if ($icon == "loader") { - content:"\e6b4"; - } - - @else if ($icon == "loader2") { - content:"\e6ba"; - } - - @else if ($icon == "loader3") { - content:"\e6bb"; - } - - @else if ($icon == "loader4") { - content:"\e6bc"; - } - - @else if ($icon == "loader5") { - content:"\e6bd"; - } - - @else if ($icon == "lock") { - content:"\e64e"; - } - - @else if ($icon == "logical") { - content:"\e702"; - } - - @else if ($icon == "mail") { - content:"\e64f"; - } - - @else if ($icon == "main-function") { - content:"\e706"; - } - - @else if ($icon == "map-location") { - content:"\e650"; - } - - @else if ($icon == "menu") { - content:"\e651"; - } - - @else if ($icon == "message") { - content:"\e635"; - } - - @else if ($icon == "micro-services") { - content:"\e6ce"; - } - - @else if ($icon == "minus") { - content:"\e616"; - } - - @else if ($icon == "mobile") { - content:"\e652"; - } - - @else if ($icon == "ms-document") { - content:"\e654"; - } - - @else if ($icon == "mute") { - content:"\e655"; - } - - @else if ($icon == "nodejs") { - content:"\e656"; - } - - @else if ($icon == "notification") { - content:"\e60b"; - } - - @else if ($icon == "organization") { - content:"\e6ac"; - } - - @else if ($icon == "own") { - content:"\e6c8"; - } - - @else if ($icon == "package") { - content:"\e6fd"; - } - - @else if ($icon == "pages") { - content:"\e6c0"; - } - - @else if ($icon == "paste") { - content:"\e658"; - } - - @else if ($icon == "pdf") { - content:"\e659"; - } - - @else if ($icon == "pending") { - content:"\e727"; - } - - @else if ($icon == "php") { - content:"\e6c9"; - } - - @else if ($icon == "pie-chart") { - content:"\e65a"; - } - - @else if ($icon == "pinterest") { - content:"\e6dd"; - } - - @else if ($icon == "policy") { - content:"\e67d"; - } - - @else if ($icon == "polygon") { - content:"\e70d"; - } - - @else if ($icon == "prototype") { - content:"\e6cc"; - } - - @else if ($icon == "proxy") { - content:"\e699"; - } - - @else if ($icon == "public") { - content:"\e6ad"; - } - - @else if ($icon == "publish") { - content:"\e65c"; - } - - @else if ($icon == "question") { - content:"\e6b0"; - } - - @else if ($icon == "raspberry") { - content:"\e6aa"; - } - - @else if ($icon == "redo") { - content:"\e65d"; - } - - @else if ($icon == "refresh") { - content:"\e692"; - } - - @else if ($icon == "register") { - content:"\e65e"; - } - - @else if ($icon == "rename") { - content:"\e6fc"; - } - - @else if ($icon == "reply") { - content:"\e714"; - } - - @else if ($icon == "resource") { - content:"\e660"; - } - - @else if ($icon == "rest-api") { - content:"\e661"; - } - - @else if ($icon == "rest-service") { - content:"\e662"; - } - - @else if ($icon == "resume") { - content:"\e71e"; - } - - @else if ($icon == "retire") { - content:"\e6cd"; - } - - @else if ($icon == "return") { - content:"\e715"; - } - - @else if ($icon == "retweet") { - content:"\e6b9"; - } - - @else if ($icon == "right-arrow") { - content:"\e68b"; - } - - @else if ($icon == "right") { - content:"\e687"; - } - - @else if ($icon == "ringing") { - content:"\e694"; - } - - @else if ($icon == "rules") { - content:"\e664"; - } - - @else if ($icon == "run") { - content:"\e708"; - } - - @else if ($icon == "save") { - content:"\e665"; - } - - @else if ($icon == "scep") { - content:"\e666"; - } - - @else if ($icon == "schema") { - content:"\e667"; - } - - @else if ($icon == "search") { - content:"\e668"; - } - - @else if ($icon == "security-policy") { - content:"\e67e"; - } - - @else if ($icon == "security") { - content:"\e669"; - } - - @else if ($icon == "send") { - content:"\e66a"; - } - - @else if ($icon == "sequence") { - content:"\e66b"; - } - - @else if ($icon == "server") { - content:"\e66c"; - } - - @else if ($icon == "service-provider") { - content:"\e66e"; - } - - @else if ($icon == "service") { - content:"\e66d"; - } - - @else if ($icon == "settings") { - content:"\e66f"; - } - - @else if ($icon == "share") { - content:"\e670"; - } - - @else if ($icon == "shell") { - content:"\e730"; - } - - @else if ($icon == "shortcut") { - content:"\e725"; - } - - @else if ($icon == "sign-in") { - content:"\e671"; - } - - @else if ($icon == "sign-out") { - content:"\e6b8"; - } - - @else if ($icon == "skype") { - content:"\e6de"; - } - - @else if ($icon == "slash") { - content:"\e6e1"; - } - - @else if ($icon == "soap") { - content:"\e672"; - } - - @else if ($icon == "sort-down") { - content:"\e663"; - } - - @else if ($icon == "sort-up") { - content:"\e64b"; - } - - @else if ($icon == "sort") { - content:"\e673"; - } - - @else if ($icon == "speed-alert") { - content:"\e731"; - } - - @else if ($icon == "square-outline") { - content:"\e6b2"; - } - - @else if ($icon == "square") { - content:"\e6b1"; - } - - @else if ($icon == "star") { - content:"\e674"; - } - - @else if ($icon == "start") { - content:"\e718"; - } - - @else if ($icon == "statistics") { - content:"\e675"; - } - - @else if ($icon == "stepin") { - content:"\e719"; - } - - @else if ($icon == "stepout") { - content:"\e71a"; - } - - @else if ($icon == "stepover") { - content:"\e71b"; - } - - @else if ($icon == "stop") { - content:"\e71c"; - } - - @else if ($icon == "store") { - content:"\e676"; - } - - @else if ($icon == "struct") { - content:"\e716"; - } - - @else if ($icon == "subscribe") { - content:"\e677"; - } - - @else if ($icon == "success") { - content:"\e657"; - } - - @else if ($icon == "swagger") { - content:"\e679"; - } - - @else if ($icon == "sync") { - content:"\e6b3"; - } - - @else if ($icon == "table") { - content:"\e6c4"; - } - - @else if ($icon == "tag") { - content:"\e67a"; - } - - @else if ($icon == "task") { - content:"\e67b"; - } - - @else if ($icon == "text") { - content:"\e67c"; - } - - @else if ($icon == "theme") { - content:"\e726"; - } - - @else if ($icon == "throttling-policy") { - content:"\e67f"; - } - - @else if ($icon == "throw") { - content:"\e722"; - } - - @else if ($icon == "tiles") { - content:"\e681"; - } - - @else if ($icon == "transaction") { - content:"\e72b"; - } - - @else if ($icon == "try-catch") { - content:"\e703"; - } - - @else if ($icon == "twitter") { - content:"\e6df"; - } - - @else if ($icon == "type-converter") { - content:"\e6f3"; - } - - @else if ($icon == "uncheck") { - content:"\e682"; - } - - @else if ($icon == "undo") { - content:"\e683"; - } - - @else if ($icon == "ungroup") { - content:"\e6b5"; - } - - @else if ($icon == "unmute") { - content:"\e6ae"; - } - - @else if ($icon == "up-arrow") { - content:"\e688"; - } - - @else if ($icon == "up") { - content:"\e684"; - } - - @else if ($icon == "upload") { - content:"\e68c"; - } - - @else if ($icon == "uri") { - content:"\e68d"; - } - - @else if ($icon == "usb-drive") { - content:"\e68e"; - } - - @else if ($icon == "use") { - content:"\e6ca"; - } - - @else if ($icon == "user") { - content:"\e68f"; - } - - @else if ($icon == "variable") { - content:"\e6ee"; - } - - @else if ($icon == "view") { - content:"\e691"; - } - - @else if ($icon == "vpn") { - content:"\e603"; - } - - @else if ($icon == "wadl") { - content:"\e6a1"; - } - - @else if ($icon == "war") { - content:"\e69e"; - } - - @else if ($icon == "warning") { - content:"\e693"; - } - - @else if ($icon == "web-app") { - content:"\e696"; - } - - @else if ($icon == "web-clip") { - content:"\e698"; - } - - @else if ($icon == "web-service") { - content:"\e69a"; - } - - @else if ($icon == "website") { - content:"\e69b"; - } - - @else if ($icon == "wifi") { - content:"\e607"; - } - - @else if ($icon == "windows") { - content:"\e605"; - } - - @else if ($icon == "worker-invoke") { - content:"\e723"; - } - - @else if ($icon == "worker-reply") { - content:"\e724"; - } - - @else if ($icon == "worker") { - content:"\e6ef"; - } - - @else if ($icon == "wsdl") { - content:"\e6a0"; - } - - @else if ($icon == "wso2-logo") { - content:"\e6a7"; - } - - @else if ($icon == "wso2") { - content:"\e6a8"; - } - - @else if ($icon == "xacml") { - content:"\e69f"; - } - - @else if ($icon == "xml") { - content:"\e69c"; - } - - @else if ($icon == "xq") { - content:"\e6a2"; - } - - @else if ($icon == "xsd") { - content:"\e6a3"; - } - - @else if ($icon == "xslt") { - content:"\e6a4"; - } - - @else if ($icon == "youtube") { - content:"\e6e0"; - } - - @else if ($icon == "zoom-in") { - content:"\e6a5"; - } - - @else if ($icon == "zoom-out") { - content:"\e6a6"; - } - +/*! +~ Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) 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. +*/ + +%icon-base { + &:before { + font-family: "font-entgra"; + -webkit-font-smoothing: antialiased; + } + b { + // hide text + height: 0; + display: block; + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + } +} + +@mixin font-entgra($icon) { + @extend %icon-base; + + + @if ($icon == "abort") { + content:"\e72a"; + } + + @else if ($icon == "action-invoke") { + content:"\e6fe"; + } + + @else if ($icon == "action") { + content:"\e709"; + } + + @else if ($icon == "activate") { + content:"\e6cf"; + } + + @else if ($icon == "activesync") { + content:"\e745"; + } + + @else if ($icon == "add") { + content:"\e615"; + } + + @else if ($icon == "aggregate") { + content:"\e742"; + } + + @else if ($icon == "airplay") { + content:"\e600"; + } + + @else if ($icon == "alarm") { + content:"\e6c2"; + } + + @else if ($icon == "alert") { + content:"\e6be"; + } + + @else if ($icon == "analytics-extensions") { + content:"\e6e2"; + } + + @else if ($icon == "android-logcat") { + content:"\e72c"; + } + + @else if ($icon == "android-sense") { + content:"\e72d"; + } + + @else if ($icon == "android") { + content:"\e606"; + } + + @else if ($icon == "annotation") { + content:"\e6e6"; + } + + @else if ($icon == "api") { + content:"\e601"; + } + + @else if ($icon == "apn") { + content:"\e602"; + } + + @else if ($icon == "apple") { + content:"\e604"; + } + + @else if ($icon == "application") { + content:"\e608"; + } + + @else if ($icon == "arduino") { + content:"\e6ab"; + } + + @else if ($icon == "assign") { + content:"\e6ff"; + } + + @else if ($icon == "ballerina-service") { + content:"\e729"; + } + + @else if ($icon == "ballerina") { + content:"\e728"; + } + + @else if ($icon == "bar-chart") { + content:"\e690"; + } + + @else if ($icon == "battery") { + content:"\e60a"; + } + + @else if ($icon == "bean") { + content:"\e743"; + } + + @else if ($icon == "blank-document") { + content:"\e60c"; + } + + @else if ($icon == "block") { + content:"\e695"; + } + + @else if ($icon == "bookmark") { + content:"\e60d"; + } + + @else if ($icon == "bpel") { + content:"\e60e"; + } + + @else if ($icon == "bpmn") { + content:"\e60f"; + } + + @else if ($icon == "break") { + content:"\e721"; + } + + @else if ($icon == "bug") { + content:"\e611"; + } + + @else if ($icon == "build") { + content:"\e6c1"; + } + + @else if ($icon == "calendar") { + content:"\e612"; + } + + @else if ($icon == "call-mediator") { + content:"\e736"; + } + + @else if ($icon == "camera") { + content:"\e613"; + } + + @else if ($icon == "cancel") { + content:"\e618"; + } + + @else if ($icon == "carbon") { + content:"\e6c5"; + } + + @else if ($icon == "chat") { + content:"\e65b"; + } + + @else if ($icon == "check") { + content:"\e617"; + } + + @else if ($icon == "checklist") { + content:"\e619"; + } + + @else if ($icon == "circle-outline") { + content:"\e61f"; + } + + @else if ($icon == "circle") { + content:"\e61a"; + } + + @else if ($icon == "clear") { + content:"\e61b"; + } + + @else if ($icon == "clock") { + content:"\e61d"; + } + + @else if ($icon == "cloud") { + content:"\e61e"; + } + + @else if ($icon == "code-view") { + content:"\e70e"; + } + + @else if ($icon == "code") { + content:"\e6f1"; + } + + @else if ($icon == "comment") { + content:"\e710"; + } + + @else if ($icon == "compare") { + content:"\e610"; + } + + @else if ($icon == "computer") { + content:"\e653"; + } + + @else if ($icon == "configurations") { + content:"\e609"; + } + + @else if ($icon == "connector") { + content:"\e700"; + } + + @else if ($icon == "console") { + content:"\e71d"; + } + + @else if ($icon == "constant") { + content:"\e701"; + } + + @else if ($icon == "contact") { + content:"\e620"; + } + + @else if ($icon == "continue") { + content:"\e73e"; + } + + @else if ($icon == "contract") { + content:"\e614"; + } + + @else if ($icon == "copy") { + content:"\e621"; + } + + @else if ($icon == "cut") { + content:"\e6f2"; + } + + @else if ($icon == "dashboard") { + content:"\e622"; + } + + @else if ($icon == "data-mapper") { + content:"\e735"; + } + + @else if ($icon == "database") { + content:"\e623"; + } + + @else if ($icon == "delete") { + content:"\e624"; + } + + @else if ($icon == "depend") { + content:"\e6c6"; + } + + @else if ($icon == "deploy") { + content:"\e625"; + } + + @else if ($icon == "deprecate") { + content:"\e6cb"; + } + + @else if ($icon == "design-view") { + content:"\e70f"; + } + + @else if ($icon == "devices") { + content:"\e704"; + } + + @else if ($icon == "dgm-action-invoke") { + content:"\e712"; + } + + @else if ($icon == "dgm-action") { + content:"\e711"; + } + + @else if ($icon == "dgm-connector") { + content:"\e6f4"; + } + + @else if ($icon == "dgm-constant-definition") { + content:"\e6f5"; + } + + @else if ($icon == "dgm-fork") { + content:"\e6e7"; + } + + @else if ($icon == "dgm-header") { + content:"\e6e8"; + } + + @else if ($icon == "dgm-if-else") { + content:"\e6e9"; + } + + @else if ($icon == "dgm-import") { + content:"\e717"; + } + + @else if ($icon == "dgm-lifeline") { + content:"\e6ea"; + } + + @else if ($icon == "dgm-logger") { + content:"\e6eb"; + } + + @else if ($icon == "dgm-resource") { + content:"\e6f6"; + } + + @else if ($icon == "dgm-service") { + content:"\e6f7"; + } + + @else if ($icon == "dgm-try-catch") { + content:"\e6ec"; + } + + @else if ($icon == "dgm-type-convertor") { + content:"\e6f8"; + } + + @else if ($icon == "dgm-type") { + content:"\e6f9"; + } + + @else if ($icon == "dgm-while") { + content:"\e707"; + } + + @else if ($icon == "dial-up") { + content:"\e627"; + } + + @else if ($icon == "disabled") { + content:"\e6d1"; + } + + @else if ($icon == "display") { + content:"\e626"; + } + + @else if ($icon == "docker") { + content:"\e70c"; + } + + @else if ($icon == "document") { + content:"\e628"; + } + + @else if ($icon == "dollar") { + content:"\e741"; + } + + @else if ($icon == "down-arrow") { + content:"\e689"; + } + + @else if ($icon == "down") { + content:"\e685"; + } + + @else if ($icon == "download") { + content:"\e65f"; + } + + @else if ($icon == "dss") { + content:"\e62a"; + } + + @else if ($icon == "ebook") { + content:"\e62b"; + } + + @else if ($icon == "edit") { + content:"\e62c"; + } + + @else if ($icon == "ellipsis") { + content:"\e629"; + } + + @else if ($icon == "endpoint") { + content:"\e62d"; + } + + @else if ($icon == "enterprise") { + content:"\e6b6"; + } + + @else if ($icon == "error") { + content:"\e630"; + } + + @else if ($icon == "esb-connector") { + content:"\e6e3"; + } + + @else if ($icon == "event-simulator") { + content:"\e744"; + } + + @else if ($icon == "expand") { + content:"\e61c"; + } + + @else if ($icon == "export") { + content:"\e631"; + } + + @else if ($icon == "extensions") { + content:"\e6e4"; + } + + @else if ($icon == "facebook") { + content:"\e6d3"; + } + + @else if ($icon == "factory-reset") { + content:"\e632"; + } + + @else if ($icon == "fan") { + content:"\e678"; + } + + @else if ($icon == "faq") { + content:"\e62f"; + } + + @else if ($icon == "file-browse") { + content:"\e633"; + } + + @else if ($icon == "filter") { + content:"\e634"; + } + + @else if ($icon == "folder-open") { + content:"\e70b"; + } + + @else if ($icon == "folder") { + content:"\e62e"; + } + + @else if ($icon == "foreach") { + content:"\e73ab"; + } + + @else if ($icon == "fork-join") { + content:"\e720"; + } + + @else if ($icon == "format") { + content:"\e6fa"; + } + + @else if ($icon == "forum") { + content:"\e636"; + } + + @else if ($icon == "function-invoke") { + content:"\e713"; + } + + @else if ($icon == "function") { + content:"\e6fb"; + } + + @else if ($icon == "gadget") { + content:"\e637"; + } + + @else if ($icon == "geo-fence-inbound") { + content:"\e72e"; + } + + @else if ($icon == "geo-fence-outbound") { + content:"\e72f"; + } + + @else if ($icon == "github") { + content:"\e6d4"; + } + + @else if ($icon == "globe") { + content:"\e697"; + } + + @else if ($icon == "google-docs") { + content:"\e6d6"; + } + + @else if ($icon == "google-drive") { + content:"\e6da"; + } + + @else if ($icon == "google-glass") { + content:"\e732"; + } + + @else if ($icon == "google-plus") { + content:"\e6d9"; + } + + @else if ($icon == "google-sheets") { + content:"\e6d7"; + } + + @else if ($icon == "google-slides") { + content:"\e6d8"; + } + + @else if ($icon == "google") { + content:"\e6d5"; + } + + @else if ($icon == "grid") { + content:"\e638"; + } + + @else if ($icon == "grip") { + content:"\e6b7"; + } + + @else if ($icon == "group") { + content:"\e6af"; + } + + @else if ($icon == "hardware") { + content:"\e6a9"; + } + + @else if ($icon == "hdd") { + content:"\e639"; + } + + @else if ($icon == "header") { + content:"\e734"; + } + + @else if ($icon == "heart") { + content:"\e6c3"; + } + + @else if ($icon == "hide") { + content:"\e6d2"; + } + + @else if ($icon == "home") { + content:"\e63a"; + } + + @else if ($icon == "hour-glass") { + content:"\e63b"; + } + + @else if ($icon == "html") { + content:"\e69d"; + } + + @else if ($icon == "http") { + content:"\e705"; + } + + @else if ($icon == "image") { + content:"\e70a"; + } + + @else if ($icon == "import") { + content:"\e63c"; + } + + @else if ($icon == "in-sequence") { + content:"\e739"; + } + + @else if ($icon == "incoming-call") { + content:"\e63d"; + } + + @else if ($icon == "info") { + content:"\e63e"; + } + + @else if ($icon == "instagram") { + content:"\e6db"; + } + + @else if ($icon == "integration") { + content:"\e73f"; + } + + @else if ($icon == "invitation") { + content:"\e63f"; + } + + @else if ($icon == "invoke") { + content:"\e6ed"; + } + + @else if ($icon == "is-connector") { + content:"\e6e5"; + } + + @else if ($icon == "iterate") { + content:"\e71f"; + } + + @else if ($icon == "jaggery") { + content:"\e640"; + } + + @else if ($icon == "java-spring") { + content:"\e644"; + } + + @else if ($icon == "java") { + content:"\e641"; + } + + @else if ($icon == "javaee") { + content:"\e642"; + } + + @else if ($icon == "javascript") { + content:"\e643"; + } + + @else if ($icon == "jaxrs") { + content:"\e645"; + } + + @else if ($icon == "jaxws") { + content:"\e6c7"; + } + + @else if ($icon == "jquery") { + content:"\e646"; + } + + @else if ($icon == "key") { + content:"\e647"; + } + + @else if ($icon == "kiosk") { + content:"\e746"; + } + + @else if ($icon == "laptop") { + content:"\e648"; + } + + @else if ($icon == "layout") { + content:"\e6bf"; + } + + @else if ($icon == "ldap") { + content:"\e649"; + } + + @else if ($icon == "left-arrow") { + content:"\e68a"; + } + + @else if ($icon == "left") { + content:"\e686"; + } + + @else if ($icon == "lifecycle") { + content:"\e64a"; + } + + @else if ($icon == "light") { + content:"\e680"; + } + + @else if ($icon == "linkedin") { + content:"\e6dc"; + } + + @else if ($icon == "list-sort") { + content:"\e64d"; + } + + @else if ($icon == "list") { + content:"\e64c"; + } + + @else if ($icon == "loader") { + content:"\e6b4"; + } + + @else if ($icon == "loader2") { + content:"\e6ba"; + } + + @else if ($icon == "loader3") { + content:"\e6bb"; + } + + @else if ($icon == "loader4") { + content:"\e6bc"; + } + + @else if ($icon == "loader5") { + content:"\e6bd"; + } + + @else if ($icon == "lock") { + content:"\e64e"; + } + + @else if ($icon == "log") { + content:"\e738"; + } + + @else if ($icon == "logical") { + content:"\e702"; + } + + @else if ($icon == "mail") { + content:"\e64f"; + } + + @else if ($icon == "main-function") { + content:"\e706"; + } + + @else if ($icon == "map-location") { + content:"\e650"; + } + + @else if ($icon == "mapping") { + content:"\e73c"; + } + + @else if ($icon == "menu") { + content:"\e651"; + } + + @else if ($icon == "message") { + content:"\e635"; + } + + @else if ($icon == "micro-services") { + content:"\e6ce"; + } + + @else if ($icon == "minus") { + content:"\e616"; + } + + @else if ($icon == "mobile") { + content:"\e652"; + } + + @else if ($icon == "ms-document") { + content:"\e654"; + } + + @else if ($icon == "mute") { + content:"\e655"; + } + + @else if ($icon == "namespace") { + content:"\e740"; + } + + @else if ($icon == "nodejs") { + content:"\e656"; + } + + @else if ($icon == "notification") { + content:"\e60b"; + } + + @else if ($icon == "organization") { + content:"\e6ac"; + } + + @else if ($icon == "out-sequence") { + content:"\e73a"; + } + + @else if ($icon == "own") { + content:"\e6c8"; + } + + @else if ($icon == "package") { + content:"\e6fd"; + } + + @else if ($icon == "pages") { + content:"\e6c0"; + } + + @else if ($icon == "paste") { + content:"\e658"; + } + + @else if ($icon == "payload-factory") { + content:"\e733"; + } + + @else if ($icon == "pdf") { + content:"\e659"; + } + + @else if ($icon == "pending") { + content:"\e727"; + } + + @else if ($icon == "php") { + content:"\e6c9"; + } + + @else if ($icon == "pie-chart") { + content:"\e65a"; + } + + @else if ($icon == "pinterest") { + content:"\e6dd"; + } + + @else if ($icon == "policy") { + content:"\e67d"; + } + + @else if ($icon == "polygon") { + content:"\e70d"; + } + + @else if ($icon == "property") { + content:"\e737"; + } + + @else if ($icon == "prototype") { + content:"\e6cc"; + } + + @else if ($icon == "proxy") { + content:"\e699"; + } + + @else if ($icon == "public") { + content:"\e6ad"; + } + + @else if ($icon == "publish") { + content:"\e65c"; + } + + @else if ($icon == "question") { + content:"\e6b0"; + } + + @else if ($icon == "raspberry") { + content:"\e6aa"; + } + + @else if ($icon == "redo") { + content:"\e65d"; + } + + @else if ($icon == "reduce") { + content:"\e73d"; + } + + @else if ($icon == "refresh") { + content:"\e692"; + } + + @else if ($icon == "register") { + content:"\e65e"; + } + + @else if ($icon == "rename") { + content:"\e6fc"; + } + + @else if ($icon == "reply") { + content:"\e714"; + } + + @else if ($icon == "resource") { + content:"\e660"; + } + + @else if ($icon == "rest-api") { + content:"\e661"; + } + + @else if ($icon == "rest-service") { + content:"\e662"; + } + + @else if ($icon == "resume") { + content:"\e71e"; + } + + @else if ($icon == "retire") { + content:"\e6cd"; + } + + @else if ($icon == "return") { + content:"\e715"; + } + + @else if ($icon == "retweet") { + content:"\e6b9"; + } + + @else if ($icon == "right-arrow") { + content:"\e68b"; + } + + @else if ($icon == "right") { + content:"\e687"; + } + + @else if ($icon == "ringing") { + content:"\e694"; + } + + @else if ($icon == "rules") { + content:"\e664"; + } + + @else if ($icon == "run") { + content:"\e708"; + } + + @else if ($icon == "save") { + content:"\e665"; + } + + @else if ($icon == "scep") { + content:"\e666"; + } + + @else if ($icon == "schema") { + content:"\e667"; + } + + @else if ($icon == "search") { + content:"\e668"; + } + + @else if ($icon == "security-policy") { + content:"\e67e"; + } + + @else if ($icon == "security") { + content:"\e669"; + } + + @else if ($icon == "send") { + content:"\e66a"; + } + + @else if ($icon == "sequence") { + content:"\e66b"; + } + + @else if ($icon == "server") { + content:"\e66c"; + } + + @else if ($icon == "service-provider") { + content:"\e66e"; + } + + @else if ($icon == "service") { + content:"\e66d"; + } + + @else if ($icon == "settings") { + content:"\e66f"; + } + + @else if ($icon == "share") { + content:"\e670"; + } + + @else if ($icon == "shell") { + content:"\e730"; + } + + @else if ($icon == "shortcut") { + content:"\e725"; + } + + @else if ($icon == "sign-in") { + content:"\e671"; + } + + @else if ($icon == "sign-out") { + content:"\e6b8"; + } + + @else if ($icon == "skype") { + content:"\e6de"; + } + + @else if ($icon == "slash") { + content:"\e6e1"; + } + + @else if ($icon == "soap") { + content:"\e672"; + } + + @else if ($icon == "sort-down") { + content:"\e663"; + } + + @else if ($icon == "sort-up") { + content:"\e64b"; + } + + @else if ($icon == "sort") { + content:"\e673"; + } + + @else if ($icon == "speed-alert") { + content:"\e731"; + } + + @else if ($icon == "square-outline") { + content:"\e6b2"; + } + + @else if ($icon == "square") { + content:"\e6b1"; + } + + @else if ($icon == "star") { + content:"\e674"; + } + + @else if ($icon == "start") { + content:"\e718"; + } + + @else if ($icon == "statistics") { + content:"\e675"; + } + + @else if ($icon == "stepin") { + content:"\e719"; + } + + @else if ($icon == "stepout") { + content:"\e71a"; + } + + @else if ($icon == "stepover") { + content:"\e71b"; + } + + @else if ($icon == "stop") { + content:"\e71c"; + } + + @else if ($icon == "store") { + content:"\e676"; + } + + @else if ($icon == "struct") { + content:"\e716"; + } + + @else if ($icon == "subscribe") { + content:"\e677"; + } + + @else if ($icon == "success") { + content:"\e657"; + } + + @else if ($icon == "swagger") { + content:"\e679"; + } + + @else if ($icon == "sync") { + content:"\e6b3"; + } + + @else if ($icon == "table") { + content:"\e6c4"; + } + + @else if ($icon == "tag") { + content:"\e67a"; + } + + @else if ($icon == "task") { + content:"\e67b"; + } + + @else if ($icon == "text") { + content:"\e67c"; + } + + @else if ($icon == "theme") { + content:"\e726"; + } + + @else if ($icon == "throttling-policy") { + content:"\e67f"; + } + + @else if ($icon == "throw") { + content:"\e722"; + } + + @else if ($icon == "tiles") { + content:"\e681"; + } + + @else if ($icon == "transaction") { + content:"\e72b"; + } + + @else if ($icon == "try-catch") { + content:"\e703"; + } + + @else if ($icon == "twitter") { + content:"\e6df"; + } + + @else if ($icon == "type-converter") { + content:"\e6f3"; + } + + @else if ($icon == "uncheck") { + content:"\e682"; + } + + @else if ($icon == "undo") { + content:"\e683"; + } + + @else if ($icon == "ungroup") { + content:"\e6b5"; + } + + @else if ($icon == "unmute") { + content:"\e6ae"; + } + + @else if ($icon == "up-arrow") { + content:"\e688"; + } + + @else if ($icon == "up") { + content:"\e684"; + } + + @else if ($icon == "upload") { + content:"\e68c"; + } + + @else if ($icon == "uri") { + content:"\e68d"; + } + + @else if ($icon == "usb-drive") { + content:"\e68e"; + } + + @else if ($icon == "use") { + content:"\e6ca"; + } + + @else if ($icon == "user") { + content:"\e68f"; + } + + @else if ($icon == "variable") { + content:"\e6ee"; + } + + @else if ($icon == "view") { + content:"\e691"; + } + + @else if ($icon == "vpn") { + content:"\e603"; + } + + @else if ($icon == "wadl") { + content:"\e6a1"; + } + + @else if ($icon == "war") { + content:"\e69e"; + } + + @else if ($icon == "warning") { + content:"\e693"; + } + + @else if ($icon == "web-app") { + content:"\e696"; + } + + @else if ($icon == "web-clip") { + content:"\e698"; + } + + @else if ($icon == "web-service") { + content:"\e69a"; + } + + @else if ($icon == "website") { + content:"\e69b"; + } + + @else if ($icon == "wifi") { + content:"\e607"; + } + + @else if ($icon == "windows") { + content:"\e605"; + } + + @else if ($icon == "worker-invoke") { + content:"\e723"; + } + + @else if ($icon == "worker-reply") { + content:"\e724"; + } + + @else if ($icon == "worker") { + content:"\e6ef"; + } + + @else if ($icon == "wsdl") { + content:"\e6a0"; + } + + @else if ($icon == "wso2-logo") { + content:"\e6a7"; + } + + @else if ($icon == "wso2") { + content:"\e6a8"; + } + + @else if ($icon == "xacml") { + content:"\e69f"; + } + + @else if ($icon == "xml") { + content:"\e69c"; + } + + @else if ($icon == "xq") { + content:"\e6a2"; + } + + @else if ($icon == "xsd") { + content:"\e6a3"; + } + + @else if ($icon == "xslt") { + content:"\e6a4"; + } + + @else if ($icon == "youtube") { + content:"\e6e0"; + } + + @else if ($icon == "zoom-in") { + content:"\e6a5"; + } + + @else if ($icon == "zoom-out") { + content:"\e6a6"; + } + } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/css/font-wso2.min.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/css/font-wso2.min.css deleted file mode 100644 index 8d2a487bef7..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/css/font-wso2.min.css +++ /dev/null @@ -1,15 +0,0 @@ -/*! -~ Copyright (c) WSO2 Inc. (http://wso2.com) 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. -*/.fw-fw,.fw-li{text-align:center}@font-face{font-family:font-wso2;src:local("font-wso2"),url(../fonts/font-wso2.eot?6563fa91278f239ef8c827d90a165223);src:local("font-wso2"),url(../fonts/font-wso2.eot?#iefix) format("embedded-opentype"),url(../fonts/font-wso2.woff2?6563fa91278f239ef8c827d90a165223) format("woff2"),url(../fonts/font-wso2.woff?6563fa91278f239ef8c827d90a165223) format("woff"),url(../fonts/font-wso2.ttf?6563fa91278f239ef8c827d90a165223) format("truetype"),url(../fonts/font-wso2.svg?6563fa91278f239ef8c827d90a165223#font-wso2) format("svg");font-weight:400;font-style:normal}.fw,[class*=" fw-"],[class^=fw-]{font:normal normal normal 14px/1 font-wso2;display:inline-block;font-weight:400;font-style:normal;font-size:inherit;font-variant:normal;speak:none;text-decoration:inherit;text-transform:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fw-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fw-2x{font-size:2em}.fw-3x{font-size:3em}.fw-4x{font-size:4em}.fw-5x{font-size:5em}.fw-fw{width:1.28571429em}.fw-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fw-ul>li{position:relative}.fw-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em}.fw-li.fw-lg{left:-1.85714286em}.fw-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.fw-background{background:#888;border-radius:.3em;padding:.4em .5em .45em}.fw-pull-left{float:left}.fw-pull-right{float:right}.fw.fw-pull-left{margin-right:.3em}.fw.fw-pull-right{margin-left:.3em}.fw-spin{-webkit-animation:fw-spin 2s infinite linear;animation:fw-spin 2s infinite linear}@-webkit-keyframes fw-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fw-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fw-pulse{-webkit-animation:fw-pulse 2s ease-out infinite;animation:fw-pulse 2s ease-out infinite}@-webkit-keyframes fw-pulse{0%,100%,30%{opacity:.3}40%{opacity:1}}@keyframes fw-pulse{0%,100%,30%{opacity:.3}40%{opacity:1}}.fw-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fw-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fw-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fw-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fw-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fw-flip-horizontal,:root .fw-flip-vertical,:root .fw-rotate-180,:root .fw-rotate-270,:root .fw-rotate-90{filter:none}.fw-helper,.fw-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:1.85em;vertical-align:middle}.fw-helper:after,.fw-helper:before,.fw-stack-1x,.fw-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fw-helper:before,.fw-stack-1x{line-height:inherit}.fw-helper:after,.fw-stack-2x{font-size:1.9em}.fw-helper-slash:before{font-size:1.4em}.fw-helper-circle:before,.fw-helper-square:before{z-index:1}.fw-helper-circle-outline:after{content:"\e61f"}.fw-helper-circle:after{content:"\e61a"}.fw-helper-square-outline:after{content:"\e6b2"}.fw-helper-square:after{content:"\e6b1"}.fw-helper-slash:after{content:"\e6e1"}.fw-stack>.fw-stack{position:absolute;font-size:.5em}.fw-stack>.fw-stack.fw-move-top{top:-.2em}.fw-stack>.fw-stack.fw-move-bottom{bottom:-.2em}.fw-stack>.fw.stack.fw-move-left{left:-.5em}.fw-stack>.fw-stack.fw-move-right{right:-.5em}.fw-helper-inverse:after,.fw-inverse:before,.fw-number{color:#fff}.fw-helper-shadow:after,.fw-shadow:before{text-shadow:#fff 1px 1px 0}.fw-helper-stroke:after,.fw-stroke:before{text-shadow:-2px -2px 0 #fff,2px -2px 0 #fff,-2px 2px 0 #fff,2px 2px 0 #fff}.fw-number{line-height:2em;font-family:Arial,Helvetica,sans-serif}.fw-abort:before{content:"\e72a"}.fw-action-invoke:before{content:"\e6fe"}.fw-action:before{content:"\e709"}.fw-activate:before{content:"\e6cf"}.fw-add:before{content:"\e615"}.fw-airplay:before{content:"\e600"}.fw-alarm:before{content:"\e6c2"}.fw-alert:before{content:"\e6be"}.fw-analytics-extensions:before{content:"\e6e2"}.fw-android-logcat:before{content:"\e72c"}.fw-android-sense:before{content:"\e72d"}.fw-android:before{content:"\e606"}.fw-annotation:before{content:"\e6e6"}.fw-api:before{content:"\e601"}.fw-apn:before{content:"\e602"}.fw-ios:before{content:"\e604"}.fw-application:before{content:"\e608"}.fw-arduino:before{content:"\e6ab"}.fw-assign:before{content:"\e6ff"}.fw-ballerina-service:before{content:"\e729"}.fw-ballerina:before{content:"\e728"}.fw-bar-chart:before{content:"\e690"}.fw-battery:before{content:"\e60a"}.fw-blank-document:before{content:"\e60c"}.fw-block:before{content:"\e695"}.fw-bookmark:before{content:"\e60d"}.fw-bpel:before{content:"\e60e"}.fw-bpmn:before{content:"\e60f"}.fw-break:before{content:"\e721"}.fw-bug:before{content:"\e611"}.fw-build:before{content:"\e6c1"}.fw-calendar:before{content:"\e612"}.fw-camera:before{content:"\e613"}.fw-cancel:before{content:"\e618"}.fw-carbon:before{content:"\e6c5"}.fw-chat:before{content:"\e65b"}.fw-check:before{content:"\e617"}.fw-checklist:before{content:"\e619"}.fw-circle-outline:before{content:"\e61f"}.fw-circle:before{content:"\e61a"}.fw-clear:before{content:"\e61b"}.fw-clock:before{content:"\e61d"}.fw-cloud:before{content:"\e61e"}.fw-code-view:before{content:"\e70e"}.fw-code:before{content:"\e6f1"}.fw-comment:before{content:"\e710"}.fw-compare:before{content:"\e610"}.fw-computer:before{content:"\e653"}.fw-configarations:before{content:"\e609"}.fw-connector:before{content:"\e700"}.fw-console:before{content:"\e71d"}.fw-constant:before{content:"\e701"}.fw-contact:before{content:"\e620"}.fw-contract:before{content:"\e614"}.fw-copy:before{content:"\e621"}.fw-cut:before{content:"\e6f2"}.fw-dashboard:before{content:"\e622"}.fw-database:before{content:"\e623"}.fw-delete:before{content:"\e624"}.fw-depend:before{content:"\e6c6"}.fw-deploy:before{content:"\e625"}.fw-deprecate:before{content:"\e6cb"}.fw-design-view:before{content:"\e70f"}.fw-devices:before{content:"\e704"}.fw-dgm-action-invoke:before{content:"\e712"}.fw-dgm-action:before{content:"\e711"}.fw-dgm-connector:before{content:"\e6f4"}.fw-dgm-constant-definition:before{content:"\e6f5"}.fw-dgm-fork:before{content:"\e6e7"}.fw-dgm-header:before{content:"\e6e8"}.fw-dgm-if-else:before{content:"\e6e9"}.fw-dgm-import:before{content:"\e717"}.fw-dgm-lifeline:before{content:"\e6ea"}.fw-dgm-logger:before{content:"\e6eb"}.fw-dgm-resource:before{content:"\e6f6"}.fw-dgm-service:before{content:"\e6f7"}.fw-dgm-try-catch:before{content:"\e6ec"}.fw-dgm-type-convertor:before{content:"\e6f8"}.fw-dgm-type:before{content:"\e6f9"}.fw-dgm-while:before{content:"\e707"}.fw-dial-up:before{content:"\e627"}.fw-disabled:before{content:"\e6d1"}.fw-display:before{content:"\e626"}.fw-docker:before{content:"\e70c"}.fw-document:before{content:"\e628"}.fw-down-arrow:before{content:"\e689"}.fw-down:before{content:"\e685"}.fw-download:before{content:"\e65f"}.fw-dss:before{content:"\e62a"}.fw-ebook:before{content:"\e62b"}.fw-edit:before{content:"\e62c"}.fw-ellipsis:before{content:"\e629"}.fw-endpoint:before{content:"\e62d"}.fw-enterprise:before{content:"\e6b6"}.fw-error:before{content:"\e630"}.fw-esb-connector:before{content:"\e6e3"}.fw-expand:before{content:"\e61c"}.fw-export:before{content:"\e631"}.fw-extensions:before{content:"\e6e4"}.fw-facebook:before{content:"\e6d3"}.fw-factory-reset:before{content:"\e632"}.fw-fan:before{content:"\e678"}.fw-faq:before{content:"\e62f"}.fw-file-browse:before{content:"\e633"}.fw-filter:before{content:"\e634"}.fw-folder-open:before{content:"\e70b"}.fw-folder:before{content:"\e62e"}.fw-fork-join:before{content:"\e720"}.fw-format:before{content:"\e6fa"}.fw-forum:before{content:"\e636"}.fw-function-invoke:before{content:"\e713"}.fw-function:before{content:"\e6fb"}.fw-gadget:before{content:"\e637"}.fw-geo-fence-inbound:before{content:"\e72e"}.fw-geo-fence-outbound:before{content:"\e72f"}.fw-github:before{content:"\e6d4"}.fw-globe:before{content:"\e697"}.fw-google-docs:before{content:"\e6d6"}.fw-google-drive:before{content:"\e6da"}.fw-google-plus:before{content:"\e6d9"}.fw-google-sheets:before{content:"\e6d7"}.fw-google-slides:before{content:"\e6d8"}.fw-google:before{content:"\e6d5"}.fw-grid:before{content:"\e638"}.fw-grip:before{content:"\e6b7"}.fw-group:before{content:"\e6af"}.fw-hardware:before{content:"\e6a9"}.fw-hdd:before{content:"\e639"}.fw-heart:before{content:"\e6c3"}.fw-hide:before{content:"\e6d2"}.fw-home:before{content:"\e63a"}.fw-hour-glass:before{content:"\e63b"}.fw-html:before{content:"\e69d"}.fw-http:before{content:"\e705"}.fw-image:before{content:"\e70a"}.fw-import:before{content:"\e63c"}.fw-incoming-call:before{content:"\e63d"}.fw-info:before{content:"\e63e"}.fw-instagram:before{content:"\e6db"}.fw-invitation:before{content:"\e63f"}.fw-invoke:before{content:"\e6ed"}.fw-is-connector:before{content:"\e6e5"}.fw-iterate:before{content:"\e71f"}.fw-jaggery:before{content:"\e640"}.fw-java-spring:before{content:"\e644"}.fw-java:before{content:"\e641"}.fw-javaee:before{content:"\e642"}.fw-javascript:before{content:"\e643"}.fw-jaxrs:before{content:"\e645"}.fw-jaxws:before{content:"\e6c7"}.fw-jquery:before{content:"\e646"}.fw-key:before{content:"\e647"}.fw-laptop:before{content:"\e648"}.fw-layout:before{content:"\e6bf"}.fw-ldap:before{content:"\e649"}.fw-left-arrow:before{content:"\e68a"}.fw-left:before{content:"\e686"}.fw-lifecycle:before{content:"\e64a"}.fw-light:before{content:"\e680"}.fw-linkedin:before{content:"\e6dc"}.fw-list-sort:before{content:"\e64d"}.fw-list:before{content:"\e64c"}.fw-loader:before{content:"\e6b4"}.fw-loader2:before{content:"\e6ba"}.fw-loader3:before{content:"\e6bb"}.fw-loader4:before{content:"\e6bc"}.fw-loader5:before{content:"\e6bd"}.fw-lock:before{content:"\e64e"}.fw-logical:before{content:"\e702"}.fw-mail:before{content:"\e64f"}.fw-main-function:before{content:"\e706"}.fw-map-location:before{content:"\e650"}.fw-menu:before{content:"\e651"}.fw-message:before{content:"\e635"}.fw-micro-services:before{content:"\e6ce"}.fw-dash:before,.fw-hyphen:before,.fw-minus:before{content:"\e616"}.fw-mobile:before{content:"\e652"}.fw-ms-document:before{content:"\e654"}.fw-mute:before{content:"\e655"}.fw-nodejs:before{content:"\e656"}.fw-notification:before{content:"\e60b"}.fw-organization:before{content:"\e6ac"}.fw-own:before{content:"\e6c8"}.fw-package:before{content:"\e6fd"}.fw-pages:before{content:"\e6c0"}.fw-paste:before{content:"\e658"}.fw-pdf:before{content:"\e659"}.fw-pending:before{content:"\e727"}.fw-php:before{content:"\e6c9"}.fw-pie-chart:before{content:"\e65a"}.fw-pinterest:before{content:"\e6dd"}.fw-policy:before{content:"\e67d"}.fw-polygon:before{content:"\e70d"}.fw-prototype:before{content:"\e6cc"}.fw-proxy:before{content:"\e699"}.fw-public:before{content:"\e6ad"}.fw-publish:before{content:"\e65c"}.fw-question:before{content:"\e6b0"}.fw-raspberry:before{content:"\e6aa"}.fw-redo:before{content:"\e65d"}.fw-refresh:before{content:"\e692"}.fw-register:before{content:"\e65e"}.fw-rename:before{content:"\e6fc"}.fw-reply:before{content:"\e714"}.fw-resource:before{content:"\e660"}.fw-rest-api:before{content:"\e661"}.fw-rest-service:before{content:"\e662"}.fw-resume:before{content:"\e71e"}.fw-retire:before{content:"\e6cd"}.fw-return:before{content:"\e715"}.fw-retweet:before{content:"\e6b9"}.fw-right-arrow:before{content:"\e68b"}.fw-right:before{content:"\e687"}.fw-ringing:before{content:"\e694"}.fw-rules:before{content:"\e664"}.fw-run:before{content:"\e708"}.fw-save:before{content:"\e665"}.fw-scep:before{content:"\e666"}.fw-schema:before{content:"\e667"}.fw-search:before{content:"\e668"}.fw-security-policy:before{content:"\e67e"}.fw-security:before{content:"\e669"}.fw-paper-rocket:before,.fw-send:before{content:"\e66a"}.fw-sequence:before{content:"\e66b"}.fw-server:before{content:"\e66c"}.fw-service-provider:before{content:"\e66e"}.fw-cogwheels:before,.fw-gears:before,.fw-service:before,.fw-sprockets:before{content:"\e66d"}.fw-cogwheel:before,.fw-gear:before,.fw-settings:before,.fw-sprocket:before{content:"\e66f"}.fw-share:before{content:"\e670"}.fw-shell:before{content:"\e730"}.fw-shortcut:before{content:"\e725"}.fw-sign-in:before{content:"\e671"}.fw-sign-out:before{content:"\e6b8"}.fw-skype:before{content:"\e6de"}.fw-slash:before{content:"\e6e1"}.fw-soap:before{content:"\e672"}.fw-sort-down:before{content:"\e663"}.fw-sort-up:before{content:"\e64b"}.fw-sort:before{content:"\e673"}.fw-speed-alert:before{content:"\e731"}.fw-square-outline:before{content:"\e6b2"}.fw-square:before{content:"\e6b1"}.fw-star:before{content:"\e674"}.fw-start:before{content:"\e718"}.fw-statistics:before{content:"\e675"}.fw-stepin:before{content:"\e719"}.fw-stepout:before{content:"\e71a"}.fw-stepover:before{content:"\e71b"}.fw-stop:before{content:"\e71c"}.fw-cart:before,.fw-store:before{content:"\e676"}.fw-struct:before{content:"\e716"}.fw-subscribe:before{content:"\e677"}.fw-success:before{content:"\e657"}.fw-swagger:before{content:"\e679"}.fw-sync:before{content:"\e6b3"}.fw-table:before{content:"\e6c4"}.fw-tag:before{content:"\e67a"}.fw-task:before{content:"\e67b"}.fw-text:before{content:"\e67c"}.fw-theme:before{content:"\e726"}.fw-throttling-policy:before{content:"\e67f"}.fw-throw:before{content:"\e722"}.fw-tiles:before{content:"\e681"}.fw-transaction:before{content:"\e72b"}.fw-try-catch:before{content:"\e703"}.fw-twitter:before{content:"\e6df"}.fw-type-converter:before{content:"\e6f3"}.fw-uncheck:before{content:"\e682"}.fw-undo:before{content:"\e683"}.fw-ungroup:before{content:"\e6b5"}.fw-unmute:before{content:"\e6ae"}.fw-up-arrow:before{content:"\e688"}.fw-up:before{content:"\e684"}.fw-upload:before{content:"\e68c"}.fw-uri:before{content:"\e68d"}.fw-usb-drive:before{content:"\e68e"}.fw-use:before{content:"\e6ca"}.fw-user:before{content:"\e68f"}.fw-variable:before{content:"\e6ee"}.fw-view:before{content:"\e691"}.fw-vpn:before{content:"\e603"}.fw-wadl:before{content:"\e6a1"}.fw-war:before{content:"\e69e"}.fw-warning:before{content:"\e693"}.fw-web-app:before{content:"\e696"}.fw-web-clip:before{content:"\e698"}.fw-web-service:before{content:"\e69a"}.fw-website:before{content:"\e69b"}.fw-wifi:before{content:"\e607"}.fw-windows:before{content:"\e605"}.fw-worker-invoke:before{content:"\e723"}.fw-worker-reply:before{content:"\e724"}.fw-worker:before{content:"\e6ef"}.fw-wsdl:before{content:"\e6a0"}.fw-wso2-logo:before{content:"\e6a7"}.fw-wso2:before{content:"\e6a8"}.fw-xacml:before{content:"\e69f"}.fw-xml:before{content:"\e69c"}.fw-xq:before{content:"\e6a2"}.fw-xsd:before{content:"\e6a3"}.fw-xslt:before{content:"\e6a4"}.fw-youtube:before{content:"\e6e0"}.fw-zoom-in:before{content:"\e6a5"}.fw-zoom-out:before{content:"\e6a6"} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.svg b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.svg deleted file mode 100644 index 6c7c5e70662..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.svg +++ /dev/null @@ -1,2326 +0,0 @@ - - - - - -Created by FontForge 20161004 at Wed Jun 21 08:31:03 2017 - By dimal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.ttf b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.ttf deleted file mode 100644 index 27735b28203..00000000000 Binary files a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.ttf and /dev/null differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.woff b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.woff deleted file mode 100644 index 80fd5a7fc26..00000000000 Binary files a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.woff and /dev/null differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.woff2 b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.woff2 deleted file mode 100644 index 6087330889a..00000000000 Binary files a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/font-wso2-1.3.0/fonts/font-wso2.woff2 and /dev/null differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less index 1f87dd8a34d..ca74a4ce9de 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less @@ -21,7 +21,7 @@ @font-face {.font( 'Roboto'; 300; 'normal'; 'Roboto Light'; 'Roboto-Light-webfont'; '../fonts' )} @font-default: 'Roboto Light', Arial, Helvetica, sans-serif; -@font-icons: 'font-wso2'; +@font-icons: 'font-entgra'; @font-default-weight: 300; @border-radius-default: 0; @box-shadow-default: none; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs index c6bcb4984c9..5a1331f1fbf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/theme.hbs @@ -23,7 +23,7 @@ {{~css "lib/font-awesome_4.3.0/css/font-awesome.min.css" combine=false}} - {{~css "lib/font-wso2-1.3.0/css/font-wso2.css" combine=false}} + {{~css "lib/font-entgra-1.4.0/css/font-entgra.css" combine=false}} {{~css "less/theme.less" combine=false}} {{~css "css/theme-wso2.css" combine=false}} diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index c17c4ab5206..0417b15950d 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -42,6 +42,7 @@ org.wso2.carbon.device.mgt.url.printer org.wso2.carbon.device.mgt.analytics.wsproxy io.entgra.device.mgt.ui + io.entgra.carbon.device.mgt.config.api diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index 8bf4cde0e60..d38319a04ce 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -232,7 +232,11 @@ powermock-module-testng test - + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.jwt.client.extension + test + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index e236efe7ffb..6c77071c0cc 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -55,6 +55,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES ( PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME) ); +CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES ( + GROUP_ID INTEGER NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID VARCHAR(100), + PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +); + DROP TABLE IF EXISTS DM_DEVICE_GROUP_MAP; CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( ID INTEGER AUTO_INCREMENT NOT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index 95a59858fa3..8473d376e26 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -62,6 +62,29 @@ + + copy config api + package + + copy + + + + + org.wso2.carbon.devicemgt + io.entgra.carbon.device.mgt.config.api + + ${project.version} + war + true + + ${project.build.directory}/maven-shared-archive-resources/webapps + + api#device-mgt-config#v1.0.war + + + + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf index c274dd7edc3..a313782a24f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/src/main/resources/p2.inf @@ -1,3 +1,4 @@ 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.device.mgt.api_${feature.version}/webapps/api#device-mgt#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#device-mgt#v1.0.war,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.api_${feature.version}/webapps/api#device-mgt-config#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#device-mgt-config#v1.0.war,overwrite:true);\ diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index 1207b8c8335..a89e966d281 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -8,6 +8,15 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE ( PRIMARY KEY (ID) ); +CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( + ID INTEGER auto_increment NOT NULL, + SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + USERNAME VARCHAR(500) DEFAULT NULL, + PRIMARY KEY (ID) +); + CREATE TABLE IF NOT EXISTS DM_GROUP ( ID INTEGER AUTO_INCREMENT NOT NULL, GROUP_NAME VARCHAR(100) DEFAULT NULL, @@ -50,6 +59,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES ( PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID) ); +CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES ( + GROUP_ID INTEGER NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID VARCHAR(100), + PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +); + CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( ID INTEGER AUTO_INCREMENT NOT NULL, DEVICE_ID INTEGER DEFAULT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 5577981411b..7b1af45fbb6 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -10,6 +10,16 @@ CREATE TABLE DM_DEVICE_TYPE ( CONSTRAINT DEVICE_TYPE_NAME UNIQUE(NAME, PROVIDER_TENANT_ID) ); +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_CERTIFICATE]') AND TYPE IN (N'U')) +CREATE TABLE DM_DEVICE_CERTIFICATE ( + ID INTEGER IDENTITY(1,1) NOT NULL, + SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, + CERTIFICATE VARBINARY(max) DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + USERNAME VARCHAR(500) DEFAULT NULL, +PRIMARY KEY (ID) +); + IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DEVICE_TYPE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_TYPE')) CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID); @@ -64,6 +74,15 @@ CREATE TABLE DM_DEVICE_PROPERTIES ( PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID) ); +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[GROUP_PROPERTIES]') AND TYPE IN (N'U')) +CREATE TABLE GROUP_PROPERTIES ( + GROUP_ID INTEGER NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID VARCHAR(100), + PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +); + IF NOT EXISTS(SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_MAP]') AND TYPE IN (N'U')) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 54b50c785b1..94f838a7b0a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -12,6 +12,15 @@ CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID); CREATE INDEX IDX_DEVICE_NAME ON DM_DEVICE_TYPE (NAME); CREATE INDEX IDX_DEVICE_TYPE_DEVICE_NAME ON DM_DEVICE_TYPE(ID, NAME); +CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( + ID INTEGER auto_increment NOT NULL, + SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + USERNAME VARCHAR(500) DEFAULT NULL, + PRIMARY KEY (ID) +)ENGINE = InnoDB; + CREATE TABLE IF NOT EXISTS DM_GROUP ( ID INTEGER AUTO_INCREMENT NOT NULL, GROUP_NAME VARCHAR(100) DEFAULT NULL, @@ -60,6 +69,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES ( PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID) )ENGINE = InnoDB; +CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES ( + GROUP_ID INTEGER NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID VARCHAR(100), + PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +)ENGINE = InnoDB; + CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( ID INTEGER AUTO_INCREMENT NOT NULL, DEVICE_ID INTEGER DEFAULT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index e6977b38e83..c626d1c4c63 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -23,6 +23,27 @@ WHEN (NEW.ID IS NULL) END; / +CREATE TABLE DM_DEVICE_CERTIFICATE ( + ID NUMBER(10) NOT NULL, + SERIAL_NUMBER VARCHAR2(500) DEFAULT NULL, + CERTIFICATE BLOB DEFAULT NULL, + TENANT_ID NUMBER(10) DEFAULT 0, + USERNAME VARCHAR2(500) DEFAULT NULL, + PRIMARY KEY (ID) +) +/ + +-- Generate ID using sequence and trigger +CREATE SEQUENCE DM_DEVICE_CERTIFICATE_seq START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER DM_DEVICE_CERTIFICATE_seq_tr +BEFORE INSERT ON DM_DEVICE_CERTIFICATE FOR EACH ROW +WHEN (NEW.ID IS NULL) + BEGIN + SELECT DM_DEVICE_CERTIFICATE_seq.NEXTVAL INTO :NEW.ID FROM DUAL; + END; +/ + CREATE TABLE DM_GROUP ( ID NUMBER(10) NOT NULL, DESCRIPTION CLOB DEFAULT NULL, @@ -111,6 +132,14 @@ CREATE TABLE DM_DEVICE_PROPERTIES ( ) / +CREATE TABLE GROUP_PROPERTIES ( + GROUP_ID NUMBER(10) NOT NULL, + PROPERTY_NAME VARCHAR2(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR2(100) DEFAULT NULL, + TENANT_ID VARCHAR2(100), + CONSTRAINT PK_DM_GROUP_PROPERTIES PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +) +/ CREATE TABLE DM_DEVICE_GROUP_MAP ( ID NUMBER(10) NOT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index eea13430c94..24ded4d59bb 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -8,6 +8,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE ( UNIQUE(NAME, PROVIDER_TENANT_ID) ); +CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE ( + ID BIGSERIAL NOT NULL PRIMARY KEY, + SERIAL_NUMBER VARCHAR(500) DEFAULT NULL, + CERTIFICATE BYTEA DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + USERNAME VARCHAR(500) DEFAULT NULL +); + CREATE TABLE IF NOT EXISTS DM_GROUP ( ID BIGSERIAL NOT NULL PRIMARY KEY, GROUP_NAME VARCHAR(100) DEFAULT NULL, @@ -48,6 +56,14 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES ( PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID) ); +CREATE TABLE IF NOT EXISTS GROUP_PROPERTIES ( + GROUP_ID INTEGER NOT NULL, + PROPERTY_NAME VARCHAR(100) DEFAULT 0, + PROPERTY_VALUE VARCHAR(100) DEFAULT NULL, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY (GROUP_ID, PROPERTY_NAME, TENANT_ID) +); + CREATE INDEX IDX_DM_DEVICE ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID); CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index ff85f4c4fd2..d9a783e03bc 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -62,6 +62,29 @@ + + copy-entgra-ui + package + + copy + + + + + org.wso2.carbon.devicemgt + io.entgra.device.mgt.ui + ${project.version} + war + true + + ${project.build.directory}/maven-shared-archive-resources/webapps + + entgra.war + **/* + + + + @@ -115,35 +138,6 @@ - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - package - - copy - - - - - org.wso2.carbon.devicemgt - io.entgra.device.mgt.ui - ${project.version} - war - true - - ${project.build.directory}/maven-shared-archive-resources/webapps - - entgra.war - **/* - - - - - -